How to check if the vehicle light is on?
#1

And detect if the vehicle engine is on

Checking them all the times, and reducing the VehicleInfo[carID][vBatteryLife] each 1 minutes


• Vehicle health is more then 650
Battery Life - No loss.
• Vehicle health from 550 to 649
Engine Life - (vehicle_health_loss/125.0) = deduction from engine life.
Battery Life - (vehicle_health_loss/150.0) = deduction from battery life.
• Vehicle health from 390 to 549(Grey Smoke)
Engine Life - (vehicle_health_loss/100.0) = deduction from engine life.
Battery Life - (vehicle_health_loss/125.0) = deduction from battery life.
• Vehicle health from 250 to 389 (Black smoke)
*Vehicle engine turns off around 325-389 range*
Engine Life - (vehicle_health_loss/75.0) = deduction from engine life.
Battery Life - (vehicle_health_loss/100.0) = deduction from battery life.
On Vehicle Death
Engine Life - (-10)+random( 5 ) deducted.
Battery Life - (-10) deducted.
* vehicle_health_loss = 1000.0 - Vehicle Health. ((Example: 1000.0 - 400.0 = 600.0))

When your vehicle is damaged, under 650 health it will start making problems with the engine
Reply
#2

https://sampwiki.blast.hk/wiki/GetVehicleParamsEx
This function will get information about your vehicles lights and engine. Use repeating timer for battery and engine life reduction.
Reply
#3

Quote:
Originally Posted by Scottas
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/GetVehicleParamsEx
This function will get information about your vehicles lights and engine. Use repeating timer for battery and engine life reduction.
Hello, i made a demo for it, how to makes it be fully?

Код HTML:
forward CheckVehicleInfo(playerid);
public CheckVehicleInfo(playerid)
{
	new vehicleid = GetPlayerVehicleID(playerid);
    new Float:vehicle_checkhealth;
	GetVehicleHealth(vehicleid, vehicle_checkhealth);
	if(vehicle_checkhealth > 550 && vehicle_checkhealth < 649 && VehicleInfo[vehicleid][carBatteryL] > 5 && VehicleInfo[vehicleid][carEngineL] > 5) {
	    VehicleInfo[vehicleid][carBatteryL] -= (vehicle_health_loss/125.0);
	    VehicleInfo[vehicleid][carEngineL] -= (vehicle_health_loss/150.0);
	}
	if(vehicle_checkhealth > 390 && vehicle_checkhealth < 549 && VehicleInfo[vehicleid][carBatteryL] > 5 && VehicleInfo[vehicleid][carEngineL] > 5) {
	    VehicleInfo[vehicleid][carBatteryL] -= (vehicle_health_loss/100.0);
	    VehicleInfo[vehicleid][carEngineL] -= (vehicle_health_loss/125.0);
	}
	if(vehicle_checkhealth > 250 && vehicle_checkhealth < 389 && VehicleInfo[vehicleid][carBatteryL] > 5 && VehicleInfo[vehicleid][carEngineL] > 5) {
	    VehicleInfo[vehicleid][carBatteryL] -= (vehicle_health_loss/75.0);
	    VehicleInfo[vehicleid][carEngineL] -= (vehicle_health_loss/100.0);
	    VehicleInfo[vehicleid][carBroken] = 1;
	}
	new carsengine, carslights, carsalarm, carsdoors, carsbonnet, carsboot, carsobjective;
	GetVehicleParamsEx(vehicleid, carsengine, carslights, carsalarm, carsdoors, carsbonnet, carsboot, carsobjective);
	if(carsengine == 1) {
		VehicleInfo[vehicleid][carEngineL] --;
	    // ENGINE IS RUNNING
	}
	else {
	    // ENGINE IS NOT RUNNING
	}
	if(carslights == 1) {
		VehicleInfo[vehicleid][carBatteryL] --;
        // LIGHTS IS RUNNING
	}
	else {
        // LIGHTS IS NOT RUNNING
	}
	return 1;
}
Reply
#4

Quote:
Originally Posted by Scottas
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/GetVehicleParamsEx
This function will get information about your vehicles lights and engine. Use repeating timer for battery and engine life reduction.
Look for some documentation on SA-MP Wiki?

https://sampwiki.blast.hk/wiki/GetVehicleParamsEx
https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
https://sampwiki.blast.hk/wiki/ManualVehicleEngineAndLights
https://sampforum.blast.hk/showthread.php?tid=306311
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)