1. Post #1

    September 2013
    104 Posts
    Code:
    hook.Add("PlayerNoClip", "CloakGodNoclip", function(ply, noclip)
    	if noclip then
    		ply:SetNoDraw(true)
    		for k, v in pairs(ply:GetWeapons()) do v:SetNoDraw(true) end
    		for k,v in pairs(ents.FindByClass("physgun_beam")) do if v:GetParent() == ply then v:SetNoDraw(true) end end
    		if SERVER then ply:GodEnable() end
    	else
    		ply:SetNoDraw(false)
    		for k, v in pairs(ply:GetWeapons()) do v:SetNoDraw(false) end
    		for k,v in pairs(ents.FindByClass("physgun_beam")) do if v:GetParent() == ply then v:SetNoDraw(false) end end
    		if SERVER then ply:GodDisable() end
    	end
    end)
    Trying to figure out how to allow this for certain ulx groups or just admins in general.
    Reply With Quote Edit / Delete Windows 10 Chrome United States Show Events

  2. Post #2

    January 2015
    77 Posts
    Where you have if noclip replace with.

    if noclip and ply:IsAdmin() then

    EDIT: Also this is a serversided hook.
    Reply With Quote Edit / Delete Windows 10 Chrome Australia Show Events Lua Helper Lua Helper x 2 (list)

  3. Post #3
    Potatofactory's Avatar
    June 2014
    398 Posts
    Where you have if noclip replace with.

    if noclip and ply:IsAdmin() then

    EDIT: Also this is a serversided hook.
    That would still run the bottom half which is still redundant.

    Append the following to the top of the hook callback to avoid non-admins.
    Code:
    if not ply:IsAdmin () then return end
    Reply With Quote Edit / Delete Android Chrome United States Show Events Lua Helper Lua Helper x 1 (list)

  4. Post #4

    September 2013
    104 Posts
    That would still run the bottom half which is still redundant.

    Append the following to the top of the hook callback to avoid non-admins.
    Code:
    if not ply:IsAdmin () then return end
    Ok thanks! I'm fairly new to this and get stuck easily...
    Reply With Quote Edit / Delete Windows 10 Chrome United States Show Events

  5. Post #5

    January 2015
    77 Posts
    That would still run the bottom half which is still redundant.

    Append the following to the top of the hook callback to avoid non-admins.
    Code:
    if not ply:IsAdmin () then return end
    Oh yeah, forgot about that part, oh well it's still good since it would drop people that have noclip out of it.
    Reply With Quote Edit / Delete Windows 10 Chrome Australia Show Events

  6. Post #6
    JasonMan34's Avatar
    June 2014
    1,679 Posts
    Oh yeah, forgot about that part, oh well it's still good since it would drop people that have noclip out of it.
    Except they'll never be noclipped because of the hook
    Reply With Quote Edit / Delete Windows 7 Chrome Israel Show Events

  7. Post #7

    January 2015
    77 Posts
    Except they'll never be noclipped because of the hook
    But he only wanted staff to be nocliped?

    Thus if some magical way a player had noclip and presses the bind it will take them out of noclip too.
    Reply With Quote Edit / Delete Windows 10 Chrome Australia Show Events