Change Name Cmd
#8

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]"oldnamenewname)) return SendClientMessage(playerid,Yellow"Correct Usage: /renameaccount [OldName][New name]");
    new 
filestring[128];
    new 
filestring2[128];
    
format(filestring2sizeof(filestring2), "/Users/%s.ini"oldname);
    if(!
fexist(filestring2)) return SendClientMessage(playeridYellow"That account name doesn't exist!");
    
format(filestringsizeof(filestring), "/Users/%s.ini"newname);
    if(
fexist(filestring)) return SendClientMessage(playeridYellow"The new name you've chosen is already taken");
    
frename(filestring2filestring);
    new 
INI:File INI_Open(filestring);
    
INI_SetTag(File"data");
    
INI_WriteString(File,"Name"newname);
    
INI_Close(File);
    
format(stringsizeof(string), "You have successfully renamed %s's account to %s" ,oldnamenewname);
    
SendClientMessage(playeridLimestring);
    return 
1;

Reply


Messages In This Thread
Change Name Cmd - by Blackazur - 16.10.2012, 19:10
Re: Change Name Cmd - by Shockey HD - 16.10.2012, 20:12
AW: Change Name Cmd - by Blackazur - 17.10.2012, 15:39
Re: Change Name Cmd - by Anthony © - 17.10.2012, 16:28
AW: Change Name Cmd - by Blackazur - 17.10.2012, 20:09
Re : Change Name Cmd - by yusei - 17.10.2012, 20:33
AW: Change Name Cmd - by Blackazur - 18.10.2012, 13:47
Re: Change Name Cmd - by gtakillerIV - 18.10.2012, 14:02
Re: Change Name Cmd - by Jarnu - 18.10.2012, 14:10
AW: Re: Change Name Cmd - by Blackazur - 18.10.2012, 17:37

Forum Jump:


Users browsing this thread: 1 Guest(s)