SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 26/01/2019, 12:36 AM   #1
KevTheJoker
Big Clucker
 
KevTheJoker's Avatar
 
Join Date: Dec 2018
Location: South America
Posts: 80
Reputation: 7
Exclamation Vehicles disappearing after a few seconds

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?
KevTheJoker is offline   Reply With Quote
Old 26/01/2019, 06:55 PM   #2
KevTheJoker
Big Clucker
 
KevTheJoker's Avatar
 
Join Date: Dec 2018
Location: South America
Posts: 80
Reputation: 7
Default Re: Vehicles disappearing after a few seconds

Does anyone have a fix for this problem?
KevTheJoker is offline   Reply With Quote
Old 26/01/2019, 09:14 PM   #3
d3Pedro
Huge Clucker
 
Join Date: Apr 2012
Location: darkness
Posts: 321
Reputation: 94
Default Re: Vehicles disappearing after a few seconds

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.
d3Pedro is offline   Reply With Quote
Old 27/01/2019, 12:56 AM   #4
KevTheJoker
Big Clucker
 
KevTheJoker's Avatar
 
Join Date: Dec 2018
Location: South America
Posts: 80
Reputation: 7
Default Re: Vehicles disappearing after a few seconds

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);
		}
	}
KevTheJoker is offline   Reply With Quote
Old 27/01/2019, 10:27 AM   #5
d3Pedro
Huge Clucker
 
Join Date: Apr 2012
Location: darkness
Posts: 321
Reputation: 94
Default Re: Vehicles disappearing after a few seconds

You're using a leaked script which is not allowed to do. I will not help you, make your own.
d3Pedro is offline   Reply With Quote
Old 27/01/2019, 11:19 AM   #6
Bolex_
Gangsta
 
Bolex_'s Avatar
 
Join Date: Aug 2015
Location: Croatia.
Posts: 586
Reputation: 124
Default Re: Vehicles disappearing after a few seconds

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 ?
Bolex_ is offline   Reply With Quote
Old 27/01/2019, 11:31 AM   #7
Nyzenic
Big Clucker
 
Nyzenic's Avatar
 
Join Date: Sep 2017
Location: house
Posts: 86
Reputation: 51
Default Re: Vehicles disappearing after a few seconds

I guess you're using Limitless Roleplay.
Under FuelTimer, find the DestroyVehicle function and remove it.
__________________
discord: nize#5841
[FS/INC] Custom Player Nametags

not really into samp right now
Nyzenic is offline   Reply With Quote
Old 28/01/2019, 01:23 AM   #8
KevTheJoker
Big Clucker
 
KevTheJoker's Avatar
 
Join Date: Dec 2018
Location: South America
Posts: 80
Reputation: 7
Default Re: Vehicles disappearing after a few seconds

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.
KevTheJoker is offline   Reply With Quote
Old 28/01/2019, 01:25 AM   #9
KevTheJoker
Big Clucker
 
KevTheJoker's Avatar
 
Join Date: Dec 2018
Location: South America
Posts: 80
Reputation: 7
Default Re: Vehicles disappearing after a few seconds

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.
KevTheJoker is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disappearing vehicles KtotheYle Scripting Help 6 14/06/2018 10:18 PM
Vehicles disappearing E.C2 Client Support 2 26/12/2017 09:34 AM
People/cars disappearing for ~5 seconds jbankss Scripting Help 3 12/11/2016 03:04 AM
SetPlayerMapIcon is disappearing after 2 seconds Tass007 Scripting Help 2 14/10/2016 09:47 AM
Players, cars and objects disappearing for a few seconds IzadorO Server Support 0 28/05/2016 05:31 PM


All times are GMT. The time now is 10:17 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.