STG ScriptsDocumentation
Weapon Shop

Configuration

Every option in STG Weapon Shop config.lua, from the framework, interaction and licenses to the clerk ped, blips, shops, categories and prices.

All settings live in stg-weaponshop/config.lua. The file stays editable in the escrow version. Restart the resource after a change.

Language

Config.Language = "en"

Available: en, de, fr, es, pt, it, nl, ar, ja, zh. To change a text, edit the matching file in stg-weaponshop/locales/.

Framework

Config.Framework = "auto"

Prop

Type

Interaction

Config.Target = false

Prop

Type

To use another target resource, add your code to the empty else branch in stg-weaponshop/client/target.lua and trigger the stg-weaponshop:open client event from it.

Clerk ped

Config.NPC = "a_m_y_mexthug_01"

Ped model standing at every shop. The ped is frozen, invincible and plays a clipboard animation. See the ped model list for other models.

Weapons as items

Config.weaponWithItem = true

Prop

Type

Licenses

Config.License = false

Prop

Type

The license each category needs is set by its license field in Categories.

The handgun category ships with license = "weaponsss". Change it to weapon (or your own license name) before you set Config.License = true, otherwise nobody can buy handguns.

Blip

Config.Blip = {
    label = "Weapon Shop",
    sprite = 110,
    scale = 0.7,
    color = 3,
    visible = true
}

Prop

Type

See the blip list for sprite and colour ids.

The clerk peds are created together with the blips. With visible = false the peds are not spawned either, so the target option is gone too. The E prompt still works.

Notifications

Config.Notify = function(message)
    lib.notify({
        title = getMessage('notify_title'),
        description = message,
        type = "info"
    })
end

Shows the purchase, not enough money and no license messages with ox_lib. Replace the body to use your own notification system.

Shops

Config.Shops = {
    vector4(-662.37, -933.52, 21.81, 175.91),
    vector4(810.40594482422, -2159.0717773438, 29.619016647339, 360),
    -- ...
}

The script ships with 9 shops. Each entry is the position and heading of the clerk ped. The blip and the E prompt use the same spot. Stand where the clerk should be, copy your coordinates and heading, for example with /coords or your admin menu, and add a new line to open another shop.

Categories

Categories appear as icons at the top of the store, in the order of the table. The first item of the first category is selected when the store opens.

Config.Categories = {
    [1] = {
        name = "melee",
        label = "Melee",
        license = "weapon",
        weapons = {
            [1] = {
                name = "weapon_dagger",
                label = "Dagger",
                price = 500,
                status = {
                    bullet_speed = 0,
                    magazine_capacity = 0,
                    range = 0,
                    damage = 70
                }
            },
            -- ...
        }
    },
    -- handgun, rifles, snipers
    [5] = {
        name = "ammo",
        label = "Ammo",
        license = false,
        weapons = {
            [1] = {
                name = "ammo-9",
                type = "item",
                label = "Pistol Ammo x5",
                price = 100,
                amount = 5,
                status = { bullet_speed = 0, magazine_capacity = 0, range = 0, damage = 0 }
            },
            -- ...
        }
    },
}

The default stock is 10 melee weapons, 9 handguns, 7 rifles, 3 snipers and 3 ammo boxes.

Category fields

Prop

Type

Item fields

Prop

Type

Adding a weapon

Add a new entry with the next index to the weapons table of a category, with the weapon name, a label, a price and its status values.

Make sure html/public/weapons/<name>.png exists. Images for 90 GTA weapons are already included, so most weapons need nothing extra.

Use each name in only one category. The server charges the price of the first entry it finds with that name.

To add a whole category, add a new entry to Config.Categories and place its two icons, <name>.svg and <name>-active.svg, in html/public/categories/.

Still having trouble?

Open a ticket on our Discord. Our team answers around 15 hours a day.

Get help on Discord

On this page