How to check if a player is in at the bonnet and the boot of a vehicle
#1

Hello, how would I check if a player is in at the bonnet and the boot of a vehicle, I have seen other functions made by users but I didn't know if they were outdated forms of doing it. Any help is much appreciated.
Reply
#2

Something like this>
pawn Код:
new Float:vehx, Float:vehy, Float:vehz;
GetVehiclePos(/*YOUR, Vehicle ID  (e.g GetClosestVehicle stock u can make)*/ vehx, vehy, vehz);
if(IsPlayerInRangeOfPoint(playerid, 3.0, vehx, vehy, vehz))
{
   /* Stuff to Open Bonnet */
   SendClientMessage(playerid,0xFFFFFFFF,"You have opened the bonnet");
}
else
{
  SendClientMessage(playerid,0xFFFFFFFF,"You are not close enough to the car!");
}
Reply
#3

Quote:
Originally Posted by Mriss
Посмотреть сообщение
Something like this>
pawn Код:
new Float:vehx, Float:vehy, Float:vehz;
GetVehiclePos(/*YOUR, Vehicle ID  (e.g GetClosestVehicle stock u can make)*/ vehx, vehy, vehz);
if(IsPlayerInRangeOfPoint(playerid, 3.0, vehx, vehy, vehz))
{
   /* Stuff to Open Bonnet */
   SendClientMessage(playerid,0xFFFFFFFF,"You have opened the bonnet");
}
else
{
  SendClientMessage(playerid,0xFFFFFFFF,"You are not close enough to the car!");
}
This just checks if a player is near a vehicle, not if a player is near the bonnet/boot a vehicle does it?
Reply
#4

This include would help you and don't worry, it is efficient. https://sampforum.blast.hk/showthread.php?tid=486060
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)