Testdraw countdown help?
#1

I got this rob script and players want to know how long it will take to finish robbing it, I just need a textdraw countdown for 30 seconds at the bottom of the screen...I've tried it and can't get it to work could someone help?
Reply
#2

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

https://sampwiki.blast.hk/wiki/TextDrawSetString
https://sampwiki.blast.hk/wiki/format
Reply
#3

This callback has a CountDown to be inputted and it will be displayed as a GameTextForPlayer. You can edit it accordingly

pawn Код:
//Countdown
forward CountDown(playerid, seconds);
public CountDown(playerid, seconds)
{
    new string[50];
    if(seconds > 0)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        PlayerPlaySound(playerid, 1056, X, Y, Z);
        format(string, sizeof(string), "~R~%d", seconds);
        GameTextForPlayer(playerid, string, 1000, 3);
        seconds = seconds -1;
        SetTimerEx("CountDown", 1000, 0, "ii", playerid, seconds);
        return 1;
    }
    if(seconds == 0)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        PlayerPlaySound(playerid, 1057, X, Y, Z);
        GameTextForPlayer(playerid, "~G~Start!!!", 1000, 3);
        TogglePlayerControllable(playerid, 1);
        return 1;
    }
    return 1;
}
How to use this callback?
pawn Код:
// THIS WILL SHOW YOU COUNTDOWN OF 500 Seconds.
CountDown(playerid, 500);
Reply
#4

game text makes people lag when its a countdown, I've tried it
Reply
#5

Quote:
Originally Posted by vvhy
Посмотреть сообщение
game text makes people lag when its a countdown, I've tried it
Try this one then. Just created for you [UNTESTED]
pawn Код:
//Countdown
forward CountDown(playerid, seconds);
public CountDown(playerid, seconds)
{
    new string[50];
    if(seconds > 0)
    {
            new Text:TextdrawCT;
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        format(string, sizeof(string), "~R~%d", seconds);
            TextdrawCT = TextDrawCreate(262.000000, 163.000000, "string");
        TextDrawBackgroundColor(Textdraw0, 255);
        TextDrawFont(Textdraw0, 1);
        TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
        TextDrawColor(Textdraw0, -16776961);
        TextDrawSetOutline(Textdraw0, 0);
        TextDrawSetProportional(Textdraw0, 1);
        TextDrawSetShadow(Textdraw0, 1);
        PlayerPlaySound(playerid, 1056, X, Y, Z);
        TextDrawShowForPlayer(playerid,TextdrawCT);
        seconds = seconds -1;
        SetTimerEx("CountDown", 1000, 0, "ii", playerid, seconds);
        return 1;
    }
    if(seconds == 0)
    {
            new Text:TextdrawCT1;
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        PlayerPlaySound(playerid, 1057, X, Y, Z);
            TextdrawCT = TextDrawCreate(262.000000, 163.000000, "GO..");
        TextDrawBackgroundColor(Textdraw0, 255);
        TextDrawFont(Textdraw0, 1);
        TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
        TextDrawColor(Textdraw0, -16776961);
        TextDrawSetOutline(Textdraw0, 0);
        TextDrawSetProportional(Textdraw0, 1);
        TextDrawSetShadow(Textdraw0, 1);
        TogglePlayerControllable(playerid, 1);
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)