Setting a car for just one team not working.
#1

Hello,
I'm trying to set car ID 574 just for one team so if a player is from other team, he won't be able to enter in the car and drive it.

Here is my code:

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == 2)
    {
        new 
sweeper GetPlayerVehicleID(playerid);
        if(
sweeper == 574)
        {
            if(
Team[playerid] != TEAM_SWEEPER)
            {
                
RemovePlayerFromVehicle(playerid);
                
SendClientMessage(playeridCOLOR_LIRED"  You need to be a Street Sweeper to use this car  ");
            }
            else
            {
                
SendClientMessage(playerid, -1"You're driving car id 574");
            }
        }
    }
    return 
1;

Sorry for my bad english.
Reply
#2

Change
pawn Код:
new sweeper = GetPlayerVehicleID(playerid);
if(sweeper == 574)
to
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 574)
574 is the model, not the vehicle ID.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)