2021-01-18 13:34:00 -05:00
|
|
|
-----------------------------------
|
2016-07-29 08:35:15 -06:00
|
|
|
-- func: hide
|
2014-03-10 21:20:19 -07:00
|
|
|
-- desc: Hides the GM from other players.
|
2021-01-18 13:34:00 -05:00
|
|
|
-----------------------------------
|
2024-08-25 10:54:45 -04:00
|
|
|
---@type TCommand
|
2023-09-02 07:01:35 -04:00
|
|
|
local commandObj = {}
|
2014-03-10 21:20:19 -07:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
commandObj.cmdprops =
|
2014-03-10 21:20:19 -07:00
|
|
|
{
|
|
|
|
|
permission = 1,
|
2023-08-28 21:02:28 -04:00
|
|
|
parameters = 's'
|
2020-02-19 21:40:57 -08:00
|
|
|
}
|
2014-03-10 21:20:19 -07:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
commandObj.onTrigger = function(player, cmd)
|
2014-03-10 21:20:19 -07:00
|
|
|
-- Obtain the players hide status..
|
2023-08-28 21:02:28 -04:00
|
|
|
local isHidden = player:getCharVar('GMHidden')
|
2022-11-02 17:03:50 -04:00
|
|
|
if cmd ~= nil then
|
2023-08-28 21:02:28 -04:00
|
|
|
if cmd == 'status' then
|
2023-12-09 23:54:00 +00:00
|
|
|
player:printToPlayer(string.format('Current hide status: %s', tostring(isHidden)))
|
2020-02-19 21:40:57 -08:00
|
|
|
return
|
2014-03-10 21:20:19 -07:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Toggle the hide status..
|
2022-11-02 17:03:50 -04:00
|
|
|
if isHidden == 0 then
|
2020-02-19 21:40:57 -08:00
|
|
|
isHidden = 1
|
2014-03-10 21:20:19 -07:00
|
|
|
else
|
2020-02-19 21:40:57 -08:00
|
|
|
isHidden = 0
|
2014-03-10 21:20:19 -07:00
|
|
|
end
|
2020-03-19 18:41:42 -07:00
|
|
|
|
2014-03-10 21:20:19 -07:00
|
|
|
-- If hidden animate us beginning our hide..
|
2022-11-02 17:03:50 -04:00
|
|
|
if isHidden == 1 then
|
2023-08-28 21:02:28 -04:00
|
|
|
player:setCharVar('GMHidden', 1)
|
2020-02-19 21:40:57 -08:00
|
|
|
player:setGMHidden(true)
|
2023-12-09 23:54:00 +00:00
|
|
|
player:printToPlayer('You are now GM hidden from other players.')
|
2014-03-10 21:20:19 -07:00
|
|
|
else
|
2023-08-28 21:02:28 -04:00
|
|
|
player:setCharVar('GMHidden', 0)
|
2020-02-19 21:40:57 -08:00
|
|
|
player:setGMHidden(false)
|
2023-12-09 23:54:00 +00:00
|
|
|
player:printToPlayer('You are no longer GM hidden from other players.')
|
2014-03-10 21:20:19 -07:00
|
|
|
end
|
2020-03-19 18:41:42 -07:00
|
|
|
end
|
2023-09-02 07:01:35 -04:00
|
|
|
|
|
|
|
|
return commandObj
|