D-Board
#1

first of all sory for my bad english!

i have one problem can you pleas help me the problem is:
my FUEL dont work always is 100 so i dont know how to fix that
but km/h is ok..just fuel is only 100
there is cod whats is wrong?

Sory for my bad english again!

cod:
Code:
public CheckStatus()
{
	foreach (Player, i)
	{
			if(IsPlayerInAnyVehicle(i))
			{
				if(TextShow[i] == false)
				{
				    TextDrawShowForPlayer(i, Text:Black0);
				    TextDrawShowForPlayer(i, Text:Black1);
				    TextDrawShowForPlayer(i, Text:Black2);
				    TextDrawShowForPlayer(i, Text:Black3);
				    TextDrawShowForPlayer(i, Text:LightBlack);
				    TextShow[i] = true;
				}
			    new String[128];
		        new Float:X, Float:Y, Float:Z, Float:Speed;
		        new vehicle = GetPlayerVehicleID(i);
                GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
                Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)),  floatpower(Z, 2))), 100.0);
				format(String,sizeof(String),"~b~ Tabla~n~~r~Gorivo: ~w~%i~n~~r~km/h: ~w~%i", Gas[vehicle], floatround(Speed*2, floatround_floor));
				if(VHSCreated[i] == true)
				{
					TextDrawDestroy(VHS[i]);
				}
				VHS[i] = TextDrawCreate(541.000000,137.000000,String);
				TextDrawAlignment(VHS[i],0);
				TextDrawBackgroundColor(VHS[i],0x000000ff);
				TextDrawFont(VHS[i],1);
				TextDrawLetterSize(VHS[i],0.259999,1.000000);
				TextDrawColor(VHS[i],0xffffffff);
				TextDrawSetOutline(VHS[i],1);
				TextDrawSetProportional(VHS[i],1);
				TextDrawSetShadow(VHS[i],1);
            	TextDrawShowForPlayer(i, VHS[i]);
            	VHSCreated[i] = true;

			}
			else
			{
			    if(TextShow[i] == true)
			    {
					TextDrawHideForPlayer(i, Text:Black0);
					TextDrawHideForPlayer(i, Text:Black1);
					TextDrawHideForPlayer(i, Text:Black2);
					TextDrawHideForPlayer(i, Text:Black3);
					TextDrawHideForPlayer(i, Text:LightBlack);
					TextDrawHideForPlayer(i, Text:VHS[i]);
				    TextShow[i] = false;
				}
			}
		}
}
ah yes TABLA=D-Board Gorivo=fuel


cod2: if you need that for help

Code:
public CheckGas()
{
	new string[256];
	foreach (Player, 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] == 0) {
		   				GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Rezervoar je skoro prazan",5000,3);
					}
			    }
	   		    if(gGas[i] == 1) {
	   		    if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || IsADjubretar(vehicle) || IsNpcVehicle(vehicle))
	   		    {
	      			format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Gorivo:~w~ N/A");
				}
				else
				{
                	format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Gorivo:~w~ %d%",Gas[vehicle]);
				}
	      		GameTextForPlayer(i,string,20500,3); }
				if(IsAPlane(vehicle) || IsNpcVehicle(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || IsADjubretar(vehicle) || 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~Nema goriva u vozilu",1500,3);
			}
    	}
	}
	return 1;
}

public Fillup()
{
	foreach (Player, i)
	{
	    new VID;
	    new FillUp;
	    new string[256];
	    VID = GetPlayerVehicleID(i);
	    FillUp = GasMax - Gas[VID];
		if(Refueling[i] == 1)
	    {
	        if(IsACopCar(VID) || IsAnFbiCar(VID) || IsAnAmbulance(VID) || IsNgCar(VID) || IsAGovernmentCar(VID) || IsAHspdCar(VID))
	        {
	            Gas[VID] += FillUp;
	            FillUp = FillUp * SBizzInfo[3][sbEntranceCost];
	            format(string,sizeof(string),"* Vozilo je napunjeno za: $%d.",FillUp);
    			SendClientMessage(i,COLOR_WHITE,string);
    			GameTextForPlayer(i, "~w~Uprava je platila za gorivo.", 5000, 1);
				//SBizzInfo[3][sbTill] += FillUp;
				//ExtortionSBiz(3, FillUp);
				Refueling[i] = 0;
				TogglePlayerControllable(i, 1);
	        }
	        else
	        {
				if(GetPlayerMoney(i) >= FillUp+4)
				{
					Gas[VID] += FillUp;
					FillUp = FillUp * SBizzInfo[3][sbEntranceCost];
				   	format(string,sizeof(string),"* Vozilo je napunjeno za: $%d.",FillUp);
				   	SendClientMessage(i,COLOR_WHITE,string);
					SafeGivePlayerMoney(i, - FillUp);
					SBizzInfo[3][sbTill] += FillUp;
					ExtortionSBiz(3, FillUp);
					Refueling[i] = 0;
					TogglePlayerControllable(i, 1);
				}
			   	else
			   	{
			   	   	format(string,sizeof(string),"* Nemate dovoljno novca za gorivo, racun je $%d .",FillUp);
				   	SendClientMessage(i,COLOR_WHITE,string);
				   	TogglePlayerControllable(i, 1);
				}
		 	}
		}
	}
	return 1;
}
Reply
#2

Pleas anyone help me
Reply
#3

Do you got
pawn Code:
SetTimer("CheckGas", 1000, true);
under your OnGameModeInit ?
Reply
#4

no i dont have but i have this?
Code:
checkgastimer = SetTimer("CheckGas", RunOutTime, 1);
is maybe this problem?
Reply
#5

Well the variables seems to work okay, What do you use to display the gas? A textdraw or smthing?
Reply
#6

textdraw for player.. you can se up... the first one..
i dont know why fuel is always 100..but km/h is working normaly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)