landsandboat/scripts/commands/wallhack.lua

43 lines
1 KiB
Lua
Raw Permalink Normal View History

-----------------------------------
-- func: wallhack <optional target>
2016-01-16 01:26:33 -05:00
-- desc: Allows the player to walk through walls.
-----------------------------------
---@type TCommand
local commandObj = {}
2016-01-16 01:26:33 -05:00
commandObj.cmdprops =
2016-01-16 01:26:33 -05:00
{
permission = 1,
parameters = 's'
}
2016-01-16 01:26:33 -05:00
local function error(player, msg)
player:printToPlayer(msg)
player:printToPlayer('!wallhack (player)')
end
commandObj.onTrigger = function(player, target)
-- validate target
local targ
if target == nil then
targ = player
else
targ = GetPlayerByName(target)
if targ == nil then
error(player, string.format('Player named "%s" not found!', target))
return
end
end
-- toggle wallhack for target
if targ:getWallhack() then
targ:setWallhack(false)
player:printToPlayer(string.format('Toggled %s\'s wallhack flag OFF.', targ:getName()))
else
targ:setWallhack(true)
player:printToPlayer(string.format('Toggled %s\'s wallhack flag ON.', targ:getName()))
end
end
return commandObj