CMD:changename is not working
#1

@guys, There is a problem in this cmd to pawn errors its just not working as exact as I want, all I wanted is to change user udb file name I mean his acc name without removing it or changing anything in it!
my cmd:
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; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
    if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid, red, "USAGE: /changename [playerid] [new name]");
    new player1 = strval(tmp), length = strlen(tmp2), string[128], file[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(player1) && player1 != INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    if(!udb_Exists(tmp2)){
        CMDMessageToAdmins(playerid,"CHANGENAME");
        format(string, sizeof(string), "You have set \"%s's\" name to \"%s\" ", pName(player1), tmp2); SendClientMessage(playerid,blue,string);
        SetPlayerName(player1, tmp2);
        OnPlayerConnect(player1);
        SaveToFile("NAMECHANGELOG ",string);
        format(file, sizeof(file), "/ladmin/users/%s.sav",pName(player1));
        udb_UserSet(file,"%s.sav",tmp2);
    } else return SendClientMessage(playerid,red, "ERROR: That name was already taken");
    return 1;}
regards!
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: 2 Guest(s)