Advertisement
Guest User

Sandra

a guest
Feb 21st, 2008
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. /*
  2. ============================
  3. This Include is made by =>Sandra<=
  4. ============================
  5. */
  6. #include <a_samp>
  7.  
  8. new IsCountdownStarted;
  9. new IsPlayerCountdownStarted[MAX_PLAYERS];
  10. new PlayerCountdownCount[MAX_PLAYERS];
  11. new CountdownCount;
  12. new PlayerCountdownTimer[MAX_PLAYERS];
  13. new CountdownTimer;
  14.  
  15. /*
  16. native CreateCountdown(time, sound);
  17. native CreatePlayerCountdown(playerid, time, sound);
  18. native StopCountdown();
  19. native StopPlayerCountdown(playerid);
  20. */
  21.  
  22. stock CreateCountdown(time, sound)
  23. {
  24. if(IsCountdownStarted == 0)
  25. {
  26. for(new i; i<MAX_PLAYERS; i++)
  27. {
  28. if(IsPlayerConnected(i))
  29. {
  30. if(IsPlayerCountdownStarted[i] == 1)
  31. {
  32. KillTimer(PlayerCountdownTimer[i]);
  33. PlayerCountdownCount[i] = 0;
  34. IsPlayerCountdownStarted[i] = 0;
  35. }
  36. }
  37. }
  38. GameTextForAll("~g~Get Ready...", 2000, 3);
  39. CountdownTimer = SetTimerEx("Countdown", 1000, 1, "d", sound);
  40. CountdownCount = time;
  41. IsCountdownStarted = 1;
  42. }
  43. }
  44.  
  45. stock CreatePlayerCountdown(playerid, time, sound)
  46. {
  47. if(IsPlayerCountdownStarted[playerid] == 0 && IsCountdownStarted == 0)
  48. {
  49. GameTextForPlayer(playerid, "~g~Get Ready...", 2000, 3);
  50. PlayerCountdownTimer[playerid] = SetTimerEx("PlayerCountdown", 1000, 1, "id", playerid, sound);
  51. PlayerCountdownCount[playerid] = time;
  52. IsPlayerCountdownStarted[playerid] = 1;
  53. }
  54. }
  55.  
  56. stock StopCountdown()
  57. {
  58. KillTimer(CountdownTimer);
  59. GameTextForAll(" ", 10, 3);
  60. CountdownCount = 0;
  61. IsCountdownStarted = 0;
  62. }
  63.  
  64. stock StopPlayerCountdown(playerid)
  65. {
  66. KillTimer(PlayerCountdownTimer[playerid]);
  67. GameTextForPlayer(playerid, " ", 10, 3);
  68. PlayerCountdownCount[playerid] = 0;
  69. IsPlayerCountdownStarted[playerid] = 0;
  70. }
  71.  
  72. forward Countdown(sound);
  73. public Countdown(sound)
  74. {
  75. if(CountdownCount == 0)
  76. {
  77. if(sound == 1)
  78. {
  79. for(new i; i<MAX_PLAYERS; i++)
  80. {
  81. if(IsPlayerConnected(i))
  82. {
  83. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  84. }
  85. }
  86. }
  87. GameTextForAll("~r~GoGoGo", 2000, 3);
  88. KillTimer(CountdownTimer);
  89. IsCountdownStarted = 0;
  90. }
  91. else
  92. {
  93. if(sound == 1)
  94. {
  95. for(new i; i<MAX_PLAYERS; i++)
  96. {
  97. if(IsPlayerConnected(i))
  98. {
  99. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  100. }
  101. }
  102. }
  103. new cdstring[128];
  104. format(cdstring, sizeof(cdstring), "~y~%d", CountdownCount);
  105. GameTextForAll(cdstring, 1500, 3);
  106. CountdownCount--;
  107. }
  108. }
  109.  
  110. forward PlayerCountdown(playerid, sound);
  111. public PlayerCountdown(playerid, sound)
  112. {
  113. if(PlayerCountdownCount[playerid] == 0)
  114. {
  115. if(sound == 1) PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  116. GameTextForPlayer(playerid,"~n~~n~~r~GoGoGo", 2000, 3);
  117. KillTimer(PlayerCountdownTimer[playerid]);
  118. IsPlayerCountdownStarted[playerid] = 0;
  119. }
  120. else
  121. {
  122. if(sound == 1) PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
  123. new pcdstring[128];
  124. format(pcdstring, sizeof(pcdstring), "~n~~g~%d", PlayerCountdownCount[playerid]);
  125. GameTextForPlayer(playerid, pcdstring, 1500, 3);
  126. PlayerCountdownCount[playerid]--;
  127. }
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement