SA-MP Forums Archive
People crash with any object help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: People crash with any object help. (/showthread.php?tid=403111)



People crash with any object help. - Magic_Time - 29.12.2012

How to check if a player has crashed with any object, let's say: buildings, walls, trees...?


Re: People crash with any object help. - Faisal_khan - 29.12.2012

Crashed means he hit the object? Check if the player is extremely near the object by getting the objects position using
pawn Код:
GetObjectPos(objectid, x, y, z);
Then get the co-ordinates of the object, add it in this function
pawn Код:
IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
Or use this function
pawn Код:
stock IsPlayerNearObject(playerid, objectid)
{
    new Float:X, Float:Y, Float:Z;
    GetObjectPos(objectid, X, Y, Z);
    if(IsPlayerInRangeOfPoint(playerid, 0.1, X, Y, Z)) return 1;
    return 0;
}



Re: People crash with any object help. - Tamer - 29.12.2012

I would say instead of detecting the walls and trees one by one simply do something which will decrease player health when the car health is low.


Re: People crash with any object help. - Faisal_khan - 29.12.2012

What if someone shoots the car? Or someone uses a pay and spray?