setname cmd
#1

hello friends i have setname cmd but i want when player set his name remove old name dini file from users

PHP код:
CMD:setname(playerid,params[]) {
    if(
PlayerInfo[playerid][Level] >= || IsPlayerAdmin(playerid)) {
        new 
tmp[128], tmp2[128], Indextmp strtok(params,Index), tmp2 strtok(params,Index);
        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) {
            
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);
               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

Well you shouldn't remove it and make a new one that would prolong the process. Instead I prefer renaming his .ini file from his old name into his new name which your "params" in the command are specified. I can't provide you a specific code as I do not know your variables being used for the player profile.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)