Guest User

Simple Watch System

a guest
Jul 30th, 2014
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. //------------------------------------------
  2. //Watch System v1
  3. //Created By : ~WhiteAngels
  4. //------------------------------------------
  5. #define FILTERSCRIPT
  6.  
  7. #include <a_samp>
  8. #include <zcmd>
  9.  
  10. new Text:Watch0;
  11. new Text:Watch1;
  12. new Text:Watch2;
  13. new Text:Watch3;
  14.  
  15. public OnFilterScriptInit()
  16. {
  17. Watch0 = TextDrawCreate(447.000000, 281.000000, "Time : ");
  18. TextDrawBackgroundColor(Watch0, 255);
  19. TextDrawFont(Watch0, 1);
  20. TextDrawLetterSize(Watch0, 0.439999, 1.399999);
  21. TextDrawColor(Watch0, 16711935);
  22. TextDrawSetOutline(Watch0, 1);
  23. TextDrawSetProportional(Watch0, 1);
  24. TextDrawUseBox(Watch0, 1);
  25. TextDrawBoxColor(Watch0, 135);
  26. TextDrawTextSize(Watch0, 610.000000, 50.000000);
  27.  
  28. Watch1 = TextDrawCreate(447.000000, 300.000000, "Date : ");
  29. TextDrawBackgroundColor(Watch1, 255);
  30. TextDrawFont(Watch1, 1);
  31. TextDrawLetterSize(Watch1, 0.439999, 1.399999);
  32. TextDrawColor(Watch1, 16711935);
  33. TextDrawSetOutline(Watch1, 1);
  34. TextDrawSetProportional(Watch1, 1);
  35. TextDrawUseBox(Watch1, 1);
  36. TextDrawBoxColor(Watch1, 135);
  37. TextDrawTextSize(Watch1, 610.000000, 50.000000);
  38.  
  39. Watch2 = TextDrawCreate(512.000000, 282.000000, "12:00");
  40. TextDrawBackgroundColor(Watch2, 255);
  41. TextDrawFont(Watch2, 3);
  42. TextDrawLetterSize(Watch2, 0.410000, 1.300000);
  43. TextDrawColor(Watch2, -1);
  44. TextDrawSetOutline(Watch2, 1);
  45. TextDrawSetProportional(Watch2, 1);
  46.  
  47. Watch3 = TextDrawCreate(512.000000, 300.000000, "31/12/2014");
  48. TextDrawBackgroundColor(Watch3, 255);
  49. TextDrawFont(Watch3, 3);
  50. TextDrawLetterSize(Watch3, 0.410000, 1.300000);
  51. TextDrawColor(Watch3, -1);
  52. TextDrawSetOutline(Watch3, 1);
  53. TextDrawSetProportional(Watch3, 1);
  54. print("\n----------------------------------------");
  55. print("Watch System v1.0 - Created By WhiteAngels");
  56. print("----------------------------------------\n");
  57. SetTimer("WatchSettime",1000,true);
  58. return 1;
  59. }
  60.  
  61. public OnFilterScriptExit()
  62. {
  63. return 1;
  64. }
  65.  
  66. CMD:watch(playerid,params[]) {
  67. TextDrawShowForPlayer(playerid, Watch0), TextDrawShowForPlayer(playerid, Watch1), TextDrawShowForPlayer(playerid, Watch2), TextDrawShowForPlayer(playerid, Watch3);
  68. SetTimerEx("CloseWatch", 10000, 0, "i", playerid);
  69. return 1;
  70. }
  71.  
  72. //Watch System
  73. forward WatchSettime();
  74. public WatchSettime()
  75. {
  76. new string[256];
  77. new Year,Month,Day; getdate(Year, Month, Day);
  78. new Hour,Min,Sec; gettime(Hour,Min,Sec);
  79. format(string, sizeof string, "%d/%s%d/%s%d", Day, ((Month < 10) ? ("0") : ("")), Month, (Year < 10) ? ("0") : (""), Year);
  80. TextDrawSetString(Watch3, string);
  81. format(string, sizeof string, "%s%d:%s%d:%s%d", (Hour < 10) ? ("0") : (""), Hour, (Min < 10) ? ("0") : (""), Min, (Sec < 10) ? ("0") : (""), Sec);
  82. TextDrawSetString(Watch2, string);
  83. }
  84.  
  85. forward CloseWatch(playerid);
  86. public CloseWatch(playerid)
  87. {
  88. TextDrawHideForPlayer(playerid, Watch0), TextDrawHideForPlayer(playerid, Watch1), TextDrawHideForPlayer(playerid, Watch2), TextDrawHideForPlayer(playerid, Watch3);
  89. return 1;
  90. }
Add Comment
Please, Sign In to add comment