timer help
#1

How can i make when player teleports to a place they will be frozen until the objects completes loading ?
Reply
#2

pawn Код:
forward PlayerEnterInt(playerid);
public PlayerEnterInt(playerid)  // THE FUNCTION
{
    TogglePlayerControllable(playerid, 0);
    SetTimer("PlayerEnterIntT", 3000, 0);
}
forward PlayerEnterIntT(playerid);
public PlayerEnterIntT(playerid) // THE TIMER
{
    TogglePlayerControllable(playerid, 1);
}
And after your SetPlayerPos on the function for teleport put :
pawn Код:
PlayerEnterInt(playerid);
Reply
#3

pawn Код:
CMD:das(playerid, params[])
{
    SetPlayerInterior(playerid,0);
    ResetPlayerWeapons(playerid);
    SetPlayerPos(playerid,404.1312,2452.7603,16.5000);
    PlayerEnterInt(playerid);
    SetPlayerFacingAngle(playerid,357.2612);
    SendClientMessage(playerid,0xFF9900AA,"You had teleported to Desert Air Strip!");
    return 1;
}
i get frozen for 10years
Reply
#4

pawn Код:
stock PlayerEnterInt(playerid)  // THE FUNCTION
{
    TogglePlayerControllable(playerid, false);
    SetTimerEx("PlayerEnterIntT", 3000, false, "d", playerid);
}
forward PlayerEnterIntT(playerid);
public PlayerEnterIntT(playerid) // THE TIMER
{
    TogglePlayerControllable(playerid, true);
    return 1;
}
Reply
#5

Why don`t you use the "OnPlayerInteriorChange" public ? That`s what it`s been made for:
pawn Код:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    if(oldinteriorid == 0)
    {
        FreezeInt(playerid);
    }
    return 1;
}
Then:
pawn Код:
stock FreezeInt(playerid)
{
    TogglePlayerControllable(playerid, false);
    SetTimerEx("UnfreezeInt", 3000, false, "i", playerid);
    return 1;
}
And of course, the unfreeze timer:
pawn Код:
forward UnfreezeInt(playerid);
public UnfreezeInt(playerid)
{
    return TogglePlayerControllable(playerid, true);
}
That should do it.

Or, simplier, you can just freeze the player and start the timer, as soon as they change the interior, like:
pawn Код:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    if(oldinteriorid == 0)
    {
        TogglePlayerControllable(playerid, false);
        SetTimerEx("UnfreezeInt", 3000, false, "i", playerid);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)