22.05.2014, 11:03
I put a system engine, but when I stop the engine, the fuel decreases 3-4% then increase at 100%.
Exmeple: i have fuel 80%, when i stop the engine, decreases at 76% then increase at 100%. Why?
Exmeple: i have fuel 80%, when i stop the engine, decreases at 76% then increase at 100%. Why?
pawn Код:
if (newkeys & KEY_NO)
{
if(GetPlayerState(playerid) == 2)
{
//This part here is defining the vehicle ID that the player is currently in.
new engine, lights, alarm, doors, bonnet, boot, objective; //This is defining the vehicles current items.
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);//This is checking the vehicle's engine/lights/alarm/doors/bonnet/boot/objective status.
if(Engine[vehicle] == 0) //This is checking if the engine of the vehicle, is turned off or not.
{
Engine[vehicle] = 1; //This is setting the global variable that you created at the beginning.
SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0); //This is setting the vehicles engine to be on.
GameTextForPlayer(playerid, "~w~ENGINE ~g~ON...", 1000, 6);
}
else
{
Engine[vehicle] = 0; //This is setting the global variable that you created at the beginning.
SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0); //This is setting the vehicles engine to be on.
GameTextForPlayer(playerid, "~w~ENGINE ~r~OFF...", 1000, 6);
}
}
}
pawn Код:
public CheckGas()
{
new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(i);
if(Gas[vehicle] >= 1)
{
if(Gas[vehicle] <= 10) { PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0); }
if(gGas[i] == 1) {
format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ %d% %",Gas[vehicle]);
GameTextForPlayer(i,string,15500,3); }
if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABmx(vehicle)) { Gas[vehicle]++; }
Gas[vehicle]--;
}
else
{
NoFuel[i] = 1;
TogglePlayerControllable(i, 0);
GameTextForPlayer(i,"~r~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle~n~Use /exit to leave the vehicle",1500,3);
}
}
}
}
return 1;
}