Creating Derma = Fail

I’m trying to send a umsg from the server to the client to make a Derma menu…

this is autorun/server/anti_cheat.lua


– Let them know
function AntiCheat( ply )
if ply:IsAdmin() and !ply:IsSuperAdmin() then
ply:SetNWInt(“WarningLevel”, 0)
elseif ply:IsSuperAdmin() then
ply:SetNWInt(“WarningLevel”, 0)
ply:SetNWInt(“WarningLevel”, 5)
umsg.Start(“ACInfo”, ply)
hook.Add( “PlayerInitialSpawn”, “FirstSpawn”, AntiCheat )

function Disagree( um )
local ply = um:ReadEntity()
gatekeeper.Drop(ply:UserID(), “You must agree to the Anti-Cheat system to play here”)
usermessage.Hook(“ACDisagree”, Disagree)


SLOGBlocked = {

local DontShow = {
“se auth”,

function Cmd_RecvCommand(Name, Buffer)
local Ply = false

for k,v in ipairs(player.GetAll()) do
	if IsValid(v) && v:Name() == Name then
		Ply = v

// don't bother with any commands executed by a NULL player, including say or crash commands
if !IsValid(Ply) then
	return true

local clean = string.Trim(Buffer)
local lower = string.lower(clean)

// don't log these commands
for k,v in ipairs(DontShow) do
	if string.sub(lower, 1, string.len(v)) == string.lower(v) then
		return false

local name = Ply:Name()
local steamid = Ply:SteamID()
local blocked = false
local printmessage = nil

for k,v in pairs(SLOGBlocked) do
	if lower == v || string.find(lower, v) != nil then
		blocked = true
		printmessage = "#Blocked Command: "..string.format("%s (%s) ran '%s'

", name, steamid, clean)
if Ply:IsAdmin() and !Ply:IsSuperAdmin() then
Ply:SetNWInt(“WarningLevel”, Ply:GetNWInt(“WarningLevel”) + 2)
Ply:SetNWInt(“WarningLevel”, 10)

local log = string.format("[%s] %s (%s) ran '%s'

“,”%c"), name, steamid, clean)
AppendLog(string.Replace(steamid, “:”, “_”), log)

if blocked then
	AppendLog("Blocked", log)
	if Ply:GetNWInt("WarningLevel") >= 10 then
		local Banned_SteamID = Ply:SteamID()
		local Banned_Nick = Ply:Nick()
		gatekeeper.Drop(Ply:UserID(), "Banned for 1 day; Warning Level exceeded. You CAN NOT appeal this ban")
		RunConsoleCommand("ulx", "banid", Banned_SteamID, 1440, Banned_Nick .. ": Warning Level exceeded")
	printmessage = "#"..log

if printmessage then
	for k,v in ipairs(player.GetAll()) do
		if IsValid(v) && v:IsSuperAdmin() then
			if blocked then
				v:PrintMessage(HUD_PRINTTALK, printmessage)
				v:PrintMessage(HUD_PRINTCONSOLE, printmessage)

if string.find(lower, "lua_run_cl") &&
 ( string.find(lower, "select v from ratings") ||  string.find(lower, "http") || string.find(lower, "slob") || string.find(lower, "runstring") ) then

	gatekeeper.Drop(Ply:UserID(), "Malicious bind; type 'key_findbinding lua_run_cl' and rebind those keys")
	return true

--AEcho("[" .."%c") .. "]" .. Ply:Nick() .. " ran '" .. lower .. "'.")

return blocked


hook.Add(“SetupMove”, “InfAngleGuard”, function(ply, cmd)
local ang = cmd:GetMoveAngles()

if not (ang.p >= 0 or ang.p <= 0) or not (ang.y >= 0 or ang.y <= 0) or not (ang.r >= 0 or ang.r <= 0) then
	cmd:SetMoveAngles(Angle(0, 0, 0))
	ply:SetEyeAngles(Angle(0, 0, 0))



[lua]function ShowAntiCheatInfo()
local F = vgui.Create(“DFrame”)
F:SetSize(400, 175)
F:SetTitle(“Anti-Cheat Information”)

-- tabs
local Tabs = vgui.Create( "DPropertySheet", F )
Tabs:SetPos( 5, 25 )
Tabs:SetSize( 390, 125 )

local sheet1 = vgui.Create( "DPanel" )
--local sheet2 = vgui.Create( "DPanel" )

local AI = vgui.Create( "DLabel", sheet1 ) --By putting sheet1 here, you are setting the parent of DLabel to sheet1
if LocalPlayer():IsAdmin() and !LocalPlayer():IsSuperAdmin() then
	local Warning = vgui.Create("DImage", sheet1)
	AI:SetText("As an admin, you have a higher tolerance for hacking bans.")
elseif LocalPlayer():IsSuperAdmin() then
	local OK = vgui.Create("DImage", sheet1)
	OK:SetPos( 5, 5 )
	AI:SetText("Since you are a super admin, you can not be banned for hacking.")
	local Warning = vgui.Create("DImage", sheet1)
	AI:SetText("As a client of our server, you get 1 warning before being banned for hacking.")
AI:SetColor(Color(0, 0, 0))
AI:SetPos(25, 5)

-- about the anti cheat
local About = vgui.Create("DLabel", sheet1)
About:SetText("The Anti-Cheat on this server will give you one chance to save yourself, so if

you accidently press a bind, you’re safe. If you press another cheat bind, or
enter a cheat command, you will be banned for cheating.

You MAY NOT appeal bans from our Anti-Cheat system.")
About:SetColor(Color(0, 0, 0))
About:SetPos(5, 25)

print("WHAT IS THIS?!")
local SheetItemTwo = vgui.Create( "DCheckBoxLabel" , sheet2 )
SheetItemTwo:SetText( "Use SENTs?" )
SheetItemTwo:SetConVar( "some_convar" )
SheetItemTwo:SetValue( 1 )
-- I agree button
local Agree = vgui.Create("DButton", F)
Agree:SetText("I agree to the above")
Agree:SetPos(5, 155)
Agree:SetSize(180, 15)
Agree.DoClick = function() F:SetVisible(false) AI:SetVisible(false) Tabs:SetVisible(false) sheet1:SetVisible(false) chat.AddText(Color(255, 255, 255), "Enjoy your stay ", Color(0, 255, 0), LocalPlayer():Nick(), Color(255, 255, 255), "!") chat.PlaySound() RunConsoleCommand("escape") end

-- I do not agree button

local Disagree = vgui.Create("DButton", F)
Disagree:SetText("I do not agree to the above")
Disagree:SetPos(215, 155)
Disagree:SetSize(180, 15)
Disagree.DoClick = function() umsg.Start("ACDisagree", LocalPlayer()) umsg.Entity(LocalPlayer()) umsg.End() end

--You then use the DPanels (sheet1, sheet2) for the AddSheet. All controls (buttons, checkboxes, etc. should be parented to them (sheet1,sheet2) and NOT the DPropertySheet (Tabs)
Tabs:AddSheet( "Information", sheet1, "gui/silkicons/user", false, false, "Anti-Hack Information" )
--Tabs:AddSheet( "About", sheet2, "gui/silkicons/group", false, false, "About the Anti-Hack" )

usermessage.Hook(“ACInfo”, ShowAntiCheatInfo)

–chat.AddText(Color(255, 255, 255), "Good afternoon ", Color(0, 255, 0), LocalPlayer():Nick(), Color(255, 255, 255), “! We think it’s only fair if you understand how we feel against hacking, so here’s a nice explanation.”)[/lua]

[autorun\client\anti_cheat_derma.lua:20] attempt to call method ‘IsAdmin’ (a nil value)

Am I missing something? Thanks./

Try, Changing the LocalPlayer: thing to pl or ply and up at the top by the function in parenthesis put pl or ply so like this.

line 20: if pl:IsAdmin() and !pl:IsSuperAdmin() then

function part: function ShowAntiCheatInfo(pl)

I don’t know just a suggestion.

Just tried, same error. Thanks for the response though.

Maybe try making it a client side file.

The second one causing the error is the autorun/client/anti_cheat_derma.lua is clientside

[lua] if ply:IsAdmin() and !ply:IsSuperAdmin() then [/lua]
Why would you do that?

Try it without !ply:IsSuperAdmin()

Because Supers == owners on my server, and they all have ESPs to .

Tried your suggestion, failed. The usermessage is unhanded, and my debug print is never ran.

It seems that IsAdmin() works either shared or server-side, not exclusively client-side.


says shared, not sure what you’re getting at sorry

I did a little test where I used the function in a client lua file, and it didn’t work. The same test in a shared function worked (my test message showed up in the client console)

I don’t know. I’m fucking confused.

Wait, what the hell? You got it working by running the clientside file on the client where on the client it doesn’t work and therefor tried again on the client while running as the client?

Seriously, you got it working? How?

Got it. You can’t run the function too early. Apparently it takes a second to load up the info or something.

When I use the function on init, it gives me the same error in OP. If I use it afterwards, it works. Try going in your console and doing “lua_run_cl print(LocalPlayer():IsAdmin())”. It will work.

So what should I do, add a timer?

Maybe do a if(CLIENT) in GM:InitPostEntity() , which is a shared function that runs after everything is loaded up

edit:yeah, I tested it and that works

function GM:InitPostEntity()
if (CLIENT) then
if(LocalPlayer():IsAdmin()) then print(“LOLOLOLOL POOPS”) end

edit:assuming this is a gamemode. if not,you probably know this already, but instead of an override you could hook it like the example here

I’m not following how you would incorporate that into the entire script…sorry.

No problem.

What if you replace line 76 in the client-side file:
[Lua]usermessage.Hook(“ACInfo”, ShowAntiCheatInfo) [/Lua]
[Lua]hook.Add( “InitPostEntity”, “ACInfo”, ShowAntiCheatInfo )[/Lua]

Then you could get rid of the ACInfo usermessage @ line 14-15 server-side

assuming that it only needs to run once on initpostentity

First one worked.

If I was gay, I would love you more than I do right now, if possible. <3

hah, glad it worked. I don’t know what the hell I’m doing 99% of the time, but I have a knack for figuring things out

Did any of you read his code?

There is still a massive error. He’s trying to send umsgs to the server from the client, use concommands!

For the gatekeeper part, that’s what I ended up doing.

Although I seriously hate using them.