Saving stats on exit...
#1

I use Xtreme Admin but I don't know how to save the stats on disconnect. Here is the File Variable:

pawn Код:
Variables[playerid][Kills] = GetPlayerFileVar(playerid,"Kills");
Variables[playerid][Deaths] = GetPlayerFileVar(playerid,"Deaths");
Reply
#2

Can't you just add those lines on playerdisconnect?
Reply
#3

Seriously, is that all I have to do?
Reply
#4

Quote:
Originally Posted by Tigerbeast11
Посмотреть сообщение
Seriously, is that all I have to do?
Yep, Lol
Reply
#5

It didn't work... I changed the .ini files to make me have 20 deaths. Then I went in game and killed myself twice. I left the game and when I came back, it still said 20 deaths..
Reply
#6

You are loading the variables with that code, not saving them. How does your script save the data to the files originally?
Reply
#7

I think this is what you mean?
pawn Код:
SetUserInt(playerid,"Registered",1);
                SetUserInt(playerid,"LoggedIn",1);
If it isn't, you can check it yourself. I am using Xtreme Admin. Here is the link:
https://sampforum.blast.hk/showthread.php?tid=286
Reply
#8

Quote:
Originally Posted by Tigerbeast11
Посмотреть сообщение
I think this is what you mean?
pawn Код:
SetUserInt(playerid,"Registered",1);
                SetUserInt(playerid,"LoggedIn",1);
If it isn't, you can check it yourself. I am using Xtreme Admin. Here is the link:
https://sampforum.blast.hk/showthread.php?tid=286
What he meant is, the kills and death times you want should save in the .ini, and you didn't set it up.
Reply
#9

I don't know how to save it though; that's why im asking...

under OnPlayerDeath:
pawn Код:
Variables[playerid][Deaths]++;
Variables[killerid][Kills]++;
But I don't really have a way of saving them...
Reply
#10

I realized XAdmin uses DINI
then

pawn Код:
public OnPlayerConnect( playerid )
{
    Variables[ playerid ][ Kills ] = dini_Int( GetPlayerFile( playerid ), "Kills" );
    Variables[ playerid ][ Deaths ] = dini_Int( GetPlayerFile( playerid ), "Deaths" );

    return 1;
}

public OnPlayerDisconnect( playerid, reason )
{
    dini_IntSet( GetPlayerFile( playerid ), "Kills", Variables[ playerid ][ Kills ] );
    dini_IntSet( GetPlayerFile( playerid ), "Deaths", Variables[ playerid ][ Deaths ] );

    return 1;
}
P.S: GetPlayerFile is defined in XAdmin include.
Reply
#11

It works! Thanks man! +Rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)