Need help with refueling
#1

I have made a vehicle system that has a fuel system with them. Player vehicles have fuel. but spawned vehicles dont. And I dont know how to make it so that faction cars etc spawn with 100 fuel...
Please could someone help me?

Is there any way to give all the faction vehicles fuel?

This is what my variables look like:
Код:
GetVehicleID(vehicleid)
{
	for(new i=1; i < MAX_DVEHICLES; i++)
	{
		if(VehicleID[i] == vehicleid) return i;
	}
	return 0;
}
Код:
new vid = GetVehicleID(GetPlayerVehicleID(playerid));
vInfo[vid][vFuel];
I need this vehicle to have 100 fuel also. but cant refuel them or give them fuel...
Код:
OnGameModeInit()
{
    CreateVehicle(596, 1602.8655, -1684.0818, 5.5351, 89.8200, -1, -1, 100);
    return 1;
}
Reply
#2

pawn Код:
// Just a fast solution


new
    gVehicleFuel[MAX_VEHICLES];

public OnVehicleDeath(vehicleid, killerid)
{
    gVehicleFuel[vehicleid] = 0;
}

stock CreateVehicleEx(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, fuel)
{
    new
        vehicleid = CreateVehicle(vehicletype, x, y, z, rotation, color1, color2, respawn_delay);

    gVehicleFuel[vehicleid] = fuel;
}

stock SetVehicleFuel(vehicleid, fuel)
{
    gVehicleFuel[vehicleid] = fuel;
}

stock GetVehicleFuel(vehicleid)
{
    return gVehicleFuel[vehicleid];
}
Do your own edit.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)