24.01.2014, 20:34
Hello sa-mp scripters I want to ask you how to get a vehicle who is near the player?
Thanks for help
Thanks for help
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;
}
}