Advertisement
Andrus99

Time/Clock system by Andrus99, Andruz99

Jul 14th, 2011
2,966
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.32 KB | None | 0 0
  1. /*
  2.     [Description]
  3.     Name: Serveri kell, serveriaja järgi
  4.     Scripter: Andrus99, Andruz99 on SA:MP forum.
  5.  
  6.     MSN: Andrus99@hotmail.com
  7.     Skype: Andrus99
  8.  
  9. */
  10. #include <a_samp>
  11.  
  12. // ---------- Defines ---------- //
  13. new Text:ServerTimeTXT;
  14. new ServerTime = 12;
  15. // ---------- Defines ---------- //
  16.  
  17.  
  18. public OnFilterScriptInit()
  19. {
  20.     SetWorldTime(ServerTime);
  21.     SetTimer("TimeCycle", 60000, true);
  22.    
  23.    
  24.     ServerTimeTXT = TextDrawCreate(498.000000, 13.000000, "12:00");
  25.     TextDrawBackgroundColor(ServerTimeTXT, 255);
  26.     TextDrawFont(ServerTimeTXT, 1);
  27.     TextDrawLetterSize(ServerTimeTXT, 0.440000, 1.100000);
  28.     TextDrawColor(ServerTimeTXT, -1);
  29.     TextDrawSetOutline(ServerTimeTXT, 1);
  30.     TextDrawSetProportional(ServerTimeTXT, 1);
  31.     return 1;
  32. }
  33.  
  34. public OnFilterScriptExit()
  35. {
  36.     TextDrawDestroy(ServerTimeTXT); //Kustutab ära textdrawi
  37.     return 1;
  38. }
  39.  
  40. public OnPlayerSpawn(playerid)
  41. {
  42.     TextDrawShowForPlayer(playerid, ServerTimeTXT);
  43.     return 1;
  44. }
  45.  
  46. forward TimeCycle(playerid);
  47. public TimeCycle(playerid)
  48. {
  49.     ServerTime++;
  50.     SetWorldTime(ServerTime);
  51.  
  52.     new string[48];
  53.     format(string, sizeof(string), "%d:00", ServerTime);
  54.     TextDrawSetString(ServerTimeTXT,string);
  55.  
  56.     if(ServerTime == 23)//if servetime variable is at 23 it puts it the variable to 0
  57.     {
  58.         ServerTime = 0;
  59.     }
  60.     return 1;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement