Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerDisconnect(playerid, reason)
- {
- UnrentVehicle(playerid);
- if (RobbingHouse[playerid])
- {
- KillTimer(RobTimer[playerid]);
- }
- if (PlayerInfo[playerid][pInjured])
- {
- PlayerInfo[playerid][pHospital] = 1;
- }
- if (GetPVarInt(playerid, "Digging"))
- {
- KillTimer(GetPVarInt(playerid, "DiggingTimer"));
- DeletePVar(playerid, "Digging");
- DeletePVar(playerid, "DiggingStage");
- }
- if (PlayerWeapons[playerid][pAssembleGun] > 0)
- {
- KillTimer(PlayerWeapons[playerid][pAssembleTimer]);
- KillTimer(PlayerWeapons[playerid][pAssembleStage]);
- }
- PlayerTextDrawDestroy(playerid, FuelTextDraw[playerid]);
- for (new i = 0; i < 60; i ++)
- {
- PlayerTextDrawDestroy(playerid, StatsTextdraws[playerid][i]);
- }
- new disconnectstr[128];
- DeletePVar(playerid, "InShamal");
- KillTimer(LockPickTimer[playerid]);
- KillTimer(ColorTimer[playerid]);
- #if defined NPC_KILLABLE
- KillTimer(NPCKillTimer[playerid]);
- #endif
- KillTimer(RelogTimer[playerid]);
- KillTimer(iPodLoadTimer[playerid]);
- SetPlayerPos(playerid, FlightPosition[playerid][0], FlightPosition[playerid][1], FlightPosition[playerid][2]);
- for(new i = 1; i < MAX_POINTS; i++)
- {
- if(PointAttemptingToCapture[playerid] == i)
- {
- Capturing[playerid][i] = 0;
- PointAttemptingToCapture[playerid] = 0;
- KillTimer(pointtimer);
- format(disconnectstr, sizeof(disconnectstr), "The player that recently attempted to capture %s has disconnected.", PointStatistics[i][pointname]);
- SendFamilyMessageToAll(YELLOW, disconnectstr);
- capturegoingon = 0;
- break;
- }
- }
- KillTimer(LoseHealthTimer[playerid]);
- if(PlayerPaintballing[playerid] > 0 || IsAtEvent[playerid])
- {
- IsAtEvent[playerid] = 0;
- ResetPlayerAdminWeaponsEx(playerid);
- SetPlayerWeapons(playerid);
- PlayerInfo[playerid][pHealth] = HealthBeforeEnter[playerid];
- PlayerInfo[playerid][pArmor] = ArmorBeforeEnter[playerid];
- PlayerInfo[playerid][pInt] = OldInt[playerid];
- PlayerInfo[playerid][pSPos_x] = OldX[playerid];
- PlayerInfo[playerid][pSPos_y] = OldY[playerid];
- PlayerInfo[playerid][pSPos_z] = OldZ[playerid];
- for (new i = 0; i < 13; i ++)
- {
- PlayerInfo[playerid][pGuns][i] = TempWeapons[playerid][i];
- PlayerInfo[playerid][pAmmo][i] = TempAmmo[playerid][i];
- }
- SetPlayerPosEx(playerid, OldX[playerid], OldY[playerid], OldZ[playerid]);
- SetPlayerInterior(playerid, OldInt[playerid]);
- SetPlayerVirtualWorld(playerid, OldVw[playerid]);
- SetPlayerHealth(playerid, HealthBeforeEnter[playerid]);
- SetPlayerArmour(playerid, ArmorBeforeEnter[playerid]);
- if(PlayerPaintballing[playerid] > 0) PaintballPlayers--;
- }
- if(Relogging[playerid])
- {
- new string[128];
- Relogging[playerid] = 0;
- format(string, sizeof(string), "unbanip %s", PlayerIP[playerid]);
- SendRconCommand(string);
- SendRconCommand("reloadbans");
- return 1;
- }
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(BankAccount[i] == playerid)
- {
- ShowPlayerDialog(i, 1336, DIALOG_STYLE_MSGBOX, "Error", "(( The owner of this bank account has just signed off, you may not use it anymore. ))", "Close", "");
- BankAccount[i] = -1;
- }
- if(ATMAccount[i] == playerid)
- {
- ShowPlayerDialog(i, 1336, DIALOG_STYLE_MSGBOX, "Error", "(( The owner of this ATM account has just signed off, you may not use it anymore. ))", "Close", "");
- ATMAccount[i] = -1;
- }
- }
- KillTimer(dragtimer[playerid]);
- PlayerBeingDragged[playerid] = 0;
- KillTimer(PlayerInfo[playerid][pMoveTimer]);
- planted[playerid] = 0;
- bomb[playerid] = 0;
- bombx[playerid] = 0;
- bomby[playerid] = 0;
- bombz[playerid] = 0;
- DestroyDynamicObject(bombobj[playerid]);
- KillTimer(bombtimer[playerid]);
- if(godmode[playerid])
- {
- SetPlayerHealth(playerid, storehealth[playerid]);
- PlayerInfo[playerid][pHealth] = storehealth[playerid];
- }
- new string[128];
- new discstring[128];
- new sendername[MAX_PLAYER_NAME];
- new caller = Mobile[playerid];
- GetPlayerName(playerid, sendername, sizeof(sendername));
- switch(reason)
- {
- case 0: format(discstring, sizeof(discstring), "** %s has left the server. (Timeout)", sendername);
- case 1: format(discstring, sizeof(discstring), "** %s has left the server. (Leaving)", sendername);
- case 2: format(discstring, sizeof(discstring), "** %s has left the server. (Kicked)", sendername);
- }
- if (!IsPlayerNPC(playerid))
- {
- if (!restart && ConnectMessages)
- {
- SendAdminMessage(GREY, discstring);
- }
- }
- if(PlayerInfo[playerid][pCash] <= 500 && PlayerInfo[playerid][pBankMoney] <= 500 && PlayerInfo[playerid][pLevel] <= 2 && gPlayerLogged[playerid])
- {
- if(strlen(LastPaid[playerid]))
- {
- new ip[20];
- GetPlayerIp(playerid, ip, sizeof(ip));
- format(string, sizeof(string), "Possible Moneyfarm: %s (IP: %s) just left with $%d cash and $%d cash in bank.",PlayerName(playerid),ip, PlayerInfo[playerid][pCash], PlayerInfo[playerid][pBankMoney]);
- PayLog(string);
- ABroadCast(YELLOW,string,1);
- new paidto[128];
- format(paidto,sizeof(paidto),"- Last paid money to: %s (IP: %s)",LastPaid[playerid], ip);
- ABroadCast(YELLOW,paidto,1);
- }
- }
- if(PlayerTied[playerid] > 0 || PlayerCuffed[playerid] > 0 && PlayerInfo[playerid][pJailed] == 0)
- {
- PlayerInfo[playerid][pJailed] = 1; PlayerInfo[playerid][pJailTime] = 800;
- }
- if(GuardedBy[playerid] != 999)
- {
- SendClientMessage(GuardedBy[playerid], RED, "* Your client has disconnected from the server.");
- SetPlayerToTeamColor(GuardedBy[playerid]);
- SetPlayerToTeamColor(playerid);
- GuardedBy[GuardedBy[playerid]] = 999;
- GuardingPrice[GuardedBy[playerid]] = 0;
- Guarding[playerid] = 999;
- }
- if(Guarding[playerid] != 999)
- {
- SendClientMessage(Guarding[playerid], RED, "* Your bodyguard has disconnected from the server.");
- PlayerInfo[playerid][pBankMoney] -= (GuardingPrice[Guarding[playerid]] * 2);
- SetPlayerToTeamColor(Guarding[playerid]);
- SetPlayerToTeamColor(playerid);
- GuardedBy[Guarding[playerid]] = 999;
- GuardingPrice[Guarding[playerid]] = 0;
- Guarding[playerid] = 999;
- }
- new x = 0;
- while(x != MAX_PLAYERS)
- {
- if(IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING && SpectatedID[x] == playerid)
- {
- SetPlayerHealth(x, PlayerInfo[x][pHealth]);
- SetPlayerArmour(x, PlayerInfo[x][pArmor]);
- SetPlayerVirtualWorld(x, PlayerInfo[x][pVirtualWorld]);
- SetPlayerInterior(x, PlayerInfo[x][pInt]);
- SetPlayerPosEx(x, PlayerInfo[x][pSPos_x], PlayerInfo[x][pSPos_y], PlayerInfo[x][pSPos_z]);
- SetPlayerFacingAngle(x, PlayerInfo[x][pSPos_r]);
- SendClientMessage(x, WHITE, "You are no longer spectating.");
- TogglePlayerSpectating(x, 0);
- SpectatedID[x] = INVALID_PLAYER_ID;
- SpectateType[x] = ADMIN_SPEC_TYPE_NONE;
- HidePM[x] = 0;
- PhoneOffline[x] = 0;
- ResetPlayerAdminWeaponsEx(x);
- }
- //everything below fixes bugs with player id 0 getting random offers accepted
- if(RepairOffer[x] == playerid) { RepairOffer[x] = 999; RepairPrice[x] = 0; }
- if(WeedOffer[x] == playerid) { WeedOffer[x] = 999; WeedPrice[x] = 0; WeedGram[x] = 0; }
- if(ProdOffer[x] == playerid) { ProdOffer[x] = 999; ProdPrice[x] = 0; ProdAmount[x] = 0; }
- if(CocaineOffer[x] == playerid) { CocaineOffer[x] = 999; CocainePrice[x] = 0; CocaineGram[x] = 0; }
- if(VestOffer[x] == playerid) { VestOffer[x] = 999; VestPrice[x] = 0; }
- if(GuardOffer[x] == playerid) { GuardOffer[x] = 999; GuardPrice[x] = 0; }
- if(GetPVarInt(x, "CarOfferer") == playerid) { SetPVarInt(x, "CarOfferer", -1); DeletePVar(x, "CarToBuy"); DeletePVar(x, "CarSlot"); DeletePVar(x, "CarValue"); }
- if(GetPVarInt(x, "OfferedVIP") == playerid) { SetPVarInt(x, "OfferedVIP", INVALID_PLAYER_ID); DeletePVar(x, "OfferedPrice"); }
- x++;
- }
- if(BankJobPlayer == playerid)
- {
- format(string, 256, "City Alert: The Bank Robbery attempt has failed.");
- StopPlayerHoldingObject(playerid);
- SendClientMessageToAll(LIGHTBLUE, string);
- BankJobPlayer = 999;
- TimeAfterBankJob = 0;
- BankJobTime = -1;
- BankDeliverTime = -1;
- }
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(TaxiAccepted[i] < 999)
- {
- if(TaxiAccepted[i] == playerid) { TaxiAccepted[i] = 999; GameTextForPlayer(i, "~w~Taxi Caller~n~~r~Left the game", 5000, 1); TaxiCallTime[i] = 0; DisablePlayerCheckpoint(i); }
- }
- else if(BusAccepted[i] < 999)
- {
- if(BusAccepted[i] == playerid) { BusAccepted[i] = 999; GameTextForPlayer(i, "~w~Bus Caller~n~~r~Left the game", 5000, 1); BusCallTime[i] = 0; DisablePlayerCheckpoint(i); }
- }
- if(GoChase[i] < 999)
- {
- if(GoChase[i] == playerid) { SendClientMessage(i, YELLOW, "The target has left the server."); GoChase[i] = 999; }
- }
- }
- }
- if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
- {
- if(IsPlayerConnected(TransportDriver[playerid]))
- {
- TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
- TransportTime[TransportDriver[playerid]] = 0;
- TransportCost[TransportDriver[playerid]] = 0;
- format(string, sizeof(string), "~w~Passenger left~n~~g~Earned $%d",TransportCost[playerid]);
- GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
- }
- }
- if(BombID[playerid] != -1) TakeWeapon(playerid,40); PlayerInfo[playerid][pGuns][12] = 0; DestroyDynamicObject(BombID[playerid]);
- if(PlayerPaintballing[playerid] != 0) PaintballPlayers --;
- if(caller != 999)
- {
- SendClientMessage(caller, GREY2, "The line has been disconnected....");
- CellTime[caller] = 0;
- Mobile[caller] = 999;
- SetPlayerSpecialAction(caller,SPECIAL_ACTION_STOPUSECELLPHONE);
- }
- if(TransportDuty[playerid] == 1) TaxiDrivers -= 1;
- else if(TransportDuty[playerid] == 2) BusDrivers -= 1;
- if(PlayerHadDeagle[playerid] == 1) PlayerInfo[playerid][pGuns][2] = 24;
- if(ThiefText[playerid] != Text3D:INVALID_3DTEXT_ID) DestroyDynamic3DTextLabel(ThiefText[playerid]);
- if(PlayerHasTazer[playerid]) RemovePlayerAttachedObject(playerid,0);
- SetPVarInt(playerid, "laser", 0);
- RemovePlayerAttachedObject(playerid, 0);
- SavePlayer(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement