SA-MP Forums Archive
3dlabbel cowntdown - 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: 3dlabbel cowntdown (/showthread.php?tid=453524)



3dlabbel cowntdown - Configuration - 25.07.2013

Hello eveyone how can i make cowntdown with 3dlabel? 5 4 3 2 1.
Thanks


Re: 3dlabbel cowntdown - Threshold - 25.07.2013

pawn Код:
new Text3D:cdlabel[MAX_PLAYERS];
new labeltimer[MAX_PLAYERS];
new labelcount[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    labelcount[playerid] = 0;
    return 1;
}

CMD:countdown(playerid, params[])
{
    if(labelcount[playerid] > 0) return SendClientMessage(playerid, 0xFF0000FF, "You already have a countdown running!");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z); //Get player's position
    cdlabel[playerid] = Create3DTextLabel("Counting Down...\n5", 0x00FF00FF, x, y, z, 30.0, GetPlayerVirtualWorld(playerid), 0);
    labelcount[playerid] = 5;
    labeltimer[playerid] = SetTimerEx("CountdownLabel", 1000, true, "i", playerid);
    SendClientMessage(playerid, 0xFFFF00FF, "The countdown has started.");
    return 1;
}

forward CountdownLabel(playerid);
public CountdownLabel(playerid)
{
    if(labelcount[playerid] == 0)
    {
        Destroy3DTextLabel(cdlabel[playerid]);
        KillTimer(labeltimer[playerid]);
        return 1;
    }
    if(labelcount[playerid] < 2)
    {
        labelcount[playerid] = 0;
        Update3DTextLabelText(cdlabel[playerid], 0x00FF00FF, "Counting Down...\n{FF0000}GO!");
    }
    else
    {
        labelcount[playerid]--;
        new fstr[30];
        format(fstr, sizeof(fstr), "Counting Down...\n{FFFF00}%d", labelcount[playerid]);
        Update3DTextLabelText(cdlabel[playerid], 0x00FF00FF, fstr);
    }
    return 1;
}
Give this a shot, compiles.


Re: 3dlabbel cowntdown - Configuration - 25.07.2013

all player can see this example in my body when i make /countdown?
anyway thanks so much


Re: 3dlabbel cowntdown - Threshold - 25.07.2013

Yes, and make sure you get the new code, I just edited it to make sure it deletes the label after use.

And no problem