SA-MP Forums Archive
/changename command bugged! HELP! - 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: /changename command bugged! HELP! (/showthread.php?tid=474510)



Deleted. - iFiras - 08.11.2013

Deleted.


Re: /changename command bugged! HELP! - Bost - 08.11.2013

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.");


Re: /changename command bugged! HELP! - SAMProductions - 08.11.2013

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;
}



Re: /changename command bugged! HELP! - Konstantinos - 08.11.2013

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.


Deleted. - iFiras - 19.12.2013

Deleted.