[Pomoc] Gorivo

Započeo [ED] Marac, Septembar 19, 2011, 12:42:21 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: Red Line
Detaljan opis problema: Ne trosi mi se gorivo kad se vozim u autu !
Dio skripte: public CheckGas()
{
new string[256];
foreach (Player, 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~Rezervoar je skoro prazan",5000,3);
}
   }
     if(gGas[i] == 1) {
     if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || IsADjubretar(vehicle) || IsNpcVehicle(vehicle))
     {
      format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Gorivo:~w~ N/A");
}
else
{
                format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Gorivo:~w~ %d",Gas[vehicle]);
}
      GameTextForPlayer(i,string,20500,3); }
if(IsAPlane(vehicle) || IsNpcVehicle(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || IsADjubretar(vehicle) || engineOn[vehicle] == 0) { Gas[vehicle]++; }
              Gas[vehicle]--;
  }
  else
          {
              NoFuel[i] = 1;
              TogglePlayerControllable(i, 0);
        GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Nema goriva u vozilu",1500,3);
}
    }
}
return 1;
}

Neke slike/video za lakse dobivanje pomoci(neobavezno): -
Poslednja Izmena: Septembar 19, 2011, 12:43:57 POSLE PODNE od BloodMaster

McEnnedy

public CheckGas()
{
new string[256];
foreach (Player, 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~Rezervoar je skoro prazan",5000,3);
}
    }
        if(gGas[i] == 1) {
        if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || IsADjubretar(vehicle) || IsNpcVehicle(vehicle))
        {
      format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Gorivo:~w~ N/A");
}
else
{
                format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Gorivo:~w~ %d%",Gas[vehicle]);
}
      GameTextForPlayer(i,string,20500,3); }
if(IsAPlane(vehicle) || IsNpcVehicle(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || IsADjubretar(vehicle) || engineOn[vehicle] == 0) { Gas[vehicle]++; }
              Gas[vehicle]--;
    }
    else
            {
              NoFuel[i] = 1;
              TogglePlayerControllable(i, 0);
        GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Nema goriva u vozilu",1500,3);
}
    }
}
return 1;
}

Stavio sam to ali opet vehanim vozilima se ne trosi gorivo

daj komandu /veh da vidim kako ti je definirano.

McEnnedy

Evo posto i ja taj mod editujem. Evo ti cmd /veh
if(strcmp(cmd, "/veh", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if (PlayerInfo[playerid][pAdmin] < 1340)
{
    SendClientMessage(playerid, COLOR_GRAD1, "   niste ovlasteni da koristite tu komandu!");
    return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /veh [id vozila] [boja1] [boja2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, "   ID vozila ne moze biti ispod 400 ili preko 611 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /veh [id vozila] [boja1] [boja2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, "   ID Boje ne moze biti ispod 0 ili preko 126 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /veh [id vozila] [boja1] [boja2]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, "   ID Boje ne moze biti ispod 0 ili preko 126 !"); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 60000);
CreatedCars[CreatedCar] = carid;
CreatedCar ++;
format(string, sizeof(string), "   Vozilo %d je stvoreno.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}