how can i fix it with sourcemod
matrix function didn't included in sourcemod
here is my code:
Code:
if(Build_RegisterEntityOwner(Client, wheelIndex)) {
new Float:hitPos[3];
new Float:hitNormal[3];
TR_GetEndPosition(hitPos, trace);
TR_GetPlaneNormal(trace, hitNormal);
GetArrayString(g_hWheelModelPathArray, IndexInArray, szModelPath, sizeof(szModelPath));
if(!IsModelPrecached(szModelPath))
PrecacheModel(szModelPath);
DispatchKeyValue(wheelIndex, "model", szModelPath);
DispatchKeyValue(wheelIndex, "spawnflags", "256");
DispatchKeyValueFloat(wheelIndex, "physdamagescale", 0.0);
DispatchKeyValueFloat(wheelIndex, "ExplodeDamage", 0.0);
DispatchKeyValueFloat(wheelIndex, "ExplodeRadius", 0.0);
DispatchSpawn(wheelIndex);
ActivateEntity(wheelIndex);
new Float:surfaceAng[3];
GetVectorAngles(hitNormal, surfaceAng);
new Float:wheelCenter[3]; // Should be calculating the width of the model for this.
new Float:vecToAdd[3];
vecToAdd[0] = hitNormal[0];
vecToAdd[1] = hitNormal[1];
vecToAdd[2] = hitNormal[2];
switch(StringToInt(szWheelName)) {
case 1:
ScaleVector(vecToAdd, 5.0);
case 2:
ScaleVector(vecToAdd, 10.0);
case 3:
ScaleVector(vecToAdd, 7.5);
case 4:
ScaleVector(vecToAdd, 12.5);
case 5:
ScaleVector(vecToAdd, 11.0);
case 6:
ScaleVector(vecToAdd, 40.0);
case 7:
ScaleVector(vecToAdd, 40.0);
}
AddVectors(hitPos, vecToAdd, wheelCenter);
TeleportEntity(wheelIndex, wheelCenter, surfaceAng, NULL_VECTOR);
Phys_CreateHingeConstraint(entIndex, wheelIndex, INVALID_HANDLE, hitPos, hitNormal);
Build_PrintToChat(Client, "Added wheel to target");
}