Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerDisconnect(playerid, reason)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- if(!strcmp(name, "InvalidNick", true)) return 1;
- if(!strcmp(name, "BannedPlayer", true)) return 1;
- if(playerid == MAX_PLAYERS) return 1;
- PlayersConnected--;
- if(PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDuty] == 1|| PlayerInfo[playerid][pLeader] == 4 && PlayerInfo[playerid][pDuty] == 1)
- {
- Medics -= 1;
- }
- if(pDragging[playerid] != -1)
- {
- TogglePlayerControllable(pDragging[playerid], 1);
- KillTimer(pDragTimer[playerid]);
- pDrag[pDragging[playerid]] = -1;
- pDragging[playerid] = -1;
- }
- if(broadcasting-2 == playerid)
- {
- broadcasting = 0;
- UpdateSANewsBroadcast();
- DestroyDynamic3DTextLabel(camera);
- new string[128];
- foreach(Player, i)
- {
- if(WatchingTV[i] == 1)
- {
- WatchingTV[i] = 0;
- viewers--;
- UpdateSANewsBroadcast();
- format(string, sizeof(string), "* %s stops watching TV", GetPlayerNameEx(i));
- SendClientMessage(i, COLOR_GREY, string);
- TogglePlayerSpectating(i, false);
- SetCameraBehindPlayer(i);
- SetPlayerVirtualWorld(i, BroadcastLastVW[i]);
- ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SetPlayerPos(i,BroadcastFloats[i][1],BroadcastFloats[i][2],BroadcastFloats[i][3]);
- PlayerInfo[i][pVW] = BroadcastLastVW[i];
- SetPlayerInterior(i, BroadcastLastInt[i]);
- PlayerInfo[i][pInt] = BroadcastLastInt[i];
- return 1;
- }
- }
- }
- TextDrawHideForPlayer(playerid,blind);
- if(pDrag[playerid] != -1)
- {
- TogglePlayerControllable(playerid, 1);
- KillTimer(pDragTimer[pDrag[playerid]]);
- pDragging[pDrag[playerid]] = -1;
- pDrag[playerid] = -1;
- }
- if(PlayerInfo[playerid][pWExists] == 1)
- {
- WeedLogout(playerid);
- }
- if(pTazer[playerid] == 1) GivePlayerValidWeapon(playerid,pTazerReplace[playerid],60000);
- if(GetPVarInt(playerid, "SpeedRadar") == 1) GivePlayerValidWeapon(playerid, GetPVarInt(playerid, "RadarReplacement"), 60000);
- if(GetPVarInt(playerid, "MovingStretcher") != -1)
- {
- KillTimer(GetPVarInt(playerid, "TickEMSMove"));
- DeletePVar(GetPVarInt(playerid, "MovingStretcher"), "OnStretcher");
- SetPVarInt(playerid, "MovingStretcher", -1);
- }
- if(GetPVarInt(playerid, "Hospital") > 0)
- {
- PlayerInfo[playerid][pHospital] = 1;
- }
- if(GetPVarInt(playerid, "Injured") == 1)
- {
- PlayerInfo[playerid][pHospital] = 1;
- KillEMSQueue(playerid);
- ResetPlayerWeaponsEx(playerid);
- }
- if(PlayerInfo[playerid][pAlreadyBoombox])
- {
- DestroyDynamicObject(PlayerInfo[playerid][pBoombox]);
- DestroyDynamic3DTextLabel(bbox[playerid]);
- PlayerInfo[playerid][pAlreadyBoombox] = 0;
- }
- for(new s = 0; s < 12; s++)
- {
- if(PlayerInfo[playerid][pAGuns][s] != 0)
- {
- RemovePlayerWeapon(playerid, PlayerInfo[playerid][pAGuns][s]);
- }
- }
- if(control[playerid] == 1)
- {
- control[playerid] = 0;
- KillTimer(ControlTimer[playerid]);
- }
- if(PlayerInfo[playerid][pLockCar] != INVALID_VEHICLE_ID)
- {
- vehicle_unlock_doors(PlayerInfo[playerid][pLockCar]);
- }
- if(PlayerInfo[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
- {
- PlayerVehicleInfo[PlayerInfo[playerid][pVehicleKeysFrom]][PlayerInfo[playerid][pVehicleKeys]][pvAllowedPlayerId] = INVALID_PLAYER_ID;
- }
- new string[128], Float:playerPos[3];
- GetPlayerPos(playerid, playerPos[0], playerPos[1], playerPos[2]);
- if(!playerRelogging[playerid]) {
- switch (reason)
- {
- case 0:
- {
- format(string, sizeof(string), "%s has left the server (timeout).", GetPlayerNameEx(playerid));
- foreach(Player, i) {
- if((PlayerInfo[i][pAdmin] >= 1) && !togJoin[playerid]) {
- if(!IsPlayerInRangeOfPoint(i, 30.0, playerPos[0], playerPos[1], playerPos[2])) {
- SendClientMessage(i, TEAM_AZTECAS_COLOR, string);
- }
- }
- }
- ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
- if(PlayerCuffed[playerid] != 0)
- {
- PlayerInfo[playerid][pJailed] = 4;
- PlayerInfo[playerid][pJailTime] += 20*60;
- }
- }
- case 1:
- {
- format(string, sizeof(string), "%s has left the server (leaving).", GetPlayerNameEx(playerid));
- foreach(Player, i) {
- if((PlayerInfo[i][pAdmin] >= 1) && !togJoin[playerid]) {
- if(!IsPlayerInRangeOfPoint(i, 30.0, playerPos[0], playerPos[1], playerPos[2])) {
- SendClientMessage(i, TEAM_AZTECAS_COLOR, string);
- }
- }
- }
- ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
- if(PlayerCuffed[playerid] != 0)
- {
- PlayerInfo[playerid][pJailed] = 4;
- PlayerInfo[playerid][pJailTime] += 20*60;
- }
- }
- case 2:
- {
- format(string, sizeof(string), "%s has left the server (kicked/banned).", GetPlayerNameEx(playerid));
- foreach(Player, i) {
- if(( PlayerInfo[i][pAdmin] >= 1) && !togJoin[playerid]) {
- if(!IsPlayerInRangeOfPoint(i, 30.0, playerPos[0], playerPos[1], playerPos[2])) {
- SendClientMessage(i, TEAM_AZTECAS_COLOR, string);
- }
- }
- }
- ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
- }
- }
- } else {
- format(string, sizeof(string), "%s has left the server (relogging).", GetPlayerNameEx(playerid));
- foreach(Player, i) {
- if((PlayerInfo[i][pAdmin] >= 1) && !togJoin[playerid]) {
- if(!IsPlayerInRangeOfPoint(i, 30.0, playerPos[0], playerPos[1], playerPos[2])) {
- SendClientMessage(i, TEAM_AZTECAS_COLOR, string);
- }
- }
- }
- ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
- }
- if(EventKernel[EventRequest] == playerid)
- {
- EventKernel[EventRequest] = 999;
- ABroadCast( COLOR_YELLOW, "{AA3333}AdmWarning{FFFF00}: The player that was requesting an event has disconnected/crashed.", 4 );
- }
- if(EventKernel[EventCreator] == playerid)
- {
- EventKernel[EventCreator] = 999;
- ABroadCast( COLOR_YELLOW, "{AA3333}AdmWarning{FFFF00}: The player that was creating an event has disconnected/crashed.", 4 );
- }
- if(EventKernel[EventStaff][0] == playerid)
- {
- EventKernel[EventStaff][0] = 999;
- }
- else if(EventKernel[EventStaff][1] == playerid)
- {
- EventKernel[EventStaff][1] = 999;
- }
- else if(EventKernel[EventStaff][2] == playerid)
- {
- EventKernel[EventStaff][2] = 999;
- }
- else if(EventKernel[EventStaff][3] == playerid)
- {
- EventKernel[EventStaff][3] = 999;
- }
- else if(EventKernel[EventStaff][4] == playerid)
- {
- EventKernel[EventStaff][4] = 999;
- }
- if(GetPVarInt(playerid, "IsInArena") >= 0)
- {
- LeavePaintballArena(playerid, GetPVarInt(playerid, "IsInArena"));
- PlayerInfo[playerid][pInt] = GetPVarInt(playerid, "pbOldInt");
- PlayerInfo[playerid][pVW] = GetPVarInt(playerid, "pbOldVW");
- PlayerInfo[playerid][pPos_x] = GetPVarFloat(playerid, "pbOldX");
- PlayerInfo[playerid][pPos_y] = GetPVarFloat(playerid, "pbOldY");
- PlayerInfo[playerid][pPos_z] = GetPVarFloat(playerid, "pbOldZ");
- PlayerInfo[playerid][pHealth] = GetPVarFloat(playerid, "pbOldHealth");
- PlayerInfo[playerid][pArmor] = GetPVarFloat(playerid, "pbOldArmor");
- SetPlayerHealth(playerid,GetPVarFloat(playerid, "pbOldHealth"));
- SetPlayerArmour(playerid,GetPVarFloat(playerid, "pbOldArmor"));
- }
- else if(GetPVarInt(playerid, "EventToken") == 0)
- {
- new Float: x, Float: y, Float: z;
- PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
- PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
- PlayerInfo[playerid][pChar] = PlayerInfo[playerid][pModel];
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]);
- PlayerInfo[playerid][pPos_x] = x;
- PlayerInfo[playerid][pPos_y] = y;
- PlayerInfo[playerid][pPos_z] = z;
- }
- else if(GetPVarInt(playerid, "EventToken") == 1)
- {
- PlayerInfo[playerid][pInt] = EventLastInt[playerid];
- PlayerInfo[playerid][pVW] = EventLastVW[playerid];
- PlayerInfo[playerid][pChar] = PlayerInfo[playerid][pModel];
- PlayerInfo[playerid][pPos_r] = EventFloats[playerid][0];
- PlayerInfo[playerid][pPos_x] = EventFloats[playerid][1];
- PlayerInfo[playerid][pPos_y] = EventFloats[playerid][2];
- PlayerInfo[playerid][pPos_z] = EventFloats[playerid][3];
- }
- if(WatchingTV[playerid] == 1)
- {
- PlayerInfo[playerid][pInt] = BroadcastLastInt[playerid];
- PlayerInfo[playerid][pVW] = BroadcastLastVW[playerid];
- PlayerInfo[playerid][pPos_r] = BroadcastFloats[playerid][0];
- PlayerInfo[playerid][pPos_x] = BroadcastFloats[playerid][1];
- PlayerInfo[playerid][pPos_y] = BroadcastFloats[playerid][2];
- PlayerInfo[playerid][pPos_z] = BroadcastFloats[playerid][3];
- WatchingTV[playerid] = 0;
- viewers--;
- UpdateSANewsBroadcast();
- }
- if(Spectate[playerid] < 553)
- {
- PlayerInfo[playerid][pInt] = GetPVarInt(playerid, "SpecInt");
- PlayerInfo[playerid][pVW] = GetPVarInt(playerid, "SpecVW");
- PlayerInfo[playerid][pChar] = PlayerInfo[playerid][pModel];
- PlayerInfo[playerid][pPos_x] = GetPVarFloat(playerid, "SpecPosX");
- PlayerInfo[playerid][pPos_y] = GetPVarFloat(playerid, "SpecPosY");
- PlayerInfo[playerid][pPos_z] = GetPVarFloat(playerid, "SpecPosZ");
- GettingSpectated[Spectate[playerid]] = 999;
- Spectate[playerid] = 999;
- }
- if(gBike[playerid] >= 0 && gBikeRenting[playerid] == 1)
- {
- gBike[playerid] = 0;
- gBikeRenting[playerid] = 0;
- KillTimer(GetPVarInt(playerid, "RentTime"));
- }
- if(GetPVarInt(playerid, "gpsonoff") == 1) TextDrawDestroy(GPS[playerid]);
- if(GetPVarInt(playerid, "fuelonoff") == 1)
- {
- DestroyProgressBar(FuelBar[playerid]);
- textdrawscount--;
- FuelBar[playerid] = INVALID_BAR_ID;
- }
- if(InsideShamal[playerid] != INVALID_VEHICLE_ID)
- {
- if(InsideShamal[playerid] == INVALID_VEHICLE_ID || GetVehicleModel(InsideShamal[playerid]) != 519)
- {
- GivePlayerValidWeapon(playerid, 46, 60000);
- PlayerInfo[playerid][pPos_x] = 0.000000;
- PlayerInfo[playerid][pPos_y] = 0.000000;
- PlayerInfo[playerid][pPos_z] = 420.000000;
- }
- else
- {
- new Float:X, Float:Y, Float:Z;
- GetVehiclePos(InsideShamal[playerid], X, Y, Z);
- PlayerInfo[playerid][pPos_x] = X;
- PlayerInfo[playerid][pPos_y] = Y;
- PlayerInfo[playerid][pPos_z] = Z;
- new Float:XB, Float:YB, Float:ZB;
- GetVehiclePos(InsideShamal[playerid], XB, YB, ZB);
- if(ZB > 50.0)
- {
- GivePlayerValidWeapon(playerid, 46, 60000);
- }
- }
- PlayerInfo[playerid][pVW] = 0;
- SetPlayerVirtualWorld(playerid, 0);
- PlayerInfo[playerid][pInt] = 0;
- SetPlayerInterior(playerid, 0);
- InsideShamal[playerid] = INVALID_VEHICLE_ID;
- }
- if(BankJobPlayer == playerid)
- {
- format(string, 256, "City Alert: The Bank Robbery attempt has failed!");
- RemovePlayerAttachedObject(playerid, 0);
- SendClientMessageToAll(COLOR_LIGHTBLUE, string);
- BankJobPlayer = 999;
- TimeAfterBankJob = 3;
- BankJobTime = -1;
- BankDeliverTime = -1;
- }
- InsideShamal[playerid] = INVALID_VEHICLE_ID;
- gActivePlayers[playerid]--;
- numplayers--;
- PlayerInfo[playerid][pAdjustable] = 1;
- OnPlayerStatsUpdate(playerid);
- UnloadPlayerVehicles(playerid);
- ResetPlayerWeapons(playerid);
- for(new i = 0; i < MAX_REPORTS; i++)
- {
- if(Reports[i][ReportFrom] == playerid)
- {
- Reports[i][ReportFrom] = 999;
- Reports[i][BeingUsed] = 0;
- Reports[i][TimeToExpire] = 0;
- }
- }
- foreach(Player, i)
- {
- if(TaxiAccepted[i] == playerid)
- {
- TaxiAccepted[i] = 999;
- GameTextForPlayer(i, "~w~Taxi Caller~n~~r~Left the game", 5000, 1);
- TaxiCallTime[i] = 0;
- DisablePlayerCheckpoint(i);
- }
- if(EMSAccepted[i] == playerid)
- {
- EMSAccepted[i] = 999;
- GameTextForPlayer(i, "~w~EMS Caller~n~~r~Left the game", 5000, 1);
- EMSCallTime[i] = 0;
- DisablePlayerCheckpoint(i);
- }
- 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(MedicAccepted[i] == playerid)
- {
- TaxiAccepted[playerid] = 999; BusAccepted[playerid] = 999; MedicAccepted[playerid] = 999;
- GameTextForPlayer(i, "~w~Medic Caller~n~~r~Left the game", 5000, 1);
- MedicCallTime[i] = 0;
- DisablePlayerCheckpoint(i);
- }
- if(OrderAssignedTo[i] == playerid)
- {
- OrderAssignedTo[i] = INVALID_PLAYER_ID;
- }
- }
- if(HaveGPS[playerid])
- {
- KillTimer(GPSTimer[playerid]);
- HaveGPS[playerid] = false;
- GPSTimer[playerid] = 0;
- }
- 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);
- TransportDriver[playerid] = 999;
- }
- }
- if(GotHit[playerid] > 0)
- {
- if(GetChased[playerid] < 999)
- {
- if(IsPlayerConnected(GetChased[playerid]))
- {
- SendClientMessageEx(GetChased[playerid], COLOR_YELLOW, "Your hit has left the server.");
- GoChase[GetChased[playerid]] = 999;
- }
- }
- }
- if(GoChase[playerid] < 999)
- {
- GetChased[GoChase[playerid]] = 999;
- GotHit[GoChase[playerid]] = 999;
- }
- if(HireCar[playerid] != 299)
- {
- gLastDriver[HireCar[playerid]] = 300;
- vehicle_unlock_doors(HireCar[playerid]);
- }
- if (gLastCar[playerid] > 0)
- {
- gLastDriver[gLastCar[playerid]] = 300;
- if(PlayerInfo[playerid][pPhousekey] != gLastCar[playerid]-1)
- {
- vehicle_unlock_doors(gLastCar[playerid]);
- }
- }
- if(PlayerBoxing[playerid] > 0)
- {
- if(Boxer1 == playerid)
- {
- if(IsPlayerConnected(Boxer2))
- {
- if(IsPlayerInRangeOfPoint(PlayerBoxing[Boxer2], 20.0, 768.94, -70.87, 1001.56))
- {
- PlayerBoxing[Boxer2] = 0;
- SetPlayerPos(Boxer2, 768.48, -73.66, 1000.57);
- SetPlayerInterior(Boxer2, 7);
- GameTextForPlayer(Boxer2, "~r~Match interupted", 5000, 1);
- return 1;
- }
- PlayerBoxing[Boxer2] = 0;
- SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
- SetPlayerInterior(Boxer2, 5);
- GameTextForPlayer(Boxer2, "~r~Match interupted", 5000, 1);
- }
- }
- else if(Boxer2 == playerid)
- {
- if(IsPlayerConnected(Boxer1))
- {
- if(IsPlayerInRangeOfPoint(PlayerBoxing[Boxer1],20.0,764.35, -66.48, 1001.56))
- {
- PlayerBoxing[Boxer1] = 0;
- SetPlayerPos(Boxer1, 768.48, -73.66, 1000.57);
- SetPlayerInterior(Boxer1, 7);
- GameTextForPlayer(Boxer1, "~r~Match interupted", 5000, 1);
- return 1;
- }
- PlayerBoxing[Boxer1] = 0;
- SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
- SetPlayerInterior(Boxer1, 5);
- GameTextForPlayer(Boxer1, "~r~Match interupted", 5000, 1);
- }
- }
- InRing = 0;
- RoundStarted = 0;
- Boxer1 = INVALID_PLAYER_ID;
- Boxer2 = INVALID_PLAYER_ID;
- TBoxer = INVALID_PLAYER_ID;
- }
- if(GetPVarInt(playerid, "ModeratorDuty") == 1)
- {
- Moderators--;
- }
- if(TransportDuty[playerid] == 1)
- {
- TaxiDrivers -= 1;
- }
- else if(TransportDuty[playerid] == 2)
- {
- BusDrivers -= 1;
- }
- if(PlayerInfo[playerid][pJob] == 11 || PlayerInfo[playerid][pJob2] == 11)
- {
- if(JobDuty[playerid] == 1) { Medics -= 1; }
- }
- if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7)
- {
- if(JobDuty[playerid] == 1) { Mechanics -= 1; }
- }
- if(PlayerInfo[playerid][pJob] == 11 || PlayerInfo[playerid][pJob2] == 11)
- {
- if(JobDuty[playerid] == 1) { Coastguard -= 1; }
- }
- SaveContacts(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement