Fixed Existing Lua Check Errors

This commit is contained in:
Cooldude2606
2020-05-26 18:21:10 +01:00
parent 2aaeb06be3
commit 32507492b8
76 changed files with 1622 additions and 1617 deletions

View File

@@ -13,47 +13,47 @@ require 'config.expcore.command_role_parse'
-- @command give-warning
-- @tparam LuaPlayer player the player the will recive a warning
-- @tparam string reason the reason the player is being given a warning
Commands.new_command('give-warning','Gives a warning to a player; may lead to automatic script action.')
:add_param('player',false,'player-role')
:add_param('reason',false)
Commands.new_command('give-warning', 'Gives a warning to a player; may lead to automatic script action.')
:add_param('player', false, 'player-role')
:add_param('reason', false)
:add_alias('warn')
:enable_auto_concat()
:register(function(player,action_player,reason,raw)
Warnings.add_warning(action_player,player.name,reason)
:register(function(player, action_player, reason)
Warnings.add_warning(action_player, player.name, reason)
local action_player_name_color = format_chat_player_name(action_player)
local by_player_name_color = format_chat_player_name(player)
game.print{'expcom-warnings.received',action_player_name_color,by_player_name_color,reason}
game.print{'expcom-warnings.received', action_player_name_color, by_player_name_color, reason}
end)
--- Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have.
-- @command get-warnings
-- @tparam[opt=list] LuaPlayer player the player to get the warning for, if nil all players are listed
Commands.new_command('get-warnings','Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have.')
:add_param('player',true,'player')
:add_alias('warnings','list-warnings')
:register(function(player,action_player,raw)
if action_player then
local warnings = Warnings.get_warnings(action_player)
local script_warnings = Warnings.get_script_warnings(action_player)
local action_player_name_color = format_chat_player_name(action_player)
Commands.print{'expcom-warnings.player',action_player_name_color,warnings,script_warnings,config.temp_warning_limit}
Commands.new_command('get-warnings', 'Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have.')
:add_param('player', true, 'player')
:add_alias('warnings', 'list-warnings')
:register(function(_, player)
if player then
local warnings = Warnings.get_warnings(player)
local script_warnings = Warnings.get_script_warnings(player)
local player_name_color = format_chat_player_name(player)
Commands.print{'expcom-warnings.player', player_name_color, warnings, script_warnings, config.temp_warning_limit}
else
local rtn = {}
local user_warnings = Warnings.user_warnings
local user_script_warnings = Warnings.user_script_warnings
for player_name,warnings in pairs(user_warnings) do
rtn[player_name] = {#warnings,0}
for player_name, warnings in pairs(user_warnings) do
rtn[player_name] = {#warnings, 0}
end
for player_name,warnings in pairs(user_script_warnings) do
for player_name, warnings in pairs(user_script_warnings) do
if not rtn[player_name] then
rtn[player_name] = {0,0}
rtn[player_name] = {0, 0}
end
rtn[player_name][2] = #warnings
end
Commands.print{'expcom-warnings.list-tilte'}
for player_name,warnings in pairs(rtn) do
for player_name, warnings in pairs(rtn) do
local player_name_color = format_chat_player_name(player_name)
Commands.print{'expcom-warnings.list',player_name_color,warnings[1],warnings[2],config.temp_warning_limit}
Commands.print{'expcom-warnings.list', player_name_color, warnings[1], warnings[2], config.temp_warning_limit}
end
end
end)
@@ -61,12 +61,12 @@ end)
--- Clears all warnings (and script warnings) from a player
-- @command clear-warnings
-- @tparam LuaPlayer player the player to clear the warnings from
Commands.new_command('clear-warnings','Clears all warnings (and script warnings) from a player')
:add_param('player',false,'player')
:register(function(player,action_player,raw)
Warnings.clear_warnings(action_player,player.name)
Warnings.clear_script_warnings(action_player,player.name)
Commands.new_command('clear-warnings', 'Clears all warnings (and script warnings) from a player')
:add_param('player', false, 'player')
:register(function(player, action_player)
Warnings.clear_warnings(action_player, player.name)
Warnings.clear_script_warnings(action_player, player.name)
local action_player_name_color = format_chat_player_name(action_player)
local by_player_name_color = format_chat_player_name(player)
game.print{'expcom-warnings.cleared',action_player_name_color,by_player_name_color}
game.print{'expcom-warnings.cleared', action_player_name_color, by_player_name_color}
end)