mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Added warn to player list
This commit is contained in:
@@ -3,6 +3,7 @@ local Roles = require 'expcore.roles'
|
|||||||
local Store = require 'expcore.store'
|
local Store = require 'expcore.store'
|
||||||
local Game = require 'utils.game'
|
local Game = require 'utils.game'
|
||||||
local Reports = require 'modules.addons.reports-control'
|
local Reports = require 'modules.addons.reports-control'
|
||||||
|
local Warnings = require 'modules.addons.warnings-control'
|
||||||
local Jail = require 'modules.addons.jail-control'
|
local Jail = require 'modules.addons.jail-control'
|
||||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name')
|
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name')
|
||||||
|
|
||||||
@@ -88,6 +89,22 @@ local function report_player_callback(player,reason)
|
|||||||
Reports.report_player(action_player,reason,player.name)
|
Reports.report_player(action_player,reason,player.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local warn_player =
|
||||||
|
Gui.new_button()
|
||||||
|
:set_sprites('utility/spawn_flag')
|
||||||
|
:set_tooltip{'player-list.warn-player'}
|
||||||
|
:set_style('tool_button',tool_button_style)
|
||||||
|
:on_click(function(player,element)
|
||||||
|
Store.set_child(action_name_store,player.name,'command/give-warning')
|
||||||
|
end)
|
||||||
|
|
||||||
|
local function warn_player_callback(player,reason)
|
||||||
|
local action_player,action_player_name_color = get_action_player(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}
|
||||||
|
Warnings.add_warnings(action_player,player.name)
|
||||||
|
end
|
||||||
|
|
||||||
local jail_player =
|
local jail_player =
|
||||||
Gui.new_button()
|
Gui.new_button()
|
||||||
:set_sprites('utility/item_editor_icon')
|
:set_sprites('utility/item_editor_icon')
|
||||||
@@ -165,10 +182,19 @@ return {
|
|||||||
kill_player
|
kill_player
|
||||||
},
|
},
|
||||||
['command/report'] = {
|
['command/report'] = {
|
||||||
auth=auth_lower_role,
|
auth=function(player,action_player_name)
|
||||||
|
if not Roles.player_allowed(player,'command/give-warning') then
|
||||||
|
return auth_lower_role(player,action_player_name)
|
||||||
|
end
|
||||||
|
end,
|
||||||
reason_callback=report_player_callback,
|
reason_callback=report_player_callback,
|
||||||
report_player
|
report_player
|
||||||
},
|
},
|
||||||
|
['command/give-warning'] = {
|
||||||
|
auth=auth_lower_role,
|
||||||
|
reason_callback=warn_player_callback,
|
||||||
|
warn_player
|
||||||
|
},
|
||||||
['command/jail'] = {
|
['command/jail'] = {
|
||||||
auth=auth_lower_role,
|
auth=auth_lower_role,
|
||||||
reason_callback=jail_player_callback,
|
reason_callback=jail_player_callback,
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
return {
|
return {
|
||||||
actions = { -- what actions are taking at number of warnings
|
actions = { -- what actions are taking at number of warnings
|
||||||
-- if a localized string is used then __1__ will by_player_name and __2__ will be the current warning count (auto inserted)
|
-- if a localized string is used then __1__ will by_player_name and __2__ will be the current warning count (auto inserted)
|
||||||
{'warnings.received'},
|
{'warnings.received',''},
|
||||||
{'warnings.received'},
|
{'warnings.received',''},
|
||||||
{'warnings.received',{'warnings.pre-kick'}},
|
{'warnings.received',{'warnings.pre-kick'}},
|
||||||
function(player,by_player_name,number_of_warnings)
|
function(player,by_player_name,number_of_warnings)
|
||||||
game.kick_player(player,{'warnings.received',by_player_name,number_of_warnings,{'warnings.kick'}})
|
game.kick_player(player,{'warnings.received',by_player_name,number_of_warnings,{'warnings.kick'}})
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ goto-player=Goto player
|
|||||||
bring-player=Bring player
|
bring-player=Bring player
|
||||||
kill-player=Kill player
|
kill-player=Kill player
|
||||||
report-player=Report player
|
report-player=Report player
|
||||||
|
warn-player=Warn player
|
||||||
jail-player=Jail player
|
jail-player=Jail player
|
||||||
temp-ban-player=Temp ban player
|
temp-ban-player=Temp ban player
|
||||||
kick-player=Kick player
|
kick-player=Kick player
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ end)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
--- Button used to confirm a reason
|
--- Button used to confirm a reason
|
||||||
local reasonc_confirm =
|
local reason_confirm =
|
||||||
Gui.new_button()
|
Gui.new_button()
|
||||||
:set_sprites('utility/confirm_slot')
|
:set_sprites('utility/confirm_slot')
|
||||||
:set_tooltip{'player-list.reason-confirm'}
|
:set_tooltip{'player-list.reason-confirm'}
|
||||||
@@ -145,7 +145,7 @@ local function generate_container(player,element)
|
|||||||
reason_field.style.height = 28
|
reason_field.style.height = 28
|
||||||
reason_field.style.minimal_width = 160
|
reason_field.style.minimal_width = 160
|
||||||
|
|
||||||
reasonc_confirm(reason_bar)
|
reason_confirm(reason_bar)
|
||||||
|
|
||||||
return list_table, action_bar
|
return list_table, action_bar
|
||||||
end
|
end
|
||||||
@@ -194,7 +194,7 @@ local function update_action_bar(player)
|
|||||||
for action_name,buttons in pairs(config) do
|
for action_name,buttons in pairs(config) do
|
||||||
if buttons.auth and not buttons.auth(player,action_player) then
|
if buttons.auth and not buttons.auth(player,action_player) then
|
||||||
element[action_name].visible = false
|
element[action_name].visible = false
|
||||||
else
|
elseif Roles.player_allowed(player,action_name) then
|
||||||
element[action_name].visible = true
|
element[action_name].visible = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user