Added Lots of Commands

This commit is contained in:
Cooldude2606
2018-01-05 13:10:10 +00:00
parent b1165cfa00
commit 45d7323e55
7 changed files with 139 additions and 1 deletions

View File

@@ -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)

22
Addons/Commands/kill.lua Normal file
View File

@@ -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)

View File

@@ -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)

30
Addons/Commands/tags.lua Normal file
View File

@@ -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)

21
Addons/Commands/tp.lua Normal file
View File

@@ -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)

View File

@@ -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')

View File

@@ -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{