Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ============================
- This Include is made by =>Sandra<=
- ============================
- */
- #include <a_samp>
- new IsCountdownStarted;
- new IsPlayerCountdownStarted[MAX_PLAYERS];
- new PlayerCountdownCount[MAX_PLAYERS];
- new CountdownCount;
- new PlayerCountdownTimer[MAX_PLAYERS];
- new CountdownTimer;
- /*
- native CreateCountdown(time, sound);
- native CreatePlayerCountdown(playerid, time, sound);
- native StopCountdown();
- native StopPlayerCountdown(playerid);
- */
- stock CreateCountdown(time, sound)
- {
- if(IsCountdownStarted == 0)
- {
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(IsPlayerCountdownStarted[i] == 1)
- {
- KillTimer(PlayerCountdownTimer[i]);
- PlayerCountdownCount[i] = 0;
- IsPlayerCountdownStarted[i] = 0;
- }
- }
- }
- GameTextForAll("~g~Get Ready...", 2000, 3);
- CountdownTimer = SetTimerEx("Countdown", 1000, 1, "d", sound);
- CountdownCount = time;
- IsCountdownStarted = 1;
- }
- }
- stock CreatePlayerCountdown(playerid, time, sound)
- {
- if(IsPlayerCountdownStarted[playerid] == 0 && IsCountdownStarted == 0)
- {
- GameTextForPlayer(playerid, "~g~Get Ready...", 2000, 3);
- PlayerCountdownTimer[playerid] = SetTimerEx("PlayerCountdown", 1000, 1, "id", playerid, sound);
- PlayerCountdownCount[playerid] = time;
- IsPlayerCountdownStarted[playerid] = 1;
- }
- }
- stock StopCountdown()
- {
- KillTimer(CountdownTimer);
- GameTextForAll(" ", 10, 3);
- CountdownCount = 0;
- IsCountdownStarted = 0;
- }
- stock StopPlayerCountdown(playerid)
- {
- KillTimer(PlayerCountdownTimer[playerid]);
- GameTextForPlayer(playerid, " ", 10, 3);
- PlayerCountdownCount[playerid] = 0;
- IsPlayerCountdownStarted[playerid] = 0;
- }
- forward Countdown(sound);
- public Countdown(sound)
- {
- if(CountdownCount == 0)
- {
- if(sound == 1)
- {
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
- }
- }
- }
- GameTextForAll("~r~GoGoGo", 2000, 3);
- KillTimer(CountdownTimer);
- IsCountdownStarted = 0;
- }
- else
- {
- if(sound == 1)
- {
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
- }
- }
- }
- new cdstring[128];
- format(cdstring, sizeof(cdstring), "~y~%d", CountdownCount);
- GameTextForAll(cdstring, 1500, 3);
- CountdownCount--;
- }
- }
- forward PlayerCountdown(playerid, sound);
- public PlayerCountdown(playerid, sound)
- {
- if(PlayerCountdownCount[playerid] == 0)
- {
- if(sound == 1) PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
- GameTextForPlayer(playerid,"~n~~n~~r~GoGoGo", 2000, 3);
- KillTimer(PlayerCountdownTimer[playerid]);
- IsPlayerCountdownStarted[playerid] = 0;
- }
- else
- {
- if(sound == 1) PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
- new pcdstring[128];
- format(pcdstring, sizeof(pcdstring), "~n~~g~%d", PlayerCountdownCount[playerid]);
- GameTextForPlayer(playerid, pcdstring, 1500, 3);
- PlayerCountdownCount[playerid]--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement