meta-hub / meta_target

A complete third eye solution for FiveM and RedM, aiming to proving all solutions from fivem-target, bt-target and qtarget under one resource.
21 stars 15 forks source link

Job lock #38

Closed Arcticguy867 closed 1 year ago

Arcticguy867 commented 2 years ago

There is no lock for the job any one can use it even if i have set it to a job in the qtarget zone

BaziForYou commented 2 years ago

hi use canShow function here one example can give you to put as canShow

canShow = function(target,pos,ent,endPos,modelHash,isNetworked,netId,targetDist,entityType)
    if ESX and ESX.PlayerData and ESX.PlayerData.job and ESX.PlayerData.job.name == "police" then
        return true
    end
    return false
end
Arcticguy867 commented 2 years ago

is there a way u can tell me how to put it in this ??

    exports.qtarget:AddBoxZone("uwu_register_2", vector3(-584.25, -1061.5, 22.37), 0.6, 0.5, {
        name="uwu_register_2",
        debugPoly = false,
        heading=270,
        minZ=21.0,
        maxZ=22.8,
        }, {
                options = {
                    {
                        event = "qb-uwu:bill",
                        parms = "2",
                        icon = "fas fa-credit-card",
                        label = "Charge Customer",
                        job = "uwu",
                    },
                },
                distance = 1.5
            })

end)

RegisterNetEvent("qb-uwu:bill", function() local bill = exports["qb-input"]:ShowInput({ header = "Create Receipt", submitText = "Charge Customer", inputs = { { type = 'number', name = "id", text = 'ID', isRequired = true, }, { type = 'number', name = "amount", text = '$', isRequired = true }, } }) if bill ~= nil then if not bill.id or not bill.amount then return end

    TriggerServerEvent('srp_billing:sendBill', bill.id, 'society_uwu', 'UwU Cafe', bill.amount)
end

end)

BaziForYou commented 2 years ago

can you send the code readable? you can use image

Arcticguy867 commented 2 years ago

https://ctxt.io/2/AAAQ1p28FA

are u able to see this ?

BaziForYou commented 2 years ago

didn't test this code but should be something like this

local PlayerData = {}
RegisterNetEvent('esx:playerLoaded', function(xPlayer)
    PlayerData = xPlayer
end)

RegisterNetEvent('esx:setJob', function(job)
    PlayerData.job = job
end)

RegisterNetEvent('esx:onPlayerLogout', function()
    PlayerData = {}
end)

AddEventHandler('esx:setPlayerData', function(key, val)
    if GetInvokingResource() == 'es_extended' then
        PlayerData[key] = val
    end
end)

exports.qtarget:AddBoxZone("uwu_register_2", vector3(-584.25, -1061.5, 22.37), 0.6, 0.5, {
    name="uwu_register_2",
    debugPoly = false,
    heading=270,
    minZ=21.0,
    maxZ=22.8,
    },
    {
        options = {
            {
                event = "qb-uwu:bill",
                parms = "2",
                icon = "fas fa-credit-card",
                label = "Charge Customer",
            },
        },
        distance = 1.5,
        canShow = function(target,pos,ent,endPos,modelHash,isNetworked,netId,targetDist,entityType)
            if PlayerData.job and PlayerData.job.name and PlayerData.job.name == "uwu" then
                return true
            end
            return false
        end
    }
)
Arcticguy867 commented 2 years ago

not working man still everyone is able to access it what does foo = 'bar' do ??

BaziForYou commented 2 years ago

what framework you are using esx or qbcore?

Arcticguy867 commented 2 years ago

Esx