Advertisement
Wiper223

Simple Clock FilterScript

Aug 9th, 2015
1,483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.17 KB | None | 0 0
  1. #define FILTERSCRIPT
  2. #include <a_samp>
  3.  
  4. #define SDATE_COL 0x7458C1FF
  5. #define STIME_COL 0x1E90FFFF
  6.  
  7. new Text:ServerDate;
  8. new Text:ServerTime;
  9.  
  10. public OnFilterScriptInit()
  11. {
  12.     print("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  13.     print(" Sample Clock Filter Script SA:MP by Wiper has successfully loaded.");
  14.     print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
  15.     SetTimer("TimeSet", 1000, true);
  16.     ServerDate = TextDrawCreate(544.5, 13.00, "--");
  17.     ServerTime = TextDrawCreate(547.5, 25.33, "--");
  18.     TextDrawFont(ServerDate, 1);
  19.     TextDrawFont(ServerTime, 3);
  20.     TextDrawColor(ServerDate, SDATE_COL);
  21.     TextDrawColor(ServerTime, STIME_COL);
  22.     TextDrawLetterSize(ServerDate, 0.550, 1.414);
  23.     TextDrawLetterSize(ServerTime, 0.600, 1.614);
  24.     TextDrawSetShadow(ServerDate, 0);
  25.     TextDrawSetShadow(ServerTime, 0);
  26.     TextDrawSetOutline(ServerDate, 1);
  27.     TextDrawSetOutline(ServerTime, 1);
  28.     TextDrawShowForAll(ServerDate);
  29.     TextDrawShowForAll(ServerTime);
  30.  
  31.     return 1;
  32. }
  33.  
  34. public OnFilterScriptExit()
  35. {
  36.     print("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  37.     print(" Sample Clock Filter Script SA:MP by Wiper unloaded.");
  38.     print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
  39.    
  40.     TextDrawHideForAll(ServerDate);
  41.     TextDrawHideForAll(ServerTime);
  42.     TextDrawDestroy(ServerDate);
  43.     TextDrawDestroy(ServerTime);
  44.  
  45.     return 1;
  46. }
  47. public OnPlayerConnect(playerid)
  48. {
  49.     TextDrawShowForPlayer(playerid, ServerDate);
  50.     TextDrawShowForPlayer(playerid, ServerTime);
  51.    
  52.     return 1;
  53. }
  54. public OnPlayerDisconnect(playerid, reason)
  55. {
  56.     TextDrawHideForPlayer(playerid, ServerDate);
  57.     TextDrawHideForPlayer(playerid, ServerTime);
  58.  
  59.     return 1;
  60. }
  61.  
  62. forward TimeSet( );
  63. public TimeSet( )
  64. {
  65.     new String[2][12];
  66.     new y,m,d,h,mi,s;
  67.     new MonthName[12][] =
  68.     {
  69.         "January", "February", "March", "April", "May", "June",
  70.         "July", "August", "September", "October", "November", "December"
  71.     };
  72.    
  73.     getdate(y,m,d);
  74.     gettime(h,mi,s);
  75.    
  76.     format(String[0], 18, "%d %s", d, MonthName[m-1]);
  77.     format(String[1], 18, "%02d:%02d", h,m);
  78.  
  79.     TextDrawSetString(ServerDate, String[0]);
  80.     TextDrawSetString(ServerTime, String[1]);
  81.  
  82.     return 1;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement