Skip to content

Commit

Permalink
feat(2.1.9 | Fix OX_Target AddTargetModel Error)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnelyk committed Aug 19, 2023
1 parent abb57df commit f57519a
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 81 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Codine Development Fuel Script Banner](https://i.imgur.com/qVOMMvW.png)

# _CDN-Fuel (2.1.8)_
# _CDN-Fuel (2.1.9)_

A highly in-depth fuel system for **FiveM** with support for the **QBCore Framework & QBox Remastered**.

Expand Down
56 changes: 43 additions & 13 deletions client/electric_cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -726,15 +726,43 @@ if Config.ElectricVehicleCharging then
end
end)

-- Target
local TargetResource = Config.TargetResource
if Config.TargetResource == 'ox_target' then
TargetResource = 'qb-target'
end

exports[TargetResource]:AddTargetModel('electric_charger', {
options = {
{
-- Target --
if Config.TargetResource ~= "ox_target" then
-- This assumes your target resource uses the same format as qb-target or has an auto converter.
exports[Config.TargetResource]:AddTargetModel('electric_charger', {
options = {
{
num = 1,
type = "client",
event = "cdn-fuel:client:grabelectricnozzle",
icon = "fas fa-bolt",
label = Lang:t("grab_electric_nozzle"),
canInteract = function()
if not IsHoldingElectricNozzle() and not IsPedInAnyVehicle(PlayerPedId()) then
return true
end
end
},
{
num = 2,
type = "client",
event = "cdn-fuel:client:returnnozzle",
icon = "fas fa-hand",
label = Lang:t("return_nozzle"),
canInteract = function()
if IsHoldingElectricNozzle() and not refueling then
return true
end
end
},
},
distance = 2.0
})
else
-- Using OX_Target:
local modelOptions = {
[1] = {
name = "cdn-fuel:modelOptions:electric:option_1",
num = 1,
type = "client",
event = "cdn-fuel:client:grabelectricnozzle",
Expand All @@ -746,7 +774,8 @@ if Config.ElectricVehicleCharging then
end
end
},
{
[2] = {
name = "cdn-fuel:modelOptions:electric:option_2",
num = 2,
type = "client",
event = "cdn-fuel:client:returnnozzle",
Expand All @@ -758,7 +787,8 @@ if Config.ElectricVehicleCharging then
end
end
},
},
distance = 2.0
})
}

exports.ox_target:addModel(props, modelOptions)
end
end
134 changes: 69 additions & 65 deletions client/fuel_cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2622,73 +2622,77 @@ CreateThread(function()

exports.ox_target:addGlobalVehicle(options)

exports['qb-target']:AddTargetModel(props, {
options = {
{
num = 1,
type = "client",
event = "cdn-fuel:client:grabnozzle",
icon = "fas fa-gas-pump",
label = Lang:t("grab_nozzle"),
canInteract = function()
if PlayerInSpecialFuelZone then return false end
if not IsPedInAnyVehicle(PlayerPedId()) and not holdingnozzle and not HoldingSpecialNozzle and inGasStation == true and not PlayerInSpecialFuelZone then
return true
end
end,
},
{
num = 2,
type = "client",
event = "cdn-fuel:client:purchasejerrycan",
icon = "fas fa-fire-flame-simple",
label = Lang:t("buy_jerrycan"),
canInteract = function()
if not IsPedInAnyVehicle(PlayerPedId()) and not holdingnozzle and not HoldingSpecialNozzle and inGasStation == true then
return true
end
end,
},
{
num = 3,
type = "client",
event = "cdn-fuel:client:returnnozzle",
icon = "fas fa-hand",
label = Lang:t("return_nozzle"),
canInteract = function()
if holdingnozzle and not refueling then
return true
end
end,
},
{
num = 4,
type = "client",
event = "cdn-fuel:client:grabnozzle:special",
icon = "fas fa-gas-pump",
label = Lang:t("grab_special_nozzle"),
canInteract = function()
if Config.FuelDebug then print("Is Player In Special Fuel Zone?: "..tostring(PlayerInSpecialFuelZone)) end
if not HoldingSpecialNozzle and not IsPedInAnyVehicle(PlayerPedId()) and PlayerInSpecialFuelZone then
return true
end
end,
},
{
num = 5,
type = "client",
event = "cdn-fuel:client:returnnozzle:special",
icon = "fas fa-hand",
label = Lang:t("return_special_nozzle"),
canInteract = function()
if HoldingSpecialNozzle and not IsPedInAnyVehicle(PlayerPedId()) then
return true
end
local modelOptions = {
[1] = {
name = "cdn-fuel:modelOptions:option_1",
num = 1,
type = "client",
event = "cdn-fuel:client:grabnozzle",
icon = "fas fa-gas-pump",
label = Lang:t("grab_nozzle"),
canInteract = function()
if PlayerInSpecialFuelZone then return false end
if not IsPedInAnyVehicle(PlayerPedId()) and not holdingnozzle and not HoldingSpecialNozzle and inGasStation == true and not PlayerInSpecialFuelZone then
return true
end
},
end,
},
distance = 2.0
})
[2] = {
name = "cdn-fuel:modelOptions:option_2",
num = 2,
type = "client",
event = "cdn-fuel:client:purchasejerrycan",
icon = "fas fa-fire-flame-simple",
label = Lang:t("buy_jerrycan"),
canInteract = function()
if not IsPedInAnyVehicle(PlayerPedId()) and not holdingnozzle and not HoldingSpecialNozzle and inGasStation == true then
return true
end
end,
},
[3] = {
name = "cdn-fuel:modelOptions:option_3",
num = 3,
type = "client",
event = "cdn-fuel:client:returnnozzle",
icon = "fas fa-hand",
label = Lang:t("return_nozzle"),
canInteract = function()
if holdingnozzle and not refueling then
return true
end
end,
},
[4] = {
name = "cdn-fuel:modelOptions:option_4",
num = 4,
type = "client",
event = "cdn-fuel:client:grabnozzle:special",
icon = "fas fa-gas-pump",
label = Lang:t("grab_special_nozzle"),
canInteract = function()
if Config.FuelDebug then print("Is Player In Special Fuel Zone?: "..tostring(PlayerInSpecialFuelZone)) end
if not HoldingSpecialNozzle and not IsPedInAnyVehicle(PlayerPedId()) and PlayerInSpecialFuelZone then
return true
end
end,
},
[5] = {
name = "cdn-fuel:modelOptions:option_5",
num = 5,
type = "client",
event = "cdn-fuel:client:returnnozzle:special",
icon = "fas fa-hand",
label = Lang:t("return_special_nozzle"),
canInteract = function()
if HoldingSpecialNozzle and not IsPedInAnyVehicle(PlayerPedId()) then
return true
end
end
},
}

exports.ox_target:addModel(props, modelOptions)
else
exports[Config.TargetResource]:AddTargetBone(bones, {
options = {
Expand Down
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fx_version 'cerulean'
game 'gta5'
author 'https://www.github.com/CodineDev' -- Base Refueling System: (https://github.com/InZidiuZ/LegacyFuel), other code by Codine (https://www.github.com/CodineDev).
description 'cdn-fuel'
version '2.1.8'
version '2.1.9'

client_scripts {
'@PolyZone/client.lua',
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.8
2.1.9

0 comments on commit f57519a

Please sign in to comment.