ServerGuard

This commit is contained in:
Malboro 2016-07-24 19:47:17 +02:00
parent 7bbfe6f794
commit 06ef48df9c
5 changed files with 64 additions and 13 deletions

View File

@ -319,15 +319,15 @@ local function pp_open_menu()
end
local CheckBox13 = vgui.Create( "DCheckBoxLabel", ConfigPanel )
CheckBox13:SetPos( 245, 10 )
CheckBox13:SetText( "Enable ULX permissions" )
CheckBox13:SetChecked( Content.ULXMod )
CheckBox13:SetPos( 235, 10 )
CheckBox13:SetText( "Enable ULX/SG permissions" )
CheckBox13:SetChecked( Content["ULX/SG"] )
CheckBox13:SizeToContents()
CheckBox13:SetTextColor( Color( 0, 0, 0, 255) )
CheckBox13.OnChange = function(Self, Value)
net.Start("pp_info_send")
net.WriteTable({CMD = "VAR", Val = Value, Data = "ULXMod"})
net.WriteTable({CMD = "VAR", Val = Value, Data = "ULX/SG"})
net.SendToServer()
CheckBox1:SetDisabled( Value )

View File

@ -0,0 +1,17 @@
/*
____ _ _ ____ __ __ _ _
/ ___|___ __| | ___ __| | | __ ) _ _ | \/ | __ _| | |__ ___ _ __ ___
| | / _ \ / _` |/ _ \/ _` | | _ \| | | | | |\/| |/ _` | | '_ \ / _ \| '__/ _ \
| |__| (_) | (_| | __/ (_| | | |_) | |_| | | | | | (_| | | |_) | (_) | | | (_) |
\____\___/ \__,_|\___|\__,_| |____/ \__, | |_| |_|\__,_|_|_.__/ \___/|_| \___/
|___/
*/
serverguard.permission:Add("PermaProps Tool")
serverguard.permission:Add("PermaProps Phys")
serverguard.permission:Add("PermaProps Property")
serverguard.permission:Add("PermaProps Save")
serverguard.permission:Add("PermaProps Delete")
serverguard.permission:Add("PermaProps Update")
serverguard.permission:Add("PermaProps Menu")
serverguard.permission:Add("PermaProps Menu cfg")

View File

@ -33,7 +33,7 @@ local function PermissionLoad()
PermaProps.Permissions["ToolUpdtA"] = true
PermaProps.Permissions["ToolUpdtSA"] = true
PermaProps.Permissions["ULXMod"] = false
PermaProps.Permissions["ULX/SG"] = false
if file.Exists( "permaprops_config.txt", "DATA" ) then
@ -57,6 +57,10 @@ local function pp_open_menu( ply )
if ULib and ULib.ucl then
if !ULib.ucl.query( ply, "permaprops_menu" ) then return end
elseif serverguard then
if !serverguard.player:HasPermission(ply, "PermaProps Menu") then return end
else
@ -111,6 +115,10 @@ local function pp_info_send( um, ply )
if ULib and ULib.ucl then
if !ULib.ucl.query( ply, "permaprops_menu_cfg" ) then ply:ChatPrint("Access denied for user") return end
elseif serverguard then
if !serverguard.player:HasPermission(ply, "PermaProps Menu cfg") then return end
else

View File

@ -12,7 +12,15 @@ local function PermaPropsPhys( ply, ent, phys )
if ent.PermaProps then
if PermaProps.IsAdmin(ply) and PermaProps.Permissions["PhysA"] then
if ULib and ULib.ucl and PermaProps.Permissions["ULX/SG"] == true then
return ULib.ucl.query( ply, "permaprops_phys" )
elseif serverguard and PermaProps.Permissions["ULX/SG"] == true then
return serverguard.player:HasPermission(ply, "PermaProps Phys")
elseif PermaProps.IsAdmin(ply) and PermaProps.Permissions["PhysA"] then
return true
@ -42,10 +50,14 @@ hook.Add( "CanTool", "PermaPropsTool", function( ply, tr, tool )
end
if ULib and ULib.ucl and PermaProps.Permissions["ULXMod"] == true then
if ULib and ULib.ucl and PermaProps.Permissions["ULX/SG"] == true then
return ULib.ucl.query( ply, "permaprops_tool" )
elseif serverguard and PermaProps.Permissions["ULX/SG"] == true then
return serverguard.player:HasPermission(ply, "PermaProps Tool")
else
if PermaProps.IsAdmin(ply) and PermaProps.Permissions["ToolA"] then -- Make another convar option if you want.
@ -72,10 +84,14 @@ hook.Add( "CanProperty", "PermaPropsProperty", function( ply, property, ent ) --
if IsValid(ent) and ent.PermaProps and tool ~= "permaprops" then
if ULib and ULib.ucl and PermaProps.Permissions["ULXMod"] == true then
if ULib and ULib.ucl and PermaProps.Permissions["ULX/SG"] == true then
return ULib.ucl.query( ply, "permaprops_property" )
elseif serverguard and PermaProps.Permissions["ULX/SG"] == true then
return serverguard.player:HasPermission(ply, "PermaProps Property")
else
if PermaProps.IsAdmin(ply) and PermaProps.Permissions["PropA"] then -- Make another convar option if you want.

View File

@ -37,12 +37,14 @@ function TOOL:LeftClick(trace)
if not PermaProps then ply:ChatPrint( "ERROR: Lib not found" ) return end
if ULib and ULib.ucl and PermaProps.Permissions["ULXMod"] == true then
print(ULib.ucl.query( ply, "permaprops_save" ))
if ULib and ULib.ucl and PermaProps.Permissions["ULX/SG"] == true then
if not ULib.ucl.query( ply, "permaprops_save" ) then return false end
elseif serverguard and PermaProps.Permissions["ULX/SG"] == true then
if not serverguard.player:HasPermission(ply, "PermaProps Save") then return false end
else
if PermaProps.IsAdmin(ply) and PermaProps.Permissions["ToolSaveA"] then
@ -86,10 +88,14 @@ function TOOL:RightClick(trace)
if not PermaProps then ply:ChatPrint( "ERROR: Lib not found" ) return end
if ULib and ULib.ucl and PermaProps.Permissions["ULXMod"] == true then
if ULib and ULib.ucl and PermaProps.Permissions["ULX/SG"] == true then
if not ULib.ucl.query( ply, "permaprops_delete" ) then return false end
elseif serverguard and PermaProps.Permissions["ULX/SG"] == true then
if not serverguard.player:HasPermission(ply, "PermaProps Delete") then return false end
else
if PermaProps.IsAdmin(ply) and PermaProps.Permissions["ToolDelA"] then
@ -128,10 +134,14 @@ function TOOL:Reload(trace)
local ent = trace.Entity
local ply = self:GetOwner()
if ULib and ULib.ucl and PermaProps.Permissions["ULXMod"] == true then
if ULib and ULib.ucl and PermaProps.Permissions["ULX/SG"] == true then
if not ULib.ucl.query( ply, "permaprops_update" ) then return false end
elseif serverguard and PermaProps.Permissions["ULX/SG"] == true then
if not serverguard.player:HasPermission(ply, "PermaProps Update") then return false end
else
if PermaProps.IsAdmin(ply) and PermaProps.Permissions["ToolUpdtA"] then