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) On 13/03/2020 at 19:09, 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. Expand 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 On 13/03/2020 at 19:53, Simple. said: local BlockedModel = { -- [Car id] = true, [411] = true, [457] = true, } if not BlockedModel[getElementModel ( v )] then -- Bla Bla Bla end Expand It doesn't work... Where should i paste this ? On 13/03/2020 at 19:53, Simple. said: local BlockedModel = { -- [Car id] = true, [411] = true, [457] = true, } if not BlockedModel[getElementModel ( v )] then -- Bla Bla Bla end Expand What about this message ? https://prnt.sc/rg4d33 Link to comment
Simple. Posted March 14, 2020 Share Posted March 14, 2020 On 14/03/2020 at 03:28, lockdw said: It doesn't work... Where should i paste this ? What about this message ? https://prnt.sc/rg4d33 Expand 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 On 14/03/2020 at 11:59, 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) Expand Thank you my friend On 14/03/2020 at 11:59, 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) Expand Thank you my friend On 13/03/2020 at 21:57, 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. Expand This time Simple solved my problem, but thank you dude. I remember you from a week ago hahaha On 14/03/2020 at 11:59, 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) Expand Thank you my friend On 13/03/2020 at 21:57, 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. Expand 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