Oblivion_UFF

SingPlayer Clock for samp

Sep 10th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. new Text:TDEditor_TD[2];
  2.  
  3. forward UpdateClock(playerid);
  4.  
  5. public OnFilterScriptInit()
  6. {
  7. SetTimer("UpdateClock",1000,true);
  8. return 1;
  9. }
  10.  
  11.  
  12. public OnPlayerConnect(playerid)
  13. {
  14. TDEditor_TD[0] = TextDrawCreate(533.999938, 2.586616, "Day");
  15. TextDrawLetterSize(TDEditor_TD[0], 0.342400, 1.495466);
  16. TextDrawAlignment(TDEditor_TD[0], 1);
  17. TextDrawColor(TDEditor_TD[0], 16777215);
  18. TextDrawSetShadow(TDEditor_TD[0], 0);
  19. TextDrawSetOutline(TDEditor_TD[0], 1);
  20. TextDrawBackgroundColor(TDEditor_TD[0], 255);
  21. TextDrawFont(TDEditor_TD[0], 2);
  22. TextDrawSetProportional(TDEditor_TD[0], 1);
  23.  
  24. TDEditor_TD[1] = TextDrawCreate(546.000122, 19.759992, "00:00");
  25. TextDrawLetterSize(TDEditor_TD[1], 0.550398, 2.146236);
  26. TextDrawAlignment(TDEditor_TD[1], 1);
  27. TextDrawColor(TDEditor_TD[1], 16777215);
  28. TextDrawSetShadow(TDEditor_TD[1], 2);
  29. TextDrawSetOutline(TDEditor_TD[1], 2);
  30. TextDrawBackgroundColor(TDEditor_TD[1], 255);
  31. TextDrawFont(TDEditor_TD[1], 3);
  32. TextDrawSetProportional(TDEditor_TD[1], 1);
  33.  
  34.  
  35. TextDrawShowForPlayer(playerid, TDEditor_TD[0]), TextDrawShowForPlayer(playerid, TDEditor_TD[1]);
  36. return 1;
  37. }
  38.  
  39. public OnPlayerDisconnect(playerid)
  40. {
  41. TextDrawHideForPlayer(playerid, TDEditor_TD[0]), TextDrawHideForPlayer(playerid, TDEditor_TD[1]);
  42. return 1;
  43. }
  44.  
  45. stock GetMonth(Month)
  46. {
  47. new MonthStr[15];
  48. switch(Month)
  49. {
  50. case 1: MonthStr = "January";
  51. case 2: MonthStr = "February";
  52. case 3: MonthStr = "March";
  53. case 4: MonthStr = "April";
  54. case 5: MonthStr = "May";
  55. case 6: MonthStr = "June";
  56. case 7: MonthStr = "July";
  57. case 8: MonthStr = "August";
  58. case 9: MonthStr = "September";
  59. case 10: MonthStr = "October";
  60. case 11: MonthStr = "November";
  61. case 12: MonthStr = "December";
  62. }
  63. return MonthStr;
  64. }
  65.  
  66. public UpdateClock(playerid)
  67. {
  68. new string[256], day, year, month, hours, minutes;
  69.  
  70. getdate(year, month, day), gettime(hours, minutes);
  71.  
  72. format(string, sizeof string, "%s", GetMonth(month));
  73. TextDrawSetString(TDEditor_TD[0], string);
  74.  
  75. format(string, sizeof string, "%s%d:%s%d", (hours < 10) ? ("0") : ("") , hours, (minutes < 10) ? ("0") : (""), minutes);
  76. TextDrawSetString(TDEditor_TD[1], string);
  77. }
Add Comment
Please, Sign In to add comment