Search the Community
Showing results for tags 'fuel'.
-
Hi, I Got A Script Of Fuel ,Server Side And It's Perfectly Work With My Fuel Hud ,But Vehicle Engine Does Not Stop When The Fuel Is Empty Pls Help. fuelConsumption = 0.004 fuelTable = {} function vehMove() for i,v in ipairs(getElementsByType("vehicle")) do x,y,z = getElementPosition(v) if fuelTable[v] then distance = getDistanceBetweenPoints3D(x,y,z,fuelTable[v][2],fuelTable[v][3],fuelTable[v][4]) enginePlus = 0 if getVehicleEngineState(v) then enginePlus = 0.08 end newFuel = fuelTable[v][1] - (fuelConsumption*(distance+enginePlus)) fuelTable[v] = {newFuel,x,y,z} setElementData(v, "fuel", fuelTable[v][1]) else if getElementData(v, "fuel") then fuelTable[v] = {getElementData(v, "fuel"), x, y, z} else fuelTable[v] = {100, x, y, z} end end end end setTimer(vehMove, 1000, 0)
-
Quando eu inicio o mod "[-=Fuel=-]" junto com o servidor ou seja configurado na mtaserver.conf, fica flodando esse erro no console " [-=BVC=-]\[-=Script=-]\[-=Fuel=-]\server\main.Lua:16: attempt to compare string with number " factor = 0.03 function createVehicles(player) for i,v in ipairs(getElementsByType("vehicle")) do fuel = math.random(70,80) setElementData(v, "fuel", fuel) end end function processFuel(player) for i,v in ipairs(getElementsByType("vehicle")) do local fuel = getElementData(v, "fuel") or math.random(70,80) if (getVehicleEngineState(v) and fuel > 0 ) then fuel = fuel - factor end if (fuel <= 0.99) then fuel = 0 setVehicleEngineState(v, false) end setElementData(v, "fuel", fuel) end end createVehicles() setTimer(processFuel, 1000, 0) OBS: Só da esse bug se o mod for iniciado com o servidor, se for iniciado com o painel admin. obg pela atenção!!
-
Hi guys, I want to make a fuel system. As I understand it better to do this on the server side. So that they could not change the values. Yes? And is it possible to do without getElementData? For example, using the table