Quote:
Originally Posted by BigETI
pawn Код:
#define MAX_TIME 180 //Add here your time in seconds. 180 seconds/60 seconds per minute makes 3 minutes
new Text:TimeText, ticked, countdowntimer;
forward Tick();
public Tick() { ticked++; new ticktime = MAX_TIME-ticked, tempticktime = ticktime, minutes = 0; while(tempticktime > 59) { minutes++; tempticktime = tempticktime-60; } format(str, sizeof(str), "%02d:%02d", minutes, tempticktime); TextDrawSetString(TimeText, str); if(ticktime == 0) { KillTimer(countdowntimer); //Do here your things when the time end. } }
public OnGameModeInit() { TimeText = TextDrawCreate(550.0, 33.0, "--:--"); new ticktime = MAX_TIME, minutes = 0; while(ticktime > 59) { minutes++; ticktime = ticktime-60; } new str[128]; format(str, sizeof(str), "%02d:%02d", minutes, ticktime); TextDrawSetString(TimeText, str); countdowntimer = SetTimer("Tick", 1000, true); return 1; }
public OnPlayerConnect(playerid) { TextDrawShowForPlayer(playerid, TimeText); return 1; }
|
Fucking awesome dude, you got credits :)