[PHP]surface.CreateFont("ElebotPlayerTitle", { size = 14, weight = 500, antialias = true, font = "Coolvetica"})
surface.CreateFont("ElebotPlayerInfo", { size = 14, weight = 500, antialias = true, font = "Coolvetica"})
local target = nil;
if (cmdStr != nil and cmdStr != NULL) then
concommand.Remove("+"..cmdStr)
concommand.Remove("-"..cmdStr)
end
local cmdStr = "elebot"
local offset = CreateClientConVar(cmdStr.."_offset", 24, true, false)
local targetTeam = CreateClientConVar(cmdStr.."_targetteam", 0, true, false)
local simpleColors = CreateClientConVar(cmdStr.."_simplecolors", 1, true, false)
local maxView = CreateClientConVar(cmdStr.."_maxview", 4800, true, false)
local minView = CreateClientConVar(cmdStr.."_minview", 120, true, false)
local boxSize = CreateClientConVar(cmdStr.."_boxsize", 10, true, false)
local filledBox = CreateClientConVar(cmdStr.."_filledbox", 0, true, false)
local showAdmin = CreateClientConVar(cmdStr.."_showadmin", 1, true, false)
local shouldESP = CreateClientConVar(cmdStr.."_esp", 1, true, false)
local filterProps = CreateClientConVar(cmdStr.."_xray", 1, true, false)
local function TrackTarget(ucmd)
if !target or !IsValid(target) then
local filterTable = {LocalPlayer()}
if (filterProps:GetBool()) then
if (ents.GetAll()[1]:IsWorld()) then
print("World found!")
table.insert(filterTable, ents.GetAll()[1])
end
for k,v in pairs (ents.GetAll()) do
if !(v:IsNPC() or v:IsPlayer()) then
table.insert(filterTable, v)
end
end
end
/*
if (ents.FindByClass("worldspawn") != nil) then
print("Found world entity!")
table.insert(filterTable, ents.FindByClass("worldspawn")[1])
end
*/
local trace = util.QuickTrace(LocalPlayer():GetShootPos(), LocalPlayer():GetAimVector() * 100000, filterTable)
/*
local traceTable = {start = LocalPlayer():GetShootPos(), endpos = LocalPlayer():GetAimVector() * 10000, filter = filterTable}
local trace = util.TraceLine(traceTable)
*/
/*
if (trace.Entity and IsValid(trace.Entity) and trace.Entity:IsValid() and (trace.Entity:IsPlayer() or trace.Entity:IsNPC())) then
if trace.Entity:IsPlayer() and !targetTeam:GetBool() and trace.Entity:Team() == LocalPlayer():Team() then
return
else
target = trace.Entity
end
else
return
end
*/
if (trace.Entity and IsValid(trace.Entity)) then
if (trace.Entity:IsPlayer()) then
if !targetTeam:GetBool() and trace.Entity:Team() == LocalPlayer():Team() then
return
else
target = trace.Entity
end
else
if (trace.Entity:IsNPC()) then
target = trace.Entity
else
return
end
end
else
return
end
end
/*
if (target:OBBMaxs().z < offset:GetFloat() or string.find(target:GetModel(), "crab") or string.find(target:GetModel(), "torso")) then
ucmd:SetViewAngles((target:GetPos() + Vector(0, 0, target:OBBMaxs().z * 0.25) - LocalPlayer():GetShootPos()):Normalize():Angle())
else
ucmd:SetViewAngles((target:GetPos() + Vector(0, 0, offset:GetFloat()) - LocalPlayer():GetShootPos()):Normalize():Angle())
end
*/
if (target:GetAttachment(target:LookupAttachment("eyes"))) then //Standard
ucmd:SetViewAngles((target:GetAttachment(target:LookupAttachment("eyes")).Pos - LocalPlayer():GetShootPos()):Normalize():Angle())
elseif (target:GetAttachment(target:LookupAttachment("forward"))) then //CSS models
ucmd:SetViewAngles((target:GetAttachment(target:LookupAttachment("forward")).Pos - LocalPlayer():GetShootPos()):Normalize():Angle())
elseif (target:GetAttachment(target:LookupAttachment("head"))) then //Zombies
ucmd:SetViewAngles((target:GetAttachment(target:LookupAttachment("head")).Pos - LocalPlayer():GetShootPos()):Normalize():Angle())
else //Headcrabs, antlions, etc.
ucmd:SetViewAngles((target:GetPos() + Vector(0, 0, offset:GetFloat()) - LocalPlayer():GetShootPos()):Normalize():Angle())
end
end
local function PaintTargets()
if (!shouldESP:GetBool()) then return end
local adminList = "";
for k,v in pairs (ents.GetAll()) do
if v:IsNPC() then
local pos = (v:GetPos() + Vector(0, 0, offset:GetFloat())):ToScreen()
if v:OBBMaxs().z < offset:GetFloat() then
pos = (v:GetPos() + Vector(0, 0, v:OBBMaxs().z * 0.25)):ToScreen()
end
if (pos.visible) then
local alpha = math.Clamp((maxView:GetFloat() - v:GetPos():Distance(LocalPlayer():GetShootPos())) * (255 / (maxView:GetFloat() - minView:GetFloat())), 30, 255)
draw.SimpleText(string.gsub(v:GetClass(), "npc_", ""), "ElebotPlayerTitle", pos.x, pos.y, Color(0, 255, 0, alpha), 1, 1)
local boxCenter = (v:GetPos() + Vector(0, 0, v:OBBMaxs().z)):ToScreen()
local bL = boxSize:GetFloat()
if (filledBox:GetBool() && bL != 0) then
draw.RoundedBox(1, boxCenter.x - bL, boxCenter.y - bL, bL * 2, bL * 2, Color(0, 255, 0, alpha))
else
if (!filledBox:GetBool() && bL != 0) then
local bL = boxSize:GetFloat()
surface.SetDrawColor(0, 255, 0, alpha)
surface.DrawLine(boxCenter.x - bL, boxCenter.y + bL, boxCenter.x - bL, boxCenter.y - bL) //Left vertical
surface.DrawLine(boxCenter.x - bL, boxCenter.y + bL, boxCenter.x + bL, boxCenter.y + bL) //Bottom horizontal
surface.DrawLine(boxCenter.x + bL, boxCenter.y - bL, boxCenter.x - bL, boxCenter.y - bL) // Top horizontal
surface.DrawLine(boxCenter.x + bL, boxCenter.y - bL, boxCenter.x + bL, boxCenter.y + bL) //Right vertical
end
end
end
else
if v:IsPlayer() then
local pos = (v:GetPos() + Vector(0, 0, offset:GetFloat())):ToScreen()
if string.find(v:GetModel(), "crab") or string.find(v:GetModel(), "torso") then
pos = (v:GetPos() + Vector(0, 0, v:OBBMaxs().z * 0.25)):ToScreen()
end
if (pos.visible and v != LocalPlayer() and v.Nick and v.Health and v.GetActiveWeapon and v:GetActiveWeapon().GetPrintName) then
local alpha = math.Clamp((maxView:GetFloat() - v:GetPos():Distance(LocalPlayer():GetShootPos())) * (255 / (maxView:GetFloat() - minView:GetFloat())), 30, 255)
local tcol// = team.GetColor(v:Team())
if (simpleColors:GetBool()) then
if (v:Team() == LocalPlayer():Team()) then
tcol = Color(0, 255, 0, alpha)
else
tcol = Color(255, 0, 0, alpha)
end
else
tcol = team.GetColor(v:Team())
tcol = Color(tcol.r, tcol.g, tcol.b, alpha)
end
draw.SimpleText(v:Nick(), "ElebotPlayerTitle", pos.x, pos.y, tcol, 1, 1)
draw.SimpleText("HP: "..v:Health(), "ElebotPlayerInfo", pos.x, pos.y + 25, tcol, 1, 1)
draw.SimpleText("Weapon: "..v:GetActiveWeapon():GetPrintName(), "ElebotPlayerInfo", pos.x, pos.y + 38, tcol, 1, 1)
local boxCenter = ((v:GetPos() + Vector(0, 0, v:OBBMaxs().z * 0.9))):ToScreen()
local bL = boxSize:GetFloat()
if (filledBox:GetBool() && bL != 0) then
draw.RoundedBox(1, boxCenter.x - bL, boxCenter.y - bL, bL * 2, bL * 2, tcol)
else
if (!filledBox:GetBool() && bL != 0) then
surface.SetDrawColor(tcol.r, tcol.g, tcol.b, alpha)
surface.DrawLine(boxCenter.x - bL, boxCenter.y + bL, boxCenter.x - bL, boxCenter.y - bL) //Left vertical
surface.DrawLine(boxCenter.x - bL, boxCenter.y + bL, boxCenter.x + bL, boxCenter.y + bL) //Bottom horizontal
surface.DrawLine(boxCenter.x + bL, boxCenter.y - bL, boxCenter.x - bL, boxCenter.y - bL) // Top horizontal
surface.DrawLine(boxCenter.x + bL, boxCenter.y - bL, boxCenter.x + bL, boxCenter.y + bL) //Right vertical
end
end
end
if v:IsAdmin() or v:IsSuperAdmin() then
adminList = adminList..", "..v:Nick()
end
end
end
end
if (showAdmin:GetBool()) then
if (adminList != "") then
adminList = string.sub(adminList, 3, string.len(adminList))
draw.SimpleText("Admins: "..adminList, "ElebotPlayerInfo", ScrW() * 0.8, ScrH() * 0.2, Color(0, 255, 0, 200), 1, 1)
else
draw.SimpleText("No admins online!", "ElebotPlayerInfo", ScrW() * 0.8, ScrH() * 0.2, Color(255, 0, 0, 200), 1, 1)
end
end
end
hook.Add
Lines 2, 4, 6, and 8 in the part you are suggesting is whats causing the error. You are attempting to index a nil value ( in this case: GetAttachment().Pos ) of the table that is being returned. In addition, you are not creating an angle properly for SetViewAngles() to be called - so once you fix the Pos issue you are going to run into an "unexpected table" error.
[editline]30th March 2013[/editline]
Also, the general rule for posting / bumping is 24 hours. Not everyone is on at the time you are posting, so don't spam the forums saying things like "Nothing? Why Dont you help me?" or everyone will simply ignore you on here.
Welcome To Facepunch, home of the minges and assholes.
Not helping because you sent me a PM titled help me with the body just being the link to this thread.
Also you bumped this wayyyy too much.
Sorry, i dont have read this rule, but @SeveredSkull, how i can do this work?
[QUOTE=Charrax;40099880]Not helping because you sent me a PM titled help me with the body just being the link to this thread.
Also you bumped this wayyyy too much.[/QUOTE]
He did the same to me... Just been on a helping spree over in the Help and Support so I figured why the hell not.
And Ayzake, I told you how. Doing it for you defeats the purpose of you learning. Convert what you have to an Angle to pass into SetViewAngles().
Tip: An angle is like a vector, but with [I]p,y,r[/I] instead. you can create them by using Angle(p,y,r) with the respective pitch, yaw, and roll values.
If the code you posted is t.lua then it looks like you have an error on line 93, but that could just be the start of it. It looks like you're attempting to use something that you can't see within the current scope or call a function without () or a function that doesn't exist.
It's hard to try and help you when you can't tell us where the error is coming from specifically.
Also, you shouldn't just PM people you don't know with a link to your thread.
Dose hackers... Also, that code is a shit-fuck. Did you make that? If so, how the hell did you test it while you worked on it.
Sorry, you need to Log In to post a reply to this thread.