LESM Installation

From MyGamingTalk
Jump to navigation Jump to search

Lua Enhanced Server Mod Install Guide

This guide will teach you how to install LESM on your server. Please read it carefully.
When I refer to the server's mod directory I mean:
/etdirectory/mod/ Your qagame.mp.i386.so or qagame.mp.i386.dll will be in this directory.
Example: /home/et/silent/
When I refer to the /LESM/ directory that is inside your server's mod directory.
Example: /home/et/silent/LESM/
JSON Files(files ending in .json) can be picky when editing them, you can use jsonformatter to ensure you have valid JSON format, if they are not valid it will cause errors.

Requirements

The only requirement is that you have lua 5.1 installed on your server. For silent mod, it comes with the mod and you do not need to make any further adjustments. For other mods you will need to follow their instructions on how to install it. Usually it just requires you to download the lua 5.1 library, and using a specific qagame.

Download LuaESMod

Download LuaESMod and extract it to some temporary folder on your computer.

Install

The Files/Folders you need are: LuaESMod.lua and the entire LESM folder.
Upload those to your server's mod directory.
Next you will need to go into your server config edit your lua_modules cvar to include LuaESMod.lua
Will look something like set lua_modules "LuaESMod.lua" or set lua_modules "LuaESMod.lua test.lua testlua2.lua"


Note: If your server uses a seperate fs_homepath you will need to manually create the following directories:

/fs_homepath/mod/LESM/
/fs_homepath/mod/LESM/save/
/fs_homepath/mod/LESM/extra/
/fs_homepath/mod/LESM/logs/


Also you will need to make sure Commands.json is in /fs_homepath/mod/LESM/save/Commands.json Basic rule of thumb is you keep only the .lua files in /fs_basepath/fs_game/ and everything else can go into /fs_homepath/fs_game/

First Run

Restart/start your server.
You can verify if the script is running by typing: lua_status in rcon
If it is running then you can continue on to configuring the server.
The configuration file is /LESM/save/Config.json you may edit values there. (See below for what the configuration values mean)
If your config fails to load for some reason or there are keys that were missing, a ConfigDefaults.json will be created with your old values and new values. This file is just for you to read and copy to Config.json if you wish, it is not actually loaded ever.
The most important values are Level.Leader and Level.Admin as this determines the level at which you can use some commands.

Updating

If you are updating from a previous version it is basically the same thing as installing, you will overwrite all the lua files. There is Commands.json shipped with releases so the lua will know which commands were added. This only needs to be replaced if the new lua version adds a command, if it doesn't then you do not need to bother. If it does add a command but you have already edited your Commands.json and you do not want to lose your changes, you will need to find out which commands were added and add a section for each new command to your Commands.json.

Other Config Files

Other specific configuration files:

Colors

Colors are saved in /LESM/save/Colors.json If you want to change the color scheme you can that do that in this file. There are 3 keys in here you probably want to change to match your server's theme
Primary Is your main message color, white is a safe bet, definitely don't use black as it is hard to see.
Secondary Is the color used to highlight important information
Tertiary Is used for symbols or brackets surrounding text
The capital letter keys like LIGHT_BLUE are currently not used, in the future they may be used.
The rest are command colors, used in the help command.

Banners

Banners are saved in /LESM/save/Banners.json See related config options here
If you want to use banners you will need to edit this file.
Each message in a quote is a new banner.
When making banner messages you can use <color1> to use your Color.Primary <color2> to use Color.Secondary and <color3> to use Color.Tertiary. You can still use normal color codes though if you wish.
The beginning of the file must start with a [ and end of the file must end with ]
Also every new message must end with , UNLESS it is the last one which ends with nothing In the example will Color.Primary equals ^7 Color.Secondary equals ^5 and Color.Tertiary equals 2

So for example:

[ "<color1>Registration <color2>required<color1> for xpsave and admin level<color3>!",
 "<color1>Autolevel up to level <color2>600",
 "<color3>/<color2>lua help<color1> to view all your commands<color3>!" ]

Means the messages are:

^7Registration ^5required^7 for xpsave and admin level^2!
^7Autolevel up to level ^5600
^2/^5lua help^7 to view all your commands^5!

Rules

Rules are saved in /LESM/save/Rules.json
If you want to use the rules command, or add rules to banners then you will need to edit this file.
Same rules apply to Rules that apply to Banners

Sounds

Sounds are saved in /LESM/save/Sounds.json
This file isn't meant to be created/edited manually.
I package a python script that will create a Sounds.json from all the sounds in a pk3 named sounds.py
If you do not know how to use a python script, post on forums with a link to your sounds pk3 I can easily get you setup.
You can edit your sounds ingame with the playsound command
!playsound hello level 5 you need to be a leader of authorized to do this

Maps

Maps is just a list of your map vote pool and is found in /LESM/save/Maps.json Will look something like this:

[
 "adlernest",
 "oasis",
 "frostbite"
]

To get info for this list type in rcon: dir maps bsp
You can try manually creating this list. Or post on forums and we will create one for you.

Grammar/SwearFilter

Found in /LESM/save/Grammar.json and /LESM/save/SwearFilter.json
Grammar is more of a spellcheck and is used when players have the grammarcheck key.
SwearFilter replace swear words with less vulgar words.

Commands

See Commands for a list of commands.
The /LESM/save/Commands.json file decides what command gets loaded, and who can use it. This file needs to be updated each time a new command is added in a new version. When it comes with the release package it only contains a list of paths to lua commands. After it LESM loads it will then update the Commands.json to include: auth force level load login keys. These keys you can toggle to control loading commands(Explained below).

load

If load is set to true the command will load if the conditions are right. Almost all commands will be loaded, except for certain ones on certain mods, for example: Admintest on silent mod, since silentmod already has admintest. If load is set to false then the command will not load no matter what. By default all the commands load will be set to true.

force

If force is set to true it will force the command to load even if the command isn't supposed to load(Like admintest in the above example). If set to false nothing special happens and it will continue on default behavior. If you force load a command it may produce odd results. By default all of the commands force are set to false.

level

Set this to the minimum level required to use this command, or set to 0 to allow everyone to use the command. By default this key is set to either 0, Config.Level.Admin, or Config.Level.Leader depending on the command on first run.

login

If login is set to true then you must be logged into a profile to use this command. If set to false you are not required to be logged in. The default value for this depends on the command.

auth

If auth is set to true then you must be logged into a profile and have the authorize profile key set to true to use this command. The default value for this depends on the command.

path

Path is the path to the lua command file relative to /fs_homepath/fs_game/

Examples

Let's say for example you want to give all your admins level 5 and up access to the ammo command. What I changed here from default is I set login and auth to false, and set level to 5.

{
     "auth": false,
    "force": false,
    "level": 5,
     "load": true,
    "login": false,
     "path": "LESM/commands/ammo.lua"
}


Now let us say we do not like the afk command, so we want to disable the afk and back command.

So we simply change load to false in both commmands:

{
     "auth": false,
    "force": false,
    "level": 0,
     "load": false,
    "login": false,
     "path": "LESM/commands/afk.lua"
}, {
     "auth": false,
    "force": false,
    "level": 0,
     "load": false,
    "login": false,
     "path": "LESM/commands/back.lua"
}

If you want more examples I can do them. Please request.

Config

Found in /LESM/save/Config.json saves all your config keys it can be edited directly or from ingame. If you are editing ingame with the config commmand you need to use !config save after you have made your changes. Also the config only gets loaded when map restarts, this means if you change the file directly, and then go ingame and type use !config save your changes will be overwritten by what is currently loaded on the server. Now on to the keys

AdminWatchConsole

If enabled will send adminwatch messages to console print(So it will show up in server log and similar stuff). Only really useful for when you have access to direct server console output.
Values: true or false

BlockNoSilentFlag

If the player does not have the silent command flag 3 it will block silent commands that output messages to everyone, such as !afk and !me. For example it will block /me Slaps players & /!me Slaps player & /lua me Slaps player. But it will still allow commands to be used in chat: !me slaps player
Values: true or false

ConvertNoSilentFlag

If the player does not have the silent command flag 3 it will convert command to a chat command if enabled. Example: /me Slaps player turns into !me Slaps player in the global chat.
Values: true or false

ClassHPMax

Experimental, only works on silent mod. If enabled it will take the value defined in /LESM/extra/Classes.json for each class and make it their maximum health.
Values: true or false

ClassHPRegen

Experimental, only works on silent mod. If enabled it will take the value defined in /LESM/extra/Classes.json for each class and regenerate that amount of health each second.
Values: true or false

DamagePrint

Experimental, only works on silent mod. Allows players to see how much damage they are taking each hit.
Warning this enabled g_debugBullets which spams the console log with a lot of messages(each hit), use at own risk.
On legacy this feature is greatly expanded with more info on each hit, hopefully silent mod will soon bring et_Damage callback for this feature.
Values: true or false

DisplayRegister

Displays information on how to register and why to register when player connects.
Values: true or false

EncryptSha1

Uses sha1 for passwords and other similar things. Downside adds about 3/4 a second to load time, upside is no one is gonna figure out the passwords. If not enabled uses a weak string jumbler instead.
Values: true or false

FreezeStart

Uses lua to force clients into the same position for FreezeStartTime seconds, will also add that time onto the timelimit so no time is lost. Useful to allow clients with bad computers or connections to start at the same time as everyone else. Also prevents bots from being 60 feet ahead at beginning of map.
Values: true or false

FreezeStartTime

Seconds to remain frozen at map start. My suggestion is around 8.
Values: number

PauseStart

Similar to FreezeStart. This will pause the game and immediately unpause the game at the start of the map, so no one can get an unfair start. Disadvantages to this one is that you can't tweak the time paused.
Values: true or false

MapEnts

Enables the map entity functions, for disabling objectives.
Values: true or false

MapListStart

Number to determine where your nextmap variables start. (Usually 1) if in your mapcycle.cfg you have vstr d1 at the end then set this value to 1.
Values: number

MapListVarName

Variable name to determine where your nextmap variables start. (Usually d) if in your mapcycle.cfg you have vstr d1 at the end then set this value to d.
Values: string

MaxReports

Number of allowed reports (Through the /report command) per game.
Values: number

ReportToMail

Whether or not reports should report to admin mail(Only players with Config.Level.Admin level and plus can read). If not enabled then reports will save in a json format in /LESM/save/ directory.
Values: true or false

MetricDistance

Whether or not to use metric distance by default in distance output. (Users can change this them self with the metricdistance profile key)
Values: true or false

MinNameLength

Minmum name length before getting renamed to a random name.
Values: number

Rename

A list of names to be automatically renamed to a random name. Example: "Rename": [ "ETPlayer", "UnnamedPlayer" ],
Values: list

SetLevelMax

Maximum allowed level distance allowed to promote to. Example: If this were 2 and you were level 10 you could only promote to level 8.
Values: number

ShrubCommandFix

A temporary bug fix for using certain shrub commands alongside lua commands of the same name. Shouldn't need this, unless told.
Values: list

SpamProtect

Amount of time in seconds (float value) that must pass before using another command.
Values: float number

SpawnWalkthrough

If enabled players spawning (Only from spawn, not revive) will be able to walk through players for as long as they have their spawn shield.
Works with g_spawnInvulFair
Values: true or false

Spec999

Amount of seconds to pass after map has started to check if clients that have no ping/are downloading still should be moved spec.
Set to 0 to disable.
Values: number

TeamBlock

Amount of seconds to pass before blocking the team command. To be used with TeamBlockMultiplier. If a certain player is switch a lot their teamblock will keep getting larger until eventually it will take 10-60 seconds before they can switch team again. This prevents players from constantly switching to the better team, if configured correctly.
Resets each map. Set to 0.0 to disable.
Values: float number

TeamBlockMultiplier

Amount to multiply TeamBlock by. Suggested is between 1.0 and 3.0.
Set to 0.0 to disable.
Values: float number

AutoLevel


Enabled

Whether or not to use the autolevel feature.
Values: true or false

StartLevel

The first level to start the autolevel. Players will get this level when they reach XPBase xp.
Values: number

EndLevel

Last level autolevel levels to.
Values: number

NoSetLevel

Whether or not to allow admins with lower than Config.Level.Leader to setlevel people in the autolevel range.
Values: true or false

RequireLogin

Require player to be logged in to get automatically leveled.
Values: true or false

XPBase

The base xp to start the autolevel. Players will get StartLevel when they reach this.
Values: float number

XPModifier

The amount to multiply XPBase by for levels after StartLevel. Example:

XPBase: 500 , XPModifier: 1.75 , StartLevel: 1 , EndLevel: 5
Level 1: 500 , Level 2: 875 , Level 3: 1531 , Level 4: 2679 , Level 5: 4689


Values: float number

Balance


Balance only moves the player switching to a team, it will not move anyone who was already on the team. That is still being worked on as another feature.
Some actions can be combined, for example: PutSpec and BlockTeam

Enabled

Whether or not to use the balance feature.
Values: true or false

CountBots

Whether or not to count bots into the balance calculation. Example: 4 players 1 bot on axis vs 1 player 4 bots on allies would still be considered fair, if enabled.
Values: true or false

MaxSwitches

Maximum amount of switches before action is taken. There will be two warning messages given prior to the action taken, if MaxSwitches is set high enough. Example: MaxSwitches: 2
Switch to unbalanced team 1: Please do not switch to the stacked team.
Switch to unbalanced team 1: **WARNING** If you switch again action will be taken
(Action taken here)
Values: number

PutSpec

(Action) Will put the player spectator when MaxSwitches is reached.
Values: true or false

BlockTeam

Will block the team command (Command used to switch teams) for this round.
Values: true or false

BlacklistTime

Will blacklist(kick/ban) a user for the specified time.
Time format is: 1 for 1 second, 1m for 1 minute, 1h for 1 hour, 1d for 1 day, 1o for 1 month
Set to 0 to not kick.
Set below 0 to permanently ban.
Values: timeformat

KickReason

Message to be given to players that get blacklisted.
Values: string

ExcludeOnline

Exclude people who are logged in from balance actions.
Values: true or false

ExcludeAuth

Exclude authorized users from balance actions.
Values: true or false

ExcludeLevel

Exclude players with at least this level from balance actions.
Values: number


Enabled

Whether or not banners are enabled.
Values: true or false

Delay

The delay between banner prints in seconds.
Values: number

AddRules

Whether or not to add the rules to the banners as well.
Values: true or false

Random

Whether or not to randomize the order in which the banners are printed.
Values: true or false

Location

The location in which to print the banners.
Values: print bannerprint centerprint chat echo printclean bannerprintclean centerprintclean chatclean echoclean

Blacklist


AllowIfAuth

Allow blacklisted users to connect if there is an authorized user online.
Values: true or false

AllowIfLeader

Allow blacklisted users to connect if there is a leader online.
Values: true or false

ClanTag


Enabled

Whether or not to enable clantag protection.
Values: true or false

Level

Level in which your tag is ok to be used. Example: Level 3 and below will be warned if set to 4.
Values: number

MaxRenames

Maximum amount of renames before action is taken.
Set to 0 to take action right away.
Values: number

Exact

Whether or not to use exact match (including color codes). If false it will clear ignore case and color codes.
Values: true or false

Tags

List of tags to protect. Example: [ "TT|", "(TT)", "xTTx" ],
Values: string list

BlacklistTime

(Action) Blacklists user for specified time format when MaxRenames is reached.
Time format is: 1 for 1 second, 1m for 1 minute, 1h for 1 hour, 1d for 1 day, 1o for 1 month
Set to 0 to not kick.
Set below 0 to permanently ban.
Values: timeformat

Warn

Will warn the user when MaxRenames is reached.
Values: true or false

Message

Message to be used in the warn or blacklist
Values: string

ConnectPrint


Location

Location where to print the message.
Values: print bannerprint centerprint chat echo printclean bannerprintclean centerprintclean chatclean echoclean

Bots

Will show connect print for bots.
Values: true or false

Ip

Will show a partial ip.
Values: true or false

Name

Will show name.
Values: true or false

Username

Will show username if autologged in. Required Name
Values: true or false

Country

Will show country of connecting user if exist.
Values: true or false

ETVersion

Will show ET Version if exists.
Values: true or false

Protocol

Will show protocol(2.55,2.56,2.60,2.60b) if exists.
Values: true or false

Level

Will show level.
Values: true or false

DeathPrint


Location

Location where to print the message.
Values: print bannerprint centerprint chat echo printclean bannerprintclean centerprintclean chatclean echoclean

Distance

Print distance from killer.
Values: true or false

Name

Print killer name.
Values: true or false

Hp

Print killer hp.
Values: true or false

Debug

There are many debug values, you shouldn't ever need them, they will spam your console log.

DynamiteCounter


Enabled


Values: true or false

CountDown

List of times when to print the current time till detonation. Example: [ 20, 10, 5, 3, 2, 1 ],
Values: number list

Location

Location where to print the message.
Values: print bannerprint centerprint chat echo printclean bannerprintclean centerprintclean chatclean echoclean

PrintAll

If enabled it will print to all teams. If not enabled it will only print to the team that planted the dynamite.
Values: true or false

Plant

Print a message when dynamite gets planted.
Values: true or false

Defuse

Print a message when dynamite gets defused.
Values: true or false

Explode

Print a message when dynamite explodes.
Values: true or false

Intermission


BlockSpec

Blocks spectators from voting for a map.
Values: true or false

Mute

Blocks muted playersfrom voting for a map.
Values: true or false

ReadyMessage

Prints a message when a player is ready during intermission.
Values: true or false

VoteMessage

Prints a message when a player votes for a map during intermission.
Values: true or false

PrintBoth

If enabled prints both ready and vote messages separately. If not enabled it will wait until the player both votes and is ready before printing a message.
Values: true or false

RequireLevel

Requires level to vote for a map.
Values: number

RequireLogin

Requires to be logged into a profile to vote for a map.
Values: true or false

JSON


Paths to each of the JSON files.

Karma


Consecutive

Number of consecutive karma actions to one player allowed.
Values: number

Time

Time required to pass before taking another karma action.
Values: timeformat

Level


Admin

The level your admin starts(Admin meaning they are apart of your clan)
Values: number

Admin

The level your leader status starts
Values: number

Log


Colors

Keep colors in the logs.
Values: true or false

Full

Do a full log message output. This is easier to read manually, but harder for scripts to parse.
Values: true or false

OneFile

Output all log to one file. If not enabled it will separate logs by day.
Values: true or false

Message


ColorReplace

Allow to replace <color1> 2 and 3 in messages and chat.
Values: true or false

NameMentions

Allow to use @name and @last in messages and chat.
Values: true or false

EventMentions

Allow to replace <event> with certain info.
Work in progress feature, doesn't work well at the moment.
Events: <killer><victim><heal><revive><name><weapon><ip><guid><ammo>
Values: true or false

GrammarCheck

Force grammarcheck globally.
Values: true or false

NoCaps

Force nocaps globally.
Values: true or false

NoColors

Force nocolors globally.
Values: true or false

SwearFilter

Force swearfilter globally.
Values: true or false

Format

Format in which messages are printed. Useful to keep a color scheme or style to all your messages.
Example: <color3><<color2>< <color1><message> <color2>><color3>>
Looks like: << Message here >>
Values: string

TableSymbol

Symbol to use for table border.
Note: Use only one character!
Values: character

TableColor

Color of table symbol. Suggested: <color3>
Values: color

PingMonitor


Ping Monitor will add the players current ping to a list and then take the average of that list. If the average is over Ping then action will be taken. Ping checks happen about every 10 seconds. Player must be in a team for it to check.

Ping

Action will be taken when the average ping after MinChecks ping checks.
Set above 1000 to disable.
Values: number

MinChecks

Number of times ping must be checked before
Values: number

BlacklistTime

(Action) The amount of time the player will be blacklisted for.
Set to 0 to not blacklist.
Set below 0 for permanent blacklist.
Values: timeformat

Warn

(Action) Warn the player with Message
Values: true or false

Spec

(Action) Puts the player spectator.
Values: true or false

Message

Message to be sent when blacklisting and warning.
Values: string

Prefix


Chat

Prefix for commands done in chat.
Example if set to !: !help
I don't recommend changing this as it is used to hook itself into shrubbot.
Values: string

Admin

Prefix for commands done in console.
Example if set to !: /!help
I don't recommend changing this as it is used to hook itself into shrubbot.
Values: string

Lua

Prefix for lua commands done in console.
Example if set to lua: /lua help
Values: string

Auth

Prefix for authorized lua commands done in console.
Example if set to sudo: /sudo help
auth is used by silent mod, so be careful if you set it to auth it could break silent mod functionality.
Values: string

Mail

Prefix for mail commands done in console.
Example if set to mail: /mail inbox
Values: string

Profile


AutoCreate

Automatically creates a profile for every player that joins.
Values: true or false

ForceRegister

If enabled players will need to register a profile before they are able to join a team.
Values: true or false

RequireBoth

If enabled this will require an ip and a guid to match to automatically be logged in.
Values: true or false

MaxIp

Maximum amount of profiles allowed on one ip.
Values: number

MaxGuid

Maximum amount of profiles allowed on one guid.
Values: number

Greetings

Allow users with profiles to customize their own greeting message. (For when they connect)
Values: true or false

Farewells

Allow users with profiles to customize their own farewell message. (For when they disconnect)
Values: true or false

SoundGreetings

Allow users with profiles to choose a sound (From the playsound list) to play when they connect.
Values: true or false

SoundFarewells

Allow users with profiles to choose a sound (From the playsound list) to play when they disconnect.
Values: true or false

Location

Default location for greeting and farewell messages.
Values: location

Sound


I package a small soundpack with the release that you can use if you want, it is not required. You can make your own soundpack if you wish.
Sounds marked with (Local) Only play to the client the event happens to.
Sounds marked with (Global) Play to all clients on the server.
Set to "" if you want to disable.

Enabled

Global value to enable or disable all sounds made by LESM.
Values: true or false

AdminWatch

(Local) Will play a sound when an adminwatch message is received when user has adminwatchsound profile key.
Values: path

Afk

(Global) Plays when a user goes away.
Values: path

Return

(Global) Plays when a user returns from being away.
Values: path

AutoLevel

(Global) Plays when a user is automatically leveled up.
Values: path

BlackList

(Local) Plays to authorized and leaders users when a blacklisted player trys to connect.
Values: path

Hello

(Global) Plays when the hi lua command is used.
Values: path

Bye

(Global) Plays when the bye lua command is used.
Values: path

Welcome

(Global) Plays when the welcome lua command is used.
Values: path

Salute

(Global) Plays when the salute lua command is used.
Values: path

Connect

(Global) Plays when a client connects for the first time.
Values: path

Disconnect

(Global) Plays when a client disconnects.
Values: path

Command

(Local) Plays when a command is executed.
Values: path

Error

(Local) Plays when an error is encountered in a command.
Values: path

KillConfirm

(Local) Plays when you get a kill. (To confirm that you did kill the player)
Values: path

TeamKillConfirm

(Local) Plays when you get a teamkill.
Values: path

Login

(Local) Plays when you use the login command to login.
Values: path

Logout

(Local) Plays when you use the logout command to logout.
Values: path

Register

(Local) Plays when you register a new account.
Values: path

NewMail

(Local) Plays when you receive a new ingame mail message.
Values: path

PrivateMessage

(Local) Plays when you receive an ingame privatemessage.
Values: path

Mention

(Local) Plays when you are mentioned in a command or chat.
TODO
Values: path

Warn

(Local) Plays when you are warned by LESM.
Values: path

Vote


Mute

If enabled you cannot call votes while muted.
Values: true or false

Mute

If enabled you cannot call votes unless you are logged into a profile.
Values: true or false

RequireLevel

Requires specified level to call a vote.
Values: number

Warn


Shrubbot

Use shrubbot warns when LESM automatically warns someone.
If set the rest of the options do not matter.
Values: true or false

AllowNoReason

Allow warnings with no reason.
Values: true or false

Mail

All warnings will go to admin-mail.
Values: true or false

RemoveLast

Removes last warning when Max warnings is reached.
Values: true or false

Max

Maximum amount of warns before action is taken.
Values: number

Expires

How long a warning lasts before it expires.
Values: timeformat

BlacklistTime

(Action) Time for client to be blacklisted when Max warnings is reached.
Set to 0 to not blacklist.
Set to -1 to permanently blacklist.
Values: timeformat

XpSave


Only recommended for mods that do not have their own xpsave system.

Enabled

Enable LESM xpsave.
Values: true or false

RequireLogin

Require client to be logged in to save XP.
Values: true or false

Bots

Save bots xp as well.
Values: true or false

Expire

Time in seconds for when the xp will expire when there is no activity.
Set to 0 to never expire.
Values: number

Expire

Time in seconds for when the xp will start to decay when there is no activity.
Set to 0 to never decay.
Values: number

= DecayMin

The minimum amount of xp to decay to.
Values: number

= DecayRate

The rate at which xp decays each skill per second.
Values: float number