mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +09:00
Fixed All Commands
This commit is contained in:
@@ -11,5 +11,5 @@ Discord: https://discord.gg/r6dC2uK
|
|||||||
commands.add_command('cheat-mode', 'Toggles cheat mode for a player', {'player'}, function(event,args)
|
commands.add_command('cheat-mode', 'Toggles cheat mode for a player', {'player'}, function(event,args)
|
||||||
local player = Game.get_player(args.player)
|
local player = Game.get_player(args.player)
|
||||||
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
|
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
|
if player.cheat_mode == true then player.cheat_mode = false else player.cheat_mode = true end
|
||||||
end)
|
end)
|
||||||
@@ -13,16 +13,17 @@ local const = 100
|
|||||||
|
|
||||||
commands.add_command('repair', 'Repairs all destoryed and damaged entites in an area', {'range'}, function(event,args)
|
commands.add_command('repair', 'Repairs all destoryed and damaged entites in an area', {'range'}, function(event,args)
|
||||||
local range = tonumber(args.range)
|
local range = tonumber(args.range)
|
||||||
local rank = Ranking.get_rank(event)
|
local player = Game.get_player(event)
|
||||||
|
local rank = Ranking.get_rank(player)
|
||||||
local highest_admin_power = Ranking.get_group('Admin').highest.power-1
|
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 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}
|
local center = player and player.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
|
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 x = -range-2, range+2 do
|
||||||
for y = -range-2, range+2 do
|
for y = -range-2, range+2 do
|
||||||
if x^2+y^2 < range^2 then
|
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_filtered({area={{x+center.x,y+center.y},{x+center.x+1,y+center.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
|
for key, entity in pairs(player.surface.find_entities({{x+center.x,y+center.y},{x+center.x+1,y+center.y+1}})) do if entity.health then entity.health = 10000 end end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ local const = 20
|
|||||||
-- this is the max lenth of a tag
|
-- 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)
|
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 player = Game.get_player(event)
|
||||||
local rank = Ranking.get_rank(player)
|
local rank = Ranking.get_rank(player)
|
||||||
if string.len(args.tag) > const then player_return({'commands.invalid-length',const}) return commands.error end
|
if string.len(args.tag) > const then player_return({'commands.invalid-length',const}) return commands.error end
|
||||||
player.tag = rank.tag..' - '..args.tag
|
player.tag = rank.tag..' - '..args.tag
|
||||||
|
|||||||
Reference in New Issue
Block a user