public OnPlayerDisconnect(playerid, reason){ specby[specto[playerid]]=-1; specto[playerid]=-1; specby[playerid]=-1; PlayersCount--; Account[playerid][pVotesForKick]=0; Account[playerid][pVotesForBan]=0; PlayerInVotekick[playerid]=false; PlayerInVoteban[playerid]=false; KillTimer(VoteKickTimer[player]); KillTimer(VoteBanTimer[player]); DestroyObject(myobject[playerid]); DestroyObject(myobject2[playerid]); DestroyObject(myobject3[playerid]); DestroyObject(myobject4[playerid]); DestroyObject(myobject5[playerid]); for(new i=0;i<MAX_SERVER_PLAYERS;i++){ MyVoteK[i][playerid]=false; MyVoteB[i][playerid]=false;} MyVoteC[playerid]=false; new stringa[128],file[256]; GetPlayerName(playerid, name, sizeof(name)); switch(reason){ case 0: format(stringa, sizeof(stringa), "* [CRASH]: %s has left the server. *", name); case 1: format(stringa, sizeof(stringa), "* [EXIT]: %s has left the server. *", name); case 2:{ if(Banned[playerid]==false){ format(stringa, sizeof(stringa), "* [KICK]: %s has been kicked. *", name);} if(Banned[playerid]==true){ format(stringa, sizeof(stringa), "* [BAN]: %s has been banned!!! *", name);}}} if(Options[ConnectMessages]==1){ SendClientMessageToAll(COLOR_GREY, stringa);} print(stringa); Banned[playerid]=false; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), UsersFile, pname); OnPlayerLogout(playerid); Account[playerid][pMuteWarnings]=0; Account[playerid][pSpamWarnings]=0; Account[playerid][pPingWarnings]=0; Account[playerid][pFloodding]=0; Account[playerid][pJailed]=false; Account[playerid][pFreezed]=false; Account[playerid][pMuted]=false; Account[playerid][pFlood]=false; Account[playerid][pVehicleLocked]=false; Account[playerid][pWarning]=0; Account[playerid][pBanWarning]=0; Account[playerid][pSkin]=0; if(Account[playerid][pLoggedin]==1){ dini_IntSet(file,"muted",0); dini_IntSet(file,"jailed",0); dini_IntSet(file,"freezed",0);} Spawned[playerid]=false; GodActive[playerid]=false; ResetPlayerWeapons(playerid); KillTimer(MuteTimer[playerid]); KillTimer(JailTimer[playerid]); return 1;}
public OnPlayerDisconnect(playerid, reason){
specby[specto[playerid]]=-1;
specto[playerid]=-1;
specby[playerid]=-1;
PlayersCount--;
Account[playerid][pVotesForKick]=0;
Account[playerid][pVotesForBan]=0;
PlayerInVotekick[playerid]=false;
PlayerInVoteban[playerid]=false;
KillTimer(VoteKickTimer[player]);
KillTimer(VoteBanTimer[player]);
DestroyObject(myobject[playerid]);
DestroyObject(myobject2[playerid]);
DestroyObject(myobject3[playerid]);
DestroyObject(myobject4[playerid]);
DestroyObject(myobject5[playerid]);
for(new i=0;i<MAX_SERVER_PLAYERS;i++){
MyVoteK[i][playerid]=false;
MyVoteB[i][playerid]=false;}
MyVoteC[playerid]=false;
new stringa[128],file[256];
GetPlayerName(playerid, name, sizeof(name));
switch(reason){
case 0: format(stringa, sizeof(stringa), "* [CRASH]: %s has left the server. *", name);
case 1: format(stringa, sizeof(stringa), "* [EXIT]: %s has left the server. *", name);
case 2:{
if(Banned[playerid]==false){
format(stringa, sizeof(stringa), "* [KICK]: %s has been kicked. *", name);}
if(Banned[playerid]==true){
format(stringa, sizeof(stringa), "* [BAN]: %s has been banned!!! *", name);}}}
if(Options[ConnectMessages]==1){
SendClientMessageToAll(COLOR_GREY, stringa);}
print(stringa);
Banned[playerid]=false;
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), UsersFile, pname);
OnPlayerLogout(playerid);
Account[playerid][pMuteWarnings]=0;
Account[playerid][pSpamWarnings]=0;
Account[playerid][pPingWarnings]=0;
Account[playerid][pFloodding]=0;
Account[playerid][pJailed]=false;
Account[playerid][pFreezed]=false;
Account[playerid][pMuted]=false;
Account[playerid][pFlood]=false;
Account[playerid][pVehicleLocked]=false;
Account[playerid][pWarning]=0;
Account[playerid][pBanWarning]=0;
Account[playerid][pSkin]=0;
if(Account[playerid][pLoggedin]==1){
dini_IntSet(file,"muted",0);
dini_IntSet(file,"jailed",0);
dini_IntSet(file,"freezed",0);}
Spawned[playerid]=false;
GodActive[playerid]=false;
ResetPlayerWeapons(playerid);
KillTimer(MuteTimer[playerid]);
KillTimer(JailTimer[playerid]);
return 1;
)
i believe the callback crashes when its get called. happened to me before.
use crashdetect plugin and compile with the more params thingy and then look on the console, you will be able to fix it |
The problem that he putted the "}" in someplace wrong anyway my code that I posted will fix that problem .
|
public OnPlayerDisconnect(playerid, reason)
{
print("[debug] OnPlayerDisconnect called!");
return 1;
}
Like Viniborn said, make a debug to make a debug print something (even random message), if it prints out in the console it means the callback is working, if it's not, the callback has causing some problems.
Here is an example of debug code PHP код:
|