/changename command bugged! HELP!
#1

Deleted.
Reply
#2

Try to remove this:
if(AdminLevel[playerid] < 5) return SCM(playerid,COLOR_WHITE,"{FF0000}[ERROR] {FFFFFF}You don't have an appropriate administration level to use this command.");
Reply
#3

Try This (EXAMPLE ONLY) :-
pawn Код:
dcmd_changename(playerid, params[])
{
    new targetid, name[128], newname[16];
    if(AdminLevel[playerid] < 5) return SCM(playerid,COLOR_WHITE,"{FF0000}[ERROR] {FFFFFF}You don't have an appropriate administration level to use this command.");
    else if (sscanf(params,"us",targetid,name))SendClientMessage(playerid,COLOR_WHITE,""COL_ORANGE"[USAGE] {FFFFFF}/changename [PLAYER_ID] [NEW_NAME]");
    else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR] {FFFFFF}Invalid player ID.");
    elseif(dini_Exists(newname)) return SendClientMessage(playerid, COLOUR_RED, "That name has already been taken!");
    else
    {
        new string[128],n[MAX_PLAYER_NAME];
        GetPlayerName(targetid,n,sizeof(n));
        SetPlayerName(targetid,name);
        udb_RenameUser(PlayerName(targetid),name);
        if(strlen(params) >= 3)
        {
            format(file, sizeof(file), "Users/%s.txt", name); //Change "Users/" to your Users Folder Directory, Change ".txt" to your File Format.
            dini_Set(file, "%s.txt", newname); //Change ".txt" to your File Format.
            format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}You have changed %s's name to \"%s\"!",n,name);
            SendClientMessage(playerid,COLOR_WHITE,string);
            format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}Your name has been changed to %s by %s(%d)!",n,PlayerName(playerid),playerid);
            SendClientMessage(targetid,COLOR_WHITE,string);
        }
    }
    return 1;
}
Reply
#4

pawn Код:
SetPlayerName(targetid,name);
udb_RenameUser(PlayerName(targetid),name);
It sets the new name to the player and then you force it to rename the new name (PlayerName returns the new name) with the new name? It seems legit.

Either use it with the opposite way:
pawn Код:
udb_RenameUser(PlayerName(targetid),name);
SetPlayerName(targetid,name);
or use frename.
Reply
#5

Deleted.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)