[HELP] Cant enter cars.
#1

Hello again, well, I just got help to block my Police Cars with ranks and it works, but, this also blocks me from enter any other car that don't got anything to do with the Police Team.

This is how it looks like, it should block this car id's and only let players with a pRank of 1 or above enter them:

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(newstate == PLAYER_STATE_DRIVER)
  {
    new vehicleid = GetPlayerVehicleID(playerid);
		new modelid = GetVehicleModel(vehicleid);

		if(modelid == 596 || 523 || 528 || 427 || 601 || 477 || 497)
    {
      if(PlayerInfo[playerid][pRank] >= 1)
      {

			}
			else
			{
  				SendClientMessage(playerid, COLOR_GREY,"	You are not authorized to use that vehicle.");
    			RemovePlayerFromVehicle(playerid);
			}
		}
	}
	return 1;
}
As I said, this also blocks every other car on my script, what did I do wrong?

Thanks
Reply
#2

Try this:

if(modelid == 596 || modelid == 523 || modelid == 528 || modelid == 427 || modelid == 601 || modelid == 477 || modelid == 497)
Reply
#3

Quote:
Originally Posted by addinol
Try this:

if(modelid == 596 || modelid == 523 || modelid == 528 || modelid == 427 || modelid == 601 || modelid == 477 || modelid == 497)
I think that did it, thanks dude
Reply
#4

Use:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new modelid = GetVehicleModel(vehicleid);
       
switch(modelid)
{
case 596,523,528,427,601,477,497:
{
if(PlayerInfo[playerid][pRank] >= 1)
{
//Function
} else {
SendClientMessage(playerid, COLOR_GREY,"    You are not authorized to use that vehicle.");
RemovePlayerFromVehicle(playerid);
}
}
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)