> For the complete documentation index, see [llms.txt](https://hrs-scripts.gitbook.io/hrs-scripts-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hrs-scripts.gitbook.io/hrs-scripts-doc/hrs-zombies/snippets/adding-qb-shops-to-safezone-peds.md).

# Adding QB-SHOPS to SafeZone Peds

## In qb-shops script

#### In qb-shops/client/main.lua

* old code

```lua
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
    PlayerData = QBCore.Functions.GetPlayerData()
    createBlips()
    createPeds()
    TriggerServerEvent('qb-shops:server:SetShopList')
end)

RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
    deletePeds()
    PlayerData = nil
end)

RegisterNetEvent('QBCore:Player:SetPlayerData', function(val)
    PlayerData = val
end)

AddEventHandler('onResourceStart', function(resourceName)
    if GetCurrentResourceName() ~= resourceName then return end
    createBlips()
    createPeds()
    TriggerServerEvent('qb-shops:server:SetShopList')
end)

AddEventHandler('onResourceStop', function(resourceName)
    if GetCurrentResourceName() ~= resourceName then return end

    deletePeds()
end)
```

* new code

```lua
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
    PlayerData = QBCore.Functions.GetPlayerData()
    --createBlips()
    --createPeds()
    TriggerServerEvent('qb-shops:server:SetShopList')
end)

RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
    --deletePeds()
    PlayerData = nil
end)

RegisterNetEvent('QBCore:Player:SetPlayerData', function(val)
    PlayerData = val
end)

AddEventHandler('onResourceStart', function(resourceName)
    if GetCurrentResourceName() ~= resourceName then return end
    --createBlips()
    --createPeds()
    TriggerServerEvent('qb-shops:server:SetShopList')
end)

AddEventHandler('onResourceStop', function(resourceName)
    if GetCurrentResourceName() ~= resourceName then return end

    --deletePeds()
end)
```

* code you have to add to the file

```lua
function openShopExport(k)
    openShop(k, Config.Locations[k])
end

exports('openShopExport',openShopExport)
```

## In hrs\_zombies script

#### In hrs\_zombies/config.lua

```lua
Config.safezonePedsAndProps = {
    ['shop_ped'] = {
        type = 'ped',
        model = `csb_ramp_marine`,
        coords = vector3(-2277.5537, 387.5620, 174.6018),
        heading = 90.0,
        drawDistance = 160.0,
        anim = {
            animDict = "amb@world_human_aa_smoke@male@idle_a", 
	    animName = "idle_a"
        },
        targetInfo = { 
            options = { 
                { 
                    num = 1, 
                    icon = 'fa-solid fa-basket-shopping', 
                    label = 'Open Shop', 
                    targeticon = 'fas fa-example', 
                    action = function(entity) 
                        exports['qb-shops']:openShopExport("247supermarket") 
                        -- the argument of the export is the index of the shop
                        -- in qb-shops/config.lua in the section Config.Locations
                    end,
                    canInteract = function(entity, distance, data) 
                        return true
                    end,
                }
            },
            distance = 2.5,
        },
        blip = {
            label = "Gun Shop",
            color = 2,
            alpha = 128,
            scale = 1.0,
            sprite = 150,
            shortRange = true 
        }
    },
}
```

example of the qb-shops

```lua
Config.Locations = {
    -- 24/7 Locations
    ["247supermarket"] = { --- this is the index "247supermarket"
        ["label"] = "24/7 Supermarket",
        ["coords"] = vector4(24.47, -1346.62, 29.5, 271.66),
        ["ped"] = 'mp_m_shopkeep_01',
        ["scenario"] = "WORLD_HUMAN_STAND_MOBILE",
        ["radius"] = 1.5,
        ["targetIcon"] = "fas fa-shopping-basket",
        ["targetLabel"] = "Open Shop",
        ["products"] = Config.Products["normal"],
        ["showblip"] = true,
        ["blipsprite"] = 52,
        ["blipscale"] = 0.6,
        ["blipcolor"] = 0
    },
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hrs-scripts.gitbook.io/hrs-scripts-doc/hrs-zombies/snippets/adding-qb-shops-to-safezone-peds.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
