CMD:changename is not working
#2

try this...

but this script is untested yet...

pawn Код:
CMD:changename(playerid,params[]) {
    if(PlayerInfo[playerid][Level] <= 5 || IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    new tmp[128], tmp2[128], Index;
    if(sscanf(params,"is[128]",tmp,tmp2)) return SendClientMessage(playerid, red, "USAGE: /changename [playerid] [new name]");
    new length = strlen(tmp2), string[128], file[256], file2[256];
    if(length < 3 || 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(tmp) || tmp != INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    format(file, sizeof(file), "/ladmin/users/%s.sav",pName(tmp));
    format(file2, sizeof(file2), "/ladmin/users/%s.sav",pName(tmp2));
    if(!udb_Exists(file2)){
        CMDMessageToAdmins(playerid,"CHANGENAME");
        format(string, sizeof(string), "You have set \"%s's\" name to \"%s\" ", pName(tmp), tmp2); SendClientMessage(playerid,blue,string);
        SetPlayerName(tmp, tmp2);
        OnPlayerConnect(tmp);
        SaveToFile("NAMECHANGELOG ",string);
        udb_UserSet(file,"%s.sav",tmp2);
    } else return SendClientMessage(playerid,red, "ERROR: That name was already taken");
    return 1;
}
Reply


Messages In This Thread
CMD:changename is not working - by KillerStrike23 - 15.05.2014, 12:39
Re: CMD:changename is not working - by AiRaLoKa - 15.05.2014, 12:52
Re: CMD:changename is not working - by biker122 - 15.05.2014, 14:01
Re: CMD:changename is not working - by KillerStrike23 - 15.05.2014, 17:09
Re: CMD:changename is not working - by KillerStrike23 - 16.05.2014, 07:45
Re: CMD:changename is not working - by KillerStrike23 - 16.05.2014, 09:28
Re: CMD:changename is not working - by KillerStrike23 - 16.05.2014, 13:12
Re : CMD:changename is not working - by Ramoboss - 16.05.2014, 14:06

Forum Jump:


Users browsing this thread: 1 Guest(s)