this worked two weeks ago but now it doesn't, it just does nothing with no errors, anyone see anything I missed?
[lua]
AddCSLuaFile( "autorun/killother.lua" )
local function findByName( identifier, ignore_immunity, ply )
local result
local user = string.lower( identifier ) -- We want to make this a case insensitive search
local players = player.GetAll()
for _, player in ipairs( players ) do
if CLIENT or player:IsConnected() then
local temp = string.find( string.lower( player:Nick() ), user, 1, true ) -- No special characters.
if temp then -- We have a match
if result then
return nil, "Found multiple targets! Please choose a better string for the target."
end
result = player
end
end
end
if result then return result end
return false, "No target found!"
end
local function zap(start,endp)
local targ = ents.Create("info_target");
targ:SetKeyValue("targetname", tostring(targ));
targ:SetPos(start);
targ:Spawn()
targ:Fire("Kill","1",0.5)
local targ2 = ents.Create("info_target");
targ2:SetKeyValue("targetname", "nnnrrg" .. tostring(targ2:EntIndex()));
targ2:SetPos(endp);
targ2:Spawn()
targ2:Fire("Kill","1",0.5)
local beam = ents.Create( "env_beam" )
beam:SetKeyValue( "life", "0" )
beam:SetKeyValue( "BoltWidth", "50" )
beam:SetKeyValue( "NoiseAmplitude", "10" )
beam:SetKeyValue( "damage", "0" )
beam:SetKeyValue( "TouchType", "4" )
beam:SetKeyValue( "Spawnflags", "1" )
beam:SetKeyValue( "texture", "sprites/bluelaser1.spr" )
beam:SetKeyValue( "LightningStart", tostring(targ) )
beam:SetKeyValue( "LightningEnd", "nnnrrg" .. tostring(targ2:EntIndex()) )
beam:SetPos(start)--player:EyePos() + player:GetAimVector()*5)
beam:Spawn()
beam:Activate()
beam:Fire("Kill","1",0.2)
beam:EmitSound("jk3/thunder_close"..math.random(1,2)..".mp3")
local beam2 = ents.Create("env_laser")
beam2:SetKeyValue( "life", "0" )
beam2:SetKeyValue( "width", "30" )
beam2:SetKeyValue( "NoiseAmplitude", "15" )
beam2:SetKeyValue( "damage", "0" )
beam2:SetKeyValue( "TouchType", "4" )
beam2:SetKeyValue( "Spawnflags", "1" )
beam2:SetKeyValue( "texture", "sprites/bluelaser1.spr" )
beam2:SetKeyValue( "TextureScroll", 4)
beam2:SetKeyValue("renderamt", "255")
beam2:SetKeyValue("rendercolor", "255 255 255")
beam2:SetKeyValue( "LaserTarget", "nnnrrg" .. tostring(targ2:EntIndex()) )
beam2:SetPos(start)--player:EyePos() + player:GetAimVector()*5)
beam2:Spawn()
beam2:Activate()
beam2:Fire("TurnOn","", 0)
beam2:Fire("Kill","1",0.3)
end
function killother(player,command,args)
if !SERVER then return end
if !ValidEntity(player) then return end
if args[1] != nil then
tply = findByName(args[1])
print(tply)
if ValidEntity(tply) and tply:IsPlayer() then
local tracedata = {}
tracedata.start = tply:GetPos()
tracedata.endpos = tply:GetPos() + Vector(0,0,9001)
tracedata.filter = tply
tracedata.mask = MASK_NPCSOLID_BRUSHONLY
local tr = util.TraceLine(tracedata) --util.QuickTrace(tply:EyePos() + Vector(0,0,40),Vector(0,0,1),{tply})
zap(tply:GetPos()+Vector(0,0,1),tr.HitPos)
if tply:Alive() then
tply:SetLocalVelocity(Vector(0,0,400))
end
tply:EmitSound("jk3/thunder_close"..math.random(1,2)..".mp3",500,100)
tply:SetKeyValue("targetname","nnnn" .. tostring(tply:EntIndex()))
local beam2 = ents.Create("env_laser")
beam2:SetKeyValue( "life", "0" )
beam2:SetKeyValue( "width", "30" )
beam2:SetKeyValue( "NoiseAmplitude", "5" )
beam2:SetKeyValue( "damage", "0" )
beam2:SetKeyValue( "TouchType", "4" )
beam2:SetKeyValue( "Spawnflags", "33" )
beam2:SetKeyValue( "texture", "sprites/bluelaser1.spr" )
beam2:SetKeyValue( "TextureScroll", 4)
beam2:SetKeyValue("renderamt", "100")
beam2:SetKeyValue("rendercolor", "255 255 255")
beam2:SetKeyValue( "LaserTarget", "nnnn" .. tostring(tply:EntIndex()))
beam2:SetPos(tr.HitPos)--player:EyePos() + player:GetAimVector()*5)
beam2:Spawn()
beam2:Activate()
beam2:Fire("TurnOn","", 0)
beam2:Fire("Kill","1",0.3)
local effectdata = EffectData()
effectdata:SetStart( tply:GetPos()+Vector(0,0,1) ) // not sure if we need a start and origin (endpoint) for this effect, but whatever
effectdata:SetOrigin( tply:GetPos()+Vector(0,0,1))
effectdata:SetScale( 1 )
util.Effect( "cball_explode", effectdata )
util.Effect( "ImpactGunship", effectdata )
timer.Simple(0.2, function()
if ValidEntity(tply) and tply:Alive() then
tply:Kill()
end
end)
return
end
end
local tr = player:GetEyeTrace()
zap(player:EyePos() + player:GetAimVector()*5,tr.HitPos)
local effectdata = EffectData()
effectdata:SetStart( tr.HitPos ) // not sure if we need a start and origin (endpoint) for this effect, but whatever
effectdata:SetOrigin( tr.HitPos )
effectdata:SetScale( 1 )
util.Effect( "cball_explode", effectdata )
util.Effect( "ImpactGunship", effectdata )
player:EmitSound("jk3/thunder_close"..math.random(1,2)..".mp3",500,100)
if ValidEntity(tr.Entity) and tr.Entity:IsPlayer() or tr.Entity:IsNPC() then
zap(player:GetPos()+Vector(0,0,1),tr.HitPos)
tr.Entity:SetLocalVelocity(Vector(0,0,300))
timer.Simple(0.2, function()
if ValidEntity(tr.Entity) then
if tr.Entity:IsNPC() then
tr.Entity:SetLocalVelocity(Vector(0,0,500))
tr.Entity:Fire("SelfDestruct",1,0.01)
tr.Entity:Fire("InteractivePowerDown",1,0)
tr.Entity:TakeDamage(40000000,tr.Entity,tr.Entity)
else
tr.Entity:Kill()
end
end
end)
end
end
function getAutoCompleteOptions(commandName,args)
return player.GetAll()
end
concommand.Add("killother",killother,getAutoCompleteOptions)
[/lua]
also since when does facepunch have a security script
Sorry, you need to Log In to post a reply to this thread.