Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerDisconnect(playerid, reason)
- {
- //new stringa[256];
- //new string1[256];
- new asdlol;
- asdlol = GetPlayerSkin(playerid);
- PlayerInfo[playerid][pModel] = asdlol;
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- DestroyProgressBar(phealth[playerid]);
- phealth[playerid] = INVALID_BAR_ID;
- Update3DTextLabelText(NameTag[playerid], WHITE, "");
- Delete3DTextLabel(NameTag[playerid]);
- Delete3DTextLabel(PlayerLabel[playerid]);
- new disconnectstr[128];
- new string[128];
- new sendername[MAX_PLAYER_NAME];
- new caller = Mobile[playerid];
- gActivePlayers[playerid]--;
- numplayers--;
- KillTimer(RelogTimer[playerid]);
- TextDrawHideForPlayer(playerid, Website);
- TextDrawHideForPlayer(playerid, Time);
- TextDrawHideForPlayer(playerid, Date);
- 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), "Il player che ha tentato di catturare %s si è disconnesso.", PointStatistics[i][pointname]);
- SendFamilyMessageToAll(YELLOW, disconnectstr);
- capturegoingon = 0;
- break;
- }
- }
- if (GetPVarType(playerid, "pDynamicBB"))
- {
- DestroyDynamicObject(GetPVarInt(playerid, "pDynamicBB"));
- DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "pDynamicBBLabel"));
- if (GetPVarType(playerid, "pDynamicBBArea"))
- {
- format(string, sizeof(string), "Il proprietario del BoomBox (%s) è sloggato", SenderName(playerid));
- foreach(Player, i)
- {
- if (IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
- {
- StopAudioEx(i);
- SendClientMessage(i, COLOR_PURPLE, string);
- }
- }
- }
- }
- if (usingcarwash == playerid)
- {
- SetVehicleToRespawn(GetPlayerVehicleID(playerid));
- usingcarwash = -1;
- Update3DTextLabelText(entrancetext, 0x008B00FF, "Nessuno sta usando l'autolavaggio al momento.\nPrezzo: $5 (/autolavaggio)");
- }
- if (CurrentCCTV[playerid] > -1)
- {
- KillTimer(KeyTimer[playerid]);
- TextDrawHideForPlayer(playerid, TD);
- }
- CurrentCCTV[playerid] = -1;
- if (GetPVarInt(playerid, "Renting") == 1)
- IsRented[GetPVarInt(playerid, "CarRentID")] = 0,
- SetVehicleToRespawn(GetPVarInt(playerid, "CarRentID"));
- DeletePVar(playerid, "Renting");
- DeletePVar(playerid, "CarRentID");
- PlayerInfo[playerid][pAdjustable] = 1;
- //RadioChoose(playerid, 255);
- if (PlayerInfo[playerid][Robbing] == 1)
- {
- if (RobStatus[Setup] == 1 && RobStatus[BeingRobbed] == 0 && RobStatus[RobberID1] == playerid)
- {
- RobStatus[Setup] = 0;
- SendClientMessage(RobStatus[RobberID1], COLOR_WHITE, "* ** Il leader della rapina è sloggato, rapina fallita");
- SendClientMessage(RobStatus[RobberID2], COLOR_WHITE, "* ** Il leader della rapina è sloggato, rapina fallita");
- SendClientMessage(RobStatus[RobberID3], COLOR_WHITE, "* ** Il leader della rapina è sloggato, rapina fallita");
- SendClientMessage(RobStatus[RobberID4], COLOR_WHITE, "* ** Il leader della rapina è sloggato, rapina fallita");
- SendClientMessage(RobStatus[RobberID5], COLOR_WHITE, "* ** Il leader della rapina è sloggato, rapina fallita");
- RobStatus[RobberID1] = 255;
- RobStatus[RobberID2] = 255;
- RobStatus[RobberID3] = 255;
- RobStatus[RobberID4] = 255;
- RobStatus[RobberID5] = 255;
- }
- if (RobStatus[RobberID1] == playerid)
- {
- RobStatus[RobberID1] = 200;
- if (RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
- {
- RobStatus[BeingRobbed] = 0;
- RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
- RobStatus[Setup] = 0;
- SendClientMessageToAll(COLOR_LIGHTBLUE, "** La rapina in banca è finita **");
- FinishRobbery();
- }
- }
- if (RobStatus[RobberID2] == playerid)
- {
- RobStatus[RobberID2] = 200;
- if (RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
- {
- RobStatus[BeingRobbed] = 0;
- RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
- RobStatus[Setup] = 0;
- SendClientMessageToAll(COLOR_ORANGE, "** La rapina in banca è finita **");
- FinishRobbery();
- }
- }
- if (RobStatus[RobberID3] == playerid)
- {
- RobStatus[RobberID3] = 200;
- if (RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
- {
- RobStatus[BeingRobbed] = 0;
- RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
- RobStatus[Setup] = 0;
- SendClientMessageToAll(COLOR_ORANGE, "** La rapina in banca è finita **");
- FinishRobbery();
- }
- }
- if (RobStatus[RobberID4] == playerid)
- {
- RobStatus[RobberID4] = 200;
- if (RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
- {
- RobStatus[BeingRobbed] = 0;
- RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
- RobStatus[Setup] = 0;
- SendClientMessageToAll(COLOR_ORANGE, "** La rapina in banca è finita **");
- FinishRobbery();
- }
- }
- if (RobStatus[RobberID5] == playerid)
- {
- RobStatus[RobberID5] = 200;
- if (RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
- {
- RobStatus[BeingRobbed] = 0;
- RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
- RobStatus[Setup] = 0;
- SendClientMessageToAll(COLOR_ORANGE, "** La rapina in banca è finita **");
- FinishRobbery();
- }
- }
- format(string,sizeof(string),"** Sei morto, e non sei riuscito a portare a casa il bottino di $%d",PlayerInfo[playerid][CashLoaded]);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- PlayerInfo[playerid][CashLoaded] = 0;
- PlayerInfo[playerid][Robbing] = 0;
- DisablePlayerCheckpoint(playerid);
- }
- //if(HasPlantWeed[playerid] != 0) DestroyDynamicObject(Weed[playerid]);
- GetPlayerRPName(playerid, sendername, sizeof(sendername));
- switch (reason)
- {
- case 0: format(string, sizeof(string), "%s ha lasciato la città. [AFK]", sendername);
- case 1: format(string, sizeof(string), "%s ha lasciato la città.", sendername);
- case 2: format(string, sizeof(string), "%s ha lasciato la città. [Kick/Ban]", sendername);
- }
- if (PlayerInfo[playerid][pAdmin] < 2)
- {
- ProxDetector(30.0, playerid, string, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
- }
- if (PlayerTied[playerid] > 0 || PlayerCuffed[playerid] > 0 && PlayerInfo[playerid][pJailed] == 0)
- {
- PlayerInfo[playerid][pJailed] = 1; PlayerInfo[playerid][pJailTime] = 800;
- }
- OnPlayerSave(playerid);
- 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]);
- SetPlayerPos(x, PlayerInfo[x][pSPos_x], PlayerInfo[x][pSPos_y], PlayerInfo[x][pSPos_z]);
- SetPlayerFacingAngle(x, PlayerInfo[x][pSPos_r]);
- //SendClientMessage(x, COLOR_WHITE, " ù spectando.");
- TogglePlayerSpectating(x, 0);
- SpectatedID[x] = INVALID_PLAYER_ID;
- SpectateType[x] = ADMIN_SPEC_TYPE_None;
- HidePM[x] = 0;
- PhoneOnline[x] = 0;
- ResetPlayerAdminWeaponsEx(x);
- }
- x++;
- }
- ////foreach(Player, i)
- for (new i; i<MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i))
- {
- if (TaxiAccepted[i] < 999)
- {
- if (TaxiAccepted[i] == playerid)
- {
- TaxiAccepted[i] = 999;
- GameTextForPlayer(i, "~w~Il cliente~n~~r~e' sloggato", 5000, 1);
- TaxiCallTime[i] = 0;
- DisablePlayerCheckpoint(i);
- }
- }
- else if (BusAccepted[i] < 999)
- {
- if (BusAccepted[i] == playerid)
- {
- BusAccepted[i] = 999;
- GameTextForPlayer(i, "~w~Il cliente~n~~r~e' sloggato", 5000, 1);
- BusCallTime[i] = 0;
- DisablePlayerCheckpoint(i);
- }
- }
- if (GoChase[i] < 999)
- {
- if (GoChase[i] == playerid)
- {
- SendClientMessage(i, COLOR_WHITE, "* Il bersaglio è sloggato.");
- 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~Il passeggero è arrivato~n~~g~Guadagnato $%d",TransportCost[playerid]);
- GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
- }
- }
- if (BombID[playerid] != 0)
- {
- DestroyDynamicObject(BombID[playerid]);
- }
- if (PlayerPaintballing[playerid] != 0)
- {
- PaintballPlayers --;
- }
- if (caller != 255)
- {
- SendClientMessage(caller, COLOR_GRAD2, " Linea persa....");
- CellTime[caller] = 0;
- Mobile[caller] = 255;
- SetPlayerSpecialAction(caller,SPECIAL_ACTION_STOPUSECELLPHONE);
- }
- if (PlayersChannel[playerid] < 999)
- {
- IRCInfo[PlayersChannel[playerid]][iPlayers] -= 1;
- }
- if (PlayerBoxing[playerid] > 0)
- {
- if (Boxer1 == playerid)
- {
- if (IsPlayerConnected(Boxer2))
- {
- PlayerBoxing[Boxer2] = 0;
- SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
- SetPlayerInterior(Boxer2, 5);
- GameTextForPlayer(Boxer2, "~r~Match interrotto", 5000, 1);
- }
- }
- else if (Boxer2 == playerid)
- {
- if (IsPlayerConnected(Boxer1))
- {
- PlayerBoxing[Boxer1] = 0;
- SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
- SetPlayerInterior(Boxer1, 5);
- GameTextForPlayer(Boxer1, "~r~Match interrotto", 5000, 1);
- }
- }
- InRing = 0;
- RoundStarted = 0;
- Boxer1 = 255;
- Boxer2 = 255;
- TBoxer = 255;
- }
- if (TransportDuty[playerid] == 1)
- {
- TaxiDrivers -= 1;
- }
- else if (TransportDuty[playerid] == 2)
- {
- BusDrivers -= 1;
- }
- if (ThiefText[playerid] != Text3D:INVALID_3DTEXT_ID) DestroyDynamic3DTextLabel(ThiefText[playerid]);
- if (PlayerHadDeagle[playerid] == 1) PlayerInfo[playerid][pGun2] = 24;
- if (PlayerInfo[playerid][pJob] == 2)
- {
- if (JobDuty[playerid] == 1) { Lawyers -= 1; }
- }
- if (PlayerInfo[playerid][pJob] == 11)
- {
- if (JobDuty[playerid] == 1) { Medics -= 1; }
- }
- else if (PlayerInfo[playerid][pJob] == 7)
- {
- if (JobDuty[playerid] == 1) { Mechanics -= 1; }
- }
- new Float: UltimaX, Float: UltimaY, Float: UltimaZ;
- GetPlayerPos(playerid, UltimaX,UltimaY, UltimaZ);
- PlayerInfo[playerid][pUltimaX] = UltimaX;
- PlayerInfo[playerid][pUltimaY] = UltimaY;
- PlayerInfo[playerid][pUltimaZ] = UltimaZ;
- PlayerInfo[playerid][pUltimaX] = Float: UltimaX;
- PlayerInfo[playerid][pUltimaY] = Float: UltimaY;
- PlayerInfo[playerid][pUltimaZ] = Float: UltimaZ;
- printf("//Coordinate salvata %f %f %f", PlayerInfo[playerid][pUltimaX],PlayerInfo[playerid][pUltimaY],PlayerInfo[playerid][pUltimaZ]);
- OnPlayerSave(playerid);
- if (reason == 0)
- {
- format(string, sizeof(string), "%s ha lasciato la città! [Crash]", RPN(playerid));
- ProxDetector(50.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
- PlayerInfo[playerid][pCrashato] = 1;
- //OnPlayerSave(playerid);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment