Skip to content

Commit

Permalink
added ox support too
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzMuri committed Jul 15, 2024
1 parent 06ba181 commit c9a0ff0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 12 deletions.
68 changes: 58 additions & 10 deletions client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ CreateThread(function()
}
})

local props = {
'prop_gas_pump_1d',
'prop_gas_pump_1a',
'prop_gas_pump_1b',
'prop_gas_pump_1c',
'prop_vintage_pump',
'prop_gas_pump_old2',
'prop_gas_pump_old3',
}

for _, model in ipairs(props) do
-- Target Export
exports.interact:AddModelInteraction({
Expand Down Expand Up @@ -116,6 +106,64 @@ CreateThread(function()
},
})
end
elseif Config.oxtarget then
local options = {
[1] = {
name = 'cdn-fuel:options:1',
icon = "fas fa-gas-pump",
canInteract = function()
return inGasStation and hasNozzle or HasPedGotWeapon(PlayerPedId(), 883325847)
end,
label = Lang:t('info.refuel_vehicle'),
onSelect = function()
TriggerEvent('ps-fuel:client:SendMenuToServer')
end
},
}

exports.ox_target:addGlobalVehicle(options)

local modelOptions = {
[1] = {
name = "cdn-fuel:modelOptions:option_1",
event = "ps-fuel:client:takenozzle",
icon = "fas fa-gas-pump",
label = Lang:t('info.take_nozzle'),
canInteract = function(entity)
return not IsPedInAnyVehicle(PlayerPedId()) and not hasNozzle
end,
},
[2] = {
name = "cdn-fuel:modelOptions:option_2",
event = "ps-fuel:client:returnnozzle",
icon = "fas fa-gas-pump",
label = Lang:t('info.return_nozzle'),
canInteract = function(entity)
return hasNozzle and not refueling
end,
},
[3] = {
name = "cdn-fuel:modelOptions:option_3",
event = "ps-fuel:client:buyCanMenu",
icon = "fas fa-burn",
label = Lang:t('info.buy_jerry_can'),
canInteract = function(entity)
return not HasPedGotWeapon(PlayerPedId(), 883325847)
end,
},
[4] = {
name = "cdn-fuel:modelOptions:option_4",
event = "ps-fuel:client:refuelCanMenu",
icon = "fas fa-gas-pump",
label = Lang:t('info.refuel_jerry_can'),
canInteract = function(entity)
return isHoldingWeapon(GetHashKey("weapon_petrolcan"))
end,
},

}

exports.ox_target:addModel(props, modelOptions)
else
local bones = {
"petroltank",
Expand Down
4 changes: 2 additions & 2 deletions shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Config.fuelPrice = 2.0 -- fuel price in litres I guess

Config.FuelDecor = "_FUEL_LEVEL" -- don't touch

Config.interact = true

Config.interact = false
Config.oxtarget = false
-- Blacklist certain vehicles. Use names or hashes. https://wiki.gtanet.work/index.php?title=Vehicle_Models
Config.Blacklist = {
--"Adder",
Expand Down

0 comments on commit c9a0ff0

Please sign in to comment.