Help with the /changename command
#2

Here is a tip
The idea is to just change player name..
When player disconnects, file is created automatically with all data.

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
        INI_WriteInt(File2,"Password",PlayerInfo[playerid][pPass]);
        INI_WriteString(File2,"PasswordOrig",stringpass);
        INI_WriteInt(File2,"Cash",GetPlayerMoney(playerid));
        INI_WriteInt(File2,"Admin",PlayerInfo[playerid][pAdmin]);
        INI_WriteInt(File2,"Kills",PlayerInfo[playerid][pKills]);
        INI_WriteInt(File2,"Deaths",PlayerInfo[playerid][pDeaths]);
        INI_WriteFloat(File2,"X_Coord",1683.2069); //ignore the value of the coords
        INI_WriteFloat(File2,"Y_Coord",1449.3086);
        INI_WriteFloat(File2,"Z_Coord",10.7716);
    INI_Close(File);
    return 1;
}
pawn Код:
COMMAND:setname(playerid, params[])

{   new oldname[125], newname[125], string[128];
    GetPlayerName(playerid, oldname, sizeof(oldname));
    if(sscanf(params, "s[125]", newname)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /setname [new_name]");
    format(string,sizeof(string),"\\Users\\%s.ini",newname);
    if(fexist(string)) return SendClientMessage(playerid, COLOR_YELLOW, "Account name already exists! Please choose another name!");
    else
        {
        SetPlayerName(playerid,newname);
        format(lolname,sizeof(lolname)," ~ %s has changed his account name to %s", oldname, newname);
        SendClientMessageToAll(COLOR_ORANGE,lolname);  
  }
  return 1;
}
Reply


Messages In This Thread
Help with the /changename command - by Gengar - 18.06.2012, 12:58
Re: Help with the /changename command - by [MM]RoXoR[FS] - 18.06.2012, 13:15
Re: Help with the /changename command - by ryansheilds - 18.06.2012, 13:19
Re: Help with the /changename command - by Gengar - 18.06.2012, 14:12
Re: Help with the /changename command - by rachit_rocks - 18.06.2012, 15:40

Forum Jump:


Users browsing this thread: 1 Guest(s)