Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <YSI\y_commands>
- #include <sscanf2>
- new Tseconds, Tminutes, Thours;
- new Text: Time;
- public OnFilterScriptInit()
- {
- print("\n");
- print(" \4\4\4\4\4\4\4\4\4\4\4\4");
- print(" \4 S32Time \4");
- print(" \4 by \4");
- print(" \4 System32 \4");
- print(" \4\4\4\4\4\4\4\4\4\4\4\4\n");
- Time = TextDrawCreate(555.000000, 10.000000, "00:00:00");
- TextDrawBackgroundColor(Time, 255);
- TextDrawFont(Time, 1);
- TextDrawLetterSize(Time, 0.500000, 1.000000);
- TextDrawColor(Time, -65281);
- TextDrawSetOutline(Time, 0);
- TextDrawSetProportional(Time, 1);
- TextDrawSetShadow(Time, 1);
- Tseconds = 0;
- Tminutes = 9;
- Thours = 8;
- SetTimer("TimeUp", 1000, true);
- return 1;
- }
- public OnFilterScriptExit()
- {
- TextDrawDestroy(Time);
- return 1;
- }
- forward TimeUp();
- public TimeUp()
- {
- new string[128];
- Tseconds += 1;
- if(Tseconds == 60)
- {
- Tseconds = 0;
- Tminutes += 1;
- }
- if(Tminutes == 60)
- {
- Tseconds = 0;
- Tminutes = 0;
- Thours += 1;
- }
- if(Thours == 24)
- {
- Tseconds += 1;
- Tminutes = 0;
- Thours = 0;
- }
- if(Thours < 10 || Tminutes < 10 || Tseconds < 10)
- {
- format(string, sizeof(string), "%02d:%02d:%02d", Thours, Tminutes, Tseconds);
- }
- else if(Thours >= 10 || Tminutes >= 10 || Tseconds >= 10)
- {
- format(string, sizeof(string), "%d:%d:%d", Thours, Tminutes, Tseconds);
- }
- for(new i; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- SetPlayerTime(i, Thours, Tminutes);
- }
- TextDrawSetString(Time, string);
- }
- YCMD:settime(playerid, params[], help)
- {
- #pragma unused help
- if(IsPlayerAdmin(playerid))
- {
- if(sscanf(params, "dd", Thours, Tminutes)) return SendClientMessage(playerid, -1, "Usage: /settime [Hours][Minutes]");
- else if(Thours < 0 || Thours > 24) return SendClientMessage(playerid, -1, "Hours must be between 0 & 24!");
- else if(Tminutes < 0 || Tminutes > 60) return SendClientMessage(playerid, -1, "Minutes must be between 0 & 60!");
- else
- for(new i; i < MAX_PLAYERS; i++)
- {
- SetPlayerTime(i, Thours, Tminutes);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement