🚦templates

Overview

SL-Chat includes a separate template system (templates.config.lua) for predefined message types that can be used from other scripts. These templates are perfect for system notifications, error messages, success confirmations, and more.

Configuration File

Location: shared/templates.config.lua

Built-in Templates

SYSTEM

Generic system message with gray styling.

SYSTEM template (Lua)
['SYSTEM'] = {
    logType = 'system',
    template = [[
        <div style="padding: 1vh 1.2vh; background: linear-gradient(180deg, rgba(74, 74, 74, 0.85) 0%, rgba(26, 26, 26, 0.85) 100%); border-bottom: 0.25vh solid #4A4A4A; border-radius: 0.2vh;">
            <span style="font-size: 1.1vh; font-weight: 600; background: #4A4A4A; padding: 0.3vh 0.6vh; border-radius: 0.3vh; color: #fff;">SYSTEM</span>
            <span style="font-size: 1.3vh; color: #fff;"> {message}</span>
            <span style="font-size: 1vh; color: rgba(255,255,255,0.7);">{time}</span>
        </div>
    ]]
}

WELCOME

Welcome message with green styling.

ERROR

Error message with red styling.

SUCCESS

Success message with green styling.

INFO

Information message with blue styling.

WARNING

Warning message with yellow/orange styling.

Template Options

Option
Type
Description

logType

string

Log category for Discord webhooks

template

string

HTML template with placeholders

Template Placeholders

Placeholder
Description

{message}

The message content

{time}

Current time (HH:MM format)

{playerId}

Player's server ID

Using Templates from Other Scripts

Server-side Export

Server-side Event

Adding Custom Templates

Integration Examples

Player Join Welcome

Vehicle Purchase Confirmation

Job Notification

Next Steps

  • πŸ› οΈ Configuration - Main config

  • πŸ’¬ Commands - Chat commands

  • πŸ“€ Exports - All exports