3dlabbel cowntdown
#1

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

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)