CodineDev / cdn-fuel

A functionality fuel system based off of LegacyFuel that uses PolyZones that target fueling pumps and vehicles to allow you to refuel your vehicle, as well as interact-sound to play accurate refueling sounds, Syphoning, Jerry Cans and more!
GNU General Public License v3.0
115 stars 102 forks source link

Cant interact with electric charger #126

Open DrDeath25 opened 4 months ago

DrDeath25 commented 4 months ago

Im using ox_target and i cant interact with electric charger

Steps to reproduce the behavior:

  1. Use target to open electric charger menu
  2. Nothing shows up
  3. No errors in f8 or in console

Expected behavior Open context menu after interacting with electric charger prop with ox_target image

AlfonzDivoch commented 2 months ago

Edit it like this:

local TargetResource = Config.TargetResource

if TargetResource == 'ox_target' then
    exports.ox_target:addModel('electric_charger', {
        {
            name = "grab_electric_nozzle",
            event = "cdn-fuel:client:grabelectricnozzle",
            icon = "fas fa-bolt",
            label = Lang:t("grab_electric_nozzle"),
            canInteract = function(entity, distance, data)
                if not IsHoldingElectricNozzle() and not IsPedInAnyVehicle(PlayerPedId()) then
                    return true
                end
            end
        },
        {
            name = "return_nozzle",
            event = "cdn-fuel:client:returnnozzle",
            icon = "fas fa-hand",
            label = Lang:t("return_nozzle"),
            canInteract = function(entity, distance, data)
                if IsHoldingElectricNozzle() and not refueling then
                    return true
                end
            end
        }
    })
else
    exports['qb-target']: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
    })
end

end