30.10.2015, 15:44
(
Последний раз редактировалось Scottylad; 31.10.2015 в 01:20.
)
Nevermind, going to re-do the system from scratch to make sure there is no bugs!
if(!IsAFactionVehicle(vehicleid))
{
if(Gas[vehicleid] < 1.0)
{
SendClientMessage(playerid, COLOR_RED, "[!ERROR] Your vehicle is out of fuel, it won't start!");
}
}
stock IsAFactionVehicle(vehicleid))
{
if(vehicleid == ... || vehicleid == ...) return true;
return false;
}
forward SetVehicleEngine(vehicleid, playerid);
public SetVehicleEngine(vehicleid, playerid)
{
new string[128];
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SERVER] Vehicle engine stopped successfully.");
arr_Engine{vehicleid} = 0;
}
else if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
{
new
Float: f_vHealth;
GetVehicleHealth(vehicleid, f_vHealth);
if(f_vHealth < 350.0) return SendClientMessage(playerid, COLOR_RED, "The car won't start - it's totalled!");
if(VehicleFuel[vehicleid] <= 1.0) return SendClientMessage(playerid, COLOR_RED, "The car won't start - there's no fuel in the tank!");
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SERVER] Vehicle engine started successfully (/car engine to turn the engine off).");
arr_Engine{vehicleid} = 1;
}
return 1;
}