Advertisement
Guest User

Countdown - Nova Godina

a guest
Dec 16th, 2017
1,213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. #include < a_samp >
  2.  
  3. #undef MAX_PLAYERS
  4. #define MAX_PLAYERS (50) // - Namestite kako je vama u gamemodu
  5.  
  6. new Text:TextDraw_NovaGodina, bool:Prikazani_Tdovi[MAX_PLAYERS], TimerDoNove;
  7.  
  8. public OnFilterScriptInit()
  9. {
  10. TextDraw_NovaGodina = TextDrawCreate(320.691223, 2.166717, " ");
  11. TextDrawLetterSize(TextDraw_NovaGodina, 0.255695, 0.894167);
  12. TextDrawAlignment(TextDraw_NovaGodina, 2);
  13. TextDrawColor(TextDraw_NovaGodina, -1);
  14. TextDrawSetShadow(TextDraw_NovaGodina, 0);
  15. TextDrawSetOutline(TextDraw_NovaGodina, 1);
  16. TextDrawBackgroundColor(TextDraw_NovaGodina, 255);
  17. TextDrawFont(TextDraw_NovaGodina, 1);
  18. TextDrawSetProportional(TextDraw_NovaGodina, 1);
  19. TextDrawSetShadow(TextDraw_NovaGodina, 0);
  20.  
  21. TimerDoNove = SetTimer("CountDownNewYear", 1000, true);
  22.  
  23. print("\n\n\n==============================================");
  24. print("> CountDown - Nova Godina by Terzic");
  25. print("> CountDown - Nove Godina ucitavanje...");
  26. print("> CountDown - Nove Godina uspesno ucitan!");
  27. print("==============================================\n\n\n");
  28. return (true);
  29. }
  30.  
  31. public OnPlayerConnect(playerid)
  32. {
  33. Prikazani_Tdovi[playerid] = false;
  34. return (true);
  35. }
  36.  
  37. public OnPlayerSpawn(playerid)
  38. {
  39. if(Prikazani_Tdovi[playerid] == false)
  40. {
  41. TextDrawShowForPlayer(playerid, TextDraw_NovaGodina);
  42. Prikazani_Tdovi[playerid] = true;
  43. }
  44. return (true);
  45. }
  46.  
  47. public OnFilterScriptExit()
  48. {
  49. KillTimer(TimerDoNove);
  50. return (true);
  51. }
  52.  
  53. forward CountDownNewYear();
  54. public CountDownNewYear()
  55. {
  56. new godina, mesec, dan, sat, minut, sekunda, brojdana, string[120];
  57. getdate(godina, mesec, dan), gettime(sat, minut, sekunda);
  58.  
  59. if(mesec == 1 && dan == 1) TextDrawHideForAll(TextDraw_NovaGodina), KillTimer(TimerDoNove);
  60. else
  61. {
  62. switch(mesec)
  63. {
  64. case 1, 3, 5, 7, 8, 10, 12: brojdana = 31;
  65. case 2:
  66. {
  67. if (godina % 4) brojdana = 29;
  68. else brojdana = 28;
  69. }
  70. case 4, 6, 9, 11: brojdana = 30;
  71. }
  72. mesec = 12 - mesec;
  73. sat = 24 - sat;
  74. dan = brojdana - dan;
  75. minut = 60 - minut;
  76. sekunda = 60 - sekunda;
  77.  
  78. format(string, 120, "~w~-_~r~Nova_Godina_~w~-~n~-_~r~%d_~w~meseca~w~_-~n~-_~r~%d_~w~dana_~r~%d_~w~sati_~r~%d_~w~minuta_~r~%d_~w~sekundi_-", mesec, dan, sat, minut, sekunda);
  79. TextDrawSetString(TextDraw_NovaGodina, string);
  80. }
  81. return (true);
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement