Best way to do this? - 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: Best way to do this? (
/showthread.php?tid=135458)
Best way to do this? -
jameskmonger - 20.03.2010
Код:
public TenSecondTimerForDeliveries(playerid) {
TogglePlayerControllable(playerid,0);
SetTimer(GameTextForPlayer(playerid, "1", 1000, 5),1000,false);
SetTimer(GameTextForPlayer(playerid, "2", 1000, 5),1000,false);
SetTimer(GameTextForPlayer(playerid, "3", 1000, 5),1000,false);
SetTimer(GameTextForPlayer(playerid, "4", 1000, 5),1000,false);
SetTimer(GameTextForPlayer(playerid, "5", 1000, 5),1000,false);
SetTimer(GameTextForPlayer(playerid, "6", 1000, 5),1000,false);
SetTimer(GameTextForPlayer(playerid, "7", 1000, 5),1000,false);
SetTimer(GameTextForPlayer(playerid, "8", 1000, 5),1000,false);
SetTimer(GameTextForPlayer(playerid, "9", 1000, 5),1000,false);
SetTimer(GameTextForPlayer(playerid, "10", 1000, 5),1000,false);
TogglePlayerControllable(playerid,1);
}
I get errors because of using the GameTextForPlayer function in it, and I don't know if it will even work.
Re: Best way to do this? -
ray187 - 20.03.2010
What do you actually want to do?
Definition of SetTimerEx:
SetTimerEx(funcname[], interval, repeating, const format[], {Float,_}:...)
What you are trying to do in this code is calling the function GameTextForPlayer with parameters instead of entering the function name only.
Re: Best way to do this? -
Killa_ - 20.03.2010
Код:
new CountDown[MAX_PLAYERS]; //Top Of Your Script
new Bool:Frozen[MAX_PLAYERS]; //Top Of Your Script
forward TenSecondTimerForDeliveries(playerid);
public TenSecondTimerForDeliveries(playerid)
{
new String[128];
if(Frozen[playerid] == false)
{
TogglePlayerControllable(playerid,0);
Frozen[playerid] = true;
}
if(CountDown[playerid] == 10)
{
TogglePlayerControllable(playerid,1);
Frozen[playerid] = false;
CountDown[playerid] = 0;
return 1;
}
else
{
CountDown[playerid]++;
format(String,128,"~r~~h~%d",CountDown[playerid]);
GameTextForPlayer(Playerid,String,1200,5);
SetTimerEx("TenSecondTimerForDeliveries",1000,0,"i",playerid);
}
return 1;
}
Untested.
Re: Best way to do this? -
jameskmonger - 20.03.2010
Killa_, there were a couple of capitalization errors but it worked, thanks.