vehicle fuel help
#4

You Can Try This , Not Tested But Should Work
PHP код:
new Fuel[MAX_VEHICLES];
new 
Text:FuelTxt[MAX_PLAYERS];
forward FuelUpdate();
main()
{
  for(new 
i=0;i<MAX_PLAYERS;i++)
  {
    
//--[Fuel]
    
FuelTxt[playerid] = TextDrawCreate(0,410,"Fuel:%i%");
    
TextDrawBackgroundColor(FuelTxt[playerid],0x00000033);
    
TextDrawFont(FuelTxt[playerid],3);
    
TextDrawLetterSize(FuelTxt[playerid],0.399999,1.700000);
    
TextDrawColor(FuelTxt[playerid],0xFFFFFFFF);
    
TextDrawSetShadow(FuelTxt[playerid],3);
  }
}
public 
OnGameModeInit()
{
  
//--[Fuel]
  
for(new i=0;i<MAX_VEHICLES;i++)
  {
    
Fuel[i] = 100;
  }
  return 
1;
}
public 
FuelUpdate()
{    
  for(new 
i=0;i<MAX_PLAYERS;i++)
  {
    new 
vehicleid GetPlayerVehicleID(i);
    new 
engine,lights,alarm,doors,bonnet,boot,objective;
    
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);           
    if(
GetPlayerVehicleSeat(i) == 0)
    {
      if(
vehicleid == VIP)///(VIP = CreateStaticVehicle)///---[change]
      
{
         
VehicleFuel[vehicleid]++; 
      }
      else
      {               
         
VehicleFuel[vehicleid]--;
         if(
VehicleFuel[vehicleid]<= 0)
         {
           
VehicleFuel[vehicleid] = 0;
           
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
           
VehicleInfo[vehicleid][vEngine] = 0;
           
GameTextForPlayer(i,"~w~You Are Out Of ~r~Fuel~w~!",5000,4);
         }
      }
    }
    new 
string[125];
    
format(string,sizeof string,"Fuel:%i%",VehicleFuel[vehicleid]);
    
TextDrawSetString(FuelTxt[i],string);
  }
  return 
1;

Reply


Messages In This Thread
vehicle fuel help - by SMW - 24.06.2013, 14:50
Re: vehicle fuel help - by SMW - 24.06.2013, 15:06
Re: vehicle fuel help - by horsemeat - 24.06.2013, 15:41
Re: vehicle fuel help - by Pillhead2007 - 24.06.2013, 17:00

Forum Jump:


Users browsing this thread: 1 Guest(s)