• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Server] Group law cars
#1
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.
OG

Since of 2011


Discord: zeetayn#2166

  Reply
#2
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.
  Reply
#3
You forgot to add a `vehicleid` parameter to the function. But otherwise that.
  Reply
#4
Oh..of course, thank you.
OG

Since of 2011


Discord: zeetayn#2166

  Reply


Forum Jump: