Код:
public CheckGas()
{
new string[256];
for(new i=0;i<PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(i);
if(Gas[vehicle] >= 1)
{
if(Gas[vehicle] > 100)
Gas[vehicle] = 100;
if(Gas[vehicle] <= 10)
{
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
if(gGas[i] == 0) {
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel is low",5000,3);
}
}
if(gGas[i] == 1) {
if(IsAPlane(vehicle) || IsABoat(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || GetVehicleModel(vehicle) == 481)
{
format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ N/A");
}
else
{
format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ %d%",Gas[vehicle]);
}
GameTextForPlayer(i,string,20500,3); }
if(IsAPlane(vehicle) || IsABoat(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || GetVehicleModel(vehicle) == 481 || engineOn[vehicle] == 0) { Gas[vehicle]++; }
Gas[vehicle]--;
}
else
{
NoFuel[i] = 1;
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicle,0,0,alarm,doors,bonnet,boot,objective);
TogglePlayerControllable(i, 0);
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
}
}
}
}
return 1;
}