Vehicles disappearing after a few seconds
#1

There is a bug that I'm unable to fix within the script that I'm using. When I spawn a temporary vehicle or buy a vehicle from a dealership, it de-spawns. In order to get back to that vehicle, if it's a temporarily spawned one, I have to check for it's ID with the /oldcar cmd and teleport to it and if it's a purchased vehicle, I have to enter my vehicle storage,respawn and teleport to it. It's extremely annoying.

How to fix this bug/glitch or whatever it's known as?
Reply
#2

Does anyone have a fix for this problem?
Reply
#3

Provide your vehicle code, this is the only way to get help so we can figure out the "glitch".
Check around your script where SetVehicleToRespawn is used and how do you create the vehicle when player purchase/spawn it.
Reply
#4

Found 9 codes that includes 'SetVehicleToRespawn' with the aid of Notepad++:

Code One:
Code:
CancelActiveCheckpoint(playerid)
{
    if(PlayerInfo[playerid][pDrivingTest])
	{
	    SetVehicleToRespawn(PlayerInfo[playerid][pTestVehicle]);
	}
	if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY)
	{
	    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
	    RemovePlayerAttachedObject(playerid, 9);
    }

    DisablePlayerCheckpoint(playerid);

	PlayerInfo[playerid][pCP] = CHECKPOINT_NONE;
	PlayerInfo[playerid][pPizzas] = 0;
	PlayerInfo[playerid][pSmuggleMats] = 0;
	PlayerInfo[playerid][pSmuggleDrugs] = 0;
	PlayerInfo[playerid][pDrivingTest] = 0;
	PlayerInfo[playerid][pTestVehicle] = INVALID_VEHICLE_ID;
	PlayerInfo[playerid][pTestCP] = 0;
    PlayerInfo[playerid][pMiningRock] = 0;
    PlayerInfo[playerid][pShipment] = -1;
}
Code Two:
Code:
PlayerInfo[playerid][pTestCP]++;

	        if(PlayerInfo[playerid][pTestCP] < sizeof(drivingTestCPs))
	        {
	            if(!(testVehicles[0] <= GetPlayerVehicleID(playerid) <= testVehicles[4]))
	            {
					SendClientMessage(playerid, COLOR_LIGHTRED, "** You failed the test as you left your vehicle.");
	                DisablePlayerCheckpoint(playerid);
		    		SetVehicleToRespawn(PlayerInfo[playerid][pTestVehicle]);

				    PlayerInfo[playerid][pCP] = CHECKPOINT_NONE;
		            PlayerInfo[playerid][pDrivingTest] = 0;
				}
				else
				{
		            SetPlayerCheckpoint(playerid, drivingTestCPs[PlayerInfo[playerid][pTestCP]][0], drivingTestCPs[PlayerInfo[playerid][pTestCP]][1], drivingTestCPs[PlayerInfo[playerid][pTestCP]][2], 3.0);
				}
			}
			else
Code Three:
Code:
 new
			        Float:health;

				GetVehicleHealth(PlayerInfo[playerid][pTestVehicle], health);

			    if(health < 900.0)
			    {
			        GameTextForPlayer(playerid, "~r~Failed", 5000, 1);
			        SendClientMessage(playerid, COLOR_LIGHTRED, "** You brought back the vehicle damaged and therefore failed your test.");
			    }
			    else
			    {
                    GameTextForPlayer(playerid, "~w~Passed!~n~~r~-$500", 5000, 1);
			        SendClientMessage(playerid, COLOR_AQUA, "You successfully passed your drivers test and received your license!");

			        GivePlayerCash(playerid, -500);
			        PlayerInfo[playerid][pCarLicense] = 1;

			        mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE users SET carlicense = 1 WHERE uid = %i", PlayerInfo[playerid][pID]);
			        mysql_tquery(connectionID, queryBuffer, "", "");
			    }

	    		DisablePlayerCheckpoint(playerid);
	    		SetVehicleToRespawn(PlayerInfo[playerid][pTestVehicle]);

			    PlayerInfo[playerid][pCP] = CHECKPOINT_NONE;
	            PlayerInfo[playerid][pDrivingTest] = 0;
	        }
Code Four:
Code:
else if(oldstate == PLAYER_STATE_DRIVER)
	{
     	if(PlayerInfo[playerid][pDrivingTest])
	    {
         	PlayerInfo[playerid][pDrivingTest] = 0;
         	SetVehicleToRespawn(PlayerInfo[playerid][pTestVehicle]);
         	SendClientMessage(playerid, COLOR_LIGHTRED, "** You have left the vehicle and therefore failed the test.");
		}

	    PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][1]);
	    PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][2]);
	}
Code Five:
Code:
if(!strcmp(option, "job", true))
	{
		for(new i = 1; i < MAX_VEHICLES; i ++)
		{
	    	if(IsValidVehicle(i) && !IsVehicleOccupied(i) && !adminVehicle{i})
		    {
		        if((pizzaVehicles[0] <= i <= pizzaVehicles[5]) || (courierVehicles[0] <= i <= courierVehicles[6]) || (sweeperVehicles[0] <= i <= sweeperVehicles[3]) || (taxiVehicles[0] <= i <= taxiVehicles[3]) || (VehicleInfo[i][vJob] != JOB_NONE))
		        {
	        		SetVehicleToRespawn(i);
				}
	 		}
		}

		SendClientMessageToAllEx(COLOR_LIGHTRED, "AdmCmd: %s respawned all unoccupied job vehicles.", GetPlayerRPName(playerid));
	}
Code Six:
Code:
for(new i = 1; i < MAX_VEHICLES; i ++)
		{
	    	if(IsValidVehicle(i) && !IsVehicleOccupied(i) && !adminVehicle{i} && VehicleInfo[i][vFactionType] == type)
	    	{
				SetVehicleToRespawn(i);
			}
		}
Code Seven:
Code:
else if(!strcmp(option, "nearby", true))
	{
		for(new i = 1; i < MAX_VEHICLES; i ++)
		{
	    	if(IsValidVehicle(i) && !IsVehicleOccupied(i) && !adminVehicle{i} && IsVehicleStreamedIn(i, playerid))
		    {
				SetVehicleToRespawn(i);
			}
		}

		SendClientMessageToAllEx(COLOR_LIGHTRED, "AdmCmd: %s respawned all unoccupied vehicles in %s.", GetPlayerRPName(playerid), GetPlayerZoneName(playerid));
	}
Code Eight:
Code:
else if(!strcmp(option, "all", true))
	{
		for(new i = 1; i < MAX_VEHICLES; i ++)
		{
	    	if(IsValidVehicle(i) && !IsVehicleOccupied(i) && !adminVehicle{i})
		    {
				SetVehicleToRespawn(i);
			}
		}

		SendClientMessageToAllEx(COLOR_LIGHTRED, "AdmCmd: %s respawned all unoccupied vehicles.", GetPlayerRPName(playerid));
	}
Code Nine:
Code:
 for(new i = 1; i < MAX_VEHICLES; i ++)
	{
	    if(IsValidVehicle(i) && VehicleInfo[i][vID] > 0 && VehicleInfo[i][vGang] == PlayerInfo[playerid][pGang] && !IsVehicleOccupied(i))
	    {
	        SetVehicleToRespawn(i);
		}
	}
Reply
#5

You're using a leaked script which is not allowed to do. I will not help you, make your own.
Reply
#6

Quote:
Originally Posted by ConnorW
View Post
You're using a leaked script which is not allowed to do. I will not help you, make your own.
A non-resident post as you have such materials so no one has made any noise and in the end it has helped you. If so category scripting help wouldn't make sense, right ?
Reply
#7

I guess you're using Limitless Roleplay.
Under FuelTimer, find the DestroyVehicle function and remove it.
Reply
#8

Quote:
Originally Posted by ConnorW
View Post
You're using a leaked script which is not allowed to do. I will not help you, make your own.
Uhm... if you're not gonna help me, I suggest that you don't reply. It only builds your post count and that's basically farming. And, I can use any script I want, since it won't be bothering you. Get a life, jerk.
Reply
#9

Quote:
Originally Posted by zerruv
View Post
I guess you're using Limitless Roleplay.
Under FuelTimer, find the DestroyVehicle function and remove it.
Oh sweet, thanks for the assistance. It worked! +1 Rep from me btw.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)