18.10.2012, 14:02
Here is my command with YINI, take it as an example.
PHP Code:
CMD:renameaccount(playerid,params[])
{
new oldname[128], newname[128], string[90];
if(sscanf(params,"s[128]s[128]", oldname, newname)) return SendClientMessage(playerid,Yellow, "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, Yellow, "That account name doesn't exist!");
format(filestring, sizeof(filestring), "/Users/%s.ini", newname);
if(fexist(filestring)) return SendClientMessage(playerid, Yellow, "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, Lime, string);
return 1;
}

