3DTextLabel - Attach To Player
#1

Hello, i have a Donating System on my server.
Each Donators should have a 3D Text Label above their head, but they can also turn it off by using /vipsettings.

Now the problem is, I don't have any errors on the script, but for some reason the Text doesn't attach to head.

Creating the variable

pawn Код:
new Text3D:vip_text[MAX_PLAYERS];
This allows to make the text visible or unvisible. (I have a Dialog System)

pawn Код:
switch(itemid)
{
    case 1:
    {
        if(attach_vip[playerid] == true)
        {
            attach_vip[playerid] = false;
            Update3DTextLabelText(vip_text[playerid], 0xFFFFFFFF, " ");
        }
        else
        {
            attach_vip[playerid] = true;
                    Update3DTextLabelText(vip_text[playerid], COLOR_GROUP, "Donator Player");
        }
    }
}
This is when player connects the server and he's Donator.

pawn Код:
vip_text[playerid] = Create3DTextLabel("Donating Player", COLOR_GROUP, 0.0, 0.0, 0.0, 40.0, 0, 0);
When the player spawns.

pawn Код:
if(attach_vip[playerid] == true)
{
    Attach3DTextLabelToPlayer(vip_text[playerid], playerid, 0.0, 0.0, 0.5);
}
When player disconnects.

pawn Код:
Delete3DTextLabel(vip_text[playerid]);
vip_text[playerid] = Text3D:INVALID_3DTEXT_ID;
Reply
#2

try this

and btw you have not to use everywhere this Text3D:vip_text[playerid],only vip_text[playerid]
Код:
        if(attach_vip[playerid] == true)
        {
            attach_vip[playerid] = false;
            Delete3DTextLabel(vip_text[playerid]);
            vip_text[playerid] = Text3D:INVALID_3DTEXT_ID;
        }
        else
        {
            attach_vip[playerid] = true;
            Update3DTextLabelText(Text3D:vip_text[playerid], COLOR_GROUP, "Donator Player");
            Attach3DTextLabelToPlayer(Text3D:vip_text[playerid], playerid, 0.0, 0.0, 0.5);
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)