Guest User

HP

a guest
Feb 19th, 2010
760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. /*
  2. * Clock Real Time - Created by Noredine - Licence GPLv3
  3. */
  4.  
  5. #include <a_samp>
  6.  
  7. forward clock();
  8. forward clock2();
  9.  
  10. new Text:Clock;
  11. new clockcreated = 0;
  12.  
  13. public OnFilterScriptInit()
  14. {
  15. print("\n--------------------------------------");
  16. print(" Clock by HP Loaded ");
  17. print("--------------------------------------\n");
  18. return 1;
  19. }
  20.  
  21. public OnFilterScriptExit()
  22. {
  23. return 1;
  24. }
  25.  
  26. public OnPlayerSpawn(playerid){
  27. clock();
  28. }
  29.  
  30. public clock(){
  31. new hour,minute,second;
  32. new string[256];
  33. gettime(hour,minute,second);
  34. if (minute <= 9) {
  35. format(string,25,"%d:0%d",hour,minute);
  36. }
  37. else {
  38. format(string,25,"%d:%d",hour,minute);
  39. }
  40.  
  41. if (clockcreated == 0) {
  42. clockcreated = 1;
  43. Clock = TextDrawCreate(546.0, 23.0, string);
  44. TextDrawLetterSize(Clock, 0.5, 1.9);
  45. TextDrawFont(Clock, 3);
  46. TextDrawSetOutline(Clock, 2);
  47. TextDrawShowForAll(Clock);
  48. }
  49. else {
  50.  
  51. }
  52. SetTimer("clock2",1000,1);
  53. return 1;
  54. }
  55.  
  56. public clock2(){
  57. new hour,minute,second;
  58. new string[256];
  59. gettime(hour,minute,second);
  60. if (minute <= 9) {
  61. if (second <= 9) {
  62. format(string,25,"%d:0%d:0%d", hour, minute, second);
  63. }
  64. else {
  65. format(string,25,"%d:0%d:%d",hour,minute, second);
  66. }
  67. }
  68. else {
  69. if (second <= 9) {
  70. format(string,25,"%d:%d:0%d", hour, minute, second);
  71. }
  72. else {
  73. format(string,25,"%d:%d:%d",hour,minute, second);
  74. }
  75. }
  76.  
  77. if (clockcreated == 1) {
  78. TextDrawSetString(Clock, string);
  79. }
  80. TextDrawShowForAll(Clock);
  81. return 1;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment