Fuel error
#1

When someone comes onto the server and does /car engine to any car, it says it has no fuel:

Код:
forward SetVehicleEngine(vehicleid, playerid);
public SetVehicleEngine(vehicleid, playerid)
{
	new string[128];
	new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(engine == VEHICLE_PARAMS_ON)
	{
		SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
		SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine stopped successfully.");
		arr_Engine{vehicleid} = 0;
		if(IsABaitCar(vehicleid) && BaitCarActive == 1)
		{
			foreach(Player, i)
			{
				PlayerTextDrawSetString(i, Textdraw9, "  ~r~OFF");
			}
		}
	}
    else if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
	{
		new
			Float: f_vHealth;

		GetVehicleHealth(vehicleid, f_vHealth);
		if(f_vHealth < 350.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - it's totalled!");
	    if(VehicleFuel[vehicleid] <= 0.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - there's no fuel in the tank!");
		SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
		SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine started successfully (/car engine to turn the engine off).");
		arr_Engine{vehicleid} = 1;
Reply
#2

Maybe you didn't set any fuel to the vehicle when you created it?
Reply
#3

Under OnGameModeInit should be the above code:

pawn Код:
public OnGameModeInit()
{
        for(new v = 0; v < MAX_VEHICLES; v++)
    {
        if(Cars(v))
        {
            VehicleFuel[v] = 100;
        }
        if(Bikes(v))
        {
            VehicleFuel[v] = 999;
        }
    }
}
Ofc that you don't have to use those Ifs Its just a better RP situation. If you won't check Bikes then they will have fuel too. Btw you probably don't have the Cars & Bikes function so i recommand creating them.
Reply
#4

I get
Quote:

C:\Users\Administrator\Desktop\Server\gamemodes\De bt.pwn(28300) : error 017: undefined symbol "Cars"
C:\Users\Administrator\Desktop\Server\gamemodes\De bt.pwn(28304) : error 017: undefined symbol "Bikes"

Reply
#5

Quote:
Originally Posted by MrCallum
Посмотреть сообщение
I get
Well ofcurse you will get this error.
Those Cars & Bikes are an example of making system to check which vehicle needs fuel and which doesn't.
Anyway, use this to check if it works overall:
pawn Код:
public OnGameModeInit()
{
        for(new v = 0; v < MAX_VEHICLES; v++)
    {
        VehicleFuel[v] = 100;
    }
}
If you are developing RP you should check which vehicle needs fuel and which doesn't.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)