Помогите с бензином(проверки)
#1

Здравствуйте, вот хотел сделать так чтобы если двигатель транспорта заведен, и игрока в нем нету, чтобы бензин заканчивался, вот код:
PHP код:
public CheckGas()
{
    new 
string[256];
    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(i10850.00.00.0);
                           if(
gGas[i] == 1) {
                               
GameTextForPlayer(i,"~w~~n~~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(stringsizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ N/A");
                    }
                    else
                    {
                        
format(stringsizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ %.1f",Gas[vehicle]);
                    }
                      
GameTextForPlayer(i,string,20500,3); }
                      if(
IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || engineOn[vehicle] == 0) {  }
                      else { 
Gas[vehicle] -= 0.1; }
                   }
                   else
                   {
                      
NoFuel[i] = 1;
                      
TogglePlayerControllable(i0);
                    
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
                }
            }
        }
    }
    return 
1;

а это то что сделал я:
PHP код:
public CheckGas()
{
    new 
string[256];
    
//for(new i=0;i<MAX_PLAYERS;i++)
    
for(new i=0;i<MAX_VEHICLES;i++)
    {
        if(
IsPlayerConnected(i))
           {
               
//if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
               
if(engineOn[GetPlayerVehicleID(playerid)])
               {
                   new 
vehicle GetPlayerVehicleID(i);
                if(
Gas[vehicle] >= 1)
                   {
                       if(
Gas[vehicle] <= 10)
                    {
                           
PlayerPlaySound(i10850.00.00.0);
                           if(
gGas[i] == 1) {
                               
GameTextForPlayer(i,"~w~~n~~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(stringsizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ N/A");
                    }
                    else
                    {
                        
format(stringsizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ %.1f",Gas[vehicle]);
                    }
                      
GameTextForPlayer(i,string,20500,3); }
                      if(
IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || engineOn[vehicle] == 0) {  }
                      else { 
Gas[vehicle] -= 0.1; }
                   }
                   else
                   {
                      
NoFuel[i] = 1;
                      
TogglePlayerControllable(i0);
                    
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
                }
            }
        }
    }
    return 
1;

но не работает, подскажите какую проверку можно поставить?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)