yINI - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: yINI (
/showthread.php?tid=293994)
yINI -
moadi - 30.10.2011
Hello,
I'm having some problem with my file system, actually everything is working fine except for this:
pawn Код:
public OnPlayerDeath(playerid,killerid,reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Kills",PlayerInfo[killerid][pKills]++);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]++);
INI_Close(File);
return 1;
}
When the function is called it never stores the kills and deaths or any other thing...
Does anyone know what's the problem?
Thanks.
Re: yINI -
SmiT - 30.10.2011
Try:
pawn Код:
public OnPlayerDeath( playerid,killerid,reason )
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
if ( killerid != INVALID_PLAYER_ID )
{
INI_WriteInt(File,"Kills",PlayerInfo[killerid][pKills]++);
}
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]++);
INI_Close(File);
return 1;
}
Re: yINI -
Wesley221 - 30.10.2011
You actually just need:
pawn Код:
public OnPlayerDeath( playerid,killerid,reason )
{
if ( killerid != INVALID_PLAYER_ID )
{
PlayerInfo[killerid][pKills]++;
}
PlayerInfo[playerid][pDeaths]++;
return 1;
}
Re: yINI -
moadi - 30.10.2011
Quote:
Originally Posted by SmiT
Try:
pawn Код:
public OnPlayerDeath( playerid,killerid,reason ) { new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); if ( killerid != INVALID_PLAYER_ID ) { INI_WriteInt(File,"Kills",PlayerInfo[killerid][pKills]++); } INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]++); INI_Close(File); return 1; }
|
Thanks

+1 rep for the helpful post.