03.03.2016, 15:07
I need a help in creating fireman job.I want to detect when player is aiming fire object with firetruck,but i can't find the working code..
Код:
if(HOLDING(KEY_FIRE) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 407) {
new Float: fAimingCoords[3];
GetPlayerCameraPos(playerid, fAimingCoords[0], fAimingCoords[1], fAimingCoords[2]);
new Float: pos[3];
GetDynamicObjectPos(vatra[0], pos[0], pos[1], pos[2]);
if(IsPointInRangeOfPoint(pos[0], pos[1], pos[2], fAimingCoords[0], fAimingCoords[1], fAimingCoords[2], 3.0))
{
DestroyDynamicObject(vatra[0]);
}
}
stock IsPointInRangeOfPoint(Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, Float:range)
{
x2 -= x;
y2 -= y;
z2 -= z;
return ((x2 * x2) + (y2 * y2) + (z2 * z2)) < (range * range);
}

