Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --=======================================--
- -- I claim no credit for this code most of it is
- -- base ULX code that has my punishment logging
- -- injected into it. What I do however have is
- -- permission from the ULX creators to sell and
- -- redistribute this code in my addon. Should you
- -- question the validity of this statement you are more
- -- then welcome to contact me on steam or contact the ULX
- -- creators and I will provide prof that this statement is
- -- true.
- --=======================================--
- if not RapSheet.Settings.OverWriteULX or not ulx then return end
- if RapSheet.Log then RapSheet.Log("Loading ULX commands!") end
- -- Fun.lua
- ------------------------------ Slay ------------------------------
- function ulx.slay( calling_ply, target_plys, reason )
- local affected_plys = {}
- for i=1, #target_plys do
- local v = target_plys[ i ]
- if ulx.getExclusive( v, calling_ply ) then
- ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
- elseif not v:Alive() then
- ULib.tsayError( calling_ply, v:Nick() .. " is already dead!", true )
- elseif v:IsFrozen() then
- ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
- else
- v:Kill()
- table.insert( affected_plys, v )
- if RapSheet then RapSheet.SavePlayerPunishment(v, "Slayed", reason and reason != "" and reason or "No Reason", IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- end
- end
- if reason and reason != "" then
- ulx.fancyLogAdmin( calling_ply, "#A slayed #T for #s", affected_plys, reason )
- else
- ulx.fancyLogAdmin( calling_ply, "#A slayed #T", affected_plys )
- end
- end
- local slay = ulx.command( "Fun", "ulx slay", ulx.slay, "!slay" )
- slay:addParam{ type=ULib.cmds.PlayersArg }
- slay:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
- slay:defaultAccess( ULib.ACCESS_ADMIN )
- slay:help( "Slays target(s)." )
- ------------------------------ Sslay ------------------------------
- function ulx.sslay( calling_ply, target_plys )
- local affected_plys = {}
- for i=1, #target_plys do
- local v = target_plys[ i ]
- if ulx.getExclusive( v, calling_ply ) then
- ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
- elseif not v:Alive() then
- ULib.tsayError( calling_ply, v:Nick() .. " is already dead!", true )
- elseif v:IsFrozen() then
- ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
- else
- if v:InVehicle() then
- v:ExitVehicle()
- end
- v:KillSilent()
- table.insert( affected_plys, v )
- if RapSheet then RapSheet.SavePlayerPunishment(v, "Silent Slayed", "", IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- end
- end
- ulx.fancyLogAdmin( calling_ply, "#A silently slayed #T", affected_plys )
- end
- local sslay = ulx.command( "Fun", "ulx sslay", ulx.sslay, "!sslay" )
- sslay:addParam{ type=ULib.cmds.PlayersArg }
- sslay:defaultAccess( ULib.ACCESS_ADMIN )
- sslay:help( "Silently slays target(s)." )
- ------------------------------ Freeze ------------------------------
- function ulx.freeze( calling_ply, target_plys, should_unfreeze )
- local affected_plys = {}
- for i=1, #target_plys do
- if not should_unfreeze and ulx.getExclusive( target_plys[ i ], calling_ply ) then
- ULib.tsayError( calling_ply, ulx.getExclusive( target_plys[ i ], calling_ply ), true )
- else
- local v = target_plys[ i ]
- if v:InVehicle() then
- v:ExitVehicle()
- end
- if not should_unfreeze then
- v:Lock()
- v.frozen = true
- ulx.setExclusive( v, "frozen" )
- if RapSheet and not should_unfreeze then RapSheet.SavePlayerPunishment(v, "Frozen", "", IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- else
- v:UnLock()
- v.frozen = nil
- ulx.clearExclusive( v )
- end
- v:DisallowSpawning( not should_unfreeze )
- ulx.setNoDie( v, not should_unfreeze )
- table.insert( affected_plys, v )
- if v.whipped then
- v.whipcount = v.whipamt -- Will make it remove
- end
- end
- end
- if not should_unfreeze then
- ulx.fancyLogAdmin( calling_ply, "#A froze #T", affected_plys )
- else
- ulx.fancyLogAdmin( calling_ply, "#A unfroze #T", affected_plys )
- end
- end
- local freeze = ulx.command( "Fun", "ulx freeze", ulx.freeze, "!freeze" )
- freeze:addParam{ type=ULib.cmds.PlayersArg }
- freeze:addParam{ type=ULib.cmds.BoolArg, invisible=true }
- freeze:defaultAccess( ULib.ACCESS_ADMIN )
- freeze:help( "Freezes target(s)." )
- freeze:setOpposite( "ulx unfreeze", {_, _, true}, "!unfreeze" )
- ------------------------------ Blind ------------------------------
- function ulx.blind( calling_ply, target_plys, amount, should_unblind )
- for i=1, #target_plys do
- local v = target_plys[ i ]
- umsg.Start( "ulx_blind", v )
- umsg.Bool( not should_unblind )
- umsg.Short( amount )
- umsg.End()
- if should_unblind then
- if v.HadCamera then
- v:Give( "gmod_camera" )
- end
- v.HadCamera = nil
- if RapSheet then RapSheet.SavePlayerPunishment(v, "Blinded", "", IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- else
- if v.HadCamera == nil then -- In case blind is run twice
- v.HadCamera = v:HasWeapon( "gmod_camera" )
- end
- v:StripWeapon( "gmod_camera" )
- end
- end
- if not should_unblind then
- ulx.fancyLogAdmin( calling_ply, "#A blinded #T by amount #i", target_plys, amount )
- else
- ulx.fancyLogAdmin( calling_ply, "#A unblinded #T", target_plys )
- end
- end
- local blind = ulx.command( "Fun", "ulx blind", ulx.blind, "!blind" )
- blind:addParam{ type=ULib.cmds.PlayersArg }
- blind:addParam{ type=ULib.cmds.NumArg, min=0, max=255, default=255, hint="amount", ULib.cmds.round, ULib.cmds.optional }
- blind:addParam{ type=ULib.cmds.BoolArg, invisible=true }
- blind:defaultAccess( ULib.ACCESS_ADMIN )
- blind:help( "Blinds target(s)." )
- blind:setOpposite( "ulx unblind", {_, _, _, true}, "!unblind" )
- ------------------------------ Jail ------------------------------
- local doJail
- local jailableArea
- function ulx.jail( calling_ply, target_plys, seconds, should_unjail )
- local affected_plys = {}
- for i=1, #target_plys do
- local v = target_plys[ i ]
- if not should_unjail then
- if ulx.getExclusive( v, calling_ply ) then
- ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
- elseif not jailableArea( v:GetPos() ) then
- ULib.tsayError( calling_ply, v:Nick() .. " is not in an area where a jail can be placed!", true )
- else
- doJail( v, seconds )
- if RapSheet then RapSheet.SavePlayerPunishment(v, "Jailed", "for "..seconds, IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- table.insert( affected_plys, v )
- end
- elseif v.jail then
- v.jail.unjail()
- v.jail = nil
- table.insert( affected_plys, v )
- end
- end
- if not should_unjail then
- local str = "#A jailed #T"
- if seconds > 0 then
- str = str .. " for #i seconds"
- end
- ulx.fancyLogAdmin( calling_ply, str, affected_plys, seconds )
- else
- ulx.fancyLogAdmin( calling_ply, "#A unjailed #T", affected_plys )
- end
- end
- local jail = ulx.command( "Fun", "ulx jail", ulx.jail, "!jail" )
- jail:addParam{ type=ULib.cmds.PlayersArg }
- jail:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
- jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
- jail:defaultAccess( ULib.ACCESS_ADMIN )
- jail:help( "Jails target(s)." )
- jail:setOpposite( "ulx unjail", {_, _, _, true}, "!unjail" )
- ------------------------------ Jail TP ------------------------------
- function ulx.jailtp( calling_ply, target_ply, seconds )
- local t = {}
- t.start = calling_ply:GetPos() + Vector( 0, 0, 32 ) -- Move them up a bit so they can travel across the ground
- t.endpos = calling_ply:GetPos() + calling_ply:EyeAngles():Forward() * 16384
- t.filter = target_ply
- if target_ply ~= calling_ply then
- t.filter = { target_ply, calling_ply }
- end
- local tr = util.TraceEntity( t, target_ply )
- local pos = tr.HitPos
- if ulx.getExclusive( target_ply, calling_ply ) then
- ULib.tsayError( calling_ply, ulx.getExclusive( target_ply, calling_ply ), true )
- return
- elseif not target_ply:Alive() then
- ULib.tsayError( calling_ply, target_ply:Nick() .. " is dead!", true )
- return
- elseif not jailableArea( pos ) then
- ULib.tsayError( calling_ply, "That is not an area where a jail can be placed!", true )
- return
- else
- target_ply.ulx_prevpos = target_ply:GetPos()
- target_ply.ulx_prevang = target_ply:EyeAngles()
- if target_ply:InVehicle() then
- target_ply:ExitVehicle()
- end
- if RapSheet then RapSheet.SavePlayerPunishment(target_ply, "Jailed", "for "..seconds, IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- target_ply:SetPos( pos )
- target_ply:SetLocalVelocity( Vector( 0, 0, 0 ) ) -- Stop!
- doJail( target_ply, seconds )
- end
- local str = "#A teleported and jailed #T"
- if seconds > 0 then
- str = str .. " for #i seconds"
- end
- ulx.fancyLogAdmin( calling_ply, str, target_ply, seconds )
- end
- local jailtp = ulx.command( "Fun", "ulx jailtp", ulx.jailtp, "!jailtp" )
- jailtp:addParam{ type=ULib.cmds.PlayerArg }
- jailtp:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
- jailtp:defaultAccess( ULib.ACCESS_ADMIN )
- jailtp:help( "Teleports, then jails target(s)." )
- local function jailCheck()
- local remove_timer = true
- local players = player.GetAll()
- for i=1, #players do
- local ply = players[ i ]
- if ply.jail then
- remove_timer = false
- end
- if ply.jail and (ply.jail.pos-ply:GetPos()):LengthSqr() >= 6500 then
- ply:SetPos( ply.jail.pos )
- if ply.jail.jail_until then
- doJail( ply, ply.jail.jail_until - CurTime() )
- else
- doJail( ply, 0 )
- end
- end
- end
- if remove_timer then
- timer.Remove( "ULXJail" )
- end
- end
- jailableArea = function( pos )
- entList = ents.FindInBox( pos - Vector( 35, 35, 5 ), pos + Vector( 35, 35, 110 ) )
- for i=1, #entList do
- if entList[ i ]:GetClass() == "trigger_remove" then
- return false
- end
- end
- return true
- end
- local mdl1 = Model( "models/props_building_details/Storefront_Template001a_Bars.mdl" )
- local jail = {
- { pos = Vector( 0, 0, -5 ), ang = Angle( 90, 0, 0 ), mdl=mdl1 },
- { pos = Vector( 0, 0, 97 ), ang = Angle( 90, 0, 0 ), mdl=mdl1 },
- { pos = Vector( 21, 31, 46 ), ang = Angle( 0, 90, 0 ), mdl=mdl1 },
- { pos = Vector( 21, -31, 46 ), ang = Angle( 0, 90, 0 ), mdl=mdl1 },
- { pos = Vector( -21, 31, 46 ), ang = Angle( 0, 90, 0 ), mdl=mdl1 },
- { pos = Vector( -21, -31, 46), ang = Angle( 0, 90, 0 ), mdl=mdl1 },
- { pos = Vector( -52, 0, 46 ), ang = Angle( 0, 0, 0 ), mdl=mdl1 },
- { pos = Vector( 52, 0, 46 ), ang = Angle( 0, 0, 0 ), mdl=mdl1 },
- }
- doJail = function( v, seconds )
- if v.jail then -- They're already jailed
- v.jail.unjail()
- end
- if v:InVehicle() then
- local vehicle = v:GetParent()
- v:ExitVehicle()
- vehicle:Remove()
- end
- -- Force other players to let go of this player
- if v.physgunned_by then
- for ply, v in pairs( v.physgunned_by ) do
- if ply:IsValid() and ply:GetActiveWeapon():IsValid() and ply:GetActiveWeapon():GetClass() == "weapon_physgun" then
- ply:ConCommand( "-attack" )
- end
- end
- end
- if v:GetMoveType() == MOVETYPE_NOCLIP then -- Take them out of noclip
- v:SetMoveType( MOVETYPE_WALK )
- end
- local pos = v:GetPos()
- local walls = {}
- for _, info in ipairs( jail ) do
- local ent = ents.Create( "prop_physics" )
- ent:SetModel( info.mdl )
- ent:SetPos( pos + info.pos )
- ent:SetAngles( info.ang )
- ent:Spawn()
- ent:GetPhysicsObject():EnableMotion( false )
- ent:SetMoveType( MOVETYPE_NONE )
- ent.jailWall = true
- table.insert( walls, ent )
- end
- local key = {}
- local function unjail()
- if not v:IsValid() or not v.jail or v.jail.key ~= key then -- Nope
- return
- end
- for _, ent in ipairs( walls ) do
- if ent:IsValid() then
- ent:DisallowDeleting( false )
- ent:Remove()
- end
- end
- if not v:IsValid() then return end -- Make sure they're still connected
- v:DisallowNoclip( false )
- v:DisallowMoving( false )
- v:DisallowSpawning( false )
- v:DisallowVehicles( false )
- ulx.clearExclusive( v )
- ulx.setNoDie( v, false )
- v.jail = nil
- end
- if seconds > 0 then
- timer.Simple( seconds, unjail )
- end
- local function newWall( old, new )
- table.insert( walls, new )
- end
- for _, ent in ipairs( walls ) do
- ent:DisallowDeleting( true, newWall )
- ent:DisallowMoving( true )
- end
- v:DisallowNoclip( true )
- v:DisallowMoving( true )
- v:DisallowSpawning( true )
- v:DisallowVehicles( true )
- v.jail = { pos=pos, unjail=unjail, key=key }
- if seconds > 0 then
- v.jail.jail_until = CurTime() + seconds
- end
- ulx.setExclusive( v, "in jail" )
- ulx.setNoDie( v, true )
- timer.Create( "ULXJail", 1, 0, jailCheck )
- end
- ------------------------------ Ragdoll ------------------------------
- function ulx.ragdoll( calling_ply, target_plys, should_unragdoll )
- local affected_plys = {}
- for i=1, #target_plys do
- local v = target_plys[ i ]
- if not should_unragdoll then
- if ulx.getExclusive( v, calling_ply ) then
- ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
- elseif not v:Alive() then
- ULib.tsayError( calling_ply, v:Nick() .. " is dead and cannot be ragdolled!", true )
- else
- if v:InVehicle() then
- local vehicle = v:GetParent()
- v:ExitVehicle()
- end
- ULib.getSpawnInfo( v ) -- Collect information so we can respawn them in the same state.
- local ragdoll = ents.Create( "prop_ragdoll" )
- ragdoll.ragdolledPly = v
- ragdoll:SetPos( v:GetPos() )
- local velocity = v:GetVelocity()
- ragdoll:SetAngles( v:GetAngles() )
- ragdoll:SetModel( v:GetModel() )
- ragdoll:Spawn()
- ragdoll:Activate()
- v:SetParent( ragdoll ) -- So their player ent will match up (position-wise) with where their ragdoll is.
- -- Set velocity for each peice of the ragdoll
- local j = 1
- while true do -- Break inside
- local phys_obj = ragdoll:GetPhysicsObjectNum( j )
- if phys_obj then
- phys_obj:SetVelocity( velocity )
- j = j + 1
- else
- break
- end
- end
- v:Spectate( OBS_MODE_CHASE )
- v:SpectateEntity( ragdoll )
- v:StripWeapons() -- Otherwise they can still use the weapons.
- ragdoll:DisallowDeleting( true, function( old, new )
- v.ragdoll = new
- end )
- v:DisallowSpawning( true )
- v.ragdoll = ragdoll
- ulx.setExclusive( v, "ragdolled" )
- if RapSheet then RapSheet.SavePlayerPunishment(v, "Ragdolled", "", IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- table.insert( affected_plys, v )
- end
- elseif v.ragdoll then -- Only if they're ragdolled...
- v:DisallowSpawning( false )
- v:SetParent()
- v:UnSpectate() -- Need this for DarkRP for some reason, works fine without it in sbox
- local ragdoll = v.ragdoll
- v.ragdoll = nil -- Gotta do this before spawn or our hook catches it
- if not ragdoll:IsValid() then -- Something must have removed it, just spawn
- ULib.spawn( v, true )
- else
- local pos = ragdoll:GetPos()
- pos.z = pos.z + 10 -- So they don't end up in the ground
- ULib.spawn( v, true )
- v:SetPos( pos )
- v:SetVelocity( ragdoll:GetVelocity() )
- local yaw = ragdoll:GetAngles().yaw
- v:SetAngles( Angle( 0, yaw, 0 ) )
- ragdoll:DisallowDeleting( false )
- ragdoll:Remove()
- end
- ulx.clearExclusive( v )
- table.insert( affected_plys, v )
- end
- end
- if not should_unragdoll then
- ulx.fancyLogAdmin( calling_ply, "#A ragdolled #T", affected_plys )
- else
- ulx.fancyLogAdmin( calling_ply, "#A unragdolled #T", affected_plys )
- end
- end
- local ragdoll = ulx.command( "Fun", "ulx ragdoll", ulx.ragdoll, "!ragdoll" )
- ragdoll:addParam{ type=ULib.cmds.PlayersArg }
- ragdoll:addParam{ type=ULib.cmds.BoolArg, invisible=true }
- ragdoll:defaultAccess( ULib.ACCESS_ADMIN )
- ragdoll:help( "ragdolls target(s)." )
- ragdoll:setOpposite( "ulx unragdoll", {_, _, true}, "!unragdoll" )
- function ulx.maul( calling_ply, target_plys )
- local affected_plys = {}
- for i=1, #target_plys do
- local v = target_plys[ i ]
- if ulx.getExclusive( v, calling_ply ) then
- ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
- elseif not v:Alive() then
- ULib.tsayError( calling_ply, v:Nick() .. " is dead!", true )
- else
- local pos = {}
- local testent = newZombie( Vector( 0, 0, 0 ), Angle( 0, 0, 0 ), v, true ) -- Test ent for traces
- local yawForward = v:EyeAngles().yaw
- local directions = { -- Directions to try
- math.NormalizeAngle( yawForward - 180 ), -- Behind first
- math.NormalizeAngle( yawForward + 90 ), -- Right
- math.NormalizeAngle( yawForward - 90 ), -- Left
- yawForward,
- }
- local t = {}
- t.start = v:GetPos() + Vector( 0, 0, 32 ) -- Move them up a bit so they can travel across the ground
- t.filter = { v, testent }
- for i=1, #directions do -- Check all directions
- t.endpos = v:GetPos() + Angle( 0, directions[ i ], 0 ):Forward() * 47 -- (33 is player width, this is sqrt( 33^2 * 2 ))
- local tr = util.TraceEntity( t, testent )
- if not tr.Hit then
- table.insert( pos, v:GetPos() + Angle( 0, directions[ i ], 0 ):Forward() * 47 )
- end
- end
- testent:DisallowDeleting( false )
- testent:Remove() -- Don't forget to remove our friend now!
- if #pos > 0 then
- v.maul_npcs = {}
- for _, newpos in ipairs( pos ) do
- local newang = (v:GetPos() - newpos):Angle()
- local ent = newZombie( newpos, newang, v )
- table.insert( v.maul_npcs, ent )
- end
- v:SetMoveType( MOVETYPE_WALK )
- v:DisallowNoclip( true )
- v:DisallowSpawning( true )
- v:DisallowVehicles( true )
- v:GodDisable()
- v:SetArmor( 0 ) -- Armor takes waaaay too long for them to take down
- v.maulOrigWalk = v:GetWalkSpeed()
- v.maulOrigSprint = v:GetRunSpeed()
- v:SetWalkSpeed(1)
- v:SetRunSpeed(1)
- v.maulStart = CurTime()
- v.maulStartHP = v:Health()
- hook.Add( "Think", "MaulMoreDamageThink", maulMoreDamage )
- ulx.setExclusive( v, "being mauled" )
- if RapSheet then RapSheet.SavePlayerPunishment(v, "Mauled", "", IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- table.insert( affected_plys, v )
- else
- ULib.tsayError( calling_ply, "Can't find a place to put the npcs for " .. v:Nick(), true )
- end
- end
- end
- ulx.fancyLogAdmin( calling_ply, "#A mauled #T", affected_plys )
- end
- local maul = ulx.command( "Fun", "ulx maul", ulx.maul, "!maul" )
- maul:addParam{ type=ULib.cmds.PlayersArg }
- maul:defaultAccess( ULib.ACCESS_SUPERADMIN )
- maul:help( "Maul target(s)." )
- local ID_GIMP = 1
- local ID_MUTE = 2
- -- Chat.lua
- function ulx.gimp( calling_ply, target_plys, should_ungimp )
- for i=1, #target_plys do
- local v = target_plys[ i ]
- if should_ungimp then
- v.gimp = nil
- else
- v.gimp = ID_GIMP
- end
- v:SetNWBool("ulx_gimped", not should_ungimp)
- if RapSheet and not should_ungimp then RapSheet.SavePlayerPunishment(v, "Gimped", "", IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- end
- if not should_ungimp then
- ulx.fancyLogAdmin( calling_ply, "#A gimped #T", target_plys )
- else
- ulx.fancyLogAdmin( calling_ply, "#A ungimped #T", target_plys )
- end
- end
- local gimp = ulx.command( "Chat", "ulx gimp", ulx.gimp, "!gimp" )
- gimp:addParam{ type=ULib.cmds.PlayersArg }
- gimp:addParam{ type=ULib.cmds.BoolArg, invisible=true }
- gimp:defaultAccess( ULib.ACCESS_ADMIN )
- gimp:help( "Gimps target(s) so they are unable to chat normally." )
- gimp:setOpposite( "ulx ungimp", {_, _, true}, "!ungimp" )
- ------------------------------ Mute ------------------------------
- function ulx.mute( calling_ply, target_plys, should_unmute, reason )
- for i=1, #target_plys do
- local v = target_plys[ i ]
- if should_unmute then
- v.gimp = nil
- else
- v.gimp = ID_MUTE
- end
- v:SetNWBool("ulx_muted", not should_unmute)
- if RapSheet and not should_unmute then RapSheet.SavePlayerPunishment(v, "Muted", reason != "reason" and reason or "", calling_ply and IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- end
- if not should_unmute then
- if reason and reason ~= "" then
- ulx.fancyLogAdmin( calling_ply, "#A muted #T for #s", target_plys, reason)
- else
- ulx.fancyLogAdmin( calling_ply, "#A muted #T", target_plys )
- end
- else
- ulx.fancyLogAdmin( calling_ply, "#A unmuted #T", target_plys )
- end
- end
- local mute = ulx.command( "Chat", "ulx mute", ulx.mute, "!mute" )
- mute:addParam{ type=ULib.cmds.PlayersArg }
- mute:addParam{ type=ULib.cmds.BoolArg, invisible=true }
- mute:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
- mute:defaultAccess( ULib.ACCESS_ADMIN )
- mute:help( "Mutes target(s) so they are unable to chat." )
- mute:setOpposite( "ulx unmute", {_, _, true}, "!unmute" )
- ------------------------------ Gag ------------------------------
- function ulx.gag( calling_ply, target_plys, should_ungag, reason )
- local players = player.GetAll()
- for i=1, #target_plys do
- local v = target_plys[ i ]
- v.ulx_gagged = not should_ungag
- v:SetNWBool("ulx_gagged", v.ulx_gagged)
- if RapSheet and not should_ungag then RapSheet.SavePlayerPunishment(v, "Gagged", reason != "reason" and reason or "", IsValid(calling_ply) and string.format("%s (%s)",calling_ply:Nick(),calling_ply:SteamID()) or "(CONSOLE)") end
- end
- if not should_ungag then
- if reason and reason ~= "" then
- ulx.fancyLogAdmin( calling_ply, "#A gagged #T for #s", target_plys, reason )
- else
- ulx.fancyLogAdmin( calling_ply, "#A gagged #T", target_plys )
- end
- else
- ulx.fancyLogAdmin( calling_ply, "#A ungagged #T", target_plys )
- end
- end
- local gag = ulx.command( "Chat", "ulx gag", ulx.gag, "!gag" )
- gag:addParam{ type=ULib.cmds.PlayersArg }
- gag:addParam{ type=ULib.cmds.BoolArg, invisible=true }
- gag:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
- gag:defaultAccess( ULib.ACCESS_ADMIN )
- gag:help( "Gag target(s), disables microphone." )
- gag:setOpposite( "ulx ungag", {_, _, true}, "!ungag" )
- ------------------------------ Kick ------------------------------
- function ulx.kick( calling_ply, target_ply, reason )
- if reason and reason ~= "" then
- ulx.fancyLogAdmin( calling_ply, "#A kicked #T (#s)", target_ply, reason )
- else
- reason = nil
- ulx.fancyLogAdmin( calling_ply, "#A kicked #T", target_ply )
- end
- -- Delay by 1 frame to ensure the chat hook finishes with player intact. Prevents a crash.
- if RapSheet then RapSheet.SavePlayerPunishment(target_ply, "Kicked", string.format("%s",reason), IsValid(calling_ply) and string.format("%s (%s)", calling_ply:Nick(), calling_ply:SteamID()) or "(CONSOLE)") end
- ULib.queueFunctionCall( ULib.kick, target_ply, reason, calling_ply )
- end
- local kick = ulx.command( "Utility", "ulx kick", ulx.kick, "!kick" )
- kick:addParam{ type=ULib.cmds.PlayerArg }
- kick:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
- kick:defaultAccess( ULib.ACCESS_ADMIN )
- kick:help( "Kicks target." )
- ------------------------------ Ban ------------------------------
- function ulx.ban( calling_ply, target_ply, minutes, reason )
- if target_ply:IsBot() then
- ULib.tsayError( calling_ply, "Cannot ban a bot", true )
- return
- end
- local time = "for #i minute(s)"
- if minutes == 0 then time = "permanently" end
- local str = "#A banned #T " .. time
- if reason and reason ~= "" then str = str .. " (#s)" end
- ulx.fancyLogAdmin( calling_ply, str, target_ply, minutes ~= 0 and minutes or reason, reason )
- -- Delay by 1 frame to ensure any chat hook finishes with player intact. Prevents a crash.
- if RapSheet then RapSheet.SavePlayerPunishment(target_ply, "Banned", string.format("Banned %s with reason %s", tonumber(minutes) == 0 and "permanently" or "for "..tostring(minutes).." minute(s)",reason), IsValid(calling_ply) and string.format("%s (%s)", calling_ply:Nick(), calling_ply:SteamID()) or "(CONSOLE)") end
- ULib.queueFunctionCall( ULib.kickban, target_ply, minutes, reason, calling_ply )
- end
- local ban = ulx.command( "Utility", "ulx ban", ulx.ban, "!ban" )
- ban:addParam{ type=ULib.cmds.PlayerArg }
- ban:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 }
- ban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
- ban:defaultAccess( ULib.ACCESS_ADMIN )
- ban:help( "Bans target." )
- ------------------------------ BanID ------------------------------
- function ulx.banid( calling_ply, steamid, minutes, reason )
- steamid = steamid:upper()
- if not ULib.isValidSteamID( steamid ) then
- ULib.tsayError( calling_ply, "Invalid steamid." )
- return
- end
- local name
- local plys = player.GetAll()
- for i=1, #plys do
- if plys[ i ]:SteamID() == steamid then
- name = plys[ i ]:Nick()
- break
- end
- end
- local time = "for #i minute(s)"
- if minutes == 0 then time = "permanently" end
- local str = "#A banned steamid #s "
- displayid = steamid
- if name then
- displayid = displayid .. "(" .. name .. ") "
- end
- str = str .. time
- if reason and reason ~= "" then str = str .. " (#4s)" end
- ulx.fancyLogAdmin( calling_ply, str, displayid, minutes ~= 0 and minutes or reason, reason )
- -- Delay by 1 frame to ensure any chat hook finishes with player intact. Prevents a crash.
- if RapSheet then RapSheet.SavePlayerPunishment(steamid, "Banned", string.format("Banned %s with reason %s", tonumber(minutes) == 0 and "permanently" or "for "..tostring(minutes).." minute(s)",reason), IsValid(calling_ply) and string.format("%s (%s)", calling_ply:Nick(), calling_ply:SteamID()) or "(CONSOLE)") end
- ULib.queueFunctionCall( ULib.addBan, steamid, minutes, reason, name, calling_ply )
- end
- local banid = ulx.command( "Utility", "ulx banid", ulx.banid )
- banid:addParam{ type=ULib.cmds.StringArg, hint="steamid" }
- banid:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 }
- banid:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
- banid:defaultAccess( ULib.ACCESS_SUPERADMIN )
- banid:help( "Bans steamid." )
- ------------------------------ UnBan ------------------------------
- function ulx.unban( calling_ply, steamid, reason)
- steamid = steamid:upper()
- if not ULib.isValidSteamID( steamid ) then
- ULib.tsayError( calling_ply, "Invalid steamid." )
- return
- end
- name = ULib.bans[ steamid ] and ULib.bans[ steamid ].name
- reason = reason or "No reason given."
- ULib.unban( steamid, calling_ply )
- if name then
- ulx.fancyLogAdmin( calling_ply, "#A unbanned steamid #s", steamid .. " (" .. name .. ") for #s", reason )
- else
- ulx.fancyLogAdmin( calling_ply, "#A unbanned steamid #s for #s", steamid, reason )
- end
- if RapSheet then
- RapSheet.SavePlayerPunishment(steamid, "UnBanned", string.format("Unbanned %s with reason %s",steamid, reason), IsValid(calling_ply) and string.format("%s (%s)", calling_ply:Nick(), calling_ply:SteamID()) or "(CONSOLE)")
- end
- end
- local unban = ulx.command( CATEGORY_NAME, "ulx unban", ulx.unban )
- unban:addParam{ type=ULib.cmds.StringArg, hint="steamid" }
- unban:addParam{ type=ULib.cmds.StringArg, hint="unban reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
- unban:defaultAccess( ULib.ACCESS_ADMIN )
- unban:help( "Unbans steamid." )
Advertisement
Add Comment
Please, Sign In to add comment