Check vehicle id - 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: Check vehicle id (
/showthread.php?tid=578580)
Check vehicle id -
McBan - 20.06.2015
I've been searching for a relevant post but couldn't find it so I decided to post my own.
I'm trying to check whether the nearest vehicle to me is a particular model ID. How do I go about doing this?
For example:
If there is a LSPD car or a LVPD car infront of me it'll allow me to enter however if it is a LSFD vehicle then it'll send me a error message.
Re: Check vehicle id -
Crayder - 20.06.2015
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new i = GetVehicleModel(vehicleid);
switch(i)
{
case /*list car's not allowed to enter*/: // Eject player and send error message.
default: // Allow entry.
}
return 1;
}
Re: Check vehicle id -
Pottus - 20.06.2015
@Crayder - You forgot to include a method that does not require that as well.
You can take a look here.
https://sampforum.blast.hk/showthread.php?tid=486060
Код:
GetNearestVehicle(playerid)
Then simply check the modelid.