#1

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.
Reply
#2

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;
}
Reply
#3

You actually just need:
pawn Код:
public OnPlayerDeath( playerid,killerid,reason )
{
    if ( killerid != INVALID_PLAYER_ID )
    {
        PlayerInfo[killerid][pKills]++;
    }
    PlayerInfo[playerid][pDeaths]++;
    return 1;
}
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)