Advertisement
Guest User

Countdown System

a guest
Sep 20th, 2012
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.07 KB | None | 0 0
  1. //
  2. //      Released by Good3nough Team
  3. //      Created by [G3]Gunn3R
  4. //      Scripted by [G3]Cr3F
  5. //      Helped by [G3]Winn3R and [G3]RDxX
  6. //
  7.  
  8. #include <a_samp>
  9.  
  10. #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
  11.  
  12. new Counting;
  13.  
  14. public OnFilterScriptInit()
  15. {
  16.     print("\n--------------------------------------");
  17.     print(" Countdown Filterscript by Good3nough Team");
  18.     print("--------------------------------------\n");
  19.     return 1;
  20. }
  21.  
  22. public OnPlayerCommandText(playerid, cmdtext[])
  23. {
  24.         dcmd(count, 5, cmdtext);
  25.         return 0;
  26. }
  27.  
  28. dcmd_count(playerid, params[])
  29. {
  30.         if (!strlen(params)) return SendClientMessage(playerid, 0xffffffaa, "USAGE: /count [amount]");
  31.         if (!IsNumeric(params)) return SendClientMessage(playerid, 0xffffffaa, "The amouny param must be numerical.");
  32.         if (strval(params) < 1 || strval(params) > 10) return SendClientMessage(playerid, 0xffffffaa, "The amount should be 0 < amount <= 10");
  33.         if (Counting) return SendClientMessage(playerid, 0xffffffaa, "A Countdown is already running, wait until this has finished.");
  34.         Counting = true;
  35.         new ii = strval(params);
  36.         do
  37.         {
  38.             SetTimerEx("CountDown", (strval(params) - ii) * 1000, false, "i", ii);
  39.             ii --;
  40.         }
  41.         while (ii != -1);
  42.  
  43.         new Name[32];
  44.         new string[256];
  45.         GetPlayerName(playerid, Name, 24);
  46.         format(string, sizeof(string), "* %s has started the Countdown.", Name);
  47.         SendClientMessageToAll(0xffffffaa, string);
  48.         return 1;
  49. }
  50.  
  51. forward CountDown(num);
  52. public CountDown(num)
  53. {
  54.         new str[6];
  55.         if (num) {format(str, sizeof(str), "~w~%i", num); GameTextForAll(str, 1000, 4); }
  56.         else {GameTextForAll("~g~Go", 3000, 4); Counting = false; }
  57. }
  58.  
  59. IsNumeric(const string[])
  60. {
  61.         for (new i = 0, j = strlen(string); i < j; i++)
  62.             if (string[i] > '9' || string[i] < '0') return 0;
  63.         return 1;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement