Someone help me!
#2

Quote:
Originally Posted by Bawt
Посмотреть сообщение
It's going to be difficult to solve this issue based on the information you have given. Post your vehicle saving code here from OnPlayerDisconnect.

You should also take this into account.


EDIT: There was no need to make another thread. showthread.php?t=594250
The OnPlayerDisconnect code..

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new disconnectstr[128];
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    new caller = Mobile[playerid];
    gActivePlayers[playerid]--;
    numplayers--;
    KillTimer(RelogTimer[playerid]);
    //FadePlayerDisconnect(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), "The player that recently attempted to capture %s has disconnected.", 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), "The boombox owner (%s) has logged off", 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, "Nobody is using the car wash right now.\nPrice: $5 (/carwash)");
	}
		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_YELLOW, "** The robbing leader has left, robbery over");
	        SendClientMessage(RobStatus[RobberID2], COLOR_YELLOW, "** The robbing leader has left, robbery over");
	        SendClientMessage(RobStatus[RobberID3], COLOR_YELLOW, "** The robbing leader has left, robbery over");
	        SendClientMessage(RobStatus[RobberID4], COLOR_YELLOW, "** The robbing leader has left, robbery over");
	        SendClientMessage(RobStatus[RobberID5], COLOR_YELLOW, "** The robbing leader has left, robbery over");
	        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, "** The Bank Robbery has finished **");
			    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, "** The Bank Robbery has finished **");
			    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, "** The Bank Robbery has finished **");
			    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, "** The Bank Robbery has finished **");
			    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, "** The Bank Robbery has finished **");
			    FinishRobbery();
			}
		}
		format(string,sizeof(string),"** You've died and failed to get your money of $%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]);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    switch(reason)
	{
		case 0: format(string, sizeof(string), "* %s has left the server. (Timeout)", sendername);
		case 1: format(string, sizeof(string), "* %s has left the server. (Leaving)", sendername);
		case 2: format(string, sizeof(string), "* %s has left the server. (Kicked)", 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, "You are no longer spectating.");
   			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~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, COLOR_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] != 0)
	{
        DestroyDynamicObject(BombID[playerid]);
	}
	if(PlayerPaintballing[playerid] != 0)
	{
	    PaintballPlayers --;
	}
	if(caller != 255)
	{
	    SendClientMessage(caller,  COLOR_GRAD2, "   The line has been disconnected....");
	    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 interupted", 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 interupted", 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; }
	}
	if(PlayerInfo[playerid][PlayerVehicleModel1] != 0)
	{
		ResetPlayerVehicle(playerid,1);
	}
	if(PlayerInfo[playerid][PlayerVehicleModel2] != 0)
	{
		ResetPlayerVehicle(playerid,2);
	}
	if(PlayerInfo[playerid][PlayerVehicleModel3] != 0)
	{
		ResetPlayerVehicle(playerid,3);
	}
	if(PlayerInfo[playerid][PlayerVehicleModel4] != 0)
	{
		ResetPlayerVehicle(playerid,4);
	}
	if(PlayerInfo[playerid][PlayerVehicleModel5] != 0)
	{
		ResetPlayerVehicle(playerid,5);
	}
    printf("//Deleting Vehicles For ID: %d", playerid);
	return 1;
}
Reply


Messages In This Thread
Someone help me! - by k2rl - 15.11.2015, 10:47
Re: Someone help me! - by k2rl - 15.11.2015, 14:26

Forum Jump:


Users browsing this thread: 1 Guest(s)