SA-MP Forums Archive
Help me...Vehicle Getting lost - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help me...Vehicle Getting lost (/showthread.php?tid=633730)



Help me...Vehicle Getting lost - tharvin - 06.05.2017

When i driving in my server..Suddenly the cars goes missing..For example when i taking a license test in a car..suddenly the car gone..and the license test fails..why is this happening..Help me


Re: Help me...Vehicle Getting lost - moura98 - 06.05.2017

@edit Sorry , i understand wrong


Re: Help me...Vehicle Getting lost - denNorske - 06.05.2017

Let us know:

Are you destroying the cars somewhere in your script? (DestroyVehicle)
How do you create the vehicles?

Are you assigning cars to each player?

give us some information so we can help you, else it's hopeless.


Re: Help me...Vehicle Getting lost - Kane - 06.05.2017

Show your script maybe?


Re: Help me...Vehicle Getting lost - tharvin - 07.05.2017

Quote:
Originally Posted by denNorske
Посмотреть сообщение
Let us know:

Are you destroying the cars somewhere in your script? (DestroyVehicle)
How do you create the vehicles?

Are you assigning cars to each player?

give us some information so we can help you, else it's hopeless.
Is any wrong with this code?
Код:
DespawnVehicle(vehicleid, bool:save = true)
{
	if(VehicleInfo[vehicleid][vID] > 0)
	{
	    if(VehicleInfo[vehicleid][vNeonEnabled])
	    {
	        DestroyDynamicObject(VehicleInfo[vehicleid][vObjects][0]);
	        DestroyDynamicObject(VehicleInfo[vehicleid][vObjects][1]);
	    }

		if(save) {
		    new
				Float:health;

		    GetVehicleHealth(vehicleid, health);
		    SaveVehicleModifications(vehicleid);

		    mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE vehicles SET fuel = %i, health = '%f' WHERE id = %i", vehicleFuel[vehicleid], health, VehicleInfo[vehicleid][vID]);
	    	mysql_tquery(connectionID, queryBuffer);
	    }

		DestroyVehicle(vehicleid);
		ResetVehicle(vehicleid);
	}
}
Or in this

Код:
public OnVehicleSpawn(vehicleid)
{
	if(adminVehicle{vehicleid})
	{
	    DestroyVehicle(vehicleid);
	    adminVehicle{vehicleid} = false;
	}
	if(IsValidDynamicObject(vehicleSiren[vehicleid]))
	{
	    DestroyDynamicObject(vehicleSiren[vehicleid]);
	    vehicleSiren[vehicleid] = INVALID_OBJECT_ID;
	}

	if((VehicleInfo[vehicleid][vID] > 0 && VehicleInfo[vehicleid][vOwnerID] > 0) || (VehicleInfo[vehicleid][vGang] >= 0))
	{
	    ReloadVehicle(vehicleid);

	    if(VehicleInfo[vehicleid][vGang] >= 0)
	    {
	        vehicleFuel[vehicleid] = 100;
		}
	}
	else
	{
     	if(VehicleInfo[vehicleid][vID] > 0 && VehicleInfo[vehicleid][vHealth] > 300.0)
     	{
    		SetVehicleHealth(vehicleid, VehicleInfo[vehicleid][vHealth]);
     	}

		vehicleFuel[vehicleid] = 100;
	}

	vehicleStream[vehicleid][0] = 0;

	return 1;
}



Re: Help me...Vehicle Getting lost - ShihabSoft - 07.05.2017

At when exactly when did your car vanish? Then did you try teleporting to the car with it's ID. If it's at it's spawn point, then there's somehow in the script, doing something which despawns your car. Explain the exact scenario when does this happen.


Re: Help me...Vehicle Getting lost - Kane - 07.05.2017

OnVehicleSpawn(vehicleid)
Код:
if(adminVehicle{vehicleid})
	{
	    DestroyVehicle(vehicleid);
	    adminVehicle{vehicleid} = false;
	}
This destroys admin vehicles if that's what you're using and I'm pretty sure the bolded isn't right.

Код:
if((VehicleInfo[vehicleid][vID] > 0 && VehicleInfo[vehicleid][vOwnerID] > 0) || (VehicleInfo[vehicleid][vGang] >= 0))
This entire line should be:

Код:
if(VehicleInfo[vehicleid][vID] > 0 && VehicleInfo[vehicleid][vOwnerID] > 0 || VehicleInfo[vehicleid][vGang] >= 0)



Re: Help me...Vehicle Getting lost - ShihabSoft - 07.05.2017

@Arthur, as from the question, his car only disappears while in the middle of driving, OnVehicleSpawn has nothing much to do with it, unless he rephrases his question.


Re: Help me...Vehicle Getting lost - tharvin - 07.05.2017

Quote:
Originally Posted by ShihabSoft
Посмотреть сообщение
At when exactly when did your car vanish? Then did you try teleporting to the car with it's ID. If it's at it's spawn point, then there's somehow in the script, doing something which despawns your car. Explain the exact scenario when does this happen.
Ok..when the car unoccupied..it stays there but when im occupying the car suddenly vanish..i try to teleport the car..it says invalid vehicle id..it destroys the car


Re: Help me...Vehicle Getting lost - ShihabSoft - 07.05.2017

So If the car spawns properly, then it must be the code in OnPlayerEnterVehicle or any other code which detects if player entering a vehicle, just post all the code snippets.