if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if(BusCar(GetPlayerVehicleID(playerid))) // This works { if(PlayerInfo[playerid][pJob] == 1) { SendClientMessage(playerid,-1,"{1589FF} Welcome Bus Driver."); } else SendClientMessage(playerid,COLOR_GREY,"This vehicle is LOCKED!"); RemovePlayerFromVehicle(playerid); } if(MechanicCar(GetPlayerVehicleID(playerid))) // All the code under this don't work whatever I put under here { if(PlayerInfo[playerid][pJob] == 2) { SendClientMessage(playerid,-1,"{1589FF} Welcome Mechanic."); } else SendClientMessage(playerid,COLOR_GREY,"This vehicle is LOCKED!"); RemovePlayerFromVehicle(playerid); } }
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if(BusCar(GetPlayerVehicleID(playerid))) // This works { if(PlayerInfo[playerid][pJob] == 1) { SendClientMessage(playerid,-1,"{1589FF} Welcome Bus Driver."); } else return SendClientMessage(playerid,COLOR_GREY,"This vehicle is LOCKED!"); RemovePlayerFromVehicle(playerid); } if(MechanicCar(GetPlayerVehicleID(playerid))) // All the code under this don't work whatever I put under here { if(PlayerInfo[playerid][pJob] == 2) { SendClientMessage(playerid,-1,"{1589FF} Welcome Mechanic."); } else return SendClientMessage(playerid,COLOR_GREY,"This vehicle is LOCKED!"); RemovePlayerFromVehicle(playerid); } }
else if(MechanicCar(GetPlayerVehicleID(playerid)))
Use "else if",
Код:
else if(MechanicCar(GetPlayerVehicleID(playerid))) |
At the end of OnPlayerStateChange are you returning 0 or 1? And can we see the code for MechanicCar?
|
stock MechanicCar(vehicleid) { for(new i;i <= sizeof(TowTrucks);i++) { if(vehicleid == TowTrucks[i]) return 1; } return 0; }
if(newstate == PLAYER_STATE_DRIVER)
{
if(BusCar(GetPlayerVehicleID(playerid))) // This works
{
if(PlayerInfo[playerid][pJob] == 1)
{
SendClientMessage(playerid,-1,"{1589FF} Welcome Bus Driver.");
}
else
{
SendClientMessage(playerid,COLOR_GREY,"This vehicle is LOCKED!");
RemovePlayerFromVehicle(playerid);
}
}
if(MechanicCar(GetPlayerVehicleID(playerid))) // All the code under this don't work whatever I put under here
{
if(PlayerInfo[playerid][pJob] == 2)
{
SendClientMessage(playerid,-1,"{1589FF} Welcome Mechanic.");
}
else
{
SendClientMessage(playerid,COLOR_GREY,"This vehicle is LOCKED!");
RemovePlayerFromVehicle(playerid);
}
}
}
pawn Код:
|