SA-MP Forums Archive
Tag's sometimes appear - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Tag's sometimes appear (/showthread.php?tid=597922)



Tag's sometimes appear - dillo1000 - 06.01.2016

Here's my the part of the script, sometimes the tag's will appear sometimes not. It's also run with the command /rpname which gives you a roleplay name as well

Thanks for any help
pawn Код:
new RPName[MAX_PLAYERS][MAX_PLAYER_NAME];

            if(strcmp(RPName[playerid],"None")!=0)
            {
                new str[128];
                format(str,sizeof(str),"%s(%i)",RPName[playerid],playerid);
                Label[playerid]=Create3DTextLabel(str,0xFFFFFFFF,0,0,0,15,0,1 );
                Attach3DTextLabelToPlayer(Label[playerid],playerid,0.0,0.0,0.2);
                for(new i=0; i < MAX_PLAYERS; i++){ShowPlayerNameTagForPlayer(i,playerid,0);}
                rname[playerid]=1;
            }

public OnPlayerStreamIn(playerid,forplayerid)
{
    if(rname[playerid]==1)
    {
        new str[128];
        Delete3DTextLabel(Label[playerid]);
        format(str,sizeof(str),"%s(%i)",RPName[playerid],playerid);
        Label[playerid]=Create3DTextLabel(str,0xFFFFFFFF,0,0,0,15,0,1 );
        Attach3DTextLabelToPlayer(Label[playerid],playerid,0.0,0.0,0.2);
        for(new i=0; i < MAX_PLAYERS; i++){ShowPlayerNameTagForPlayer(i,playerid,1);}
        ShowPlayerNameTagForPlayer(forplayerid,playerid,0);
    }
    return 1;
}


    if(rname[playerid]==1)
    {
        if(PlayerOrgType(playerid)==LAW)
        {
            if(Suited[playerid]>0)
            {
                format(str,sizeof(str),"{0000FF}Officer {FF8000}%s(%i) says: '%s'",RPName[playerid],playerid,params);
            }
            if(Suited[playerid]==0)
            {
                format(str,sizeof(str),"%s(%i) says: '%s'",RPName[playerid],playerid,params);
            }
        }
        else
        {
            format(str,sizeof(str),"%s(%i) says: '%s'",RPName[playerid],playerid,params);
        }
    }



CMD:rpname(playerid,params[])
{
    new str[128];
    if(IsJailedOrMuted(playerid))return 1;
    if(sscanf(params,"s[128]",params))
    {
        SendClientMessage(playerid,GREY,"USAGE: /rpname [Name]");
        if(strlen(params) > 24) return SendClientMessage(playerid,-1,"The name cannot contain more than 20 letters");
        format(RPName[playerid],25,"None");
        Delete3DTextLabel(Label[playerid]);
        SendClientMessage(playerid,ORANGE,"Roleplay name has been removed");
        SendClientMessage(playerid,-1,"Use /rpname [name(space allowed)] to add your roleplay name,leave [name] blank to remove it");
        for(new i=0; i < MAX_PLAYERS; i++){ShowPlayerNameTagForPlayer(i,playerid,1);}
        rname[playerid]=0;
    }
    else
    {
        if(rname[playerid]==0 ||rname[playerid]==1)
        {
            new bool:invalid=false;
            if(strfind(params,"[",true,0) !=-1|| strfind(params,"]",true,0)!=-1|| strfind(params,"_",true,0)!=-1
            || strfind(params,"!",true,0)!=-1|| strfind(params,"@",true,0)!=-1|| strfind(params,"#",true,0)!=-1
            || strfind(params,"%",true,0)!=-1|| strfind(params,"^",true,0)!=-1|| strfind(params,"&",true,0)!=-1
            || strfind(params,"*",true,0)!=-1|| strfind(params,"-",true,0)!=-1|| strfind(params,"=",true,0)!=-1
            || strfind(params,"+",true,0)!=-1|| strfind(params,"`",true,0)!=-1|| strfind(params,"~",true,0)!=-1
            || strfind(params,"'",true,0)!=-1|| strfind(params,";",true,0)!=-1|| strfind(params,":",true,0)!=-1
            || strfind(params,"(",true,0)!=-1|| strfind(params,")",true,0)!=-1|| strfind(params,"|",true,0)!=-1
            || strfind(params,"/",true,0)!=-1|| strfind(params,".",true,0)!=-1|| strfind(params,">",true,0)!=-1
            || strfind(params,"<",true,0)!=-1|| strfind(params,",",true,0)!=-1|| strfind(params,"/",true,0)!=-1)invalid=true;
            if(invalid==true)return SendClientMessage(playerid,GREY,"Your name contains invalid characters/symbols");
            Delete3DTextLabel(Label[playerid]);
            format(str,sizeof(str),"%s(%i)",params,playerid);
            Label[playerid]=Create3DTextLabel(str,0xFFFFFFFF,0,0,0,6,0,1 );
            Attach3DTextLabelToPlayer(Label[playerid],playerid,0.0,0.0,0.2);
            for(new i=0; i < MAX_PLAYERS; i++){ShowPlayerNameTagForPlayer(i,playerid,0);}
            SendClientMessage(playerid,ORANGE,"Roleplay name has been added successfully");
            format(RPName[playerid],25,"%s",params);
            rname[playerid]=1;
        }
    }
    return 1;
}

//saving and loading
    RPName[playerid]="None";
    format(RPName[playerid],25,INI_Get(Acc(playerid),"RPName"));
        INI_Set(Acc(playerid),"RPName",RPName[playerid]);