timer help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: timer help (
/showthread.php?tid=245758)
timer help -
tanush - 01.04.2011
How can i make when player teleports to a place they will be frozen until the objects completes loading
?
Re : timer help -
Vukilore - 01.04.2011
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);
Re: timer help -
tanush - 01.04.2011
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
Re: timer help -
Jefff - 01.04.2011
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;
}
Re: timer help -
antonio112 - 01.04.2011
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;
}