How to fix this? - 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: How to fix this? (
/showthread.php?tid=493161)
How to fix this? -
TheSnaKe - 07.02.2014
Hello guys, i have a command that appears and disappears the fuel bar, so when some type the command to be appear it appears only 1 second and then disappears , how can i make it to appear for ever? Please someone help me i really need it.
Code:
Код:
}
else if(strcmp(params, "fuel", true) == 0 && IsPlayerInAnyVehicle(playerid))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 481 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 509 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
if(GetPVarInt(playerid, "fuelonoff") == 0)
{
SendClientMessageEx(playerid, COLOR_WHITE, "You have turned on the fuel indicator (green bar).");
SetPVarInt(playerid, "fuelonoff", 1);
FuelBar[playerid] = CreateProgressBar(548.00, 26.00, 57.50, 3.20, 866792447, 100.0);
textdrawscount++;
SetProgressBarValue(FuelBar[playerid], VehicleFuel[GetPlayerVehicleID(playerid)]);
ShowProgressBarForPlayer(playerid, FuelBar[playerid]);
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You have turned off the fuel indicator (green bar).");
SetPVarInt(playerid, "fuelonoff", 0);
DestroyProgressBar(FuelBar[playerid]);
textdrawscount--;
FuelBar[playerid] = INVALID_BAR_ID;
}
}
Re: How to fix this? -
dominik523 - 07.02.2014
I think the problem is somewhere else in your code, this looks just fine. Do you have some timers where you have done something with fuel bar?
Re: How to fix this? -
Kirollos - 07.02.2014
Do you have any timer that destroys Progress Bars?
Also i suggest adding a return 1; at the end of each if() part
Re: How to fix this? -
TheSnaKe - 07.02.2014
Okay, guys thanks you was right the timer had a problem but it's fixed now and working fine, thanks for telling me where was the problem.