[Solved]Removing player from a specific vehicle.
#1

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid) == 425 || 520 || 432))
        {
            if(DMZone[playerid] == 0)
            {
               //Do nothing
            }
            else
            {
              SendClientMessage(playerid,RED,"Go to a DM to use this car.");
              RemovePlayerFromVehicle(playerid);
            }
        }
    }
    return 1;
}
For some reason the GetVehicleModel is completely ignored, It removes the player from any vehicle in a DM zone. Anyone know what's wrong?

Any help would be appreciated.


EDIT: Solved, Thank you very much Andom and Finn
Reply
#2

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 425 || 520 || 432)
        {
            if(DMZone[playerid] == 0)
            {
               //Do nothing
            }
            else
            {
              SendClientMessage(playerid,RED,"Go to a DM to use this car.");
              RemovePlayerFromVehicle(playerid);
            }
        }
    }
    return 1;
}
Try that.
Reply
#3

Lol, change:
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid) == 425 || 520 || 432))
To:
pawn Код:
new vehiclemod = GetVehicleModel(GetPlayerVehicleID(playerid));
if(vehiclemod == 425 || vehiclemod == 520 || vehiclemod == 432))
Reply
#4

Quote:
Originally Posted by xClumx``
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 425 || 520 || 432)
        {
            if(DMZone[playerid] == 0)
            {
               //Do nothing
            }
            else
            {
              SendClientMessage(playerid,RED,"Go to a DM to use this car.");
              RemovePlayerFromVehicle(playerid);
            }
        }
    }
    return 1;
}
Try that.
Same result :S

Quote:
Originally Posted by Andom
Lol, change:
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid) == 425 || 520 || 432))
To:
pawn Код:
new vehiclemod = GetVehicleModel(GetPlayerVehicleID(playerid));
if(vehiclemod == 425 || vehiclemod == 520 || vehiclemod == 432))
All you did is add a variable?..It's the same thing, and you still did it wrong, It supposed to be, if(vehiclemod == 425 || 520 || 432)

Anyway, anyone know the problem?
Reply
#5

Quote:
Originally Posted by :\
Anyway, anyone know the problem?
Just do what Andom said and it will work.

CORRECT:
pawn Код:
if(vehiclemod == 425 || vehiclemod == 520 || vehiclemod == 432)

WRONG:
pawn Код:
if(vehiclemod == 425 || 520 || 432)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)