How to fix this?
#1

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;
		}
	}
Reply
#2

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?
Reply
#3

Do you have any timer that destroys Progress Bars?

Also i suggest adding a return 1; at the end of each if() part
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)