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. |
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; }
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. |