#1

If i restart the server while some players are online, their stats are fucked up on the next spawn! What could cause this?
Reply
#2

You are probably not saving player stats under the OnGameModeExit callback. You could either port all the saving information to that callback, under a loop, or have it call OnPlayerDisconnect for each connected player at the time.
pawn Код:
public OnGameModeExit( )
{
   for( new i = 0; i < MAX_PLAYERS; i++ )
   {
      if( IsPlayerConnected( i ) ) OnPlayerDisconnect( i, 2 );
   }
   return 1;
}
That is done assuming you save their stats under OnPlayerDisconnect callback.
Reply
#3

Hmm thanks i will try it out
Reply
#4

The code above won't work (no such thing as playerid stated there)

pawn Код:
public OnGameModeExit( )
{
   for( new i = 0; i < MAX_PLAYERS; i++ )
   {
      if( IsPlayerConnected( i ) ) OnPlayerDisconnect( i, 2 );
   }
   return 1;
}
However what I wrote there will most likely work. (Not tested)
Reply
#5

Quote:
Originally Posted by Bakr
Посмотреть сообщение
You are probably not saving player stats under the OnGameModeExit callback. You could either port all the saving information to that callback, under a loop, or have it call OnPlayerDisconnect for each connected player at the time.
pawn Код:
public OnGameModeExit( )
{
   for( new i = 0; i < MAX_PLAYERS; i++ )
   {
      if( IsPlayerConnected( i ) ) OnPlayerDisconnect( playerid, 2 );
   }
   return 1;
}
That is done assuming you save their stats under OnPlayerDisconnect callback.
ORly, And how would they save in scriptfiles > Users ?
Reply
#6

@Kyle_Olsen: A mere typo, no need to blow it up to such a big deal to claim your glory.

@BATAD: If you would read my original post, you just might be able to answer your own question. And one for you; how do you know where the original posters files are saved to?

I suggest people keep comments to themselves if they don't have an average IQ.
Reply
#7

Quote:
Originally Posted by Kyle_Olsen
Посмотреть сообщение
The code above won't work (no such thing as playerid stated there)

pawn Код:
public OnGameModeExit( )
{
   for( new i = 0; i < MAX_PLAYERS; i++ )
   {
      if( IsPlayerConnected( i ) ) OnPlayerDisconnect( i, 2 );
   }
   return 1;
}
However what I wrote there will most likely work. (Not tested)
You've done nothing but replace 'playerid' in Bakr's code with the 'i' variable. People do tend to make mistakes.

Nice job Bakr.

Quote:
Originally Posted by BATAD
Посмотреть сообщение
ORly, And how would they save in scriptfiles > Users ?
He is assuming that OnPlayerDisconnect is the function in which save's the player's data. This has nothing to do with what was explained.
Reply
#8

All I did was correct the mistake he did.
Just in case the guy that wanted to use it didn't see it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)