Y_INI issue.
#1

Код:
CMD:changename(playerid,params[])
{
    new oldname[128], newname[128], string[90];
    if(sscanf(params,"s[128]s[128]", oldname, newname)) return SendClientMessage(playerid,COLOR_GREEN, "Correct Usage: /renameaccount [OldName][New name]");
    new filestring[128];
    new filestring2[128];
    format(filestring2, sizeof(filestring2), "/Users/%s.ini", oldname);
    if(!fexist(filestring2)) return SendClientMessage(playerid, COLOR_GREEN, "That account name doesn't exist!");
    format(filestring, sizeof(filestring), "/Users/%s.ini", newname);
    if(fexist(filestring)) return SendClientMessage(playerid, COLOR_GREEN, "The new name you've chosen is already taken");
    frename(filestring2, filestring);
    new INI:File = INI_Open(filestring);
    INI_SetTag(File, "data");
    INI_WriteString(File,"Name", newname);
    INI_Close(File);
    format(string, sizeof(string), "You have successfully renamed %s's account to %s" ,oldname, newname);
    SendClientMessage(playerid, COLOR_GREEN, string);
    return 1;
}

CMD works but it create a new user and I just want it to rename the account hes on now not keep this account and make a new one so you got to relog and then use the other one..
Reply


Messages In This Thread
Y_INI issue. - by alexanderjb918 - 24.10.2015, 09:16
Re: Y_INI issue. - by Dusan01 - 24.10.2015, 09:20
Re : Y_INI issue. - by alexanderjb918 - 24.10.2015, 10:48
Re: Y_INI issue. - by Dusan01 - 24.10.2015, 13:18
Re : Y_INI issue. - by alexanderjb918 - 24.10.2015, 14:09

Forum Jump:


Users browsing this thread: 1 Guest(s)