Problem with /changename command
#1

guys i made a command for change player name in game so i want if player is not a clan member and if do /changename [EmR]XYZ then show a message like you cant use tag choose another name without tag and if player is in clan then change with [EmR] tag i made but if player not in clan the showing correct message but when i set my self as clan member then showing the error you cant use tag here is the code

pawn Код:
CMD:changename(playerid, params[])
{
    new name[MAX_PLAYER_NAME], newname[16], file[128], smthng[128], msg[128],PlayerFile[50];
    GetPlayerName(playerid, name, sizeof(name));
    if(sscanf(params,"s", newname)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /changename [new name]");
    format(PlayerFile, sizeof(PlayerFile), "Saves/%s.ini", newname);
    if(strfind(newname,"[EmR]",true) != -1)
    {
     if(dini_Int(PlayerFile,"Clan")==0) return SendClientMessage(playerid, COLOR_GREY, "You can't use tag till accept from admin!");
    }
    if(dini_Exists(PlayerFile))return SendClientMessage(playerid, -1, "That name is currently unavailable!");
    if(NameLimit[playerid]==2)return SendClientMessage(playerid, COLOR_BROWN1, "You can't change your name again! Reconnect in order to change your name again.");
    if(strcmp(name, newname, true)==0)return SendClientMessage(playerid, -1, "That name is currently unavailable!");
    if(strlen(params) >= 3)
    {
        format(file, sizeof(file), "Saves/%s.ini", name);
        format(smthng, sizeof(smthng), "Saves/%s.ini", newname);
        if (IsLeader(playerid))
        {
        NRemOLead(playerid);
        }
        else
        {
        RemNMem(playerid);
        }
        SetPlayerName(playerid,newname);
        if (IsLeader(playerid))
        {
         for (new i=1;i<OrgsCount+1;i++)
         {
            SetOLead(playerid);
            PlayerLeader[playerid] = 1;
            PlayerRank[playerid]=5;
            Organization[i][Leader] = PlayerName(playerid);
            SaveLeaders();
            SavePlayerOrgInfo(playerid);
         }
       
        }
        else
        {
        SetOMem(playerid);
        }
        frenametextfile(file, smthng);
        format(msg, sizeof(msg), "'%s' has changed his account name to '%s'", name, newname);
        SendClientMessageToAll(COLOR_YELLOW, msg);
        NameLimit[playerid] = NameLimit[playerid]+1;
        if(NameLimit[playerid] >=2)
        {
         SendClientMessage(playerid, COLOR_BROWN1, "You have reached changelimit.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "That name is too short, pick something else!");
    }
    return 1;
}
can anyone have solution of this problem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)