Hello Facepunch. Recently, I’ve been looking around to try and find some manner script that would prevent players in god mode from being able to damage other players. I was given the following script a few weeks back, but it didn’t seem to function properly for me.
local PMETA = FindMetaTable("Player") function PMETA:IsGod() return self:GetNWBool("GodMode") end function PMETA:SetGod() if SERVER then if !self:IsGod() then self:GodEnable() self:SetNWBool("GodMode",true) else self:GodDisable() self:SetNWBool("GodMode",false) end end end hook.Add("PlayerShouldTakeDamage","DisableDamageFromGod",function(vic,atk) if atk:IsGod() then return false end end)
Since I possess only a basic understanding of how Lua works in Garry’s Mod, I was hoping that one of you might be able to help me diagnose the problem. Thanks in advance.