Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerDisconnect(playerid, reason) {
- /* #if defined DEBUG
- printf("[debug] OnPlayerDisconnect(%d, %d)", playerid, reason);
- #endif*/
- if(RefuelingVehicle[playerid] == 2) { DestroyObject(FillGasObject[playerid]); }
- LuX_SpeedoMeter[playerid] = 0;
- FadePlayerDisconnect(playerid);
- //===================================================
- Delete3DTextLabel(injuredLabel[playerid]);
- TextDrawDestroy(DescriptionText[playerid]);
- KillTimer(playerspeedtimer[playerid]);
- KillTimer(CrashTimer[playerid]);
- IsSpeeding[playerid] = false;
- //===================================================
- if(playerVariables[playerid][pStatus] >= 1) {
- new vehicleid = GetPlayerVehicleID(playerid);
- if(testDrive[playerid] == vehicleid){
- new dID = GetPVarInt(playerid,"dID");
- RemovePlayerFromVehicle(playerid);
- SetPlayerPos(playerid, dealershipVariables[dID][dSPosX],dealershipVariables[dID][dSPosY],dealershipVariables[dID][dSPosZ]);
- SendClientMessageEx(playerid,COLOR_GREY,"Waktu anda waktu test drive anda sudah habis.");
- KillTimer(GetPVarInt(playerid, "testDrive"));
- DestroyVehicle(testDrive[playerid]);
- testDrive[playerid] = INVALID_VEHICLE_ID;
- }
- if(playerVariables[playerid][pWExists] == 1){
- WeedLogout(playerid);
- }
- testDrive[playerid] = INVALID_VEHICLE_ID;
- kabur[playerid] = 0;
- DMVTime[playerid] = 0;
- if(gBike[playerid] >= 0 && gBikeRenting[playerid] == 1){
- gBike[playerid] = 0;
- gBikeRenting[playerid] = 0;
- KillTimer(GetPVarInt(playerid, "RentTime"));
- }
- GarbageTruck[playerid] = INVALID_VEHICLE_ID;
- jumlahSampah[playerid] = 0;
- if(GetPVarInt(playerid, "Injured") == 1){
- playerVariables[playerid][pHospitalized] = 1;
- }
- if (GetPVarInt(playerid, "HungerBar") == 1)
- {
- DeletePVar(playerid, "HungerBar");
- DeletePVar(playerid, "hTimerOn");
- }
- if (GetPVarInt(playerid, "EnergyBar") == 1)
- {
- DeletePVar(playerid, "EnergyBar");
- DeletePVar(playerid, "eTimerOn");
- }
- if (GetPVarInt(playerid, "BladderBar") == 1)
- {
- DeletePVar(playerid, "BladderBar");
- DeletePVar(playerid, "bTimerOn");
- }
- if (GetPVarInt(playerid, "ConditionBar") == 1)
- {
- DeletePVar(playerid, "ConditionBar");
- DeletePVar(playerid, "cTimerOn");
- }
- FirstSpawn[playerid] = 0;
- KillTimer(PBHTimer[playerid]);
- KillTimer(PBETimer[playerid]);
- KillTimer(PBBTimer[playerid]);
- KillTimer(PBCTimer[playerid]);
- playerVariables[playerid][pStatus] = -1;
- foreach(Player, x) {
- if(playerVariables[x][pSpectating] == playerid) {
- playerVariables[x][pSpectating] = INVALID_PLAYER_ID;
- TogglePlayerSpectating(x, false);
- SetCameraBehindPlayer(x);
- SetPlayerPos(x, playerVariables[x][pPos][0], playerVariables[x][pPos][1], playerVariables[x][pPos][2]);
- SetPlayerInterior(x, playerVariables[x][pInterior]);
- SetPlayerVirtualWorld(x, playerVariables[x][pVirtualWorld]);
- TextDrawHideForPlayer(x, textdrawVariables[4]);
- SendClientMessage(x, COLOR_GREY, "The player you were spectating has disconnected.");
- }
- }
- if(playerVariables[playerid][pAdminDuty] >= 1) {
- SetPlayerName(playerid, playerVariables[playerid][pNormalName]);
- }
- if(playerVariables[playerid][pFreezeType] >= 1 && playerVariables[playerid][pFreezeType] <= 4)
- {
- playerVariables[playerid][pPrisonTime] = 900;
- playerVariables[playerid][pPrisonID] = 2;
- }
- if(WatchingTV[playerid] == 1)
- {
- playerVariables[playerid][pInterior] = BroadcastLastInt[playerid];
- playerVariables[playerid][pVirtualWorld] = BroadcastLastVW[playerid];
- WatchingTV[playerid] = 0;
- viewers--;
- UpdateSANewsBroadcast();
- }
- if(playerVariables[playerid][pDrag] != -1) {
- SendClientMessage(playerVariables[playerid][pDrag], COLOR_WHITE, "The person you were dragging has disconnected.");
- playerVariables[playerVariables[playerid][pDrag]][pDrag] = -1; // Kills off any disconnections.
- }
- if(playerVariables[playerid][pPhoneCall] != -1 && playerVariables[playerid][pPhoneCall] < MAX_PLAYERS) {
- SendClientMessage(playerVariables[playerid][pPhoneCall], COLOR_WHITE, "Sambungan telepon anda terputus.");
- if(GetPlayerSpecialAction(playerVariables[playerid][pPhoneCall]) == SPECIAL_ACTION_USECELLPHONE) {
- SetPlayerSpecialAction(playerVariables[playerid][pPhoneCall], SPECIAL_ACTION_STOPUSECELLPHONE);
- RemovePlayerAttachedObject(playerVariables[playerid][pPhoneCall], 0);
- }
- playerVariables[playerVariables[playerid][pPhoneCall]][pPhoneCall] = -1;
- }
- if(GetPVarInt(playerid, "HaveADO") == 1) RemovePlayerADO(playerid);
- saveRentData(playerid);
- DestroyVehicle(PlayerRentInfo[playerid][prId]);
- savePlayerData(playerid);
- for(new x=0; x<MAX_PLAYER_VEHICLE; x++)
- {
- if(playerVariables[playerid][pCarID][x] >= INVALID_PLAYER_VEHICLE_ID)
- {
- for(new vt = 0; vt < MAX_OBJECTS_PER_PLAYER; vt++)
- {
- DestroyObject(PlayerVehicleInfo[playerid][x][pvToy][vt]);
- }
- KillTimer(playerVariables[playerid][pCarFlashTime][x]);
- RemoveVehSS(playerVariables[playerid][pCarID][x]);
- KillTimer(playerVariables[playerid][pCarFlashTime][x]);
- DestroyObject(playerVariables[playerid][pNeonObj][x]);
- DestroyObject(playerVariables[playerid][pNeonObj2][x]);
- DestroyObject(playerVariables[playerid][pNeonObj3][x]);
- DestroyObject(playerVariables[playerid][pNeonObj4][x]);
- playerVariables[playerid][pCarNeonUse][x] = 0;
- // DestroyObject(playerVariables[extraid][pVehicleObjectModel][0]);
- // DestroyObject(playerVariables[extraid][pVehicleObjectModel][1]);
- DestroyVehicle(playerVariables[playerid][pCarID][x]);
- playerVariables[playerid][pCarID][x] = INVALID_PLAYER_VEHICLE_ID;
- systemVariables[vehicleCounts][1]--;
- }
- }
- saveVehicleData(playerid);
- new
- string[128];
- if(playerVariables[playerid][pAdminLevel] < 1) {
- switch(reason) {
- case 1: format(string, sizeof(string), "%s telah meninggalkan server (leaving).", playerVariables[playerid][pNormalName]);
- case 2: format(string, sizeof(string), "%s telah meninggalkan server (banned/kicked).", playerVariables[playerid][pNormalName]);
- default: format(string, sizeof(string), "%s telah meninggalkan server (timeout).", playerVariables[playerid][pNormalName]);
- }
- nearByMessage(playerid, COLOR_GENANNOUNCE, string);
- submitToAdmins(string,COLOR_LIGHTBLUE);
- }
- if(playerVariables[playerid][pGroup] >= 1) {
- switch(reason) {
- case 0: {
- format(string, sizeof(string), "%s telah meninggalkan server/group (timeout).", playerVariables[playerid][pNormalName]);
- }
- case 1: {
- format(string, sizeof(string), "%s telah meninggalkan server/group (leaving).", playerVariables[playerid][pNormalName]);
- }
- case 2: {
- format(string, sizeof(string), "%s telah meninggalkan server/group (banned/kicked).", playerVariables[playerid][pNormalName]);
- }
- }
- SendToGroup(playerVariables[playerid][pGroup], COLOR_GENANNOUNCE, string);
- }
- DeletePVar(playerid,"Cash");
- if(playerVariables[playerid][pEvent] >= 1) {
- eventVariables[eEventCount]--;
- playerVariables[playerid][pEvent] = 0;
- ResetPlayerWeapons(playerid);
- if(eventVariables[eEventCount] <= 1) {
- new
- iCount;
- foreach(Player, i) {
- if(playerVariables[i][pEvent] >= 1) {
- TogglePlayerControllable(i, true);
- ResetPlayerWeapons(i);
- givePlayerWeapons(i);
- SetPlayerPos(i, playerVariables[i][pPos][0], playerVariables[i][pPos][1], playerVariables[i][pPos][2]);
- SetPlayerInterior(i, playerVariables[i][pInterior]);
- SetPlayerVirtualWorld(i, playerVariables[i][pVirtualWorld]);
- SetPlayerSkin(i, playerVariables[i][pSkin]);
- SetCameraBehindPlayer(i);
- iCount++;
- GetPlayerName(i, szPlayerName, MAX_PLAYER_NAME);
- SetPlayerHealth(i, playerVariables[i][pHealth]);
- SetPlayerArmour(i, playerVariables[i][pArmour]);
- playerVariables[i][pEvent] = 0;
- }
- }
- if(iCount == 1) {
- format(string, sizeof(string), "%s has won the event by default (after %s disconnected) - congratulations!", szPlayerName, playerVariables[playerid][pNormalName]);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- }
- else {
- format(string, sizeof(string), "The event has ended (no participants left, %s disconnected).",playerVariables[playerid][pNormalName]);
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- }
- eventVariables[eEventStat] = 0;
- eventVariables[eEventCount] = 0;
- eventVariables[eEventSkin] = 0;
- }
- else {
- switch(reason) {
- case 0: format(string, sizeof(string), "%s telah meninggalkan server/event (timeout). Dari %d peserta.", playerVariables[playerid][pNormalName], eventVariables[eEventCount]);
- case 1: format(string, sizeof(string), "%s telah meninggalkan server/event (leaving). Dari %d peserta.", playerVariables[playerid][pNormalName], eventVariables[eEventCount]);
- case 2: format(string, sizeof(string), "%s telah meninggalkan server/event (kicked/banned). Dari %d peserta.", playerVariables[playerid][pNormalName], eventVariables[eEventCount]);
- }
- SendToEvent(COLOR_YELLOW, string);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement