27.03.2014, 09:17
Hello friends I am using y_ini and this is how i saves player's stats on player disconnect:
Can some tell me how can I create a simple /changename command for players, which checks if the name is used or not. I will be very thankful. also this is userpath
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Ban",PlayerInfo[playerid][pBan]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Talent",PlayerInfo[playerid][pTalent]);
INI_WriteInt(File,"Hitman",PlayerInfo[playerid][pHitman]);
INI_Close(File);
return 1;
}
pawn Code:
#define PATH "/Users/%s.ini"
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}