open.mp forum
[Server] Group law cars - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Support (https://forum.open.mp/forumdisplay.php?fid=12)
--- Thread: [Server] Group law cars (/showthread.php?tid=1037)



Group law cars - homelessdrop - 2020-04-14

Hey guys, i need a help with function, where i can preserve all police vehicles id's for requirement when i can call permissions.
Code:
GetVehicleModel(GetPlayerVehicleID(playerid));



Example
Code:
if(newstate == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid) == 596

Code:
if(newstate == PLAYER_STATE_DRIVER?&& idkAllPoliceCar ...

Thanks.


RE: Group law cars - akosd127 - 2020-04-16

Code:
new vehicleid = GetPlayerVehicleID(playerid);

if(newstate == PLAYER_STATE_DRIVER && isPoliceCar(vehicleid))
{
? ?//do something
}

stock isPoliceCar(vehicleid)
{

? ?new vehiclemodel = GetVehicleModel(vehicleid);

? ?switch(vehiclemodel)
? ?{
? ?case 595: return true;
? ?case 596: return true;
? ?case 597: return true;
? ?case 599: return true;
? ?}

? ?return false;
}

Edit:
I really forgot. Now fixed.


RE: Group law cars - Y_Less - 2020-04-18

You forgot to add a `vehicleid` parameter to the function. But otherwise that.


RE: Group law cars - homelessdrop - 2020-04-19

Oh..of course, thank you.