[Pomoc]Tabla sa gorivom

Započeo SteXi.ılllı., Februar 26, 2011, 12:53:09 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim:FactionGame>Editujem
Detaljan opis problema:Ovako dodao sam FS brzinometar sa gorivom ali gorivo se smanjuje za 1 litar svake sekunde pa ne znam kako to da smanjim..eo ceo FS
#include "a_samp.inc"

#define FUEL_UPDATE_TIME (900)

forward PlayerVehicleFuelUpdate(playerid);

enum E_VEHICLE_INFO { bool:vehicle_processed, Float:vehicle_fuel, FuelUpdateTimer }
new VehicleInfo[MAX_VEHICLES][E_VEHICLE_INFO];

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(VehicleInfo[vehicleid][vehicle_processed] == false)
{
    VehicleInfo[vehicleid][vehicle_processed] = true;
    VehicleInfo[vehicleid][vehicle_fuel] = 100.00;
}
else
{
    if(VehicleInfo[vehicleid][vehicle_fuel] == 0.00)
{
        TogglePlayerControllable(playerid, true);
RemovePlayerFromVehicle(playerid);

GameTextForPlayer(playerid, "~r~Out of fuel!", 1000, 4);
}
}

VehicleInfo[vehicleid][FuelUpdateTimer] = SetTimerEx("PlayerVehicleFuelUpdate", FUEL_UPDATE_TIME, 1, "i", playerid);
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(VehicleInfo[vehicleid][vehicle_fuel] == 0.00)
    {
        TogglePlayerControllable(playerid, true);
RemovePlayerFromVehicle(playerid);
    }
   
return KillTimer(VehicleInfo[vehicleid][FuelUpdateTimer]);
}

public PlayerVehicleFuelUpdate(playerid)
{
new const vehicleid = GetPlayerVehicleID(playerid);

new Float:memory[3]={0.00,0.00,0.00 }, result_speed=0;
GetVehicleVelocity(vehicleid,memory[0],memory[1],memory[2]);

result_speed = floatround(floatround(floatsqroot(((memory[0]*memory[0])+(memory[1]*memory[1]))+(memory[2]*memory[2]))*(136.666667),floatround_round)*(1.609344));

if(result_speed)
{
    new _random = random(100); while(_random < 50) _random = random(100); new val[4]; format(val, sizeof(val), "0.%i", _random);

if(floatsub(VehicleInfo[vehicleid][vehicle_fuel], floatstr(val)) > 0.00)
{
    VehicleInfo[vehicleid][vehicle_fuel] = floatsub(VehicleInfo[vehicleid][vehicle_fuel], floatstr(val));
}
else
{
    VehicleInfo[vehicleid][vehicle_fuel] = 0.00;

TogglePlayerControllable(playerid, false);
    RemovePlayerFromVehicle(playerid);
    TogglePlayerControllable(playerid, true);
   
    GameTextForPlayer(playerid, "~r~Out of fuel!", 1000, 4);
}
}
return 1;
}

forward Float:GetVehicleFuelData(vehicleid);
public Float:GetVehicleFuelData(vehicleid)
{
return Float:VehicleInfo[vehicleid][vehicle_fuel];
}

Dio skripte:/
Neke slike/video za lakse dobivanje pomoci(neobavezno):/[/b]

N0NE

#define FUEL_UPDATE_TIME (900) ovo povecaj na kolko hoces mili sekundi i bice bolje