Help with gas vehicle - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with gas vehicle (
/showthread.php?tid=353839)
Help with gas vehicle -
PaulDinam - 24.06.2012
Код:
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;
TogglePlayerControllable(i, 0);
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
}
}
}
}
return 1;
}
How do i lower the gas lowering ?
i think it's something with
Gas[vehicle]--;?
Re: Help with gas vehicle -
Badger(new) - 24.06.2012
Hello.
This
Reduces the amount of gas in the vehicle by one.
If you want it to lower gas at a slower rate, you need to slow down the rate at which the function "CheckGas" is called.
I believe it is a timer, so search your script for
Once you have found that, you need to change the time until the timer runs out. This should be the first number in the function "SetTimer"
pawn Код:
SetTimer(Name, time(milliseconds), repeat);
Increase the "time" to make the timer end less frequently, and your fuel last longer.