Prevent player from exiting vehicle
#1

How can I do that? I made a research around the wiki and only found toggleplayercontrollable but that avoids player from driving. I want him to stay inside the vehicle, could you fellows enligthen me how to?
Reply
#2

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if (newkeys & KEY_SECONDARY_ATTACK)
        {
            TogglePlayerControllable(playerid, 0);
            SetTimerEx("Putbackin", 500, 0, "d", playerid);
        }
    }
    return 1;
}

forward Putbackin(playerid);
public Putbackin(playerid)
{
    TogglePlayerControllable(playerid, 1);
    SetTimerEx("Putbackin2", 400, 0, "d", playerid);
    return 1;
}

forward Putbackin2(playerid);
public Putbackin2(playerid)
{
    TogglePlayerControllable(playerid, 0);
    SetTimerEx("Putbackin3", 500, 0, "d", playerid);
    return 1;
}

forward Putbackin3(playerid);
public Putbackin3(playerid)
{
    TogglePlayerControllable(playerid, 0);
    SetTimerEx("Putbackin4", 500, 0, "d", playerid);
    return 1;
}

forward Putbackin4(playerid);
public Putbackin4(playerid)
{
    TogglePlayerControllable(playerid, 1);
    return 1;
}
Reply
#3

Hmm, thank you both, figured out how to do that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)