if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new carid = GetPlayerVehicleID(i), string[128];
new VehHealth;
if(VehHealth <= 251.0)
{
SetVehicleHealth(carid, 350.0);
format(string, sizeof(string), "** The vehicle engine stalls (( %s )).", GetName(i));
NearByMessage(i, SCRIPTPURPLE, string);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
}
}
No <= less than, or equal to. And because you dont use GetVehicleHealth or ANYTHING to change the health variable, it will never surpass 0. Therefore: you have scripted it to ALWAYS stall the engine. A simple fix would be to add GetVehicleHealth(carid, vHealth) before checking the health amount.
|
if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new carid = GetPlayerVehicleID(i), string[128];
new VehHealth;
GetVehicleHealth(carid, VehHealth);
if(VehHealth <= 251.0)
{
SetVehicleHealth(carid, 350.0);
format(string, sizeof(string), "** The vehicle engine stalls (( %s )).", GetName(i));
NearByMessage(i, SCRIPTPURPLE, string);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
}
}
new Float:VehHealth;