28.11.2011, 22:56
Untested.
pawn Код:
// top of script
new SecondsLeft;
// ongamemodeinit
SecondsLeft = SetTimer("SecondsLeftTimer",1000,true); // every 1 second
// in your command for example :
if(strcmp(cmdtext, "/countdown", true, 10))
{
SetPVarInt(playerid,"CountDown",10); // 10 sec
return 1;
}
// bottom of script
public SecondsLeftTimer()
{
new Amount;
for(new i = 0; i < MAX_PLAYERS; i++)
{
Amount = GetPVarInt(i,"CountDown");
if(Amount > 0)
{
Amount--;
SetPVarInt(i,"CountDown",Amount);
new string[128];
format(string,sizeof(string),"~n~~n~~n~~n~~n~~p~time left: ~w~%d Seconds",Amount);
GameTextForPlayer(i,string,1000,3);
if(Amount == 0)
{
// if countdown is at 0 seconds, award them / give a prize / punish / etcetera ...
}
}
}
}