VIP Tag not showing up.
#1

So I've scripted in a command, where a vip member can do /vtag to activate/deactivate his tag. But for some reason the textlabel isn't showing up on the player.

pawn Код:
CMD:vtag(playerid, params[])
{
    if(PlayerInfo[playerid][pVip] >=1 )
    {
        new Text3D:label = Create3DTextLabel("VIP", COLOR_VIOLET, 30.0, 40.0, 50.0, 40.0, 0);
        if(viptag[playerid] == 0 )
        {
            GameTextForPlayer(playerid, "~p~VIP Tag Activated.",3000,5);
            viptag[playerid] = 1;
            Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
        }
        else
        {
            GameTextForPlayer(playerid, "~r~VIP Tag Deactivated",3000,5);
            viptag[playerid] = 0;
            DeletePlayer3DTextLabel(playerid, PlayerText3D:label);
        }
    }
    else return SendClientMessage(playerid,COLOR_GREY, ERROR);
    return 1;
}
Maybe you guys will know whats wrong, thanks.
Reply
#2

Код:
CMD:vtag(playerid, params[])
{
    if(PlayerInfo[playerid][pVip] >=1 )
    {
        new Text3D:label = Create3DTextLabel("VIP", COLOR_VIOLET, 30.0, 40.0, 50.0, 40.0, 0);
        if(viptag[playerid] == 0 )
        {
            GameTextForPlayer(playerid, "~p~VIP Tag Activated.",3000,5);
            viptag[playerid] = 1;
            Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
        }
        else
        if(viptag[playerid] == 1 )
        {
            GameTextForPlayer(playerid, "~r~VIP Tag Deactivated",3000,5);
            viptag[playerid] = 0;
            DeletePlayer3DTextLabel(playerid, PlayerText3D:label);
        }
    }
    else return SendClientMessage(playerid,COLOR_GREY, ERROR);
    return 1;
}
not tested~ and i don't know if it works!
Reply
#3

It's probably just me. But I don't see what you did, lol.
Reply
#4

You are not attaching the 3DTextLabel to the player

https://sampwiki.blast.hk/wiki/Attach3DTextLabelToPlayer
Reply
#5

remove all viptag and add this

Top
pawn Код:
new Text3D:VipTag[MAX_PLAYERS];
OnPlayerConnect
pawn Код:
VipTag[playerid] = Text3D:INVALID_3DTEXT_ID;
OnPlayerDisconnect
pawn Код:
if(VipTag[playerid] != Text3D:INVALID_3DTEXT_ID)
{
    Delete3DTextLabel(VipTag[playerid]);
    VipTag[playerid] = Text3D:INVALID_3DTEXT_ID;
}
pawn Код:
CMD:vtag(playerid)
{
    if(PlayerInfo[playerid][pVip] >=1 )
    {
        if(VipTag[playerid] == Text3D:INVALID_3DTEXT_ID)
        {
            GameTextForPlayer(playerid, "~p~VIP Tag Activated.",3000,5);
            VipTag[playerid] = Create3DTextLabel("VIP", COLOR_VIOLET, 30.0, 40.0, 50.0, 40.0, 0);
            Attach3DTextLabelToPlayer(VipTag[playerid], playerid, 0.0, 0.0, 0.7);
        }
        else
        {
            GameTextForPlayer(playerid, "~r~VIP Tag Deactivated",3000,5);
            Delete3DTextLabel(VipTag[playerid]);
            VipTag[playerid] = Text3D:INVALID_3DTEXT_ID;
        }
    }
    else SendClientMessage(playerid,COLOR_GREY, ERROR);
    return 1;
}
Reply
#6

Try this ?
pawn Код:
new
    Text3D: vipLabel[ MAX_PLAYERS ],
    bool: viptag[ MAX_PLAYERS ];
   
public OnPlayerConnect( playerid )
{
    vipLabel[ playerid ] = Create3DTextLabel( "VIP", 0x33FF33AA, 0.0, 0.0, 2.0, 40, 0, 0 );
    return true;
}

CMD:vtag( playerid, params[ ] )
{
    if ( PlayerInfo[ playerid ][ pVip ] >= 1 )
    {
        viptag[ playerid ] = ! viptag[ playerid ];

        GameTextForPlayer( playerid,
        ( viptag[ playerid ] ) ? ( "~p~VIP Tag Activated" ) : ( "~r~VIP Tag Deactivated" ), 3000, 5 );

        switch ( viptag[ playerid ] )
        {
            case true : Attach3DTextLabelToPlayer( vipLabel[ playerid ], playerid, 0.0, 0.0, 0.7 );

            case false : Delete3DTextLabel( vipLabel[ playerid ] );
        }
    }

    else return SendClientMessage( playerid, 0xFF3333AA, "ERROR: You are not a VIP!" );

    return true;
}
( untested )
Reply
#7

Quote:
Originally Posted by Jefff
Посмотреть сообщение
remove all viptag and add this

Top
pawn Код:
new Text3D:VipTag[MAX_PLAYERS];
OnPlayerConnect
pawn Код:
VipTag[playerid] = Text3D:INVALID_3DTEXT_ID;
OnPlayerDisconnect
pawn Код:
if(VipTag[playerid] != Text3D:INVALID_3DTEXT_ID)
{
    Delete3DTextLabel(VipTag[playerid]);
    VipTag[playerid] = Text3D:INVALID_3DTEXT_ID;
}
pawn Код:
CMD:vtag(playerid)
{
    if(PlayerInfo[playerid][pVip] >=1 )
    {
        if(VipTag[playerid] == Text3D:INVALID_3DTEXT_ID)
        {
            GameTextForPlayer(playerid, "~p~VIP Tag Activated.",3000,5);
            VipTag[playerid] = Create3DTextLabel("VIP", COLOR_VIOLET, 30.0, 40.0, 50.0, 40.0, 0);
            Attach3DTextLabelToPlayer(VipTag[playerid], playerid, 0.0, 0.0, 0.7);
        }
        else
        {
            GameTextForPlayer(playerid, "~r~VIP Tag Deactivated",3000,5);
            Delete3DTextLabel(VipTag[playerid]);
            VipTag[playerid] = Text3D:INVALID_3DTEXT_ID;
        }
    }
    else SendClientMessage(playerid,COLOR_GREY, ERROR);
    return 1;
}
Getting a tag mismatch for these lines.
pawn Код:
VipTag[playerid] = Create3DTextLabel("VIP", COLOR_VIOLET, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(VipTag[playerid], playerid, 0.0, 0.0, 0.7);
Reply
#8

All is ok add one more time maybe you add old version of my post
Reply
#9

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
Getting a tag mismatch for these lines.
pawn Код:
VipTag[playerid] = Create3DTextLabel("VIP", COLOR_VIOLET, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(VipTag[playerid], playerid, 0.0, 0.0, 0.7);
This line
pawn Код:
VipTag[playerid] = Create3DTextLabel("VIP", COLOR_VIOLET, 30.0, 40.0, 50.0, 40.0, 0);
should be

pawn Код:
VipTag[playerid] = Create3DTextLabel("VIP", COLOR_VIOLET, 30.0, 40.0, 50.0, 40.0, 0 , 0); //or 1
https://sampwiki.blast.hk/wiki/Create3DTextLabel
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)