From cf6e2838cac70b52392f057d26074ddf8a37edfb Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 24 Jun 2018 19:33:54 +0100 Subject: [PATCH] Added Kill Command --- modules/ExpGamingCommands/kill/kill.lua | 18 ++++++++++++++++ modules/ExpGamingCommands/kill/softmod.json | 23 +++++++++++++++++++++ modules/ExpGamingCommands/softmod.json | 17 +++++++++++++++ to convert/Addons/Commands/kill.lua | 21 ------------------- 4 files changed, 58 insertions(+), 21 deletions(-) create mode 100644 modules/ExpGamingCommands/kill/kill.lua create mode 100644 modules/ExpGamingCommands/kill/softmod.json create mode 100644 modules/ExpGamingCommands/softmod.json delete mode 100644 to convert/Addons/Commands/kill.lua diff --git a/modules/ExpGamingCommands/kill/kill.lua b/modules/ExpGamingCommands/kill/kill.lua new file mode 100644 index 00000000..caaf72cb --- /dev/null +++ b/modules/ExpGamingCommands/kill/kill.lua @@ -0,0 +1,18 @@ +--- A full ranking system for factorio. +-- @module ExpGamingCommands.kill +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE + +local Game = require('FactorioStdLib.Game') + +--- Kills a player of a lower rank +-- @command kill +-- @param player the player to be killed +commands.add_command('kill', 'Kills a player. No player name kills yourself.', { + ['player']={false,'player-rank-alive'} +}, function(event,args) + local _player = Game.get_player(event) + local player = args.player + if player then player.character.die() + else _player.character.die() end +end) diff --git a/modules/ExpGamingCommands/kill/softmod.json b/modules/ExpGamingCommands/kill/softmod.json new file mode 100644 index 00000000..b3b6553e --- /dev/null +++ b/modules/ExpGamingCommands/kill/softmod.json @@ -0,0 +1,23 @@ +{ + "name": "kill", + "version": "4.0.0", + "type": "Module", + "description": "Adds a command which can be used to kill a player or yourself.", + "location": "", + "keywords": [ + "Command", + "ExpGaming", + "Kill", + "Death", + "Admin", + "Tool" + ], + "author": "Cooldude2606", + "contact": "Discord: Cooldude2606#5241", + "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", + "dependencies": { + "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingCommands/softmod.json b/modules/ExpGamingCommands/softmod.json new file mode 100644 index 00000000..49861a69 --- /dev/null +++ b/modules/ExpGamingCommands/softmod.json @@ -0,0 +1,17 @@ +{ + "name": "ExpGamingCommands", + "version": "4.0.0", + "type": "Collection", + "description": "A Collection of all of the custom commands used on ExpGaming servers.", + "location": "", + "keywords": [ + "Commands", + "ExpGaming", + "Admin", + "Tools" + ], + "author": "Cooldude2606", + "contact": "Discord: Cooldude2606#5241", + "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", + "submodules": {} +} \ No newline at end of file diff --git a/to convert/Addons/Commands/kill.lua b/to convert/Addons/Commands/kill.lua deleted file mode 100644 index a48f9143..00000000 --- a/to convert/Addons/Commands/kill.lua +++ /dev/null @@ -1,21 +0,0 @@ ---[[ -Explosive Gaming - -This file can be used with permission but this and the credit below must remain in the file. -Contact a member of management on our discord to seek permission to use our code. -Any changes that you may make to the code are yours but that does not make the script yours. -Discord: https://discord.gg/r6dC2uK -]] ---Please Only Edit Below This Line----------------------------------------------------------- - -commands.add_command('kill', 'Kills a player. Must be either yourself (/kill self) or a person of a lower rank', {'player'}, function(event,args) - local _player = Game.get_player(event) - local player = Game.get_player(args.player) - if args.player ~= 'self' and not player then player_return({'commands.invalid-player',args.player}) return commands.error end - if args.player == 'self' or _player.name == player.name then - if _player.character then _player.character.die() else player_return({'commands.dead-player'}) return commands.error end - elseif Ranking.get_rank(player).power > Ranking.get_rank(_player).power then - if player.connected then else player_return({'commands.offline-player'}) return commands.error end - if player.character then player.character.die() else player_return({'commands.dead-player'}) return commands.error end - else player_return({'commands.unauthorized'}) return commands.error end -end)