mirror of
https://github.com/Aaron113/urs.git
synced 2025-03-04 03:13:11 -05:00
Init
This commit is contained in:
parent
2103a26212
commit
a3e1a41483
6
addon.txt
Normal file
6
addon.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
"AddonInfo"
|
||||||
|
{
|
||||||
|
"name" "URS"
|
||||||
|
"author_name" "xAaron113x"
|
||||||
|
"info" "Restriction system for ULX."
|
||||||
|
}
|
66
lua/ulx/modules/cl/cl_urs.lua
Normal file
66
lua/ulx/modules/cl/cl_urs.lua
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
--========================================================================
|
||||||
|
--========================Used for debugging purposes.=============================
|
||||||
|
--========================================================================
|
||||||
|
|
||||||
|
function URSLoadouts( len )
|
||||||
|
Msg( "=============================================================\n" )
|
||||||
|
Msg( "URS - Loadouts:\n" )
|
||||||
|
PrintTable( net.ReadTable() )
|
||||||
|
Msg( "=============================================================\n" )
|
||||||
|
LocalPlayer():ChatPrint( "* Check console for a list of your Loadouts *" )
|
||||||
|
end
|
||||||
|
net.Receive( "URS-Loadouts", URSLoadouts )
|
||||||
|
|
||||||
|
function URSRestrictions( len )
|
||||||
|
Msg( "=============================================================\n" )
|
||||||
|
Msg( "URS - Restrictions:\n" )
|
||||||
|
PrintTable( net.ReadTable() )
|
||||||
|
Msg( "=============================================================\n" )
|
||||||
|
LocalPlayer():ChatPrint( "* Check console for a list of your Restrictions *" )
|
||||||
|
end
|
||||||
|
net.Receive( "URS-Restrictions", URSRestrictions )
|
||||||
|
|
||||||
|
function URSLimits( len )
|
||||||
|
Msg( "=============================================================\n" )
|
||||||
|
Msg( "URS - Limits:\n" )
|
||||||
|
PrintTable( net.ReadTable() )
|
||||||
|
Msg( "=============================================================\n" )
|
||||||
|
LocalPlayer():ChatPrint( "* Check console for a list of your Limits *" )
|
||||||
|
end
|
||||||
|
net.Receive( "URS-Limits", URSLimits )
|
||||||
|
|
||||||
|
function URSAll( len )
|
||||||
|
Msg( "=============================================================\n" )
|
||||||
|
Msg( "URS - Limits:\n" )
|
||||||
|
PrintTable( net.ReadTable() )
|
||||||
|
Msg( "=============================================================\n" )
|
||||||
|
Msg( "URS - Restrictions:\n" )
|
||||||
|
PrintTable( net.ReadTable() )
|
||||||
|
Msg( "=============================================================\n" )
|
||||||
|
Msg( "URS - Loadouts:\n" )
|
||||||
|
PrintTable( net.ReadTable() )
|
||||||
|
Msg( "=============================================================\n" )
|
||||||
|
LocalPlayer():ChatPrint( "* Check console for a list of your Limits, Restrictions, and Loadouts *" )
|
||||||
|
end
|
||||||
|
net.Receive( "URS-All", URSAll )
|
||||||
|
|
||||||
|
--========================================================================
|
||||||
|
--========================================================================
|
||||||
|
--[[ local ply = LocalPlayer()
|
||||||
|
local trace = ply:GetEyeTraceNoCursor()
|
||||||
|
function URSHelper()
|
||||||
|
-- draw.RoundedBox( 6, 2, 7, 178, 203, Color( 50, 50, 200, 200 ) )
|
||||||
|
-- draw.RoundedBox( 6, 5, 10, 175, 200, Color( 50, 50, 50, 200 ) )
|
||||||
|
surface.SetDrawColor( Color( 0, 0, 0, 255 ) )
|
||||||
|
surface.DrawOutlinedRect( 5, 10, 175, 200 )
|
||||||
|
surface.SetDrawColor( Color( 50, 50, 50, 200 ) )
|
||||||
|
surface.DrawRect( 5, 10, 175, 200 )
|
||||||
|
|
||||||
|
surface.CreateFont ("DefaultBold", 20, 700, true, false, "URSHeader")
|
||||||
|
surface.SetFont( "DefaultBold" )
|
||||||
|
surface.SetTextColor( 200, 200, 200, 255 )
|
||||||
|
surface.SetTextPos( 10, 12 )
|
||||||
|
surface.DrawText( "Target: ".. trace.Entity:GetModel() )
|
||||||
|
|
||||||
|
end
|
||||||
|
hook.Add("PostDrawHUD", "URSHelper", URSHelper) ]]
|
211
lua/ulx/modules/sh/urs_cmds.lua
Normal file
211
lua/ulx/modules/sh/urs_cmds.lua
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
local restrictiontypes = { "tool","vehicle","effect","swep", "npc","ragdoll","prop","sent", "all", "advdupe", "pickup" }
|
||||||
|
local limittypes = { "vehicle","effect", "npc","ragdoll","prop","sent" }
|
||||||
|
local Echo
|
||||||
|
if SERVER then
|
||||||
|
Echo = ulx.convar( "echours", 0 )
|
||||||
|
util.AddNetworkString("URS-Loadouts")
|
||||||
|
util.AddNetworkString("URS-Restrictions")
|
||||||
|
util.AddNetworkString("URS-All")
|
||||||
|
end
|
||||||
|
|
||||||
|
function ulx.restrict( ply, type, what, ... )
|
||||||
|
local groups = {...}
|
||||||
|
local removers = {}
|
||||||
|
what = string.lower( what )
|
||||||
|
if type == "all" and !table.HasValue( {"tool","vehicle","effect","swep", "npc","ragdoll","prop","sent"}, what ) then
|
||||||
|
ULib.tsayError( ply, "Global Restrictions are limited to:\ntool, vehicle, effect, swep, npc, ragdoll, prop, sent " )
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if !restrictions[type][what] then
|
||||||
|
restrictions[type][what] = groups
|
||||||
|
else
|
||||||
|
for group, groups in pairs( groups ) do
|
||||||
|
if table.HasValue( restrictions[type][what], groups ) then
|
||||||
|
table.insert( removers, group )
|
||||||
|
ULib.tsayError( ply, groups .." is already restricted from this rank." )
|
||||||
|
else
|
||||||
|
if groups == "*" then
|
||||||
|
table.insert( restrictions[type][what], 1, groups )
|
||||||
|
else
|
||||||
|
table.insert( restrictions[type][what], groups )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
xgui.sendDataTable( {}, "URSRestrictions" )
|
||||||
|
URSSave()
|
||||||
|
table.sort( removers, function(a, b) return a > b end )
|
||||||
|
if removers[1] then for num, nums in pairs( removers ) do table.remove( groups, nums ) end end
|
||||||
|
if groups[1] then
|
||||||
|
ulx.fancyLogAdmin( ply, Echo:GetBool(), "#A restricted #s #s from #s", type, what, table.concat( groups, ", " ) )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local restrict = ulx.command( "URS", "ulx restrict", ulx.restrict, "!restrict" )
|
||||||
|
restrict:addParam{ type=ULib.cmds.StringArg, hint="Type", completes=restrictiontypes, ULib.cmds.restrictToCompletes }
|
||||||
|
restrict:addParam{ type=ULib.cmds.StringArg, hint="Target Name/Model Path" }
|
||||||
|
restrict:addParam{ type=ULib.cmds.StringArg, hint="Groups", ULib.cmds.takeRestOfLine, repeat_min=1 }
|
||||||
|
restrict:defaultAccess( ULib.ACCESS_SUPERADMIN )
|
||||||
|
restrict:help( "Add a restriction to a group." )
|
||||||
|
|
||||||
|
function ulx.unrestrict( ply, type, what, ... )
|
||||||
|
local groups = {...}
|
||||||
|
local removers = {}
|
||||||
|
local removers2 = {}
|
||||||
|
what = string.lower( what )
|
||||||
|
if not restrictions[type][what] then ULib.tsayError( ply, what .." is not a restricted ".. type ) return
|
||||||
|
elseif groups[1] == "*" then
|
||||||
|
if restrictions[type][what][1] == "*" then
|
||||||
|
if not restrictions[type][what][2] then
|
||||||
|
restrictions[type][what] = nil
|
||||||
|
else
|
||||||
|
table.remove( restrictions[type][what], 1 )
|
||||||
|
end
|
||||||
|
else
|
||||||
|
restrictions[type][what] = nil
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for k,v in pairs( groups ) do
|
||||||
|
if table.HasValue( restrictions[type][what], v ) then
|
||||||
|
for k2,v2 in pairs( restrictions[type][what] ) do
|
||||||
|
if v2 == v then
|
||||||
|
table.insert( removers, k2 )
|
||||||
|
if not restrictions[type][what][1] then restrictions[type][what] = nil end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ULib.tsayError( ply, v .." is not restricted from ".. what )
|
||||||
|
table.insert( removers2, k )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort( removers, function(a, b) return a > b end )
|
||||||
|
for i=1,#removers do table.remove( restrictions[type][what], removers[i] ) end
|
||||||
|
URSSave()
|
||||||
|
xgui.sendDataTable( {}, "URSRestrictions" )
|
||||||
|
if groups[1] then
|
||||||
|
table.sort( removers2, function(a, b) return a > b end )
|
||||||
|
for i=1,#removers2 do table.remove( groups, removers2[i] ) end
|
||||||
|
if groups[1] == "*" and not restrictions[type][what] then
|
||||||
|
ulx.fancyLogAdmin( ply, Echo:GetBool(), "#A removed all restrictions from #s", what )
|
||||||
|
else
|
||||||
|
ulx.fancyLogAdmin( ply, Echo:GetBool(), "#A unrestricted #s from #s", what, table.concat(groups,", ") )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local unrestrict = ulx.command( "URS", "ulx unrestrict", ulx.unrestrict, "!unrestrict")
|
||||||
|
unrestrict:addParam{ type=ULib.cmds.StringArg, hint="Type", completes=restrictiontypes, ULib.cmds.restrictToCompletes }
|
||||||
|
unrestrict:addParam{ type=ULib.cmds.StringArg, hint="Target Name/Model Path" }
|
||||||
|
unrestrict:addParam{ type=ULib.cmds.StringArg, hint="Groups", ULib.cmds.takeRestOfLine, repeat_min=1 }
|
||||||
|
unrestrict:defaultAccess( ULib.ACCESS_SUPERADMIN )
|
||||||
|
unrestrict:help( "Remove a restrictions from a group." )
|
||||||
|
|
||||||
|
function ulx.setlimit( ply, type, group, limit )
|
||||||
|
if limit == -1 then limits[type][group] = nil else limits[type][group] = limit end
|
||||||
|
xgui.sendDataTable( {}, "URSLimits" )
|
||||||
|
URSSave()
|
||||||
|
ulx.fancyLogAdmin( ply, Echo:GetBool(), "#A set the #s limit for #s to #i", type, group, limit )
|
||||||
|
end
|
||||||
|
local limit = ulx.command( "URS", "ulx setlimit", ulx.setlimit, "!setlimit" )
|
||||||
|
limit:addParam{ type=ULib.cmds.StringArg, ULib.cmds.restrictToCompletes, completes=limittypes, hint="Type" }
|
||||||
|
limit:addParam{ type=ULib.cmds.StringArg, hint="Group" }
|
||||||
|
limit:addParam{ type=ULib.cmds.NumArg, min=-1, default=-1, hint="Amount (-1 is default)" }
|
||||||
|
limit:defaultAccess( ULib.ACCESS_SUPERADMIN )
|
||||||
|
limit:help( "Set limits for specific groups." )
|
||||||
|
|
||||||
|
local weaponlist = { "manhack_welder", "weapon_ak47", "weapon_deagle", "weapon_fiveseven", "weapon_glock", "weapon_m4", "weapon_mac10","weapon_tmp","weapon_pumpshotgun","weapon_para","weapon_mp5","harpooncannon","flechette_gun","weapon_crowbar","weapon_stunstick","weapon_physcannon","weapon_physgun","weapon_pistol","weapon_357","weapon_smg1","weapon_ar2","weapon_shotgun","weapon_crossbow", "weapon_frag", "weapon_rpg", "weapon_slam", "weapon_bugbait", "item_ml_grenade", "item_ar2_grenade", "item_ammo_ar2_altfire", "gmod_camera", "gmod_tool"}
|
||||||
|
|
||||||
|
function ulx.loadoutadd( ply, group, ... )
|
||||||
|
local weapons = {...}
|
||||||
|
local removers = {}
|
||||||
|
for i=1, #weapons do
|
||||||
|
if loadouts[group] and not table.HasValue( loadouts[group], weapons[i] ) then
|
||||||
|
table.insert( loadouts[group], weapons[i] )
|
||||||
|
elseif loadouts[group] and table.HasValue( loadouts[group], weapons[i] ) then
|
||||||
|
ULib.tsayError( ply, weapons[i] .." is already in the loadout for ".. group )
|
||||||
|
table.insert( removers, i )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not loadouts[group] then
|
||||||
|
loadouts[group] = weapons
|
||||||
|
end
|
||||||
|
URSSave()
|
||||||
|
xgui.sendDataTable( {}, "URSLoadouts" )
|
||||||
|
table.sort( removers, function(a, b) return a > b end )
|
||||||
|
for i=1,#removers do table.remove( weapons, removers[i] ) end
|
||||||
|
if weapons[1] then
|
||||||
|
ulx.fancyLogAdmin( ply, Echo:GetBool(), "#A added #s to the loadout for #s", table.concat( weapons, ", " ), group )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local loadout = ulx.command( "URS", "ulx loadoutadd", ulx.loadoutadd, "!loadoutadd" )
|
||||||
|
loadout:addParam{ type=ULib.cmds.StringArg, hint="Group" }
|
||||||
|
loadout:addParam{ type=ULib.cmds.StringArg, hint="Weapons", ULib.cmds.takeRestOfLine, repeat_min=1, completes=weaponlist }
|
||||||
|
loadout:defaultAccess( ULib.ACCESS_SUPERADMIN )
|
||||||
|
loadout:help( "Create or update a loudout for a specific group." )
|
||||||
|
|
||||||
|
function ulx.loadoutremove( ply, group, ... )
|
||||||
|
if not loadouts[group] then ULib.tsayError( ply, group .." does not have a loadout" ) return end
|
||||||
|
local weapons = {...}
|
||||||
|
local removers = {}
|
||||||
|
local removers2 = {}
|
||||||
|
if weapons[1] == "*" then
|
||||||
|
loadouts[group] = nil
|
||||||
|
weapons = {}
|
||||||
|
URSSave()
|
||||||
|
xgui.sendDataTable( {}, "URSLoadouts" )
|
||||||
|
ulx.fancyLogAdmin( ply, Echo:GetBool(), "#A removed the loadout from #s", group )
|
||||||
|
return
|
||||||
|
else
|
||||||
|
for k,v in pairs( weapons ) do
|
||||||
|
if table.HasValue( loadouts[group], v ) then
|
||||||
|
for k2,v2 in pairs( loadouts[group] ) do
|
||||||
|
if v2 == v then
|
||||||
|
table.insert( removers, k2 )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ULib.tsayError( ply, v .." is not a loadout of this group" )
|
||||||
|
table.insert( removers2, k )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort( removers, function(a, b) return a > b end )
|
||||||
|
for i=1,#removers do table.remove( loadouts[group], removers[i] ) end
|
||||||
|
if not loadouts[group][1] then loadouts[group] = nil end
|
||||||
|
URSSave()
|
||||||
|
xgui.sendDataTable( {}, "URSLoadouts" )
|
||||||
|
table.sort( removers2, function(a, b) return a > b end )
|
||||||
|
for i=1,#removers2 do table.remove( weapons, removers2[i] ) end
|
||||||
|
if weapons and not weapons[1] then return end
|
||||||
|
ulx.fancyLogAdmin( ply, Echo:GetBool(), "#A removed #s from the loadout of #s", table.concat( weapons, ", " ), group )
|
||||||
|
end
|
||||||
|
local loadout = ulx.command( "URS", "ulx loadoutremove", ulx.loadoutremove, "!loadoutremove" )
|
||||||
|
loadout:addParam{ type=ULib.cmds.StringArg, hint="Group" }
|
||||||
|
loadout:addParam{ type=ULib.cmds.StringArg, hint="Weapons", ULib.cmds.takeRestOfLine, repeat_min=1 }
|
||||||
|
loadout:defaultAccess( ULib.ACCESS_SUPERADMIN )
|
||||||
|
loadout:help( "Remove weapons from a loadout for a specific group." )
|
||||||
|
|
||||||
|
function ulx.print( ply, type )
|
||||||
|
if type == "loadouts" then
|
||||||
|
net.Start("URS-Loadouts")
|
||||||
|
net.WriteTable(loadouts)
|
||||||
|
net.Send(ply)
|
||||||
|
elseif type == "restrictions" then
|
||||||
|
net.Start("URS-Restrictions")
|
||||||
|
net.WriteTable(restrictions)
|
||||||
|
net.Send(ply)
|
||||||
|
elseif type == "limits" then
|
||||||
|
net.Start("URS-Limits")
|
||||||
|
net.WriteTable(limits)
|
||||||
|
net.Send(ply)
|
||||||
|
else
|
||||||
|
net.Start("URS-All")
|
||||||
|
net.WriteTable(limits)
|
||||||
|
net.WriteTable(restrictions)
|
||||||
|
net.WriteTable(loadouts)
|
||||||
|
net.Send(ply)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local loadout = ulx.command( "URS", "ulx print", ulx.print, "!print" )
|
||||||
|
loadout:addParam{ type=ULib.cmds.StringArg, hint="Type", completes={"restrictions","loadouts","limits","all" }, ULib.cmds.restrictToCompletes }
|
||||||
|
loadout:defaultAccess( ULib.ACCESS_SUPERADMIN )
|
||||||
|
loadout:help( "Print Restrictions, Loadouts, or Limits from URS into your console." )
|
138
lua/ulx/modules/urs_server.lua
Normal file
138
lua/ulx/modules/urs_server.lua
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
AddCSLuaFile( "ulx/modules/sh/urs_cmds.lua" )
|
||||||
|
local Pickups = ulx.convar( "urs_weaponpickups", 0 )
|
||||||
|
local restrictiontypes = { "tool","vehicle","effect","swep", "npc","ragdoll","prop","sent", "all", "advdupe", "pickup" }
|
||||||
|
local limittypes = { "vehicle","effect", "npc","ragdoll","prop","sent" }
|
||||||
|
restrictions = {}
|
||||||
|
limits = {}
|
||||||
|
loadouts = {}
|
||||||
|
|
||||||
|
local shoulddebug = true
|
||||||
|
local function Debug( msg ) if shoulddebug then ULib.console( nil, "[URS DEBUG] ".. msg ) Msg( "[URS DEBUG] ".. msg .."\n" ) end end
|
||||||
|
|
||||||
|
if file.Exists( "ulx/limits.txt", "DATA" ) then limits = util.JSONToTable( file.Read( "ulx/limits.txt", "DATA" ) ) end
|
||||||
|
if file.Exists( "ulx/restrictions.txt", "DATA" ) then restrictions = util.JSONToTable( file.Read( "ulx/restrictions.txt", "DATA" ) ) end
|
||||||
|
if file.Exists( "ulx/loadouts.txt", "DATA" ) then loadouts = util.JSONToTable( file.Read( "ulx/loadouts.txt", "DATA" ) ) end
|
||||||
|
|
||||||
|
for type, types in pairs( limittypes ) do if not limits[types] then limits[types] = {} end end
|
||||||
|
for type, types in pairs( restrictiontypes ) do if not restrictions[types] then restrictions[types] = {} end end
|
||||||
|
|
||||||
|
function URSSave()
|
||||||
|
if limits then file.Write( "ulx/limits.txt", util.TableToJSON( limits ) ) end
|
||||||
|
if restrictions then file.Write( "ulx/restrictions.txt", util.TableToJSON( restrictions ) ) end
|
||||||
|
if loadouts then file.Write( "ulx/loadouts.txt", util.TableToJSON( loadouts ) ) end
|
||||||
|
end
|
||||||
|
|
||||||
|
function URSCheck( ply, type, what, noecho )
|
||||||
|
what = string.lower( what )
|
||||||
|
local group = ply:GetUserGroup()
|
||||||
|
if restrictions[type][what] and (table.HasValue(restrictions[type][what], group) or table.HasValue(restrictions[type][what], "*") or table.HasValue(restrictions[type][what], ply:SteamID())) then
|
||||||
|
if !table.HasValue(restrictions[type][what], "*") and (!table.HasValue( restrictions[type][what], ply:SteamID()) and table.HasValue(restrictions[type][what], group)) then
|
||||||
|
if !noecho then
|
||||||
|
ulx.logSpawn( ply:Nick() .."<".. ply:SteamID() .."> spawned/used ".. type .." ".. what .." -=RESTRICTED=-" )
|
||||||
|
ULib.tsayError( ply, "\"".. what .."\" is a restricted ".. type .." from your rank." )
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
elseif restrictions["all"][type] and table.HasValue(restrictions["all"][type], group) then
|
||||||
|
if !noecho then
|
||||||
|
ULib.tsayError( ply, "Your rank is restricted from all ".. type .."s" )
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
elseif table.HasValue( limittypes, type ) and limits[type][ply:SteamID()] then
|
||||||
|
if ply:GetCount( type .."s" ) >= limits[type][ply:SteamID()] then
|
||||||
|
ply:LimitHit( type .."s" )
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
elseif table.HasValue( limittypes, type ) and limits[type][group] then
|
||||||
|
if ply:GetCount( type .."s" ) >= limits[type][group] then
|
||||||
|
ply:LimitHit( type .."s" )
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function URSDupeCheck( Player, Ent, EntTable )
|
||||||
|
return URSCheck( Player, "advdupe", EntTable.Class )
|
||||||
|
end
|
||||||
|
function URSDupeCheckFailed( Hook )
|
||||||
|
ULib.tsayColor( nil, false, Color( 255, 0, 0 ), "URSDupeCheck has failed. Please contact Aaron113 @\nhttp://forums.ulyssesmod.net/index.php/topic,5269.0.html" )
|
||||||
|
end
|
||||||
|
|
||||||
|
if AdvDupe then
|
||||||
|
timer.Simple( 0.1, function() AdvDupe.AdminSettings.AddEntCheckHook( "URSDupeCheck", URSDupeCheck, URSDupeCheckFailed ) end )
|
||||||
|
end
|
||||||
|
|
||||||
|
function URSCheckRestrictedSENT( ply, sent )
|
||||||
|
return URSCheck( ply, "sent", sent )
|
||||||
|
end
|
||||||
|
hook.Add( "PlayerSpawnSENT", "URSCheckRestrictedSENT", URSCheckRestrictedSENT, -10 )
|
||||||
|
|
||||||
|
function URSCheckRestrictedProp( ply, mdl )
|
||||||
|
return URSCheck( ply, "prop", mdl )
|
||||||
|
end
|
||||||
|
hook.Add( "PlayerSpawnProp", "URSCheckRestrictedProp", URSCheckRestrictedProp, -10 )
|
||||||
|
|
||||||
|
function URSCheckRestrictedTool( ply, tr, tool )
|
||||||
|
if URSCheck( ply, "tool", tool ) == false then return false end
|
||||||
|
if tool != "inflator" then
|
||||||
|
ulx.logSpawn( ply:Nick().."<".. ply:SteamID() .."> used the tool ".. tool .." on ".. tr.Entity:GetModel() )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
hook.Add( "CanTool", "URSCheckRestrictedTool", URSCheckRestrictedTool, -10 )
|
||||||
|
|
||||||
|
function URSCheckRestrictedEffect( ply, mdl )
|
||||||
|
return URSCheck( ply, "effect", mdl )
|
||||||
|
end
|
||||||
|
hook.Add( "PlayerSpawnEffect", "URSCheckRestrictedEffect", URSCheckRestrictedEffect, -10 )
|
||||||
|
|
||||||
|
function URSCheckRestrictedNPC( ply, npc, weapon )
|
||||||
|
return URSCheck( ply, "npc", npc )
|
||||||
|
end
|
||||||
|
hook.Add( "PlayerSpawnNPC", "URSCheckRestrictedNPC", URSCheckRestrictedNPC, -10 )
|
||||||
|
|
||||||
|
function URSCheckRestrictedRagdoll( ply, mdl )
|
||||||
|
return URSCheck( ply, "ragdoll", mdl )
|
||||||
|
end
|
||||||
|
hook.Add( "PlayerSpawnRagdoll", "URSCheckRestrictedRagdoll", URSCheckRestrictedRagdoll, -10 )
|
||||||
|
|
||||||
|
function URSCheckRestrictedSWEP( ply, class, weapon )
|
||||||
|
if URSCheck( ply, "swep", class ) == false then return false end
|
||||||
|
ulx.logSpawn( ply:Nick().."<".. ply:SteamID() .."> spawned/gave himself swep ".. class )
|
||||||
|
end
|
||||||
|
hook.Add( "PlayerSpawnSWEP", "URSCheckRestrictedSWEP", URSCheckRestrictedSWEP, -10 )
|
||||||
|
hook.Add( "PlayerGiveSWEP", "URSCheckRestrictedSWEP2", URSCheckRestrictedSWEP, -10 )
|
||||||
|
|
||||||
|
function URSCheckRestrictedPickUp( ply, weapon )
|
||||||
|
if Pickups:GetInt() == 2 then
|
||||||
|
return URSCheck( ply, "pickup", weapon:GetClass(), true )
|
||||||
|
elseif Pickups:GetInt() == 1 then
|
||||||
|
return URSCheck( ply, "swep", weapon:GetClass(), true )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
hook.Add( "PlayerCanPickupWeapon", "URSCheckRestrictedPickUp", URSCheckRestrictedPickUp, -10 )
|
||||||
|
|
||||||
|
function URSCheckRestrictedVehicle( ply, mdl, name, vehicle_table )
|
||||||
|
return URSCheck( ply, "vehicle", mdl ) and URSCheck( ply, "vehicle", name )
|
||||||
|
end
|
||||||
|
hook.Add( "PlayerSpawnVehicle", "URSCheckRestrictedVehicle", URSCheckRestrictedVehicle, -10 )
|
||||||
|
|
||||||
|
function URSCustomLoadouts( ply )
|
||||||
|
if loadouts[ply:SteamID()] then
|
||||||
|
ply:StripWeapons()
|
||||||
|
for k, v in pairs( loadouts[ply:SteamID()] ) do
|
||||||
|
ply:Give( v )
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
elseif loadouts[ply:GetUserGroup()] then
|
||||||
|
ply:StripWeapons()
|
||||||
|
for k, v in pairs( loadouts[ply:GetUserGroup()] ) do
|
||||||
|
ply:Give( v )
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
hook.Add( "PlayerLoadout", "URSCustomLoadouts", URSCustomLoadouts, -10 )
|
1
lua/ulx/xgui/server/sv_urs_gui.lua
Normal file
1
lua/ulx/xgui/server/sv_urs_gui.lua
Normal file
@ -0,0 +1 @@
|
|||||||
|
ULib.ucl.registerAccess( "xgui_urs", "superadmin", "Access to modify URS restrictions.", "XGUI" )
local URS = {}
function URS.Init()
xgui.addDataType( "URSLimits", function() return limits end, "xgui_urs", 0, -10 )
xgui.addDataType( "URSRestrictions", function() return restrictions end, "xgui_urs", 0, -10 )
xgui.addDataType( "URSLoadouts", function() return loadouts end, "xgui_urs", 0, -10 )
end
xgui.addSVModule( "URS", URS.Init )
|
1
lua/ulx/xgui/settings/cl_urs_gui.lua
Normal file
1
lua/ulx/xgui/settings/cl_urs_gui.lua
Normal file
File diff suppressed because one or more lines are too long
86
urs_changelog_and_todo.txt
Normal file
86
urs_changelog_and_todo.txt
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
==================================================
|
||||||
|
==================================================
|
||||||
|
URS Todo: (No Specific Order)
|
||||||
|
[GUI] Improve Auto-Completes
|
||||||
|
Easier ways to restrict multiple things
|
||||||
|
Fix Stacker not following limits.
|
||||||
|
SQL Integration
|
||||||
|
==================================================
|
||||||
|
==================================================
|
||||||
|
|
||||||
|
10/16/2011 Revision 14:
|
||||||
|
+ Added: Player Specific Restrictions
|
||||||
|
= Fixed: Weapon list is now more extensive
|
||||||
|
* Changed: URS Commands have been put in their own Lua file
|
||||||
|
* Changed: URS Server Side functions have been put in their own Lua file
|
||||||
|
* Changed: Several Lua files were renamed to seem more professional
|
||||||
|
+ [GUI] Added: A "*" will now appear in groups for auto-completes that use it
|
||||||
|
* [GUI] Changed: Weapons are now saved to a variable rather then being called each time
|
||||||
|
* [GUI] Changed: Clicking on a group/steamid in loadouts will change the textbox
|
||||||
|
* [GUI] Changed: Clicking on a target/group in restrictions/limits will change the textbox
|
||||||
|
|
||||||
|
8/15/2011 Revision 13:
|
||||||
|
= [GUI] Fixed: Remove/Add buttons would not handle spaces well
|
||||||
|
= Added: urs_changelog_and_todo.txt
|
||||||
|
= Changed: Priority of URS hooks are now higher.
|
||||||
|
= Fixed: Removing a global restriction remove everything
|
||||||
|
= Fixed: "ulx restrict all" limiting
|
||||||
|
|
||||||
|
7/14/2011 Revision 12
|
||||||
|
= [GUI] Added: Auto Completes
|
||||||
|
= Added: AdvDupe Restrictions
|
||||||
|
= Added: Weapon Pickup Restrictions
|
||||||
|
= Changed: Strings in restrictions are lowercased
|
||||||
|
= Fixed: Materials for icon should now be forced to download for the clients
|
||||||
|
= Fixed: Tool Usage Logging
|
||||||
|
= Removed: Auto-Save upon shutdown
|
||||||
|
|
||||||
|
7/7/2011 Revision 11
|
||||||
|
= [GUI] Added: Custom URS icon
|
||||||
|
= [GUI] Fixed: Loadouts from merging all loadouts into one
|
||||||
|
= [GUI] Fixed: Loadout's data sending made everything numbers
|
||||||
|
= Fixed: Echoing a blank table in ulx restrict
|
||||||
|
= Fixed: A small mistake with SENT restrictions
|
||||||
|
|
||||||
|
7/1/2011 Revision 10
|
||||||
|
= Fixed a problem with creating subtables
|
||||||
|
|
||||||
|
6/26/2011 Revision 9
|
||||||
|
= Added GUI
|
||||||
|
= Fixed (hopefully) all errors in all commands
|
||||||
|
|
||||||
|
5/29/2011 Revision 8
|
||||||
|
= Added Wildcard "*" -- You can restrict groups from everything!
|
||||||
|
= Fixed an issue that may cause other things such as Prop Protectors to fail
|
||||||
|
= Removed xgui.sendDataTable() from commands -- This is for the GUI
|
||||||
|
= Removed DebugPrint() -- No longer needed
|
||||||
|
|
||||||
|
5/28/2011 Revision 7
|
||||||
|
- Removed some debug
|
||||||
|
- Fixed loadoutremove and unrestrict skipping
|
||||||
|
- Added some stuff for future update (wildcard "*")
|
||||||
|
|
||||||
|
5/22/2011 Revision 6
|
||||||
|
- Fixed a small mistake in ulx print for limits
|
||||||
|
- Commands now use repeat_min, no more commas!
|
||||||
|
- Added a complete list for loadoutadd (weapons)
|
||||||
|
- Fixed unrestrict from skipping groups, previously missed
|
||||||
|
|
||||||
|
5/13/2011 Revision 5
|
||||||
|
- ulx_echours updates every command again
|
||||||
|
- Added an exclude list after specifying everyone(*) as a target - forrestrictions ONLY
|
||||||
|
(Ex. "ulx restrict tool duplicator *,superadmin,admin" )
|
||||||
|
[Everyone except superadmins and admins are restricted from the duplicator]
|
||||||
|
- Added an all option to ulx print
|
||||||
|
- Some Optimization with commands and un-needed things
|
||||||
|
|
||||||
|
5/11/2011 Revision 4
|
||||||
|
- Removed unneeded "if SERVER then ... end" in ULX functions
|
||||||
|
- ulx_echoURS no longer checks every command
|
||||||
|
- Added a chat notification in ursprint.lua
|
||||||
|
|
||||||
|
5/10/2011 Revision 3
|
||||||
|
-Added command ulx print
|
||||||
|
|
||||||
|
5/7/2011 Revision 2
|
||||||
|
BETA RELEASE
|
4
urs_readme.txt
Normal file
4
urs_readme.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
For any help you may need, please visit this topic:
|
||||||
|
|
||||||
|
http://forums.ulyssesmod.net/index.php/topic,5269.0.html
|
Loading…
Reference in New Issue
Block a user