Advertisement
Wiper223

[FS] Simple real time clock

Jul 28th, 2015
1,973
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.84 KB | None | 0 0
  1. /*
  2.    ~Real Time Sample Clock Filter Scipter San Andreas: Multiplayer by Wiper:
  3.  
  4. * ~Filter Script started on 28/07/2015 , 9:00AM
  5. * ~Filter Script finished on 28/07/2015, 10:00AM
  6. * ~Work time: 30 Minutes | Test time: 15 Minutes
  7. * ~Rested 10 minutes having breakfast
  8. * ~Credits: SA:MP Team
  9.                                                                                         */
  10. #define FILTERSCRIPT
  11.  
  12. #include <a_samp>
  13.  
  14. #define SNAME_COL 0x8A2BE2FF
  15. #define SDATE_COL 0x7458C1FF
  16. #define STIME_COL 0x1E90FFFF
  17.  
  18. #define SERV_NAME "eGaming RPG"
  19.  
  20. new Text:ServerName;
  21. new Text:ServerDate;
  22. new Text:ServerTime;
  23.  
  24. new const MonthName[][12] =
  25. {
  26.     "January", "February", "March", "April", "May", "June",
  27.     "July", "August", "September", "October", "November", "December"
  28. };
  29.  
  30. public OnFilterScriptInit()
  31. {
  32.     print("\n--------------------------------------------------------------------");
  33.     print(" Sample Clock Filter Script SA:MP by Wiper has successfully loaded !");
  34.     print("--------------------------------------------------------------------\n");
  35.    
  36.     SetTimer("TimeSet", 1000, true);
  37.    
  38.     ServerName = TextDrawCreate(475.0, 4.000, SERV_NAME);
  39.     ServerDate = TextDrawCreate(550.0, 17.00, "--");
  40.     ServerTime = TextDrawCreate(547.5, 30.33, "--");
  41.    
  42.     TextDrawFont(ServerName, 1);
  43.     TextDrawFont(ServerDate, 3);
  44.     TextDrawFont(ServerTime, 1);
  45.    
  46.     TextDrawColor(ServerName, SNAME_COL);
  47.     TextDrawColor(ServerDate, SDATE_COL);
  48.     TextDrawColor(ServerTime, STIME_COL);
  49.    
  50.     TextDrawLetterSize(ServerName, 0.700, 1.533);
  51.     TextDrawLetterSize(ServerDate, 0.443, 1.150);
  52.     TextDrawLetterSize(ServerTime, 0.600, 1.614);
  53.    
  54.     TextDrawSetShadow(ServerName, 0);
  55.     TextDrawSetShadow(ServerDate, 0);
  56.     TextDrawSetShadow(ServerTime, 0);
  57.    
  58.     TextDrawSetOutline(ServerName, 0);
  59.     TextDrawSetOutline(ServerDate, 0);
  60.     TextDrawSetOutline(ServerTime, 0);
  61.  
  62.     return 1;
  63. }
  64.  
  65. public OnFilterScriptExit()
  66. {
  67.     print("\n-----------------------------------------------------------");
  68.     print(" Sample Clock Filter Script SA:MP by Wiper failed to load !");
  69.     print("-----------------------------------------------------------\n");
  70.    
  71.     return 1;
  72. }
  73.  
  74. public OnPlayerSpawn(playerid)
  75. {
  76.     TextDrawShowForPlayer(playerid, ServerName);
  77.     TextDrawShowForPlayer(playerid, ServerDate);
  78.     TextDrawShowForPlayer(playerid, ServerTime);
  79.    
  80.     return 1;
  81. }
  82. public OnPlayerDisconnect(playerid, reason)
  83. {
  84.     TextDrawHideForPlayer(playerid, ServerName);
  85.     TextDrawHideForPlayer(playerid, ServerDate);
  86.     TextDrawHideForPlayer(playerid, ServerTime);
  87.  
  88.     return 1;
  89. }
  90.  
  91. forward TimeSet( );
  92. public TimeSet( )
  93. {
  94.     new String[2][256];
  95.  
  96.     new yYear, mMonth, dDay,
  97.     hHour, mMinute, sSecond;
  98.  
  99.     getdate(yYear, mMonth, dDay);
  100.     gettime(hHour, mMinute, sSecond);
  101.  
  102.     format(String[0], 256, "%d %s", dDay, MonthName[mMonth-1]);
  103.     format(String[1], 256, "%02d:%02d", hHour, mMinute);
  104.  
  105.     TextDrawSetString(ServerDate, String[0]);
  106.     TextDrawSetString(ServerTime, String[1]);
  107.  
  108.     return 1;
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement