Help me.
#1

Guys, someone helped me with my 3dLabels, it works, but only for one player. (sometimes Admin or VIP)
Example: If an Admin joins first, labels will work perfectly, but the problem is this, If another Admin or VIP player joins after, these 3dLabels will not appear

I did an image about this for show you guys:
"Test" is an Admin player, He joined first and his 3dLabel works perfectly.
"Test2" is a VIP player, He joined after "Test" and his 3dLabel doesn't appear.



Help me guys, I'll rep ya
Reply
#2

Show us your coding?
Reply
#3

Quote:

new Text3D:label1[MAX_PLAYERS];
new Text3D:label2[MAX_PLAYERS];

OnplayerSpawn:
For Admins
switch(PlayerInfo[playerid][Level])
{
case 1:
{
label1[playerid] = Create3DTextLabel("(Tester)", lightblue,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label1[playerid], playerid, 0.0, 0.0, 0.4);
}
case 2:
{
label1[playerid] = Create3DTextLabel("(Co-Moderator)", lightblue,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label1[playerid], playerid, 0.0, 0.0, 0.4);
}
case 3:
{
label1[playerid] = Create3DTextLabel("(Moderator)", lightblue,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label1[playerid], playerid, 0.0, 0.0, 0.4);
}
case 4:
{
label1[playerid] = Create3DTextLabel("(Admin)", lightblue,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label1[playerid], playerid, 0.0, 0.0, 0.4);
}
case 5:
{
label1[playerid] = Create3DTextLabel("(Leader)", lightblue,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label1[playerid], playerid, 0.0, 0.0, 0.4);
}
case 6:
{
label1[playerid] = Create3DTextLabel("(Manager/CEO)", lightblue,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label1[playerid], playerid, 0.0, 0.0, 0.4);
}
}

VIPS

switch(PlayerInfo[playerid][pVip])
{
case 1:
{
label2[playerid] = Create3DTextLabel("(Bronze VIP 1)", yellow,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label2[playerid], playerid, 0.0, 0.0, 0.4);
}
case 2:
{
label2[playerid] = Create3DTextLabel("(Bronze VIP 2)", yellow,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label2[playerid], playerid, 0.0, 0.0, 0.4);
}
case 3:
{
label2[playerid] = Create3DTextLabel("(Silver VIP 1)", yellow,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label2[playerid], playerid, 0.0, 0.0, 0.4);
}
case 4:
{
label2[playerid] = Create3DTextLabel("(Silver VIP 2)", yellow,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label2[playerid], playerid, 0.0, 0.0, 0.4);
}
case 5:
{
label2[playerid] = Create3DTextLabel("(Gold VIP 5)", yellow,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label2[playerid], playerid, 0.0, 0.0, 0.4);
}
case 6:
{
label2[playerid] = Create3DTextLabel("(Premium VIP 6)", yellow,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label2[playerid], playerid, 0.0, 0.0, 0.4);
}
}

Onplayerdisconnect
if(PlayerInfo[playerid][Level] > 0) Delete3DTextLabel(label1[playerid]);
if(PlayerInfo[playerid][pVip] > 0) Delete3DTextLabel(label2[playerid]);

sure, here is
Reply
#4

This may not be it but have you tried changing the label1[playerid] to anything like label1 or label1 [max_players]??
Reply
#5

Nope
Reply
#6

I wrote you a new code. It should work, I haven't tested it yet. Let me know if it works.

PHP код:
// Make sure if you add levels change this defines and then add the respective level name into the correspond array below.
#define MAX_ADMIN_LEVELS 6
#define MAX_VIP_LEVELS 6
// This will work better instead of switching the player level/vip everytime he spawns.
new PlayerAdminLevelTagNames[MAX_ADMIN_LEVELS][] = {"Tester""(Co-Moderator)""(Moderator)""(Admin)""(Leader)""(Manager/CEO)"},
    
PlayerVIPLevelTagNames[MAX_VIP_LEVELS][] = {"(Bronze VIP 1)""(Bronze VIP 2)""(Silver VIP 1)""(Silver VIP 1)""(Gold VIP 5)""(Premium VIP 6)"},
    
Text3D:Admin_PlayerLabel[MAX_PLAYERS] = {Text3D:INVALID_3DTEXT_ID, ...},
    
Text3D:VIP_PlayerLabel[MAX_PLAYERS]= {Text3D:INVALID_3DTEXT_ID, ...}
;
public 
OnPlayerSpawn(playerid)
{
    
// If the player level is More than 0 And Less or equal to MAX_ADMIN_LEVELS and NO labels has been created for the player then..
    
if( PlayerInfo[playerid][Level] <= MAX_ADMIN_LEVELS && Admin_PlayerLabel[playerid] != Text3D:INVALID_3DTEXT_ID)
    {
        
// Create the label with the corresponding level Name from the Array / NOTE: Only players in virtual world 0 will see the label!
        
Admin_PlayerLabel[playerid] = Create3DTextLabel(PlayerAdminLevelTagNames[PlayerInfo[playerid][Level] - 1], lightblue0.00.00.040.00);
        
Attach3DTextLabelToPlayer(Admin_PlayerLabel[playerid], playerid0.00.00.4);
    }
    
// Same, but using the VIP Label (MAX_VIP_LEVELS)
    
if( PlayerInfo[playerid][pVip] <= MAX_VIP_LEVELS && VIP_PlayerLabel[playerid] != Text3D:INVALID_3DTEXT_ID)
    {
        
VIP_PlayerLabel[playerid] = Create3DTextLabel(PlayerVIPLevelTagNames[PlayerInfo[playerid][pVip] - 1], yellow0.00.00.040.00);
        
Attach3DTextLabelToPlayer(VIP_PlayerLabel[playerid], playerid0.00.00.8); // Changed the Z-offset. What if the player is also an Admin?
    
}
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
Delete3DTextLabel(Admin_PlayerLabel[playerid]);
    
Delete3DTextLabel(VIP_PlayerLabel[playerid]);
    return 
1;

I recommend you to download the Streamer by Incognito, you can create 3D Text labels easily. You have more options using a streamer, like changing the virtual world, interior, attach it directly to a player, vehicle, etc.
PHP код:
Text3D:CreateDynamic3DTextLabel(const text[], colorFloat:xFloat:yFloat:zFloat:drawdistanceattachedplayer INVALID_PLAYER_IDattachedvehicle INVALID_VEHICLE_IDtestlos 0worldid = -1interiorid = -1playerid = -1Float:streamdistance 100.0); 
Reply
#7

Hi, first of all - before asking help there are a few things you have to remember before asking for help in the future.

Your title has to be more precise.
You have to include your code in the post thread itself, instead of posting it later (to make it look cleaner).

Anyway, let's get back to your code;

No need to have two variables for labels.

Код:
new Text3D:playerLabel[MAX_PLAYERS];
Код:
if(PlayerInfo[playerid][pAdmin]) {
     switch(PlayerInfo[playerid][pAdmin) {
          case 1: ...
     }
} else if(PlayerInfo[playerid][pVIP]) {
     switch(PlayerInfo[playerid][pVIP]) {
          case 1: ...
     }
} else {
     // (Player) above his head? You don't really need this but it's your choice.
}
I hope that clears things up, if you still have questions, please PM me.
Reply
#8

Also, you shouldn't create the label multiple times.
Just create it once, and then update its text.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)