Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new Hour,
- Minute,
- Timer,
- Text:TimeText;
- public OnFilterScriptInit()
- {
- Hour = 12;
- Minute = 0;
- SetWorldTime(Hour);
- TimeText = TextDrawCreate (547.000000, 23.000000, "00:00");
- TextDrawBackgroundColor (TimeText, 255);
- TextDrawFont (TimeText, 3);
- TextDrawLetterSize (TimeText, 0.599999, 2.100000);
- TextDrawColor (TimeText, -1);
- TextDrawSetOutline (TimeText, 1);
- TextDrawSetProportional (TimeText, 1);
- KillTimer(Timer);
- Timer = SetTimer("UpdateServerTime",1000,true);
- print("Time Cycle Started!");
- return 1;
- }
- public OnFilterScriptExit()
- {
- TextDrawDestroy(TimeText);
- KillTimer(Timer);
- return 1;
- }
- forward UpdateServerTime();
- public UpdateServerTime()
- {
- Minute += 1;
- if(Minute == 60 && Hour < 24)
- {
- Hour += 1, Minute = 0;
- SetWorldTime(Hour);
- }
- if(Hour == 24 && Minute == 0)
- {
- Hour = 0, Minute = 0;
- SetWorldTime(Hour);
- }
- new string[6];
- format(string, sizeof(string), "%02d:%02d", Hour, Minute);
- TextDrawSetString(TimeText, string);
- TextDrawShowForAll(TimeText);
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- if(!IsPlayerConnected(playerid)) continue;
- SetPlayerTime(playerid, Hour, Minute);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment