[MAKE] Countdown
#1

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!!!
Reply
#2

'Search'
Reply
#3

His Here
Reply
#4

I have searched but i dont find anything
Reply
#5

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

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

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


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

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

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)