What's wrong with this code?
#1

Ok, what's wrong with this code?
PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    new 
vehicleid GetVehicleModel(vehicleid);
    if(
vehicleid) == 487)
    {
        if(
isPilot[playerid] == 1)
        {
            if(
newstate == 2)
            {
                
PutPlayerInVehicle(playeridvehicleid0);
            }
        else
        {
            
SendClientMessage(playeridCOLOR_RED"You must be the Pilot class to fly helicopters.");
            
RemovePlayerFromVehicle(playerid);
        }
    }
    return 
1;

Reply
#2

Maybe because you are removing the player from vehicle when he is still only entering vehicle? Try it with TogglePlayerControlable
Reply
#3

Edited the original post^^
Reply
#4

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER)
    {
        if (GetVehicleModel(GetVehiclePlayerID(playerid)) == 487)
        {
            if (!isPilot[playerid])
            {
                SendClientMessage(playerid, COLOR_RED, "You must be the Pilot class to fly helicopters.");
                RemovePlayerFromVehicle(playerid);
            }
        }
    }
    return 1;
}
Reply
#5

That works perfectly. Thank you guys!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)