Last active
June 18, 2021 00:58
-
-
Save Cheatoid/d29fc5dd6ea9819295d2c87098b7bfb6 to your computer and use it in GitHub Desktop.
(GLua) Something dirty I guess. This is supposed to let you hide players from SUI scoreboard (and cloak them) based on clientside actions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Courtesy of /gh/Cheatoid | |
-- Updates: https://gist.github.com/d29fc5dd6ea9819295d2c87098b7bfb6 | |
-- Totally untested. But, it is supposed to let you hide players from SUI scoreboard (and cloak them) based on clientside actions. | |
-- Needless shall I have to tell you again, this *will* be abused by haxxors/skids... But, you will just need to live with that I guess. | |
-- Whenever you want to toggle the state, simply call the hax_ToggleCloak() function on clientside. | |
local PLAYER = FindMetaTable'Player' | |
AccessorFunc(PLAYER, 'm_bHideOnScoreboard', 'HideOnScoreboard', FORCE_BOOL) | |
local msgID = 'hax_togglecloak' | |
if SERVER then | |
util.AddNetworkString(msgID) | |
if ULib then | |
hook.Add('PlayerCloakStateChanged', 'hax_ULibCloak', function(ply, newState) | |
ULib.invisible(ply, newState, 0xFF) -- cloak the player using ULib function | |
end) | |
end | |
function PLAYER:hax_ToggleCloak() | |
if not net.Start(msgID) then return end | |
ply:SetHideOnScoreboard(not ply:GetHideOnScoreboard()) | |
local newState = ply:GetHideOnScoreboard() | |
net.WriteEntity(ply) | |
net.WriteBit(newState) | |
net.Broadcast() | |
hook.Run('PlayerCloakStateChanged', ply, newState) | |
end | |
else -- CLIENT | |
function hax_ToggleCloak() | |
if net.Start(msgID) then net.SendToServer() end | |
end | |
local hax = vgui.GetControlTable'suiscoreplayerrow' | |
if istable(hax) then -- SUI scoreboard's player_row | |
hax.RealPaint = hax.RealPaint or hax.Paint | |
function hax.Paint(...) | |
local ply = self.Player | |
if IsValid(ply) and ply:GetHideOnScoreboard() then return end | |
return hax.RealPaint(...) | |
end | |
end | |
end | |
net.Receive(msgID, function(_, ply) | |
if SERVER then | |
ply:hax_ToggleCloak() | |
else -- CLIENT | |
ply = net.ReadEntity() | |
if IsValid(ply) then -- may be invalid due to PVS | |
ply:SetHideOnScoreboard(net.ReadBit() == 1) | |
end | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment