Editable Files
G9 = {}
zone = nil
for _, events in pairs(cfg.PlayerOnloadEvents) do
RegisterNetEvent(events)
AddEventHandler(events, function()
if cfg.Framework == "qb" then
player = G9Core.Functions.GetPlayerData()
PlayerJob = player.job
else
playerData = G9Core.GetPlayerData()
while playerData == nil do
playerData = G9Core.GetPlayerData()
Wait(1000)
end
if playerData.job ~= nil then
playerJob = playerData.job.name
return playerJob
end
end
end)
end
function G9:notify(type,header,msg)
SendNUIMessage({
action = 'notify',
type = type,
header = header,
comment = msg
})
end
for _, data in pairs(cfg.markets) do
if cfg.useTarget then
RequestModel(data.model)
while not HasModelLoaded(data.model) do
Wait(0)
end
local ped = CreatePed(4, GetHashKey(data.model), data.pedCoords.x, data.pedCoords.y, data.pedCoords.z -1, data.pedCoords.w, false, false)
SetEntityHeading(ped, data.pedCoords.w)
FreezeEntityPosition(ped, true)
SetEntityInvincible(ped, true)
SetBlockingOfNonTemporaryEvents(ped, true)
SetPedDiesWhenInjured(ped, false)
SetPedCanRagdoll(ped, false)
if data.job == 'none' then
if GetResourceState('ox_target') == 'started' then
local options = {
{
label = 'Shop',
icon = "fas fa-briefcase",
onSelect = function()
zone = _
openShop()
end,
}
}
exports.ox_target:addSphereZone({
coords = GetEntityCoords(ped),
radius = 0.35,
options = options,
debug = false,
})
else
exports['qb-target']:AddTargetEntity(ped, {
options = {
{
label = 'Shop',
icon = "fas fa-briefcase",
action = function()
zone = _
openShop()
end,
}
},
distance = 2.0
})
end
else
if GetResourceState('ox_target') == 'started' then
local options = {
{
label = 'Shop',
icon = "fas fa-briefcase",
onSelect = function()
zone = _
openShop()
end,
groups = data.job
}
}
exports.ox_target:addSphereZone({
coords = GetEntityCoords(ped),
radius = 0.35,
options = options,
debug = false,
})
else
exports['qb-target']:AddTargetEntity(ped, {
options = {
{
label = 'Shop',
icon = "fas fa-briefcase",
action = function()
zone = _
openShop()
end,
job = data.job
}
},
distance = 2.0
})
end
end
else
local coord = vector3(data.pedCoords.x, data.pedCoords.y, data.pedCoords.z)
lib.zones.sphere({
coords = coord,
radius = 2,
onEnter = function()
lib.showTextUI("[E] Shop")
end,
onExit = function()
lib.hideTextUI()
end,
inside = function()
if IsControlJustPressed(0, 38) then
if playerJob == data.job then
lib.hideTextUI()
zone = _
openShop()
lib.showTextUI("[E] Shop")
elseif data.job =='none' then
lib.hideTextUI()
zone = _
openShop()
lib.showTextUI("[E] Shop")
end
end
end,
})
end
end
Last updated