From 45d7323e55f32faa7d5c4eb3f60b25215a64f1a9 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 5 Jan 2018 13:10:10 +0000 Subject: [PATCH] Added Lots of Commands --- Addons/Commands/cheat-mode.lua | 15 +++++++++++++++ Addons/Commands/kill.lua | 22 ++++++++++++++++++++++ Addons/Commands/repair.lua | 29 +++++++++++++++++++++++++++++ Addons/Commands/tags.lua | 30 ++++++++++++++++++++++++++++++ Addons/Commands/tp.lua | 21 +++++++++++++++++++++ Addons/load.lua | 5 +++++ Addons/playerRanks.lua | 18 +++++++++++++++++- 7 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 Addons/Commands/cheat-mode.lua create mode 100644 Addons/Commands/kill.lua create mode 100644 Addons/Commands/repair.lua create mode 100644 Addons/Commands/tags.lua create mode 100644 Addons/Commands/tp.lua diff --git a/Addons/Commands/cheat-mode.lua b/Addons/Commands/cheat-mode.lua new file mode 100644 index 00000000..33a2a45e --- /dev/null +++ b/Addons/Commands/cheat-mode.lua @@ -0,0 +1,15 @@ +--[[ +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('cheat-mode', 'Toggles cheat mode for a player', {'player'}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + player.cheat_mode = player.cheat_mode and false or true +end) \ No newline at end of file diff --git a/Addons/Commands/kill.lua b/Addons/Commands/kill.lua new file mode 100644 index 00000000..d1a788b8 --- /dev/null +++ b/Addons/Commands/kill.lua @@ -0,0 +1,22 @@ +--[[ +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 _player.name == player.name or args.player == 'self' 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 + 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) \ No newline at end of file diff --git a/Addons/Commands/repair.lua b/Addons/Commands/repair.lua new file mode 100644 index 00000000..b5c80961 --- /dev/null +++ b/Addons/Commands/repair.lua @@ -0,0 +1,29 @@ +--[[ +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----------------------------------------------------------- + +local const = 100 +-- given const = 100: admin+ has unlimited, admin has 100, mod has 50, member has 20 + +commands.add_command('repair', 'Repairs all destoryed and damaged entites in an area', {'range'}, function(event,args) + local range = tonumber(args.range) + local rank = Ranking.get_rank(event) + local highest_admin_power = Ranking.get_group('Admin').highest.power-1 + local max_range = rank.power-highest_admin_power > 0 and const/(rank.power-highest_admin_power) or nil + local center = Game.get_player(event) and Game.get_player(event).position or {x=0,y=0} + if not range or max_range and range > max_range then player_return({'commands.invalid-range',0,math.floor(max_range)}) return commands.error end + for x = -range-2, range+2 do + for y = -range-2, range+2 do + if x^2+y^2 < range^2 then + for key, entity in pairs(player.surface.find_entities_filtered({area={{x,y},{x+1,y+1}},type ='entity-ghost'})) do entity.revive() end + for key, entity in pairs(player.surface.find_entities({{x,y},{x+1,y+1}})) do if entity.health then entity.health = 10000 end end + end + end + end +end) \ No newline at end of file diff --git a/Addons/Commands/tags.lua b/Addons/Commands/tags.lua new file mode 100644 index 00000000..51f5a0c8 --- /dev/null +++ b/Addons/Commands/tags.lua @@ -0,0 +1,30 @@ +--[[ +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----------------------------------------------------------- + +local const = 20 +-- this is the max lenth of a tag + +commands.add_command('tag', 'Give yourself a custom tag, use /tag-clear self, to remove tag.', {'tag',true}, function(event,args) + local player = Game.get_player(args.player) + local rank = Ranking.get_rank(player) + if string.len(args.tag) > const then player_return({'commands.invalid-length',const}) return commands.error end + player.tag = rank.tag..' - '..args.tag +end) + +commands.add_command('tag-clear', 'Removes a custom tag. Player can be self (/tag-clear self)', {'player'}, function(event,args) + local _player = Game.get_player(event) + local _rank = Ranking.get_rank(_player) + local player = Game.get_player(args.player) + local rank = Ranking.get_rank(player) + if args.player ~= 'self' and not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if _player.name == player.name or args.player == 'self' then _player.tag = _rank.tag + elseif _rank.power < rank.power then player.tag = rank.tag + else player_return({'commands.unauthorized'}) return commands.error end +end) \ No newline at end of file diff --git a/Addons/Commands/tp.lua b/Addons/Commands/tp.lua new file mode 100644 index 00000000..fdd4a74b --- /dev/null +++ b/Addons/Commands/tp.lua @@ -0,0 +1,21 @@ +--[[ +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('go-to', 'Go to a player\'s location', {'player'}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + Admin.go_to(player,event) +end) + +commands.add_command('bring', 'Bring a player to your location', {'player'}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + Admin.bring(player,event) +end) \ No newline at end of file diff --git a/Addons/load.lua b/Addons/load.lua index 6015ea0b..f1194a97 100644 --- a/Addons/load.lua +++ b/Addons/load.lua @@ -22,6 +22,11 @@ require('Admin/admin') -- used with Guis/admin-gui, but can work without require('Admin/discord') -- commands dir +require('Commands/cheat-mode') +require('Commands/kill') +require('Commands/repair') +require('Commands/tags') +require('Commands/tp') -- requires Admin/admin -- guis dir require('Guis/readme') diff --git a/Addons/playerRanks.lua b/Addons/playerRanks.lua index 1fc1fe70..a724befc 100644 --- a/Addons/playerRanks.lua +++ b/Addons/playerRanks.lua @@ -128,12 +128,28 @@ groups['User']:add_rank{ power=4 } +ranks['Developer']:edit('allow',false,{ + ['cheat-mode']=true +}) + ranks['Admin']:edit('allow',false,{ ['game-settings']=true }) +ranks['Mod']:edit('allow',false,{ + ['tp']=true, + ['bring']=true +}) ranks['Member']:edit('allow',false,{ - ['edit-tasklist']=true + ['edit-tasklist']=true, + ['repair']=true +}) +ranks['Regular']:edit('allow',false,{ + ['kill']=true +}) +ranks['Guest']:edit('allow',false,{ + ['tag']=true, + ['tag-clear']=true }) Ranking._base_preset{