SA-MP Forums Archive
Help with the timer. - 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: Help with the timer. (/showthread.php?tid=249995)



Help with the timer. - GangsTa_ - 21.04.2011

I want to script this shit when I /enter a building, the player will freeze for at least 3 seconds for the objects to load;
I tried with SetTimer, but the problem was that for me it freezed, and I got unfreezed after 3 seconds, but the other player that entered the building never got unfreezed. Could you tell me how to fix it?


Re: Help with the timer. - Sergei - 21.04.2011

SetTimerEx


Re: Help with the timer. - GangsTa_ - 21.04.2011

Okay, I'm gonna try it.


Re: Help with the timer. - GangsTa_ - 21.04.2011

Look, help me out with those variables for SetTimerEx
Should they look like:
forward ptimer();

then
public ptimer()
{
TogglePlayerControllable(playerid, 1); [or wutever is it for unfreeze]
return 1;
}

Like that?


Re: Help with the timer. - NotoriousMOB - 21.04.2011

Whats wrong with your Objects since you need to freeze?
what happends when they enter it without timer.


Re: Help with the timer. - JaTochNietDan - 21.04.2011

Where are you getting the playerid value from in the function? It's never passed there, I assume you're trying to do something like this:

pawn Код:
SetTimerEx("ptimer", 1000, 0, "i", playerid);

public ptimer(playerid)
{
    TogglePlayerControllable(playerid, true);
    return 1;
}
Doesn't that make more sense? You're using SetTimerEx to the pass the value of playerid to the function, which then uses the value of playerid in the TogglePlayerControllable function.


Re: Help with the timer. - Gertin - 21.04.2011

pawn Код:
new pTimerr;

pTimerr = SetTimerEx("ptimer", 1000, 0, "i", playerid);

public ptimer(playerid)
{
    TogglePlayerControllable(playerid, true);
    KillTimer(pTimerr);
    return 1;
}



Re: Help with the timer. - Sergei - 21.04.2011

@Gertin, why would you kill nonexistant timer?