How to get near vehicle - 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: How to get near vehicle (
/showthread.php?tid=489959)
How to get near vehicle -
skydux123 - 24.01.2014
Hello sa-mp scripters I want to ask you how to get a vehicle who is near the player?
Thanks for help
Re: How to get near vehicle -
Shetch - 24.01.2014
Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
new Float:x, Float:y, Float:z;
GetVehiclePos(i, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
// Do whatever you want with the vehicle that is near you. 'i' is the variable for the vehicle's ID.
// Example: SetVehicleHealth(i, 200);
// Will set the vehicle near you on fire.
// Removing the 'break' will set all the vehicles near you on fire.
break;
}
}
Re: How to get near vehicle -
skydux123 - 24.01.2014
Thanks it's working
Re: How to get near vehicle -
Riwerry - 25.01.2014
Thanx dude this code works for me too, but I want to know. Will it cause some brutal usages of cpu or ram? Becouse when on server you will have 500 vehicles and loop will start ..