Problem with server remvoing vehicle?!
#1

I have this problem that the server removes vehicles after a few seconds after entering them, it does not give me some sort of error code and i don't really know where to look in the script? Anyone else have this problem?
Reply
#2

When the vehicles are removed, do they get deleted from the server completely, or are they returned to the spot where they were created?

If they are simply being respawned and returned to the position that they were created, you may need to increase your CreateVehicle respawn_delay parameter, this parameter defines in seconds the time after which the vehicle has been un-occupied to be respawned. You can also set this parameter to -1 to disable respawn.
Reply
#3

Quote:
Originally Posted by MEW273
Посмотреть сообщение
When the vehicles are removed, do they get deleted from the server completely, or are they returned to the spot where they were created?

If they are simply being respawned and returned to the position that they were created, you may need to increase your CreateVehicle respawn_delay parameter, this parameter defines in seconds the time after which the vehicle has been un-occupied to be respawned. You can also set this parameter to -1 to disable respawn.
They get deleted and i have to restart the server to get them back
Reply
#4

Can you please post here the code that creates the vehicles. Does this happen to every vehicle and only after a player enters the vehicle? If so perhaps you should have a look at the following public:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)

See if there is any code here that would destroy the vehicle.
Reply
#5

Quote:
Originally Posted by MEW273
Посмотреть сообщение
Can you please post here the code that creates the vehicles. Does this happen to every vehicle and only after a player enters the vehicle? If so perhaps you should have a look at the following public:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)

See if there is any code here that would destroy the vehicle.
It happens no mather vehicle and only after entering it, i've looked but found nothing that could possibly remove a vehicle, any other suggestions?
Reply
#6

Have you searched your gamemode (using ctrl+F) for terms such as "DestroyVehicle"?

Is there any code under OnPlayerEnterVehicle?

It is difficult to point you in the right direction without seeing any of your code.
Reply
#7

Quote:
Originally Posted by MEW273
Посмотреть сообщение
Have you searched your gamemode (using ctrl+F) for terms such as "DestroyVehicle"?

Is there any code under OnPlayerEnterVehicle?

It is difficult to point you in the right direction without seeing any of your code.
This is the code Under "OnPlayerEnterVehicle"
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY)
	{
	    new
	        Float:x,
	        Float:y,
	        Float:z;
	    GetPlayerPos(playerid, x, y, z);
	    SetPlayerPos(playerid, x, y, z + 0.5);
	    ClearAnimations(playerid);
	}

	if((!ispassenger) && (PlayerInfo[playerid][pCuffed] || PlayerInfo[playerid][pInjured]))
	{
	    new
	        Float:x,
	        Float:y,
	        Float:z;
	    GetPlayerPos(playerid, x, y, z);
	    SetPlayerPos(playerid, x, y, z + 0.5);
	    ClearAnimations(playerid);
	}

	if(!ispassenger)
	{
	    if((pizzaVehicles[0] <= vehicleid <= pizzaVehicles[5]) && !PlayerHasJob(playerid, JOB_PIZZAMAN))
	    {
	        SendClientMessage(playerid, COLOR_GREY, "You cannot operate this vehicle as you are not a Pizzaman.");
	        ClearAnimations(playerid);
	    }
	    if((courierVehicles[0] <= vehicleid <= courierVehicles[6]) && !PlayerHasJob(playerid, JOB_COURIER))
	    {
	        SendClientMessage(playerid, COLOR_GREY, "You cannot operate this vehicle as you are not a Courier.");
	        ClearAnimations(playerid);
	    }
	    if((sweeperVehicles[0] <= vehicleid <= sweeperVehicles[3]) && !PlayerHasJob(playerid, JOB_SWEEPER))
	    {
	        SendClientMessage(playerid, COLOR_GREY, "You cannot operate this vehicle as you are not a Street Sweeper.");
	        ClearAnimations(playerid);
	    }
	    if((taxiVehicles[0] <= vehicleid <= taxiVehicles[3]) && !PlayerHasJob(playerid, JOB_TAXIDRIVER))
	    {
	        SendClientMessage(playerid, COLOR_GREY, "You cannot operate this vehicle as you are not a Taxi Driver.");
	        ClearAnimations(playerid);
	    }
	    if((testVehicles[0] <= vehicleid <= testVehicles[2]) && !PlayerInfo[playerid][pDrivingTest])
	    {
	        SendClientMessage(playerid, COLOR_GREY, "You cannot operate this vehicle as you are not taking your drivers test.");
	        ClearAnimations(playerid);
	    }
	    if(VehicleInfo[vehicleid][vFactionType] != FACTION_NONE && GetFactionType(playerid) != VehicleInfo[vehicleid][vFactionType])
	    {
	        SendClientMessage(playerid, COLOR_GREY, "You cannot operate this vehicle as it doesn't belong to your faction.");
	        ClearAnimations(playerid);
	    }
	    if(VehicleInfo[vehicleid][vGang] >= 0 && PlayerInfo[playerid][pGang] != VehicleInfo[vehicleid][vGang])
	    {
	        SendClientMessage(playerid, COLOR_GREY, "You cannot operate this vehicle as it doesn't belong to your gang.");
	        ClearAnimations(playerid);
	    }
	    if(VehicleInfo[vehicleid][vJob] >= 0 && PlayerInfo[playerid][pJob] != VehicleInfo[vehicleid][vJob])
	    {
	        SendClientMessageEx(playerid, COLOR_GREY, "You cannot operate this vehicle as you are not a %s.", GetJobName(VehicleInfo[vehicleid][vJob]));
	        ClearAnimations(playerid);
	    }
	}

	return 1;
}
Edit:
I found the fault, it had a DestroyVehicle(i); under the fueltimer so when the fuel went down from 100 to 99 it destroyed the vehicle, thanks for your help kind sir
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)