03.08.2011, 19:15
It's because you save it in OnPlayerDisconnect, and you can't save it on timeout/disconnect. Try to leave the server, and join back in, your score will probably be the same from when you left.
Anyways, here's a DINI version, which I wouldn't recommend:
Anyways, here's a DINI version, which I wouldn't recommend:
pawn Код:
//saving:
new
file[ 128 ]
,pName[ 24 ]
;
GetPlayerName( playerid, pName, 24 );
format( file, sizeof file, "%sscr.txt", pName );
if( !dini_Exists( file ) ) {
dini_Create( file );
}
dini_IntSet( file, "score", GetPlayerScore( playerid ) );
//loading:
new
file[ 128 ]
,pName[ 24 ]
;
GetPlayerName( playerid, pName, 24 );
format( file, sizeof file, "%sscr.txt", pName );
if( dini_Exists( file ) ) {
SetPlayerScore( playerid, dini_Int( file, "score" ) );
}