Fuel consumption system? -
Baltimore - 31.01.2015
Hello.
Do you have a fuel consumption system?
For example if I'm Sultan, I will eat X liters/100 km
If I am Infernus, I'll eat a little etc.
Take the speed of the vehicle also note ...
++
https://www.youtube.com/watch?v=hWHM90RYqjg
Re: Fuel consumption system? -
Fredx - 31.01.2015
Have you tried googling it? I've found a lot of those scripts
https://www.******.nl/webhp?sourceid...0system%20samp
Re : Fuel consumption system? -
Baltimore - 01.02.2015
I have look this:
https://www.youtube.com/watch?v=hWHM90RYqjg
How to make this system?
Re : Fuel consumption system? -
Baltimore - 07.02.2015
UP, please
Re: Fuel consumption system? -
KayJ - 07.02.2015
this may help:
http://forum.sa-mp.com/showthread.ph...93892#poststop
Re : Fuel consumption system? -
Baltimore - 07.02.2015
Yes, but it's not this system:
https://www.youtube.com/watch?v=hWHM90RYqjg
Re : Fuel consumption system? -
Baltimore - 08.02.2015
up, please.
Re: Fuel consumption system? -
CalvinC - 08.02.2015
You can use GetVehicleVelocity to check a vehicle's speed, or for acceleration, check if the player is holding W while in a vehicle with OnPlayerKeyStateChange.
Respuesta: Fuel consumption system? -
admantis - 08.02.2015
You can try making your own array with consumption rates for each vehicle, and multiply that rate by the vehicle's speed to get a resultant consumption rate.
pawn Код:
new Float: VehicleFuelConsumptionRate[][] =
{
{560.0, 1.0}, // Sultan (560) will consume at full rate (100%)
{411.0, 1.0}, // Infernus (411) will consume at full rate (100%)
{562.0, 0.5}, // Elegy (562) will consume at half rate (50%)
{565.0, 0.2} // Flash (565) will consume at very low rate (20%)
};
Float: GetVehicleConsumptionPerSecond(vehicleid)
{
new Float: rate = 1;
for(new i = 0; i != sizeof VehicleFuelConsumptionRate; i += 1)
{
if(vehicleid == floatround(VehicleFuelConsumptionRate[i][0]))
{
// We're assuming GetVehicleSpeed returns a KM/H value.
// Divide Km/h by 3600 to get KM/s.
rate = (GetVehicleSpeed(vehicleid)/3600)*VehicleFuelConsumptionRate[i][1];
break;
}
}
return rate;
}
// Somewhere else, every 1 second...
Fuel -= GetVehicleConsumptionPerSecond(vehicleid);
Please, understand you have to put your own logic and work into this.
Re : Fuel consumption system? -
Baltimore - 08.02.2015
My GetVehicleSpeed:
pawn Код:
forward GetVehicleSpeed(vehicleid);
public GetVehicleSpeed(vehicleid)
{
new Float:X,
Float:Y,
Float:Z;
GetVehicleVelocity(vehicleid, X, Y, Z);
return floatround(floatsqroot(X * X + Y * Y + Z * Z) * 180);
}
It's good?
By cons I do not understand the code.
Per second, the Sultan will lose how many liters? It is with the 100% that I'm a bit stuck.