cmd:changeplayername
#1

@sup,
Can anyone teach me how to create a cmd that allow admins to change players acc name but without deleting his old acc file or remove anyting of it, am using dini files. I have a problem that when player wanted to change his name he need to call admins and sell all of his stuff and relog bla bla..... a deep shit so help!
Thanks in advanced/ Dudb k! Bump)
Reply
#2

Bump*
Reply
#3

try this i just took it from my script but it should work
PHP код:
if(strcmp(cmd"/changename"true) == 0)
    {
        
GetPlayerName(playeridsendernamesizeof(sendername));
        new 
tmpp[256];
        
tmpp strtok(cmdtextidx);
        if(!
strlen(tmpp))
        {
            
SendClientMessage(playeridCOLOR_DBLUE"Correct SYNTAX: /changename [playerid] [new nick]");
            return 
1;
        }
        
giveplayerid strval(tmpp);
        
tmp strtok(cmdtextidx);
        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
        
GetPlayerName(playeridsendernamesizeof(sendername));
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pAdmin] >= 1337)
            {
                if(
IsPlayerConnected(giveplayerid))
                {
                    
SetPlayerName(giveplayeridtmp);
                    
format(stringsizeof(string), "AdmCMD: %s(%i) you changed the name to %s"sendernameplayeridtmp);
                    
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                    
format(stringsizeof(string), "("COL_RED"C.Life{FFFFFF}!) You have changed ID %i's name to %s"giveplayeridtmp);
                    
SendClientMessage(playeridCOLOR_WHITEstring);
                    
format(string256"("COL_RED"C.Life{FFFFFF}!) "COL_RED"%s {FFFFFF}je promjenuo ime "COL_RED"%s{FFFFFF}-a u "COL_RED"%s."sendername,giveplayertmp);
                    
ABroadCast(WHITE,string,1);
                }
                else
                {
                    
format(stringsizeof(string), "%d nije aktivan igrac."giveplayerid);
                    
SendClientMessage(playeridCOLOR_REDstring);
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_RED"Nemate dozovolu za koristenje te komande!");
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_RED"Morate se prijaviti da biste koristili tu komandu!");
        }
          return 
1;
    } 
Reply
#4

dude, it don't change player acc name it just set its name I need to change account name and I had already tried that code its not your script.
Reply
#5

PHP код:
CMD:changename(playeridparams[])
{
    new 
idnewname[MAX_PLAYER_NAME];
    if(
sscanf(params"us[24]"idnewname)) return SendClientMessage(playerid, -1"USAGE: /changename [playerid] [new name]");
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"You are not admin!"); //Change it to your admin enum or whatever
    
if(IsPlayerConnected(id))
    {
        new 
pname[MAX_PLAYER_NAME];
        
GetPlayerName(idpnameMAX_PLAYER_NAME);
        if(
strcmp(pnamenewname))
        {
            
SetPlayerName(idnewname);
            new 
string[64];
            
format(stringsizeof(string), "users/%s.ini"pname); // Your user data folder
            
fremove(string);
            
//Then re-save the player
        
}
        else return 
SendClientMessage(playerid, -1"Oldname & Newname cannot same!");
    }
    else return 
SendClientMessage(playerid, -1"Player not connected!");
        return 
1;

Reply
#6

dude? a question do that change the user name without deleting its acc or it delet its acc and create a new one ? !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)