12.09.2012, 11:45
I'am using a server hosting and it restart every 5 hours or It depends what you want.
How to call OnPlayerDisconnect if I do restart?
On player disconnect I found this
its really important coz it save every player stats once they leave the server. But its also important to call onplayerdisconnect it has everything.
How to call OnPlayerDisconnect if I do restart?
On player disconnect I found this
pawn Код:
SavePlayerStats(playerid);
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(MoneyTimer[playerid]);
Firedup[playerid] = 0;
if(AccInfo[playerid][LoggedIn] == 1)
SavePlayerStats(playerid);
if(udb_Exists(PlayerName2(playerid))) dUserSetINT(PlayerName2(playerid)).("Loggedin",0);
AccInfo[playerid][LoggedIn] = 0;
AccInfo[playerid][Level] = 0;
AccInfo[playerid][pVip] = 0;
AccInfo[playerid][Jailed] = 0;
AccInfo[playerid][pCaged] = 0;
AccInfo[playerid][MaxAdv] = 0;
AccInfo[playerid][Frozen] = 0;
AccInfo[playerid][Hide] = 0;
AccInfo[playerid][OnDuty] = 0;
AccInfo[playerid][pInvis] = 0;
AccInfo[playerid][pGps] = -1;
AccInfo[playerid][pSecondScore] = 0;
#if EnableTwoRcon == true
AccInfo[playerid][MaxRcon] = 0;
#endif
if(AccInfo[playerid][Jailed] == 1)
KillTimer( JailTimer[playerid] );
if(AccInfo[playerid][Frozen] == 1)
KillTimer( FreezeTimer[playerid] );
if(ServerInfo[Locked] == 1)
KillTimer( LockKickTimer[playerid] );
if(AccInfo[playerid][pCar] != -1) EraseVeh(AccInfo[playerid][pCar]);
//------------------------------------------------------------------------------
// Spectating
//------------------------------------------------------------------------------
for(new x=0; x<MAX_PLAYERS; x++)
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && AccInfo[x][SpecID] == playerid)
AdvanceSpectate(x);
//------------------------------------------------------------------------------
#if EnableCamHack == true
if(AccInfo[playerid][InCamMod] == 1)
{
KillTimer(KeyTimer[playerid]);
AccInfo[playerid][InCamMod] = 0;
}
#endif
return 1;
}