Changename bugged
#1

Guys i have Problem in Changename Cmd Because When i Start the Command I changename But When i go to scriptfiles to check the old Don't Name Don't Leave and a new file Create With the new name
pawn Код:
stock frename(oldname[], newname[])
{
    if (!fexist(oldname)) return 0;
    new File:oldfile = fopen(oldname, io_read);
    new File:newfile = fopen(newname, io_write);
    new line[256];
    while (fread(oldfile, line))
    {
        fwrite(newfile, line);
    }
    fclose(oldfile);
    fclose(newfile);
    fremove(oldname);
    return 1;
}
pawn Код:
if (dialogid == DIALOG_CHANGENAME)
    {
        if (!response) return 1;
        if (response)
        {
            new path[40], str[150];
            if (isnull(inputtext)) return SendClientMessage(playerid, -1, "ERROR: You have not specified any new name.");
            if (strlen(inputtext) < 3 || strlen(inputtext) > 24) return SendClientMessage(playerid, -1, "ERROR: new nick cannot be smaller than 3 or longer than 24 characters!");
            format(path, sizeof(path), "ZeroAdmin/Accounts/%s.ini", inputtext);
            if (fexist(path)) return SendClientMessage(playerid, -1, "ERROR:The name you have entered is already registered. Please enter a different name to proceed.");
            else
            frename(UserPath(playerid), path);
            SetPlayerName(playerid, inputtext);
            format(str, sizeof(str), "{F5CD1B}You have successfully changed your name to %s. Make sure you change your name on your SA-MP client.", inputtext);
            SendClientMessage(playerid, -1, str);
            return 1;
        }
    }
    return 0;
}
pawn Код:
stock UserPath(playerid)
{
    new str[128], name[MAX_PLAYER_NAME], Path[126];
    GetPlayerName(playerid, name, sizeof(name));
    format(str, sizeof(str), Path, name);
    return str;
}
+rep if you Help me
Reply


Messages In This Thread
Changename bugged - by AYOUYOU - 28.01.2015, 10:16
Re: Changename bugged - by GGW - 28.01.2015, 10:57
Re : Changename bugged - by AYOUYOU - 28.01.2015, 11:15
Re : Re: Changename bugged - by AYOUYOU - 28.01.2015, 11:26
Re : Changename bugged - by AYOUYOU - 28.01.2015, 11:30
Re : Changename bugged - by AYOUYOU - 31.01.2015, 14:58
Re: Changename bugged - by Kar - 31.01.2015, 15:21
Re : Changename bugged - by AYOUYOU - 31.01.2015, 15:29
Re: Changename bugged - by Abagail - 31.01.2015, 16:00
Re : Changename bugged - by AYOUYOU - 31.01.2015, 17:09

Forum Jump:


Users browsing this thread: 1 Guest(s)