Skip to content

Instantly share code, notes, and snippets.

@rubenwardy
Last active June 21, 2021 19:34
Show Gist options
  • Save rubenwardy/a64eeb55b1f4ae8d7d8e630e5a00c2cc to your computer and use it in GitHub Desktop.
Save rubenwardy/a64eeb55b1f4ae8d7d8e630e5a00c2cc to your computer and use it in GitHub Desktop.
local function update_basic_debug(player, value)
if type(player) == "string" then
player = core.get_player_by_name(name)
if not player then
return
end
end
player:hud_set_flags({
basic_debug = value,
})
end
core.register_privilege("basic_debug", {
on_grant = function(name) update_basic_debug(name, true) end,
on_revoke = function(name) update_basic_debug(name, false) end,
})
core.register_on_joinplayer(function(player)
-- Mods may unregister the privilege
if not core.registered_privileges["basic_debug"] then
return
end
local has_priv = core.check_player_privs(player, { basic_debug = true })
if has_priv then
update_basic_debug(player, true)
end
end))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment