18.04.2011, 00:51
Hello, I am trying to make it save when the player quits the game, here is what I have:
Why isn't it saving the file? When I go to the scriptfiles folder, the playerfile is not there.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new playname[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid, playname, sizeof(playname));
format(string, sizeof(string), "%s.ini", playname);
if(fexist(string))
{
new playerName[MAX_PLAYER_NAME];
new userfile[128];
new Float:pHealth, Float:pArmour;
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(userfile, sizeof(userfile), "%s.ini", playerName);
new INI:file = INI_Open(userfile);
INI_SetTag(file, "Player Stats");
INI_WriteInt(file, "Level", GetPlayerScore(playerid));
INI_WriteInt(file, "Money", GetPlayerMoney(playerid));
INI_WriteInt(file, "Health", GetPlayerHealth(playerid, pHealth));
INI_WriteInt(file, "Armour", GetPlayerArmour(playerid, pArmour));
INI_WriteInt(file, "Skin", GetPlayerSkin(playerid));
INI_Close(file);
return 1;
}
return 1;
}