You are viewing a potentially older version of this package. View all versions.
Fifty-Server_Utilities-0.9.2 icon

Server Utilities

A chat command and poll framework for servers. Implements extra features such as map voting and more.

By Fifty
Date uploaded 4 years ago
Version 0.9.2
Download link Fifty-Server_Utilities-0.9.2.zip
Downloads 222
Dependency string Fifty-Server_Utilities-0.9.2

This mod requires the following mods to function

README

Fifty.ServerUtils

A framework for chat command based server mods. The mod is separated into modules all of which have extensive settings and apart from the core can be entirely disabled

Core

The core module implements a chat and a poll handler. For more information on the API check the API section.

Welcome message example:

image

Poll example:

image

Other

  • Map voting
    • Adds map voting functionality at the end of the match or with the command !rtv

Settings

All settings with comments are located in f_serverutils_settings.nut, the mod.json doesn't include any settings due to convar limitations. It is highly recommended to change some of the settings such as fsu_owner so your players know who to contact when wanting to report something to the server owner.

API

Chat callbacks support ANSI escape codes, these allow you to change the colour of your text. An example of such a code is \x1b[113m which changes the colour to orange.

Global functions

void function FSU_RegisterCommand ( string command, string usage, void functionref( entity, array < string > ) callbackFunc, array < string > abbreviations = [] ) )

Registers your custom command

  1. command
    • Your command, needs to have a "!"at the start
    • Example: "!help"
  2. usage
    • Explanation of what the command does
    • Example: "\x1b[113m!vote\x1b[0m <number> Allows you to vote on polls"
  3. callbackFunc
    • This function gets called when the player calls your command
    • entity is player
    • array < string > is an array of arguments, args[0] would be the first argument
  4. abbreviations
    • Abbreviations of the command
    • Example: [ "!dc", "!dikord", "!dicsord" ]

bool function FSU_CanCreatePoll ()

Returns true if you can create a poll, there can only be one poll at a time so to not conflict make sure you check this!

void function FSU_CreatePoll ( array < string > options, string before, float duration )

Creates the poll. It is not recommended to pass an array larger than 7.

  1. options
    • A list of options
  2. before
    • A string put on the first line. An example use of this would be "Vote for a map!"
  3. duration
    • Duration of the poll in seconds

int function FSU_GetPollResultIndex ()

Returns the index of the option which won the poll. If the 1st option won it will return 0. If there were no votes cast it returns -1.

Errors

"[FSU] Registered commands have to be lowercase!"

Exactly what it says. When registering a command it needs to be lowercase. Instead of "!Help" you need to register "!help". When the user enters the command its case agnostic. Only when registering the command does it need to be lower case.