How can i do...
#1

that if the player is leaving (or atlealt trying to) a vehicle it is wont allow him?
Thanks for helpers!
Reply
#2

I think it is not possible. You could only check if he leaves the vehicle, and if yes, put him back into it. Or you use TogglePlayerControllable, but he also could not do anything else then.
Reply
#3

Or kill him.
Reply
#4

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
TogglePlayerControllable(playerid, false);
TogglePlayerControllable, true);
SendClientMessage(playerid, 0xFFFF00FF, "You cannot leave vehicles!");
return 1;
}
I didn't try it, but you can test it.
Reply
#5

What if you return 0 under OnPlayerExitVehicle? If this doesnt work check the F-key (if its possible) on OnPlayerKeyStateChange and return 0 there. I hope one of this methods works.
Reply
#6

Try with OnPlayerKeyStateChange.
And when he presses enter/f, use PutPlayerInVehicle.
Reply
#7

Quote:
Originally Posted by DeathOnaStick
Посмотреть сообщение
What if you return 0 under OnPlayerExitVehicle? If this doesnt work check the F-key (if its possible) on OnPlayerKeyStateChange and return 0 there. I hope one of this methods works.
It depence on which vehicle
Reply
#8

Save the vehicle ID & seat when the player exits the vehicle, and put him back in the vehicle when the state changes to PLAYER_STATE_ONFOOT.

pawn Код:
new veh_id[MAX_PLAYERS],
    veh_seat[MAX_PLAYERS];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_ONFOOT)
    {
        if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
        {
            PutPlayerInVehicle(playerid, veh_id[playerid], veh_seat[playerid]);
        }
    }
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    veh_id[playerid] = vehicleid;
    veh_seat[playerid] = GetPlayerVehicleSeat(playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)