Control Module - Warnings - Adds a way to give and remove warnings to players.
-- import the module from the control modules
local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings
-- This will add a warning to the player
Warnings.add_warning('MrBiter', 'Cooldude2606', 'Killed too many biters')
-- This will remove a warning from a player, second name is just who is doing the action
Warnings.remove_warning('MrBiter', 'Cooldude2606')
-- Script warning as similar to normal warning but are designed to have no effect for a short amount of time
-- this is so it can be used for greifer protection without being too agressive
Warnings.add_script_warning('MrBiter', 'Killed too many biters')
-- Both normal and script warnings can also be cleared, this will remove all warnings
Warnings.clear_warnings('MrBiter', 'Cooldude2606')
utils.event |
utils.game |
utils.global |
config.warnings |
expcore.player_data |
on_warning_added | When a warning is added to a player |
on_warning_removed | When a warning is removed from a player |
on_script_warning_added | When a warning is added to a player, by the script |
on_script_warning_removed | When a warning is removed from a player, by the script |
get_warnings(player) | Gets an array of warnings that the player has, always returns a list even if empty |
count_warnings(player) | Gets the number of warnings that a player has on them |
add_warning(player, by_player_name[, reason='Non given.']) | Adds a warning to a player, when a warning is added a set action is done based on the number of warnings and the config file |
remove_warning(player, by_player_name) | Removes a warning from a player, always removes the earliest warning, fifo |
clear_warnings(player, by_player_name) | Removes all warnings from a player, will trigger remove event for each warning |
get_script_warnings(player) | Gets an array of all the script warnings that a player has |
count_script_warnings(player) | Gets the number of script warnings that a player has on them |
add_script_warning(player[, reason='Non given.']) | Adds a script warning to a player, this may add a full warning if max script warnings is met |
remove_script_warning(player) | Removes a script warning from a player |
clear_script_warnings(player) | Removes all script warnings from a player, emits event for each warning removed |
When a warning is added to a player
Event Parameters:When a warning is removed from a player
Event Parameters:When a warning is added to a player, by the script
Event Parameters:When a warning is removed from a player, by the script
Event Parameters:Gets an array of warnings that the player has, always returns a list even if empty
Parameters:Gets the number of warnings that a player has on them
Parameters:Adds a warning to a player, when a warning is added a set action is done based on the number of warnings and the config file
Parameters:Removes a warning from a player, always removes the earliest warning, fifo
Parameters:Removes all warnings from a player, will trigger remove event for each warning
Parameters:Gets an array of all the script warnings that a player has
Parameters:Gets the number of script warnings that a player has on them
Parameters:Adds a script warning to a player, this may add a full warning if max script warnings is met
Parameters:Removes a script warning from a player
Parameters:Removes all script warnings from a player, emits event for each warning removed
Parameters: