Jail control

Control Module - Jail - Adds a way to jail players.

Usage


    -- import the module from the control modules
    local Jail = require 'modules.control.jail' --- @dep modules.control.jail

    -- This will move 'MrBiter' to the jail role and remove all other roles from them
    -- the player name and reason are only so they can be included in the event for user feedback
    Jail.jail_player('MrBiter', 'Cooldude2606', 'Likes biters too much')

    -- This will give 'MrBiter' all his roles back and remove him from jail
    -- again as above the player name is only used in the event for user feedback
    Jail.unjail_player('MrBiter', 'Cooldude2606')

Dependencies

expcore.roles
utils.game

Events

on_player_jailed When a player is assigned to jail
on_player_unjailed When a player is unassigned from jail

Jail

is_jailed(player) Checks if the player is currently in jail
jail_player(player, by_player_name[, reason='Non given.']) Moves a player to jail and removes all other roles
unjail_player(player, by_player_name) Moves a player out of jail and restores all roles previously removed

Dependencies

# expcore.roles
# utils.game

Events

# on_player_jailed

When a player is assigned to jail

Event Parameters:
  • player_index : (number) the index of the player who was jailed
  • by_player_name : (string) the name of the player who jailed the other player
  • reason : (string) the reason that the player was jailed
# on_player_unjailed

When a player is unassigned from jail

Event Parameters:
  • player_index : (number) the index of the player who was unjailed
  • by_player_name : (string) the name of the player who unjailed the other player

Jail

# is_jailed(player)

Checks if the player is currently in jail

Parameters:
  • player : (LuaPlayer) the player to check if they are in jail
Returns:
  • (boolean) whether the player is currently in jail
# jail_player(player, by_player_name[, reason='Non given.'])

Moves a player to jail and removes all other roles

Parameters:
  • player : (LuaPlayer) the player who will be jailed
  • by_player_name : (string) the name of the player who is doing the jailing
  • reason : (string) the reason that the player is being jailed (default: 'Non given.')
Returns:
  • (boolean) wheather the user was jailed successfully
# unjail_player(player, by_player_name)

Moves a player out of jail and restores all roles previously removed

Parameters:
  • player : (LuaPlayer) the player that will be unjailed
  • by_player_name : (string) the name of the player that is doing the unjail
Returns:
  • (boolean) whether the player was unjailed successfully