Donut Team is a labor of love, built and maintained by a small group of passionate developers. We invest our own time and resources to offer our tools, mods, and web services completely free of charge.

We don't run ads, and we will never sell your data - period.

If you've enjoyed anything we've created, please consider supporting our work with a one-time or monthly donation via our Ko-fi page . Every contribution helps us continue building great experiences for the community.

Dismiss
  • Modding Tools
  • Simpsons Hit & Run Multiplayer Server

Lua Scripting

The Simpsons Hit & Run Multiplayer (SHAR MP) Server has a Lua Scripting component that allows mods to modify the behavior of the server.

Mods define an entry point Lua script that is executed as soon as the mod is loaded. This script can then define functions that will be executed when certain events are fired on the server.

Blocked Functions/Variables

For a list of all of the stock Lua functions and variables that are blocked in Simpsons Hit & Run Multiplayer Server, see Blocked Lua Functions and Variables.

Additional Functionality

The Lua Scripting component also provides some additional functionality that mods can utilise. This functionality is provided through a set of tables that are available in the Lua environment. Each table provides functions and/or properties related to a specific area.

Table Description
Cryptography Provides functions for performing cryptographic operations.
DateTime Provides functions for working with dates and times.
Directory Provides functions for working with directories.
Engine Provides functions for interacting with the game engine.
Engine.Quaternion Provides functions for working with quaternions.
Engine.Vector3 Provides functions for working with 3D vectors.
Engine.VectorUtil Provides functions for working with vectors.
File Provides functions for working with the file system.
HTTP Provides functions for making HTTP requests.
JSON Provides functions for encoding and decoding JSON data.
Server Provides functions for interacting with the multiplayer server.
Server.Commands Provides functions for working with server commands.
Server.CurrentMod Provides functions for working with the current mod.
Server.Players Provides functions for working with players on the server.
Session Provides functions for working with multiplayer sessions.
String Provides functions for working with strings.
System Provides structural functions.

Global Functions

In addition to the functions provided by the tables listed above, there are also some global functions that are available in the Lua environment. These functions are not part of any table and can be called directly.

Function Name Description
print_r A function that takes a Lua object and prints it in a human-readable format.

Data Structures

In some cases, functions may return data structures that represent certain concepts on the server such as players and characters. These can be used to manipulate those concepts in various ways. The following data structures are currently available:

Data Structure Description
Configuration Data representing the server's configuration.
Player Data representing a player on the server.
PlayerCharacter Data representing a player's character.