Advertisement
Guest User

vyo

a guest
May 1st, 2009
1,357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. //=-=Include=-=//
  2. #include <a_samp>
  3. //=-=Define=-=//
  4. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  5. //=-=News=-=//
  6. new Counting;
  7. //=-=Forward=-=//
  8. forward CountDown(num);
  9. //=-=Main=-=//
  10. main()
  11. {
  12. print("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-|");
  13. print("| CountDown Filterscript |");
  14. print("| Copyright � 2009 Vyorel |");
  15. print("|-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|\n");
  16. return 1;
  17. }
  18. //=-=Commands=-=//
  19. dcmd_count(playerid, params[])
  20. {
  21. if (!strlen(params)) return SendClientMessage(playerid, 0xafafafff, "Usage: /count [amount]");
  22. if (!IsNumeric(params)) return SendClientMessage(playerid, 0xafafafff, "The [amount] param must be numerical");
  23. if (strval(params) < 1) return SendClientMessage(playerid, 0xafafafff, "The count has to be greater than zero");
  24. if (Counting) return SendClientMessage(playerid, 0xafafafff, "A Countdown is already running, wait until this has finished");
  25. Counting = true;
  26. new ii = strval(params);
  27. do
  28. {
  29. SetTimerEx("CountDown", (strval(params) - ii) * 1000, false, "i", ii);
  30. ii --;
  31. }
  32. while (ii != -1);
  33. SendClientMessage(playerid, 0xffe600ff, "*** Countdown begun ***"); //yellow (yolk) colour
  34. return 1;
  35. }
  36. //===Text Command===///
  37. public OnPlayerCommandText(playerid, cmdtext[])
  38. {
  39. dcmd(count, 5, cmdtext);
  40. return 0;
  41. }
  42. //=-=CountDown=-=//
  43. public CountDown(num)
  44. {
  45. new str[2];
  46. if (num)
  47. {
  48. format(str, sizeof(str), "%i", num);
  49. GameTextForAll(str, 1001, 4);
  50. }
  51. else
  52. {
  53. GameTextForAll("~g~Go Go Go", 3000, 4);
  54. Counting = false;
  55. }
  56. }
  57.  
  58. IsNumeric(const string[])
  59. {
  60. for (new i = 0, j = strlen(string); i < j; i++)
  61. {
  62. if (string[i] > '9' || string[i] < '0') return 0;
  63. }
  64. return 1;
  65. }
  66. //-=-=-=-=-[ www.sa-mp.ro ]-[ www.sa-mp.com ]-[ http://vyo.fnhost.org ]-=-=-=-=-
  67. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  68. //-=-=-=-=-=-=-=-=-=-=-=-=-[ Copyright � 2009 Vyorel ]-=-=-=-=-=-=-=-=-=-=-=-=-=
  69. //==============================================================================
  70. /*|| ** ** ** ** ********* ******* ******* ** ||
  71. || ** ** ** ** ** ** ** ** ** ** ||
  72. || ** ** ** ** ** ** ******* ***** ** ||
  73. || ** ** ** ** ** ** ** ** ** ||
  74. || *** ** ** ** ** ** ** ** ||
  75. || * ** ********* ** ** ******* ******** ||
  76. ==============================================================================
  77. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement