+William Posted March 28, 2019 Posted March 28, 2019 Tenho um script aqui de gasolina, só ele a bicicleta ta com gasolina, como faço para colocar, para não reconhecer tais veiculos? Qual função eu posso usar? factor = 0.03 function createVehicles(player) for i,v in ipairs(getElementsByType("vehicle")) do fuel = math.random(10,25) 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(10,25) 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)
Other Languages Moderators Lord Henry Posted March 28, 2019 Other Languages Moderators Posted March 28, 2019 factor = 0.03 function createVehicles(player) for i,v in ipairs(getElementsByType("vehicle")) do if getVehicleType (v) ~= "BMX" then fuel = math.random(10,25) setElementData(v, "fuel", fuel) end end end function processFuel(player) for i,v in ipairs(getElementsByType("vehicle")) do if getVehicleType (v) ~= "BMX" then local fuel = getElementData(v, "fuel") or math.random(10,25) 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 end createVehicles() setTimer(processFuel, 1000, 0) Colocando a verificação do tipo de veículo. Onde só funciona se o tipo for diferente de "BMX" (bicicleta) 1
+William Posted March 28, 2019 Author Posted March 28, 2019 (edited) Ok, consegui, obrigado @Lord Henry! Edited March 28, 2019 by +William
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now