Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //At top of your script.
- new Race_TimeCounter = -1;
- new Text:Race_TD;
- //OnFilterScriptInit/OnGameModeInit
- Race_TD = TextDrawCreate(17.000000, 429.000000, "00:00");
- TextDrawBackgroundColor(Race_TD, 65535);
- TextDrawFont(Race_TD, 1);
- TextDrawLetterSize(Race_TD, 0.500000, 1.000000);
- TextDrawColor(Race_TD, 16777215);
- TextDrawSetOutline(Race_TD, 1);
- TextDrawSetProportional(Race_TD, 1);
- Race_TimeCounter = SetTimer("UpdateTime", 200, true);
- //OnPlayerConnect
- TextDrawShowForPlayer(playerid, Race_TD);
- //On Bottom of your script.
- forward UpdateTime();
- public UpdateTime()
- {
- if(RaceTimer == 0)
- {
- TextDrawSetString(Race_TD, "00:00");
- }
- else
- {
- new Str[34], x[2];
- new Total = GetTickCount() - RaceTimer;
- x[0] = Total/60000;
- Total -= x[0]*60000;
- x[1] = Total / 1000;
- Total -= x[1]*1000;
- format(Str, sizeof(Str), "%02d:%02d", x[0], x[1]);
- TextDrawSetString(Race_TD, Str);
- }
- return 1;
- }
- //Whereever you want to freeze the timer:
- if(Race_TimeCounter != -1) KillTimer(Race_TimeCounter);
- Race_TimeCounter = -1;
- //To start it again (we just prevent bugs, by checking if it runs already):
- if(Race_TimeCounter != -1) KillTimer(Race_TimeCounter);
- Race_TimeCounter = SetTimer("UpdateTime", 200, true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement