mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
Added /kill and /admin-chat
This commit is contained in:
18
modules/commands/admin-chat.lua
Normal file
18
modules/commands/admin-chat.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
require 'expcore.common_parse'
|
||||
|
||||
Commands.new_command('admin-chat','Sends a message in chat that only admins can see.')
|
||||
:add_param('message',false)
|
||||
:enable_auto_concat()
|
||||
:add_tag('admin_only',true)
|
||||
:add_alias('ac')
|
||||
:register(function(player,message,raw)
|
||||
local pcc = player.chat_color
|
||||
local colour = string.format('%s,%s,%s',pcc.r,pcc.g,pcc.b)
|
||||
for _,return_player in pairs(game.connected_players) do
|
||||
if return_player.admin then
|
||||
return_player.print{'exp-commands.admin-chat-format',player.name,message,colour}
|
||||
end
|
||||
end
|
||||
return Commands.success -- prevents command complete message from showing
|
||||
end)
|
||||
3
modules/commands/commands-local.cfg
Normal file
3
modules/commands/commands-local.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
[exp-commands]
|
||||
kill-already-dead=You are already dead.
|
||||
admin-chat-format=[Admin Chat] [color=__3__]__1__: __2__
|
||||
19
modules/commands/kill.lua
Normal file
19
modules/commands/kill.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
require 'expcore.common_parse'
|
||||
|
||||
Commands.new_command('kill','Kills yourself or another player.')
|
||||
:add_param('player',true,'player-alive')
|
||||
:add_defaults{player=function(player)
|
||||
-- default is the player unless they are dead
|
||||
if player.character and player.character.health > 0 then
|
||||
return player
|
||||
end
|
||||
end}
|
||||
:add_tag('admin_only',true)
|
||||
:register(function(player,action_player,raw)
|
||||
if not action_player then
|
||||
-- can only be nil if no player given and the user is dead
|
||||
return Commands.error{'exp-commands.kill-already-dead'}
|
||||
end
|
||||
action_player.character.die()
|
||||
end)
|
||||
Reference in New Issue
Block a user