Fuel help
#1

Based on my speedometer ( Lux Speedo ) where there is not a fuel system , i wonder if there could be a system like :

pawn Код:
if GetPlayerFuel
or idk witch would be like

pawn Код:
if GetPlayerFuel(playerid, [amount left of fuel])
{
       SendClientMessage(playerid,red, "You have low fuel left");
       return1;
}
If there could be one like that , can anyone show me ? IF not , can someone help me to add an system like that in the Lux Speedo ?

Regards in advance
Reply
#2

create something like this
Код:
stock CheckGas()
{
	new string[128];
	for(new i=0;i<MAX_PLAYERS;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~Nema goriva",5000,3);
						}
				    }
		   		    if(gGas[i] == 1) {
		   		    if (IsPlayerInAnyVehicle(playerid))
		   		    {
		      			format(string, sizeof(string), "~b~~n~~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~~n~Fuel:~w~ %d%",Gas[vehicle]);
					}
		      		GameTextForPlayer(i,string,20500,3); }
					if (IsPlayerInAnyVehicle(playerid)) { Gas[vehicle]++; }
	              	Gas[vehicle]--;
		   		}
	   			else
	           	{
	              	TogglePlayerControllable(i, 0);
		        	GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~ you dont have fuel ",1500,3);
				}
			}
    	}
	}
	return 1;
on top the script
Код:
new gGas[MAX_PLAYERS];
new Gas[CAR_AMOUNT];//change to your define of max_cars
and put this to ongamemodeinit
Код:
SetTimer("CheckGas", 25000, 1);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)