Closed Arcticguy867 closed 1 year 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
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)
can you send the code readable? you can use
are u able to see this ?
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
}
)
not working man still everyone is able to access it what does foo = 'bar' do ??
what framework you are using esx or qbcore?
Esx
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