SA-MP Forums Archive
I need help making a /countdown cmd - 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: I need help making a /countdown cmd (/showthread.php?tid=77622)



I need help making a /countdown cmd - PDRP_JUSTIN - 12.05.2009

I need help making a /countdown cmd.


Re: I need help making a /countdown cmd - MarcoNecroX - 12.05.2009

Search


Re: I need help making a /countdown cmd - devil614 - 13.05.2009

For a race? 3 2 1 go?

I'll give you mine, if that's what you're looking for...


Re: I need help making a /countdown cmd - PDRP_JUSTIN - 19.05.2009

Quote:
Originally Posted by devil614
For a race? 3 2 1 go?

I'll give you mine, if that's what you're looking for...
yea im looking for 5 4 3 2 1 GO GO GO!


Re: I need help making a /countdown cmd - gpclan - 19.05.2009

here yew go justin get an errors tell me


COMMAND

Код:
//=-=Commands=-=//
dcmd_count(playerid, params[])
{
    if (!strlen(params)) return SendClientMessage(playerid, 0xafafafff, "Usage: /count [amount]");
    if (!IsNumeric(params)) return SendClientMessage(playerid, 0xafafafff, "The [amount] param must be numerical");
    if (strval(params) < 1) return SendClientMessage(playerid, 0xafafafff, "The count has to be greater than zero");
    if (Counting) return SendClientMessage(playerid, 0xafafafff, "A Countdown is already running, wait until this has finished");
    Counting = true;
    new ii = strval(params);
    do
    {
        SetTimerEx("CountDown", (strval(params) - ii) * 1000, false, "i", ii);
        ii --;
    }
    while (ii != -1);
    SendClientMessage(playerid, 0xffe600ff, "*** Countdown begun ***"); //yellow (yolk) colour
    return 1;
}
//===Text Command===///
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(count, 5, cmdtext);
    return 0;
}
//=-=CountDown=-=//
public CountDown(num)
{
    new str[2];
    if (num)
    {
        format(str, sizeof(str), "%i", num);
        GameTextForAll(str, 1001, 4);
    }
    else
    {
        GameTextForAll("~g~Go Go Go", 3000, 4);
        Counting = false;
    }
}

IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
      if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
ON Top And COlor define

Код:
//=-=Define=-=//
#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
//=-=News=-=//
new Counting;
//=-=Forward=-=//
forward CountDown(num);
//=-=Main=-=//
main()
{




Re: I need help making a /countdown cmd - PDRP_JUSTIN - 19.05.2009

Quote:
Originally Posted by [DNK
ivKing ]
here yew go justin get an errors tell me


COMMAND

Код:
//=-=Commands=-=//
dcmd_count(playerid, params[])
{
    if (!strlen(params)) return SendClientMessage(playerid, 0xafafafff, "Usage: /count [amount]");
    if (!IsNumeric(params)) return SendClientMessage(playerid, 0xafafafff, "The [amount] param must be numerical");
    if (strval(params) < 1) return SendClientMessage(playerid, 0xafafafff, "The count has to be greater than zero");
    if (Counting) return SendClientMessage(playerid, 0xafafafff, "A Countdown is already running, wait until this has finished");
    Counting = true;
    new ii = strval(params);
    do
    {
        SetTimerEx("CountDown", (strval(params) - ii) * 1000, false, "i", ii);
        ii --;
    }
    while (ii != -1);
    SendClientMessage(playerid, 0xffe600ff, "*** Countdown begun ***"); //yellow (yolk) colour
    return 1;
}
//===Text Command===///
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(count, 5, cmdtext);
    return 0;
}
//=-=CountDown=-=//
public CountDown(num)
{
    new str[2];
    if (num)
    {
        format(str, sizeof(str), "%i", num);
        GameTextForAll(str, 1001, 4);
    }
    else
    {
        GameTextForAll("~g~Go Go Go", 3000, 4);
        Counting = false;
    }
}

IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
      if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
ON Top And COlor define

Код:
//=-=Define=-=//
#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
//=-=News=-=//
new Counting;
//=-=Forward=-=//
forward CountDown(num);
//=-=Main=-=//
main()
{

i get hella errors