need a bit help with GameTextForPlayer
#1

So i have a problem i dont know how to solve so i hope you may help me with this.

the thing i need help with is Speedo meter and fuel

When i enter a vehicle the Speed pops up and after a while the fuel pops up and just dissipairs how to fix this so both is visible

Here is the fuel code

Код:
		  		  {
		   			format(string, sizeof(string), "~b~~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~Fuel:~w~ %d%",Gas[vehicle]);
					}
		   		GameTextForPlayer(i,string,20500,3); }
and here is the speedo code
Код:
					{
							if(distance <10)
							{
    format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~speed :  ~w~%.0f",distance);
							}
							if(distance > 10 && distance < 100)
							{
    format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~speed : ~w~%.0f",distance);
							}
							if(distance > 100)
							{
    format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~speed : ~w~%.0f",distance);
							}
							GameTextForPlayer(i, string, 2000, 5);
						}
Reply
#2

Код:
GameTextForPlayer(i, string, 2000, 5);
i think in this line the 5 is seconds it stays up so im not sure how to change it but the problem is there.
Reply
#3

Quote:
Originally Posted by Mr_FinnigaN
Код:
GameTextForPlayer(i, string, 2000, 5);
i think in this line the 5 is seconds it stays up so im not sure how to change it but the problem is there.
No, its 2 seconds! Read the timer, not the text style!
Reply
#4

hmm so what shuld i do
Reply
#5

Quote:
Originally Posted by Cake.
hmm so what shuld i do
Should wait a while, so maybe a expert can come and see it
Im still learning how to script and I can only about 40% of the functions, so I can probaly not help you
Reply
#6

okay thanks
Reply
#7

Make a timer to update your game text.
Reply
#8

Quote:
Originally Posted by Cake.
So i have a problem i dont know how to solve so i hope you may help me with this.

the thing i need help with is Speedo meter and fuel

When i enter a vehicle the Speed pops up and after a while the fuel pops up and just dissipairs how to fix this so both is visible

Here is the fuel code

Код:
		 		  {
		   			format(string, sizeof(string), "~b~~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~Fuel:~w~ %d%",Gas[vehicle]);
					}
		   		GameTextForPlayer(i,string,20500,3); }
and here is the speedo code
Код:
					{
							if(distance <10)
							{
    format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~speed : ~w~%.0f",distance);
							}
							if(distance > 10 && distance < 100)
							{
    format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~speed : ~w~%.0f",distance);
							}
							if(distance > 100)
							{
    format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~speed : ~w~%.0f",distance);
							}
							GameTextForPlayer(i, string, 2000, 5);
						}
Okay, I know whats wrong.
Change:
pawn Код:
GameTextForPlayer(i,string,20500,3); }
And:
pawn Код:
GameTextForPlayer(i, string, 2000, 5);
To:
pawn Код:
GameTextForPlayer(i,string,99999999,3); }
And:
pawn Код:
GameTextForPlayer(i, string, 99999999, 5);
But after a long while, it will disapear again. Then just change the numbers I changed and make them higher. Hope this will help you
Reply
#9

dint work
Reply
#10

Quote:
Originally Posted by Cake.
dint work
What happend?
Reply
#11

Show us all your code, then we may help you, becouse I think, that problem is not at GameTextForPlayer.
Reply
#12

Код:
public OtherTimer()
{
  new Float:maxspeed = 500.0;
  new plname[MAX_PLAYER_NAME];
	new string[256];
	new Float:oldposx, Float:oldposy, Float:oldposz
  for(new i = 0; i < MAX_PLAYERS; i++)
	{
	  if(IsPlayerConnected(i))
	  {
	    if (GetPlayerState(i) == 1) CheckForWalkingTeleport(i); // IF THE PLAYER IS IN A TELEPORT ZONE, TELEPORT THEM
	    new vehicleid = GetPlayerVehicleID(i);
      if(SafeTime[i] > 0)
			{
				SafeTime[i]--;
			}
			if(SafeTime[i] == 1)
			{
				if(gPlayerAccount[i] == 1 && gPlayerLogged[i] == 0)
				{
					SendClientMessage(i, COLOR_WHITE, "HINT: You can now login by typing /login <password>");
				}
			}
		  if(GetPlayerState(i) == 2)
		  {
				GetPlayerPos(i, TelePos[i][3], TelePos[i][4], TelePos[i][5]);
				if(TelePos[i][5] > 550.0)
				{
					TelePos[i][0] = 0.0;
					TelePos[i][1] = 0.0;
				}
				if(TelePos[i][0] != 0.0)
				{
					new Float:xdist = TelePos[i][3]-TelePos[i][0];
					new Float:ydist = TelePos[i][4]-TelePos[i][1];
					new Float:sqxdist = xdist*xdist;
					new Float:sqydist = ydist*ydist;
					new Float:distance = (sqxdist+sqydist)/31;
						if ((BusrouteEast[i][0] == 0 && BusrouteWest[i][0] == 0))
					{
						if(gSpeedo[i] == 2)
						{
							if(distance <10)
							{
    format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~speed :  ~w~%.0f",distance);
							}
							if(distance > 10 && distance < 100)
							{
    format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~speed : ~w~%.0f",distance);
							}
							if(distance > 100)
							{
    format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~speed : ~w~%.0f",distance);
							}
							GameTextForPlayer(i, string, 99999999, 5);
						}
						if(distance > maxspeed && PlayerInfo[i][pAdmin] < 1)
						{
							new tmpcar = GetPlayerVehicleID(i);
							if(!IsAPlane(tmpcar))
							{
								GetPlayerName(i, plname, sizeof(plname));
								format(string, 256, "AdmWarning: [%d]%s %.0f speed",i,plname,distance);
								ABroadCast(COLOR_YELLOW,string,1);
							}
						}
					}
				}
				if(TelePos[i][5] < 550.0 && TelePos[i][3] != 0.0)
				{
					TelePos[i][0] = TelePos[i][3];
					TelePos[i][1] = TelePos[i][4];
				}
			}
		  if(PlayerInfo[i][pLocal] != 255 && PlayerInfo[i][pInt] != 0)
			{
				new house = PlayerInfo[i][pLocal];
				GetPlayerPos(i, oldposx, oldposy, oldposz);
				if(oldposz != 0.0)
				{
					if(oldposz < 600.0)
Код:
public CheckGas()
{
	new string[256];
	new playerid
	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] == 0) {
			  				GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~Fuel is low",5000,3);
						}
				  }
		  		  if(gGas[i] == 1) {
		  		  if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle))
		  		  {
		   			format(string, sizeof(string), "~b~~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~Fuel:~w~ %d%",Gas[vehicle]);
					}
		   		GameTextForPlayer(i,string,99999999,3); }
					if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || engineOn[vehicle] == 0) { Gas[vehicle]++; }
	       	Gas[vehicle]--;
		  		}
	  			else
	      	{
	       	NoFuel[i] = 1;
	       	TogglePlayerControllable(i, 0);
		    	GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
				}
			}
  	}
	}
	return 1;
}
Reply
#13

Cmon i need this help badly
Reply
#14

Help?
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)