Help me with this command
#1

Hi, I created this command to give tags to players, When I do /givetag to player 1, it works properly, but when the player 2 gives a tag to player 1.
Player 1 tag disappear.

Here is the code:

Also when I do /givetag.
It keeps with the same text.

PHP код:
new Tagged[MAX_PLAYERS];
new 
Text3D:label;
CMD:givetag(playerid, params[])
{
    new 
targetid; new text[128]; new color[64];
    if(
sscanf(params, "us[128]s[64]",targetid, text, color)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /givetag  [ID] [Text] [Color]");
    
    if (
Tagged[targetid] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player already has a tag");
    if(
strcmp(color, "green", true) == 0)
    {
       
Create3DTextLabel(text, COLOR_GREEN, 0,0,0,70.5,1);
    
Attach3DTextLabelToPlayer(label, targetid, 0.0, 0.0, 0.45);
    
Tagged[targetid] = 1;
    }
       else if(
strcmp(color, "blue", true) == 0)
    {
       
Create3DTextLabel(text, COLOR_BLUE, 0,0,0,70.5,1);
    
Attach3DTextLabelToPlayer(label, targetid, 0.0, 0.0, 0.45);
    
Tagged[targetid] = 1;
    }
       else if(
strcmp(color, "gold", true) == 0)
    {
    
Create3DTextLabel(text, COLOR_GOLD, 0,0,0,70.5,1);
    
Attach3DTextLabelToPlayer(label, targetid, 0.0, 0.0, 0.45);
    
Tagged[targetid] = 1;
    }
       else if(
strcmp(color, "yellow", true) == 0)
    {
    
Create3DTextLabel(text, COLOR_YELLOW, 0,0,0,70.5,1);
    
Attach3DTextLabelToPlayer(label, targetid, 0.0, 0.0, 0.45);
    
Tagged[targetid] = 1;
    }
       else if(
strcmp(color, "brown", true) == 0)
    {
    
Create3DTextLabel(text, COLOR_BROWN,0,0,0,70.5,1);
    
Attach3DTextLabelToPlayer(label, targetid,0.0, 0.0, 0.45);
    
Tagged[targetid] = 1;
    }
       else if(
strcmp(color, "white", true) == 0)
    {
    
Create3DTextLabel(text, COLOR_WHITE, 0,0,0,70.5,1);
    
Attach3DTextLabelToPlayer(label, targetid,0.0, 0.0, 0.45);
    
Tagged[targetid] = 1;
    }
    return 
1;
} 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)