Help with: /checkfuel
#1

Hey.. I'm trying to make a command that show your fuel but only you can see how much fuel left and the msg sent to you like a normal msg.. no textdraw..

this is what i got.. but it aint working ;/

command

Код:
	if(strcmp(cmd, "/checkfuel", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (IsPlayerInAnyVehicle(playerid))
			{
				gGas[playerid] = 1;
				format(string, sizeof(string), "* %s looks at his fuel guage.", sendername);
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			}
			else
			{
				SendClientMessage(playerid, COLOR_YELLOW, "You need to be in a vehicle for it!");
			}
		}
		return 1;
	}
the part of the fuel show.. its from GF script.. so there are more things above and under..

Код:
ew vehicle = GetPlayerVehicleID(i);
	        	if(Gas[vehicle] >= 1)
		   		{
		   		    if(Gas[vehicle] <= 10) { PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0); }
		   		    if(gGas[i] == 1) {
		      		format(string, sizeof(string), "Fuel left: %d%",Gas[vehicle]);
			  		SendClientMessage(i, COLOR_LIGHTRED, "string"); }
					if(IsAPlane(vehicle) || IsABoat(vehicle)) { Gas[vehicle]++; }
	              	Gas[vehicle]--;
		   		}
Reply
#2

You don't update any textdraw there.. use
pawn Код:
TextDrawSetString(Text:yourtextdraw, string[]);
Reply
#3

I dont want it in textdraw.. I said.. no textdraw
Reply
#4

ow ok I misunderstood sorry
Reply
#5

pawn Код:
format(string, sizeof(string), "Fuel left: %d%",Gas[vehicle]);
%d%? it should be %d
Reply
#6

I'm using GF script.. and that's the way its there..
and its working with that %d%...
but right now i made it work..
when you write
/checkfuel its telling you how much left.. but it taking like 5 secs till it show up..
Reply
#7

Bump..
still couldnt figure it out.. I'm still stuck on that problem:

After I use the command /checkfuel
taking like 5 secs till it show up....


I got this so far:

Код:
public CheckGas()
{
 	new string[50];
	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] > 100)
		   		    {
						Gas[vehicle] = 100;
					}
		   		    if(Gas[vehicle] <= 10) { PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0); }
		   		    if(IsPlayerInAnyVehicle(i)) {
		   		    if(gGas[i] == 1)
					{
 						format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel LEFT: ~w~%d%", Gas[vehicle]);
		  				GameTextForPlayer(i,string,5000,3);
		  				gGas[i] = 0;
			  		}
					if(IsAPlane(vehicle) || IsABoat(vehicle)) { Gas[vehicle]++; }
	              	Gas[vehicle]--;
		   		} }
	   			else
	           	{
	              	NoFuel[i] = 1;
	              	TogglePlayerControllable(i, 0);
		        	GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle~n~Use /exit to leave the vehicle",1500,3);
				}
			}
    	}
	}
	return 1;
}
Код:
	if(strcmp(cmd, "/checkfuel", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (IsPlayerInAnyVehicle(playerid))
			{
			    GetPlayerName(playerid, sendername, sizeof(sendername));
				gGas[playerid] = 1;
				format(string, sizeof(string), "* %s looks at his fuel guage.", sendername);
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			}
			else
			{
				SendClientMessage(playerid, COLOR_YELLOW, "You need to be in a vehicle for it!");
			}
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)