CD Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: CD Command (
/showthread.php?tid=275109)
CD Command -
omer5198 - 08.08.2011
i tried to make a CountDown command and it works... but when i made a /CCD(/cancelcountdown) command... it doesn't work completly...
it cancel the GameText and write: "~r~CountDown Canceled" but the timer is keep running and when it come to zero it says GO!!! (even that i canceled the CD and the gametext has desabled...)
please help me!
Re: CD Command -
Kingunit - 08.08.2011
Drop your commands here ...
Re: CD Command -
omer5198 - 08.08.2011
do you want the "new" and "forward" too? or just /CD & /CCD
Re: CD Command -
Kingunit - 08.08.2011
Just drop everything
Re: CD Command -
AndreT - 08.08.2011
Do you use KillTimer? Show us your code, otherwise we cannot help.
Re: CD Command -
omer5198 - 08.08.2011
CD command:
pawn Код:
if(strcmp(cmd, "/countdown", true) == 0 || strcmp(cmd, "/cd", true) == 0)
{
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] >= 1)
{
new tmp[256], tmp2[256];
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOUR_ORANGE, "/CountDown [Time] [0/1 - Freeze]");
return 1;
}
if(!strlen(tmp2))
{
SendClientMessage(playerid, COLOUR_ORANGE, "/CountDown [Time] [0/1 - Freeze]");
return 1;
}
new timer, number, string[128];
timer = strval(tmp);
number = strval(tmp2);
if(CountDownOn == 1) return SendClientMessage(playerid, COLOUR_RED, "лбш йщ сфйшд фетмъ");
if(ResServCdOn == 1) return SendClientMessage(playerid, COLOUR_RED, "дсфйшд майфес дщшъ лбш фетмъ");
if(number > 1 || number < 0) return SendClientMessage(playerid, COLOUR_RED, "оцб ддчфад йлем мдйеъ шч 0/1. 0 - бмй дчфад / 1 - тн дчфад");
if(timer < 1 || timer > 1000) return SendClientMessage(playerid, COLOUR_RED, "лоеъ дщрйеъ зййбъ мдйеъ бйп 1 - 1000");
CountDownOn = 1;
if(number == 0)
{
format(string, sizeof(string), "дордм дзм сфйшд щм %d щрйеъ бмй айфес дчфад", timer);
SendClientMessageToAll(COLOUR_YELLOW, string);
CountDownTimer = SetTimer("CountDown", timer*1000, 0);
CountDown(timer, 0);
}
else
{
format(string, sizeof(string), "дордм дзм сфйшд щм %d щрйеъ тн айфес дчфад");
SendClientMessageToAll(COLOUR_YELLOW, string);
CountDownTimer = SetTimer("CountDown", timer*1000, 0);
CountDown(timer, 1);
ToggleAllPlayersControllable(0);
}
}
else return SendClientMessage(playerid, COLOUR_RED, "аъд зййб мдйеъ мфзеъ агойп шод 1 бщбйм мдщъощ бфчегд же");
return 1;
}
CCD command:
pawn Код:
if(strcmp(cmd, "/cancelcountdown", true) == 0 || strcmp(cmd, "/ccd", true) == 0)
{
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] >= 1)
{
if(CountDownOn == 0) return SendClientMessage(playerid, COLOUR_RED, "айп сфйшд фтймд");
GameTextForAll("~r~Count Down Canceled", 3000, 3);
CountDownOn = 0;
KillTimer(CountDownTimer);
ToggleAllPlayersControllable(1);
}
else return SendClientMessage(playerid, COLOUR_RED, "аъд зййб мдйеъ мфзеъ агойп шод 1 бщбйм мдщъощ бфчегд же");
return 1;
}
Re: CD Command -
omer5198 - 08.08.2011
anyone!?!? b.t.w: no errors or warnings...
Re: CD Command -
omer5198 - 08.08.2011
Come On! please help!
Re: CD Command -
LZLo - 08.08.2011
PHP код:
forward CountDown();
new bool: IsCountdownStarted;
new CountdownTimer;
public CountDown()
{
switch(Count)
{
case 5: { GameTextForAll("~b~-~r~ 5 ~b~-", 1100, 3); }
case 4: { GameTextForAll("~b~-~r~ 4 ~b~-", 1100, 3); }
case 3: { GameTextForAll("~b~-~r~ 3 ~b~-", 1100, 3); }
case 2: { GameTextForAll("~b~-~r~ 2 ~b~-", 1100, 3); }
case 1: { GameTextForAll("~b~-~r~ 1 ~b~-", 1100, 3); }
case 0:
{
GameTextForAll("~b~-~g~ go! ~b~-", 2000, 3);
KillTimer(CountdownTimer);
IsCountdownStarted = false;
}
}
Count--;
}
COMMAND:count(playerid, params[]) {
#pragma unused params
if(IsCountdownStarted == false)
{
Count = 5;
CountdownTimer = SetTimer("CountDown", 1000, 1);
IsCountdownStarted = true;
SendClientMessage(playerid, COLOR_ORANGE, "You have started the CountDown!");
new countstring2[128];
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid,PlayerName, MAX_PLAYER_NAME);
format(countstring2, 128, "%s has started the CountDown", PlayerName);
SendClientMessage(COLOR_GREY, countstring2);
}
else
{
SendClientMessage(playerid, COLOR_RED, "The CountDown has already started!");
}
return 1;
}
if i could help please click a rep star for me