cmd:changeplayername
#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


Messages In This Thread
cmd:changeplayername - by KillerStrike23 - 14.05.2014, 19:54
Re: cmd:changeplayername - by KillerStrike23 - 19.05.2014, 19:15
Re: cmd:changeplayername - by sl!x - 19.05.2014, 19:20
Re: cmd:changeplayername - by KillerStrike23 - 19.05.2014, 19:28
Re : cmd:changeplayername - by yusei - 19.05.2014, 19:31
Re: cmd:changeplayername - by KillerStrike23 - 19.05.2014, 19:49

Forum Jump:


Users browsing this thread: 2 Guest(s)