toribio

toribio

Sep 26th, 2009
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.21 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 (strval(params) > 10) return SendClientMessage(playerid, 0xafafafff, "The count has to be < than 10");
  25.         if (Counting) return SendClientMessage(playerid, 0xafafafff, "A Countdown is already running, wait until this has finished");
  26.         Counting = true;
  27.         new ii = strval(params);
  28.         do
  29.         {
  30.                 SetTimerEx("CountDown", (strval(params) - ii) * 1000, false, "i", ii);
  31.                 ii --;
  32.         }
  33.         while (ii != -1);
  34.         SendClientMessage(playerid, 0xffe600ff, "*** Countdown begun ***"); //yellow (yolk) colour
  35.         return 1;
  36. }
  37. //===Text Command===///
  38. public OnPlayerCommandText(playerid, cmdtext[])
  39. {
  40.         dcmd(count, 5, cmdtext);
  41.         return 0;
  42. }
  43. //=-=CountDown=-=//
  44. public CountDown(num)
  45. {
  46.         new str[2];
  47.         if (num)
  48.         {
  49.                 format(str, sizeof(str), "%i", num);
  50.                 GameTextForAll(str, 1001, 4);
  51.         }
  52.         else
  53.         {
  54.                 GameTextForAll("~g~Go Go Go", 3000, 4);
  55.                 Counting = false;
  56.         }
  57. }
  58.  
  59. IsNumeric(const string[])
  60. {
  61.         for (new i = 0, j = strlen(string); i < j; i++)
  62.         {
  63.             if (string[i] > '9' || string[i] < '0') return 0;
  64.         }
  65.         return 1;
  66. }
  67. //-=-=-=-=-[ www.sa-mp.ro ]-[ www.sa-mp.com ]-[ http://vyo.fnhost.org ]-=-=-=-=-
  68. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  69. //-=-=-=-=-=-=-=-=-=-=-=-=-[ Copyright � 2009 Vyorel ]-=-=-=-=-=-=-=-=-=-=-=-=-=
  70. //==============================================================================
  71. /*||  **       **   **     **    *********    *******     *******    **       ||
  72.   ||   **     **     **   **     **     **    **    **    **         **       ||
  73.   ||    **   **       ** **      **     **    *******     *****      **       ||
  74.   ||     ** **         **        **     **    **    **    **         **       ||
  75.   ||      ***          **        **     **    **    **    **         **       ||
  76.   ||       *           **        *********    **    **    *******    ******** ||
  77.   ==============================================================================
  78. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
Add Comment
Please, Sign In to add comment