lockdw Posted March 13, 2020 Share Posted March 13, 2020 Guys, how can i exclude some vehicles from the fuel script? Like, exclude the job's cars from the fuel system ? http://www.mediafire.com/file/gxw58nfvpawx72a/ir-gasolina.zip/file Here's the script link. Link to comment
Simple. Posted March 13, 2020 Share Posted March 13, 2020 (edited) 47 minutes ago, lockdw said: Guys, how can i exclude some vehicles from the fuel script? Like, exclude the job's cars from the fuel system ? http://www.mediafire.com/file/gxw58nfvpawx72a/ir-gasolina.zip/file Here's the script link. local BlockedModel = { -- [Car id] = true, [411] = true, [457] = true, } if not BlockedModel[getElementModel ( v )] then -- Bla Bla Bla end Edited March 13, 2020 by Simple. Link to comment
The_GTA Posted March 13, 2020 Share Posted March 13, 2020 I suggest that you tell the client whenever he enters a vehicle whether it is a job car or not from serverside. Then you start drawing the HUD after you received that server event. Your script seems pretty big but it should not be too hard. Link to comment
lockdw Posted March 14, 2020 Author Share Posted March 14, 2020 7 hours ago, Simple. said: local BlockedModel = { -- [Car id] = true, [411] = true, [457] = true, } if not BlockedModel[getElementModel ( v )] then -- Bla Bla Bla end It doesn't work... Where should i paste this ? 7 hours ago, Simple. said: local BlockedModel = { -- [Car id] = true, [411] = true, [457] = true, } if not BlockedModel[getElementModel ( v )] then -- Bla Bla Bla end What about this message ? https://prnt.sc/rg4d33 Link to comment
Simple. Posted March 14, 2020 Share Posted March 14, 2020 8 hours ago, lockdw said: It doesn't work... Where should i paste this ? What about this message ? https://prnt.sc/rg4d33 server/main.Lua factor = 0.03 local BlockedModel = { -- [Car id] = true, [411] = true, [457] = true, } 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 if not BlockedModel[getElementModel ( v )] then 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 end createVehicles() setTimer(processFuel, 1000, 0) Link to comment
lockdw Posted March 14, 2020 Author Share Posted March 14, 2020 5 hours ago, Simple. said: server/main.Lua factor = 0.03 local BlockedModel = { -- [Car id] = true, [411] = true, [457] = true, } 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 if not BlockedModel[getElementModel ( v )] then 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 end createVehicles() setTimer(processFuel, 1000, 0) Thank you my friend 5 hours ago, Simple. said: server/main.Lua factor = 0.03 local BlockedModel = { -- [Car id] = true, [411] = true, [457] = true, } 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 if not BlockedModel[getElementModel ( v )] then 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 end createVehicles() setTimer(processFuel, 1000, 0) Thank you my friend 19 hours ago, The_GTA said: I suggest that you tell the client whenever he enters a vehicle whether it is a job car or not from serverside. Then you start drawing the HUD after you received that server event. Your script seems pretty big but it should not be too hard. This time Simple solved my problem, but thank you dude. I remember you from a week ago hahaha 5 hours ago, Simple. said: server/main.Lua factor = 0.03 local BlockedModel = { -- [Car id] = true, [411] = true, [457] = true, } 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 if not BlockedModel[getElementModel ( v )] then 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 end createVehicles() setTimer(processFuel, 1000, 0) Thank you my friend 19 hours ago, The_GTA said: I suggest that you tell the client whenever he enters a vehicle whether it is a job car or not from serverside. Then you start drawing the HUD after you received that server event. Your script seems pretty big but it should not be too hard. This time Simple solved my problem, but thank you dude. I remember you from a week ago hahaha Link to comment
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