SA-MP Forums Archive
How to script this count? - 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)
+--- Thread: How to script this count? (/showthread.php?tid=307399)



How to script this count? - Spooky - 30.12.2011

How can i script this type of countdown?

This is the Command with ZCMD
/count [hour] [min] [sec]
I want this command and i want that it should show a textdraw with Timer like
HH/MM/SS

ok?

Please tell me how to make it?


AW: How to script this count? - Nero_3D - 30.12.2011

You use a timer which calls a the countdown functions (each second)
And each time it gets decrease the time variable and update the textdraw
If the time hits zero show some text and kill the timer


Re: How to script this count? - Spooky - 30.12.2011

Sorry but its difficult for me if i get the code then it will be easy for me to learn and make some more nice ones.


Re: How to script this count? - Spooky - 30.12.2011

Is there anyone who can help this poor person?


*BUMP*


Re: How to script this count? - Tigerkiller - 30.12.2011

ill give you a small code to start.

new Counter;

in your cmd:

Counter = SetTimer("count",true);

and i can give you the full code later


Re: How to script this count? - Spooky - 30.12.2011

LoL
Is this some kind of a joke?


AW: How to script this count? - Nero_3D - 30.12.2011

pawn Код:
// Your cmd
    TextDrawShowForPlayer(playerid, YourTextdraw);
    CountDown(YourTextdraw, playerid, 5);
pawn Код:
forward CountDown(Text: text, playerid, time);
public CountDown(Text: text, playerid, time) {
    if(time < 1) {
        TextDrawSetString(text, "~r~GoGo!");
        SetTimerEx("tTextDrawHide", 5000, false, "ii", playerid, _: text);
    } else {
        new
            str[8] = "~r~";
        valstr(str[3], time, false);
        TextDrawSetString(text, str);
        SetTimerEx("CountDown", 1000, false, "iii", _: text, playerid, --time);
    }
}
pawn Код:
forward tTextDrawHide(playerid, Text: text);
public tTextDrawHide(playerid, Text: text) {
    if(playerid == MAX_PLAYERS) {
        TextDrawHideForAll(text);
    } else {
        TextDrawHideForPlayer(playerid, text);
    }
}