Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- new gRaceStart;
- public OnFilterScriptInit()
- {
- createTextDraws();
- SetTimer("updateTime",1000,true);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- new Text:Ttime;
- new gMinutes, gSeconds;
- new gindex;
- forward updateTime(playerid);
- public updateTime()
- {
- new Time, timestamp;
- timestamp = GetTickCount();
- if (gRaceStart != 0)
- Time = timestamp - gRaceStart;
- else
- Time=0;
- new MSeconds;
- timeconvert(Time, gMinutes, gSeconds, MSeconds);
- gindex=0;
- while (gSeconds > 9)
- {
- gSeconds-=10;
- gindex++;
- }
- new tmp[10];
- format(tmp,10,"%d:%d%d",gMinutes,gindex,gSeconds);
- TextDrawSetString(Ttime, tmp);
- }
- createTextDraws()
- {
- Ttime = TextDrawCreate(563.0, 376.0, "00:00");
- TextDrawLetterSize(Ttime, 0.6, 3);
- }
- public OnPlayerConnect(playerid)
- {
- gRaceStart=GetTickCount();
- TextDrawShowForPlayer(playerid, Ttime);
- return 1;
- }
- timeconvert(Time, &Minutes, &Seconds, &MSeconds)
- {
- new Float:fTime = floatdiv(Time, 60000);
- Minutes = floatround(fTime, floatround_tozero);
- Seconds = floatround(floatmul(fTime - Minutes, 60), floatround_tozero);
- MSeconds = floatround(floatmul(floatmul(fTime - Minutes, 60) - Seconds, 1000), floatround_tozero);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement