Private vehicles
#1

This code should prevent non-military players to not be able to enter the vehicles, but looks like they can't eneter any vehicle in-game, how so?I struggled with the code for quite a while and I am out of ideas.Help would be appreciated.Thanks in advance

Code
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
 if (newstate == PLAYER_STATE_DRIVER)
 {
  new CarID = GetPlayerVehicleID(playerid);
     if(pInfo[playerid][Class] != CLASS_MILITARY && aDuty[playerid] == 0 && GetVehicleModel(CarID) == 520, 447, 579, 432, 470, 433)
     {
         RemovePlayerFromVehicle(playerid);
         SendClientMessage(playerid, -1, "{FFFF00}[SERVER] {FFFFFF}This is an army vehicle. You can't enter it.");
  }
 }
 return 1;
}
Reply
#2

OnPlayerEnterVehicle
Reply
#3

Same thing happens when I put it in OnPlayerEnterVehicle
Reply
#4

Quote:
Код:
GetVehicleModel(CarID) == 520, 447, 579, 432, 470, 433
This is completely invalid. You can't list them like that. They must each be checked individually. I suggest using a switch.

PHP код:
switch(GetVehicleModel(CarID))
{
    case 
520447579432470433:
    {
        
// rest of statements
    
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)