Skip to content

Instantly share code, notes, and snippets.

@na-stewart
Created December 14, 2024 20:38
Show Gist options
  • Save na-stewart/21fb88a45381e485c90cd55d3a959a88 to your computer and use it in GitHub Desktop.
Save na-stewart/21fb88a45381e485c90cd55d3a959a88 to your computer and use it in GitHub Desktop.
Garry's Mod SAM anticheat measure that prevents hackers from tracking administrator activity.
if SAM_LOADED then return end
local sam, command, language = sam, sam.command, sam.language
command.set_category("Anticheat")
local function RecursiveSetPreventTransmit( ent, ply, stopTransmitting )
ent:SetPreventTransmit( ply, stopTransmitting )
local tab = ent:GetChildren()
for i = 1, #tab do
RecursiveSetPreventTransmit( tab[ i ], ply, stopTransmitting )
end
end
sam.command.new("ghost")
:SetPermission("ghost", "trialstaff")
:Help("Prevents the server from sending any further information about you to certain players.\n(0=Off)\n(1=On)")
:AddArg("player", {cant_target_self = true})
:AddArg("number", {
default = 1,
hint = "toggle",
min = 0,
max = 1,
})
:OnExecute(function(calling_ply, targets, toggle)
for i = 1, #targets do
RecursiveSetPreventTransmit( calling_ply, targets[i], toggle == 1 )
end
sam.player.send_message(calling_ply, toggle == 1 and "Ghost activated!" or "Ghost deactivated!")
end)
:End()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment