--@name --@author --@server --[[ TODO: Check if serverside hologram is there every n seconds and if not recreate it TODO: Cloak(?), Slay (with multiple damage methods), Slap & Whip (with multiple damage methods), Freeze, Pseudogod, Ignite --]] do local players = {} for i,v in pairs(find.allPlayers()) do players[v] = {} end -- Blind local function unblind(args) local target = core:get_entity(args[1]) if target == nil then return end if players[target].blind ~= nil then players[target].blind:remove() players[target].blind = nil core:log(log.INFO, target:getName().." has been unblinded!") else core:log(log.ERROR, target:getName().." wasn't blinded!") end end local function unsblind(args) local target = core:get_entity(args[1]) if target == nil then return end net.start("LSFT-SUnblind") net.writeEntity(target) net.send() -- Just gonna do some blind faith here, lazy core:log(log.INFO, target:getName().." has been unblinded!") end local function blind(args) local target = core:get_entity(args[1]) if target == nil then return end if players[target].blind ~= nil then core:log(log.ERROR, target:getName().." is already blinded!") return end if holograms.canSpawn() then --print(holograms.hologramsLeft()) players[target].blind = holograms.create(target:getEyePos(), Angle(0,0,0), "models/holograms/hq_sphere.mdl", Vector(-5,5,5)) players[target].blind:setParent(target, "chest") players[target].blind:setColor(Color(0,0,0)) players[target].blind:suppressEngineLighting(true) if args[2] ~= nil and tonumber(args[2]) > 0 then timer.simple(tonumber(args[2]), function() unblind({target}) end) end core:log(log.INFO, target:getName().." has been blinded "..((args[2] ~= nil and tonumber(args[2]) > 0) and "for "..tonumber(args[2]).." seconds!" or "indefinitely!")) else core:log(log.ERROR, target:getName().." could not be blinded!") end end local function sblind(args) local target = core:get_entity(args[1]) if target == nil then return end if args[2] ~= nil and tonumber(args[2]) > 0 then timer.simple(tonumber(args[2]), function() unsblind({target}) end) end net.start("LSFT-SBlind") net.writeEntity(target) net.send() core:log(log.INFO, target:getName().." has been silently blinded "..((args[2] ~= nil and tonumber(args[2]) > 0) and "for "..tonumber(args[2]).." seconds!" or "indefinitely!")) end -- Jail local function unjail(args) local target = core:get_entity(args[1]) if target == nil then return end if timer.exists("Jail"..target:getSteamID64()) then timer.remove("Jail"..target:getSteamID64()) end if players[target].jail ~= nil then if players[target].jail:isValid() then players[target].jail:remove() end players[target].jail = nil core:log(log.INFO, target:getName().." has been unjailed!") else core:log(log.ERROR, target:getName().." wasn't jailed!") end end local function jail(args) local target = core:get_entity(args[1]) if target == nil then return end if players[target].jail ~= nil then core:log(log.ERROR, target:getName().." is already jailed!") return end local function createJail(target) if prop.canSpawn() then local jailprop = prop.create(target:getPos() + Vector(0,0,45), Angle(0,0,0), "models/hunter/misc/shell2x2.mdl", true) --players[target].jail:setParent(target, "chest") jailprop:setColor(Color(0,0,0,100)) jailprop:setMaterial("models/debug/debugwhite") jailprop:setMass(50000) return jailprop end end if prop.canSpawn() then players[target].jail = createJail(target) timer.create("Jail"..target:getSteamID64(), 1, 0, function() if not players[target].jail:isValid() then players[target].jail = createJail(target) core:log(log.WARNING, target:getName().."'s jail prop was removed! Correcting.") end if players[target].jail:isValid() and (target:getPos()+Vector(0,0,45)):getDistance(players[target].jail:getPos()) > 50 and not target:isNoclipped() then players[target].jail:setPos(target:getPos()+Vector(0,0,45)) end end) if args[2] ~= nil and tonumber(args[2]) > 0 then timer.simple(tonumber(args[2]), function() unjail({target}) end) end core:log(log.INFO, target:getName().." has been jailed "..((args[2] ~= nil and tonumber(args[2]) > 0) and "for "..tonumber(args[2]).." seconds!" or "indefinitely!")) else core:log(log.ERROR, target:getName().." could not be jailed!") end end -- Strip local function unstrip(args) local target = core:get_entity(args[1]) if target == nil then return end if players[target].strip ~= nil then xpcall(hook.remove("tick", "Strip"..target:getSteamID64()), function() end) if players[target].strip:isValid() then players[target].strip:remove() end players[target].strip = nil core:log(log.INFO, target:getName().." has been unstripped!") else core:log(log.ERROR, target:getName().." wasn't stripped!") end end local function strip(args) local target = core:get_entity(args[1]) if target == nil then return end if players[target].strip ~= nil then core:log(log.ERROR, target:getName().." is already stripped!") return end -- Can probably make this it's own function outside of jail and strip local function createStripJail(target) if prop.canSpawn() then local jailprop = prop.create(target:getPos() + Vector(0,0,45), Angle(0,0,0), "models/hunter/misc/sphere2x2.mdl", true) --players[target].jail:setParent(target, "chest") jailprop:setColor(Color(0,0,0,0)) jailprop:setMaterial("models/debug/debugwhite") jailprop:setMass(1) jailprop:setNocollideAll(true) return jailprop end end if prop.canSpawn() then players[target].strip = createStripJail(target) hook.add("tick", "Strip"..target:getSteamID64(), function() if not players[target].strip:isValid() then players[target].strip = createStripJail(target) core:log(log.WARNING, target:getName().."'s strip prop was removed! Correcting.") end if players[target].strip:isValid() and not target:isNoclipped() then players[target].strip:setPos(target:getPos()+Vector(0,0,45)) end end) if args[2] ~= nil and tonumber(args[2]) > 0 then timer.simple(tonumber(args[2]), function() unstrip({target}) end) end core:log(log.INFO, target:getName().." has been stripped "..((args[2] ~= nil and tonumber(args[2]) > 0) and "for "..tonumber(args[2]).." seconds!" or "indefinitely!")) else core:log(log.ERROR, target:getName().." could not be stripped!") end end -- L-SFT Integration core.modules.admin = { version = 1, desc = "Provides pseudo-administrative functions.", commands = { --Blind blind = { usage = "blind [time]", desc = "Prevents a player from seeing. Takes an optional amount of time in seconds.", func = blind, }, unblind = { usage = "unblind ", desc = "Unblinds a blinded player.", func = unblind, }, sblind = { usage = "sblind [time]", desc = "Prevents a player from seeing. Blinder is created clientside. Takes an optional amount of time in seconds.", func = sblind, }, unsblind = { usage = "unsblind ", desc = "Unblinds a clientside blinded player.", func = unsblind, }, --Jail jail = { usage = "jail [time]", desc = "Prevents a player from moving. Takes an optional amount of time in seconds.", func = jail, }, unjail = { usage = "unjail ", desc = "Unjails a trapped player.", func = unjail, }, --Strip strip = { usage = "strip [time]", desc = "Prevents a player from shooting. Takes an optional amount of time in seconds.", func = strip, }, unstrip = { usage = "unjail ", desc = "Unstrips a stripped player.", func = unstrip, }, }, } end