Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //==============================================================================
- //------------------------------------------------------------------------------
- // If You Find Bug In This Script Pm Me ([email protected]) Okay!
- // Thank You To Support My Work :D
- //------------------------------------------------------------------------------
- //==============================================================================
- #include <a_samp>
- #include <zcmd>
- #include <sscanf>
- new CountDown, Cd_Timer;
- public OnFilterScriptInit()
- {
- // Just Don't Edit If You Found Bug!
- CountDown = 0;
- return 1;
- }
- public OnFilterScriptExit()
- {
- CountDown = 0;
- return 1;
- }
- cmd(cd, playerid, params[]) { return cmd_countdown(playerid, params); }
- cmd(countdown, playerid, params[])
- {
- new sec, fz, string[MAX_PLAYERS];
- if(sscanf(params, "dd", sec, fz)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /countdown [seconds] [freeze (0/1)]");
- if(CountDown == 1) return SendClientMessage(playerid, 0xFF0000FF, "Error: Countdown already in progress!");
- if(sec < 1 || sec > 10) return SendClientMessage(playerid, 0xFF0000FF, "Error: Seconds between 1 - 10");
- if(fz < 0 || fz > 1) return SendClientMessage(playerid, 0xFF0000FF, "Error: Use only 0 (With freeze) and 1 (Without freeze)!");
- if(fz == 1)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- TogglePlayerControllable(i, 0);
- }
- }
- if(sec == 10) { Cd_Timer = SetTimer("CountDown10", 1000, false); }
- if(sec == 9) { Cd_Timer = SetTimer("CountDown9", 1000, false); }
- if(sec == 8) { Cd_Timer = SetTimer("CountDown8", 1000, false); }
- if(sec == 7) { Cd_Timer = SetTimer("CountDown7", 1000, false); }
- if(sec == 6) { Cd_Timer = SetTimer("CountDown6", 1000, false); }
- if(sec == 5) { Cd_Timer = SetTimer("CountDown5", 1000, false); }
- if(sec == 4) { Cd_Timer = SetTimer("CountDown4", 1000, false); }
- if(sec == 3) { Cd_Timer = SetTimer("CountDown3", 1000, false); }
- if(sec == 2) { Cd_Timer = SetTimer("CountDown2", 1000, false); }
- if(sec == 1) { Cd_Timer = SetTimer("CountDown1", 1000, false); }
- format(string, sizeof(string), ":: %s (%d) has started countdown from %d seconds, (Freeze: %d) ::", IsPlayerName(playerid), playerid, sec, fz);
- SendClientMessageToAll(0x99FF00FF, string);
- CountDown = 1;
- return 1;
- }
- forward CountDown10();
- forward CountDown9();
- forward CountDown8();
- forward CountDown7();
- forward CountDown6();
- forward CountDown5();
- forward CountDown4();
- forward CountDown3();
- forward CountDown2();
- forward CountDown1();
- forward CountDown0();
- public CountDown10()
- {
- //
- GameTextForAll("~p~:: 10 ::", 999, 3);
- KillTimer(Cd_Timer);
- Cd_Timer = SetTimer("CountDown9", 1000, false);
- }
- public CountDown9()
- {
- //
- GameTextForAll("~b~:: 9 ::", 999, 3);
- KillTimer(Cd_Timer);
- Cd_Timer = SetTimer("CountDown8", 1000, false);
- }
- public CountDown8()
- {
- //
- GameTextForAll("~p~:: 8 ::", 999, 3);
- KillTimer(Cd_Timer);
- Cd_Timer = SetTimer("CountDown7", 1000, false);
- }
- public CountDown7()
- {
- //
- GameTextForAll("~b~:: 7 ::", 999, 3);
- KillTimer(Cd_Timer);
- Cd_Timer = SetTimer("CountDown6", 1000, false);
- }
- public CountDown6()
- {
- //
- GameTextForAll("~p~:: 6 ::", 999, 3);
- KillTimer(Cd_Timer);
- Cd_Timer = SetTimer("CountDown5", 1000, false);
- }
- public CountDown5()
- {
- //
- GameTextForAll("~b~:: 5 ::", 999, 3);
- KillTimer(Cd_Timer);
- Cd_Timer = SetTimer("CountDown4", 1000, false);
- }
- public CountDown4()
- {
- //
- GameTextForAll("~p~:: 4 ::", 999, 3);
- KillTimer(Cd_Timer);
- Cd_Timer = SetTimer("CountDown3", 1000, false);
- }
- public CountDown3()
- {
- //
- GameTextForAll("~b~:: 3 ::", 999, 3);
- KillTimer(Cd_Timer);
- Cd_Timer = SetTimer("CountDown2", 1000, false);
- }
- public CountDown2()
- {
- //
- GameTextForAll("~p~:: 2 ::", 999, 3);
- KillTimer(Cd_Timer);
- Cd_Timer = SetTimer("CountDown1", 1000, false);
- }
- public CountDown1()
- {
- //
- GameTextForAll("~b~:: 1 ::", 999, 3);
- KillTimer(Cd_Timer);
- Cd_Timer = SetTimer("CountDown0", 1000, false);
- }
- public CountDown0()
- {
- //
- GameTextForAll("~r~:: GO! GO! GO! ::", 999, 3);
- CountDown = 0;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- TogglePlayerControllable(i, 0);
- }
- KillTimer(Cd_Timer);
- }
- stock IsPlayerName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment