SA-MP Forums Archive
Countdown for Server - 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: Countdown for Server (/showthread.php?tid=205751)



Countdown for Server - Marios - 02.01.2011

Can Someone give me a script code for a screen countdown? (3,2,1,go). I want one but no for Admins use, i want to be able to do it everyone in my server with a command! thnx!


Re: Countdown for Server - Ironboy - 02.01.2011

pawn Код:
CMD:count(playerid,params[]) {
    new ccseconds;
    if (sscanf(params, "i", ccseconds)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /count [seconds]");
    if(PlayerInfo[playerid][Jailed] == 1) {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You are in jail and cannot use this command");
        return 1;
    }
    if (isnull(params)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You must enter a duration in seconds.");
    if (!IsNumeric(params)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You must enter a duration in seconds.");
    if (ccseconds < 1) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You must enter a duration between 1 and 20 seconds");
    if (ccseconds > 20) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You must enter a duration between 1 and 20 seconds");
    if (cseconds) return SendClientMessage(playerid, COLOR_BRIGHTRED, "A countdown is already running.");
    CountingTimer = SetTimer("ctimer", 1000, true);
    format(cstring,40,"You started a countdown of %d seconds.",ccseconds);
    SendClientMessage(playerid,COLOR_LIGHTBLUE, cstring);
    cseconds = ccseconds+1;
    cCount[playerid] = 1;
    return 1;
}



Re: Countdown for Server - HyperZ - 02.01.2011

pawn Код:
new Count = 3;
pawn Код:
if(strcmp(cmdtext,"/count",true) == 0)
{
    if(Count < 3) return SendClientMessage(playerid,red,"Countdown is already in progress");
    SetTimer("CountDown",1000,0);
    return 1;
}
pawn Код:
public CountDown()
{
    format(string,sizeof(string),"%d",Count);
    if(Count == 0)
    {
        GameTextForAll("Go go go!",1500,3);
        Count = 3;
    }
    else
    {
        GameTextForAll(string,1500,3);
        Count--;
        SetTimer("CountDown",1000,0);
    }
    return 1;
}



Re: Countdown for Server - Marios - 02.01.2011

Quote:
Originally Posted by Clive
Посмотреть сообщение
pawn Код:
new Count = 3;
pawn Код:
if(strcmp(cmdtext,"/count",true) == 0)
{
    if(Count < 3) return SendClientMessage(playerid,red,"Countdown is already in progress");
    SetTimer("CountDown",1000,0);
    return 1;
}
pawn Код:
public CountDown()
{
    format(string,sizeof(string),"%d",Count);
    if(Count == 0)
    {
        GameTextForAll("Go go go!",1500,3);
        Count = 3;
    }
    else
    {
        GameTextForAll(string,1500,3);
        Count--;
        SetTimer("CountDown",1000,0);
    }
    return 1;
}
I get the following errors!
warning 235: public function lacks forward declaration (symbol "CountDown")
: error 017: undefined symbol "string"
: error 017: undefined symbol "string"
: error 029: invalid expression, assumed zero


Re: Countdown for Server - gangstajoe - 02.01.2011

Quote:
Originally Posted by Marios
Посмотреть сообщение
I get the following errors!
warning 235: public function lacks forward declaration (symbol "CountDown")
: error 017: undefined symbol "string"
: error 017: undefined symbol "string"
: error 029: invalid expression, assumed zero
change
pawn Код:
new Count = 3;
to
pawn Код:
new Count = 3;
new string[256];
forward CountDown();
That should solve it.


Re: Countdown for Server - Marios - 02.01.2011

Quote:
Originally Posted by gangstajoe
Посмотреть сообщение
change
pawn Код:
new Count = 3;
to
pawn Код:
new Count = 3;
new string[256];
forward CountDown();
That should solve it.
thanks so much


Re: Countdown for Server - Mean - 02.01.2011

Quote:
Originally Posted by gangstajoe
Посмотреть сообщение
change
pawn Код:
new Count = 3;
to
pawn Код:
new Count = 3;
new string[256];
forward CountDown();
That should solve it.
LoL why to use 256 cells ?