SA-MP Forums Archive
[MAKE] Countdown - 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: [MAKE] Countdown (/showthread.php?tid=193591)



[MAKE] Countdown - Larsey123IsMe - 26.11.2010

Hmm, How to make an countdown like this:

/countdown <TIME> <TEXT>

Like:

/countdown 3 The Race Have Started! GoGo!!!

3
2
1
The Race Have Started! GoGo!!!


Re: [MAKE] Countdown - WillyP - 26.11.2010

'Search'


Re: [MAKE] Countdown - zSuYaNw - 26.11.2010

His Here


Re: [MAKE] Countdown - Larsey123IsMe - 26.11.2010

I have searched but i dont find anything


Re: [MAKE] Countdown - JamesC - 26.11.2010

Learn to search please, and check tutorials before posting here.
...


Re: [MAKE] Countdown - Tai_Storm - 26.11.2010

What do you mean, you don't know how to search... Theres tutorials on *******, this site, everywhere!


Re: [MAKE] Countdown - WillyP - 26.11.2010

Here: http://************/585y44


This forum requires that you wait 120 seconds between posts. Please try again in 55 seconds.


Re: [MAKE] Countdown - Hal - 26.11.2010

or look in a race script, just be self sufficient and dont always ask here.


Re: [MAKE] Countdown - Jeffry - 26.11.2010

https://sampforum.blast.hk/showthread.php?tid=169023



-----------------------------------------------------

EDIT: I have just seen that you want the <TEXT>, so:

At TOP:
pawn Код:
new CountdownTimer = -1;
new CountDownMessage[128];
new Counttime;
Command:
pawn Код:
dcmd_countdown(playerid, params[])
{
    if(CountdownTimer != -1) return SendClientMessage(playerid, COLOR_RED, "ERROR: Countdown already active!");
    new tmp[256], tmp2[256], idx; tmp=strtok(params, idx); tmp2=strtok(params, idx);
    if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, COLOR_RED, "Usage: /countdown <TIME> <TEXT>");
    Counttime = strval(tmp);
    format(CountDownMessage, 128, "%s", params[strlen(tmp)+1]);
    CountdownTimer = SetTimer("Counter", 1000, true);
    return 1;
}
At Bottom:
pawn Код:
forward Counter();
public Counter()
{
    Counttime--;
    if(Counttime <= 0)
    {
        GameTextForAll(CountDownMessage, 1500, 3);
        KillTimer(CountdownTimer);
        CountdownTimer = -1;
    }
    else
    {
         new str[10];
         format(str, 10, "%d", Counttime);
         GameTextForAll(str, 2000, 3);
    }
    return 1;
}
I hope it works, haven't tested it.


Re: [MAKE] Countdown - Larsey123IsMe - 27.11.2010

pawn Код:
#include <a_samp>
#include <dcmd>

#define FILTERSCRIPT
#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

new CountdownTimer = -1;
new CountDownMessage[128];
new Counttime;

dcmd_countdown(playerid, params[])
{
    if(CountdownTimer != -1) return SendClientMessage(playerid, COLOR_RED, "ERROR: Countdown already active!");
    new tmp[256], tmp2[256], idx; tmp=strtok(params, idx); tmp2=strtok(params, idx);
    if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, COLOR_RED, "Usage: /countdown <TIME> <TEXT>");
    Counttime = strval(tmp);
    format(CountDownMessage, 128, "%s", params[strlen(tmp)+1]);
    CountdownTimer = SetTimer("Counter", 1000, true);
    return 1;
}

forward Counter();
public Counter()
{
    Counttime--;
    if(Counttime <= 0)
    {
        GameTextForAll(CountDownMessage, 1500, 3);
        KillTimer(CountdownTimer);
        CountdownTimer = -1;
    }
    else
    {
         new str[10];
         format(str, 10, "%d", Counttime);
         GameTextForAll(str, 2000, 3);
    }
    return 1;
}
ERROR
pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\Countdown.pwn(40) : warning 203: symbol is never used: "dcmd_countdown"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.