Rename
#1

Hey guyz here i have /setname cmd o rename player but it isnt working when i use it it does not load player data to new name also delete to old name file
i want to to load his admin lvl owned cars house biz to his new name

code

PHP код:
CMD:setname(playerid,params[]) {
    if(
PlayerInfo[playerid][Level] >= || IsPlayerAdmin(playerid)) {
        new 
tmp[128], tmp2[128], Indextmp strtok(params,Index), tmp2 strtok(params,Index);
        new 
playername[MAX_PLAYER_NAME];
        if(
isnull(tmp) || isnull(tmp2)) return SendClientMessage(playeridred"USAGE: /setname [playerid] [new name]");
        new 
player1 strval(tmp), length strlen(tmp2), string[128];
        if(
length || length MAX_PLAYER_NAME) return SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");
        if(
PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(
IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
                 
                new    
newname[MAX_PLAYER_NAME 10];
                
GetPlayerName(player1playernamesizeof(playername));
                
format(newnamesizeof(newname), "/ladmin/users/%s.sav"pName(player1));
            
CMDMessageToAdmins(playerid,"SETNAME");
            
format(stringsizeof(string), "You have set \"%s's\" name to \"%s\" "pName(player1), tmp2); SendClientMessage(playerid,blue,string);
            if(
player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your name to \"%s\" "pName(playerid), tmp2); SendClientMessage(player1,blue,string); }
            
PlayerInfo[playerid][God] = 0;
            
SetPlayerHealth(player1100);
            
SetPlayerName(player1tmp2);
            
SavePlayer(player1);
                 
format(newnamesizeof(newname), "/ladmin/users/%s.sav"playername);
                
fremove(newname);
                
               return 
OnPlayerConnect(player1);
        } else return 
SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return 
SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");

Reply
#2

up up up i need it too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)