mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
Changed kill and tag to use role system
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local Roles = require 'expcore.roles'
|
||||
require 'config.command_parse_general'
|
||||
|
||||
Commands.new_command('kill','Kills yourself or another player.')
|
||||
@@ -9,11 +10,22 @@ Commands.new_command('kill','Kills yourself or another player.')
|
||||
return player
|
||||
end
|
||||
end}
|
||||
:set_flag('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()
|
||||
if player == action_player then
|
||||
action_player.character.die()
|
||||
elseif Roles.player_allowed(player,'command/kill/always') then
|
||||
local player_highest = Roles.get_player_highest_role(player)
|
||||
local action_player_highest = Roles.get_player_highest_role(action_player)
|
||||
if player_highest.index < action_player_highest.index then
|
||||
action_player.character.die()
|
||||
else
|
||||
return Commands.error{'expcore-roles.command-error-higher-role',action_player.name}
|
||||
end
|
||||
else
|
||||
return Commands.error{'expcore-commands.unauthorized'}
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user