Checking if a player exits a vehicle
#2

Quote:
Originally Posted by [WSE]Dave
Посмотреть сообщение
Why doesn't this work?

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {
        if(Checkpoint[playerid] != 0) //They're doing something..
        {
            PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
        }
    }
    return true;
}
Hello mate,

You can also use this for checking if player is exiting a vehicle:-

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid, ispassenger)
{
    SendClientMessage(playerid, -1, "You are going to exit the vehicle.");
    return 1;
}
or for the states, it's better and more accurate on some places:-

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if ((newstate == PLAYER_STATE_ONFOOT) && ((oldstate == PLAYER_STATE_DRIVER) || (oldstate == PLAYER_STATE_PASSENGER))) // your new state is ONFOOT and old state is when he was in the vehicle.
        // your rest of code here
        SendClientMessage(playerid, -1, "you just exited a vehicle.");
    return 1;
}
was just a fast coding, reply down if i have helped you.

-FalconX
Reply


Messages In This Thread
Checking if a player exits a vehicle - by [WSE]Dave - 25.02.2012, 22:27
Re: Checking if a player exits a vehicle - by FalconX - 25.02.2012, 22:37
Re: Checking if a player exits a vehicle - by [WSE]Dave - 25.02.2012, 22:45
Re: Checking if a player exits a vehicle - by FalconX - 25.02.2012, 22:46

Forum Jump:


Users browsing this thread: 2 Guest(s)