Help me...Vehicle Getting lost
#1

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
Reply
#2

@edit Sorry , i understand wrong
Reply
#3

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.
Reply
#4

Show your script maybe?
Reply
#5

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;
}
Reply
#6

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.
Reply
#7

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)
Reply
#8

@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.
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)