STG ScriptsDocumentation
Advanced Warning Zone

Configuration

Every option in STG Advanced Warning Zone, from job access, menu command and key to zone time limits, situation templates, notifications, webhooks and menu colours.

The settings live in the stg-warnzone/configs/ folder:

FileWhat it holds
config.luaLanguage, access, menu, situations and notifications
sv_config.luaWebhook URLs, kept on the server
css_config.cssMenu colours
server-logo.pngLogo at the top of the menu

config.lua and sv_config.lua stay editable in the escrow version. Restart the resource after a change.

Language

STG.Language = "en"

Available: en, de, fr, es, pt, it, nl, pl, sv, fi, ar, he, jp, zh. To change a text, edit the matching file in stg-warnzone/locales/. Each file also holds the long descriptions of the ready-made situations, their task names (AvailableZoneTasks) and the menu labels (web).

Debug

STG.Debug = false

Prints debug messages to the client console. Leave it off on a live server.

STG.ServerName = "STG"
STG.SubServerName = "SCRIPTS"

Prop

Type

To use your own logo, replace stg-warnzone/configs/server-logo.png with your image under the same name.

Command

STG.Command = {
    active = true,
    command = "warnzone"
}

Prop

Type

Key

STG.Key = {
    active = true,
    key = "F7"
}

Prop

Type

Zone time limit

STG.MaximumZoneTime = 200

Longest time in minutes a player can enter for a zone. A higher value is refused in the menu with an error notification.

Keep this above 0. The comment in the file says 0 means unlimited, but in the current version a value of 0 makes the menu refuse every zone.

Access

STG.AllPlayersAllowed = false
STG.AllowedJobs = {
    {
        name = 'police',
        allowedRanks = {
            1,
            2
        }
    }
}

Prop

Type

Add one entry per job. A player without an allowed job and grade gets an Unauthorized! notification when they try to open the menu.

Situations

The ready-made situations in the menu. The script ships with six:

STG.ZoneTemplates = {
    {
        id = 1,
        name = "Shop Robbery",
        image = "img/Zones/ShopRobbery.png",
        description = "Create your own zone where shop robbery will happen",
        detailedDescription = STG.Locales[STG.Language]['shop_description'],
        defaultRank = "1",
        defaultSize = "25",
        defaultTime = "1"
    },
    -- ...
}

Prop

Type

The player can still change the danger level, size and time before creating the zone. The zone is placed at the player's position.

Situations players create with Create a new situation are saved in the stg_warnzone database table and listed after these ones. To remove one, delete its row from that table.

Danger levels

The danger level sets the colour of the zone blip on the map. Each level from 1 to 5 has its own colour, and level 5 is also less transparent.

Notifications

STG.CustomNotify = false
STG.CustomNotifyFunction = function(title, msg)
    -- Your custom notify function (client)
end

When CustomNotify is false, the script shows its own notifications in the top right corner of the screen. Set it to true and fill in CustomNotifyFunction to use your own notification system instead. It runs on the client with a title and a message, for example:

STG.CustomNotify = true
STG.CustomNotifyFunction = function(title, msg)
    lib.notify({ title = title, description = msg })
end

These are the zone enter and leave warnings, the no access message and the screenshot errors. The error for a zone time above the limit always uses the built-in notification.

Announcement

STG.Announce = function(msg)
    -- Your announce function (server)
end

Runs on the server every time a zone is created, from the menu or from an export. msg is the newZone text from the locale file with the street name and danger level filled in, for example "Attention! A new Warnzone was created in Vinewood Blvd with the Warning Grade of 3". It is empty by default, so nothing is announced. To post it in chat for every player:

STG.Announce = function(msg)
    TriggerClientEvent('chat:addMessage', -1, { args = { msg } })
end

Webhooks

In stg-warnzone/configs/sv_config.lua:

STG.Webhooks = {
    screenshot = "",
    log = ""
}

Prop

Type

stg-warnzone/configs/css_config.css holds the accent colours of the menu:

:root {
	--yellow-primary: #39fffc;
	--yellow-secondary: #49f6ff;

	--green-primary: #9DFF50;

	--gradient-yellow: linear-gradient(180deg, var(--yellow-primary) 0%, var(--yellow-secondary) 100%);
	--gradient-green: linear-gradient(131.37deg, #7DF553 1.85%, #6D931D 121.15%);
}

Change the hex values to match your server. The names are fixed, so --yellow-primary stays the main accent even when you set it to another colour.

Still having trouble?

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

Get help on Discord

On this page