21.03.2013, 18:26
Hello, I have a problem where my test server goes into an infinite loop! It generally happens when I /q So here is my onplayerdisconnect.
These are the functions that we're in that disconnect function:
Anything inside that will trigger a infinite loop?
Kind Regards
Oscii
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
#if defined DEBUG
printf("[debug] OnPlayerDisconnect(%i, %i)", playerid, reason);
#endif
ClearPlayerVars(playerid);
HidePlayerTextDraws(playerid);
Delete3DTextLabel(adminduty[playerid]);
//FadePlayerDisconnect(playerid);
DestroyPlayerProgressBar(playerid, WaterBar[playerid]);
DestroyPlayerProgressBar(playerid, FoodBar[playerid]);
DestroyPlayerProgressBar(playerid, SleepBar[playerid]);
if(accountInformation[playerid][sirenVeh] != -1)
{
accountInformation[playerid][sirenVeh] = -1;
DestroyObject(accountInformation[playerid][sirenObjects][0]);
DestroyObject(accountInformation[playerid][sirenObjects][1]);
}
if(accountInformation[playerid][inSDHeli] == true)
{
accountInformation[playerid][inSDHeli] = false;
for(new i = 0; i < 13; i++)
{
TextDrawHideForPlayer(playerid, Textdraw[playerid][SDHeli][i]);
}
SetCameraBehindPlayer(playerid);
DestroyObject(accountInformation[playerid][SDHeliObj]);
}
switch(reason)
{
case 0: format(Message, sizeof(Message), "{C0C0C0}[ADMIN] %s [%d] has {FFF000}disconnected{C0C0C0} from the server (Timed Out).", RemoveUnderScore(playerid), playerid);
case 1: format(Message, sizeof(Message), "{C0C0C0}[ADMIN] %s [%d] has {FFF000}disconnected{C0C0C0} from the server (Leaving).", RemoveUnderScore(playerid), playerid);
case 2: format(Message, sizeof(Message), "{C0C0C0}[ADMIN] %s [%d] has {FFF000}disconnected{C0C0C0} from the server (Kicked/Banned).", RemoveUnderScore(playerid), playerid);
}
SendToAdmins(Message, COLOR_YELLOW);
GetPlayerHealth(playerid, accountInformation[playerid][health]);
GetPlayerArmour(playerid, accountInformation[playerid][armour]);
for (new i = 0; i < 13; i++) {
GetPlayerWeaponData(playerid, i, accountInformation[playerid][weapon][i], accountInformation[playerid][ammo][i]);
}
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(systemInformation[GMX] == 0) {
saveAccount(playerid, PlayerName);
}
if(accountInformation[playerid][isRentingVeh] == 1)
{
new vid = accountInformation[playerid][rentingVehID];
new gov[100];
format(gov, sizeof(gov), "Government");
vehicleInformation[vid][vehicleOwner] = gov;
}
if(drugSystem[playerid][plantedDrugs] > 0) {
for(new i = 0; i < 6; i++) {
DestroyDynamic3DTextLabel(drugSystem[playerid][label][i]);
DestroyDynamicObject(drugSystem[playerid][object][i]);
drugSystem[playerid][plantedDrugs] = 0;
drugSystem[playerid][dPosX][i] = 0;
drugSystem[playerid][dPosY][i] = 0;
drugSystem[playerid][dPosZ][i] = 0;
drugSystem[playerid][timeStamp][i] = 0;
}
}
return 1;
}
pawn Код:
stock HidePlayerTextDraws(playerid)
{
#if defined DEBUG
printf("[debug] HidePlayerTextDraws(%i)", playerid);
#endif
TextDrawDestroy(Textdraw[playerid][vbackground]);
TextDrawDestroy(Textdraw[playerid][vseatbelt]);
TextDrawDestroy(Textdraw[playerid][vseatbeltStatus]);
TextDrawDestroy(Textdraw[playerid][vengine]);
TextDrawDestroy(Textdraw[playerid][vengineStatus]);
TextDrawDestroy(Textdraw[playerid][vlights]);
TextDrawDestroy(Textdraw[playerid][vlightsStatus]);
TextDrawDestroy(Textdraw[playerid][vspeed]);
TextDrawDestroy(Textdraw[playerid][vfuelStatus]);
TextDrawDestroy(Textdraw[playerid][Type]);
TextDrawDestroy(Textdraw[playerid][StopAnim]);
TextDrawDestroy(Textdraw[playerid][To]);
TextDrawDestroy(Textdraw[playerid][StopAnim2]);
TextDrawDestroy(Textdraw[playerid][ANPR]);
TextDrawDestroy(Textdraw[playerid][ANPRPlate]);
TextDrawDestroy(Textdraw[playerid][sFlash]);
TextDrawDestroy(Textdraw[playerid][loginBar][0]);
TextDrawDestroy(Textdraw[playerid][loginBar][1]);
TextDrawDestroy(Textdraw[playerid][WelcomeText][0]);
TextDrawDestroy(Textdraw[playerid][WelcomeText][1]);
TextDrawDestroy(Textdraw[playerid][LoginButton]);
TextDrawDestroy(Textdraw[playerid][QuitButton]);
TextDrawDestroy(Textdraw[playerid][JailText]);
TextDrawDestroy(Textdraw[playerid][JailTimeText]);
TextDrawDestroy(Textdraw[playerid][Clock][0]);
TextDrawDestroy(Textdraw[playerid][Clock][1]);
TextDrawDestroy(Textdraw[playerid][Clock][2]);
for(new i = 0; i < 13; i++)
{
TextDrawDestroy(Textdraw[playerid][SDHeli][i]);
}
}
pawn Код:
stock ClearPlayerVars(playerid)
{
#if defined DEBUG
printf("[debug] ClearPlayerVars(%i)", playerid);
#endif
loggedin[playerid] = 0;
pChances[playerid] = 0;
accountInformation[playerid][hasAccount] = 0;
accountInformation[playerid][loginCheck] = 0;
accountInformation[playerid][hasReported] = false;
accountInformation[playerid][tracker] = false;
accountInformation[playerid][requestedTaxi] = false;
accountInformation[playerid][togglePM] = false;
accountInformation[playerid][finishedTrucking] = false;
accountInformation[playerid][ownsHouse] = false;
accountInformation[playerid][insideHouse] = -1;
accountInformation[playerid][qAnsweredC] = 0;
accountInformation[playerid][inDrivingTest] = 0;
accountInformation[playerid][acceptedDeath] = 0;
accountInformation[playerid][adminDuty] = 0;
accountInformation[playerid][hasDied] = 0;
accountInformation[playerid][inSDHeli] = false;
accountInformation[playerid][SDHeliObj] = -1;
accountInformation[playerid][hasSearched] = false;
accountInformation[playerid][FadePos] = 0;
accountInformation[playerid][adminLevel] = 0;
accountInformation[playerid][editingToys] = false;
accountInformation[playerid][sirenVeh] = -1;
accountInformation[playerid][sirenIndex] = 0;
printf("Done (%s).", RemoveUnderScore(playerid));
return 1;
}
Kind Regards
Oscii