STG ScriptsDocumentation
Warning System

Configuration

Every option in STG Warning System config/config.lua and config/webhooks.lua, from the command and staff permissions to the warning screen, hooks, colours and the Discord log.

All settings live in stg-warnsystem/config/config.lua, and the Discord log in stg-warnsystem/config/webhooks.lua. Both files stay editable in the escrow version. Restart the resource after a change.

Language

Config.Language = "en"

Available: en, de, fr, es, pt, it, nl, pl, sv, ar, jp, zh, he, fi. To change a text, edit the matching file in stg-warnsystem/locales/. The text used when staff leave out the title or the message is default-warning-title and default-warning-message in the same file.

Framework

Config.Framework = "auto"

Prop

Type

The player and group lookups live in stg-warnsystem/server/editable/utils.lua. Edit getPlayer and getGroup there if your framework stores players or groups differently.

Command

Config.WarnCommand = "warn"

Name of the chat command staff use, without the slash:

/warn <id> <title> <message>
  • id: server ID of the player to warn. Required.
  • title: one word shown as the heading of the warning. Leave it out and the default title and message are used.
  • message: everything after the title. Leave it out and the default message is used.

For example, /warn 12 RDM Read the rules before you shoot anyone. The staff member gets a notification when the warning is sent.

Permissions

Config.AllowedGroups = {
    "god",
    "superadmin",
    "admin"
}

Config.AllowedPlayers = {
    -- "license:abcdef1234567890",
    -- "license2:abcdef1234567890",
    -- "xbl:abcdef1234567890",
}

Prop

Type

A player only needs to match one of the two lists. Everyone else gets a "no permission" notification.

Warning screen

Config.TimeToClose = 20
Config.EnableGodmodeInWarn = true
Config.DisableMovementInWarn = true
Config.DisableWeaponsInWarn = true

Prop

Type

All three effects are removed when the warning closes.

Hooks

Config.OnWarn = function(source)
    -- Add your code here(optional)
end

Config.OnWarnClose = function(source)
    -- Add your code here(optional)
end

Both run on the warned player's client. OnWarn runs when the warning opens and OnWarnClose when it closes, for example to play a sound or hide your HUD. They are called without arguments, so source is always nil.

Notifications

Config.Notify = function(type, message)
    lib.notify({
        title = Config.Locales[Config.Language]["title"],
        description = message,
        type = type,
        position = "center-right"
    })
end

Used for the messages staff get from the command: warning sent, no permission, missing ID and player not found. Replace the body to use your own notification system.

Colours

The colours of the warning screen are in stg-warnsystem/nui/css/config.css:

:root{
    --primary-background: rgba(17, 17, 17, .95);
    --primary-white: #ffffff;
    --primary-highlight: #FFDE2A;
    --primary-semi-highlight: #FFE44F;
    --prgressbar-background: rgba(255, 255, 255, 0.15);
    --prgressbar-fill: #FFDE2A;
}
VariableUsed for
--primary-backgroundFull screen overlay behind the warning
--primary-whiteMessage, staff label and bottom text
--primary-highlightStaff name and the highlighted word in the bottom text
--primary-semi-highlightWarning title
--prgressbar-backgroundEmpty part of the progress bar
--prgressbar-fillFilled part of the progress bar

Discord log

Webhooks.URLs = {
    ["warn"] = ""
}

Webhooks.log = {
    username = 'Warnsystem by STG Scripts',
    icon = 'https://cdn.discordapp.com/icons/...',
    title = 'WARNSYSTEM - LOG',
    footer = "Warnsystem by STG Scripts",
    color = 15459636
}

Prop

Type

Each entry names the staff member and the warned player and contains the title, the message and the steam, discord, IP, license and xbl identifiers of both players.

The log includes both players' IP addresses. Post it to a private channel only your management can read.

Still having trouble?

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

Get help on Discord

On this page