Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a modified version of an entity finder made by Lenny, from his script pack.
- // Added features include the ability to add an entity via name, and a couple server specific features that I myself use that are probably completely useless to everyone else.
- // There is a 'blacklist' feature down in the code if things you want to see arent showing up. You can delete that if you want.
- local trackents = { -- Set Default entities here, lenny_ents to add while you're ingame
- "spawned_money",
- "spawned_shipment",
- "spawned_weapon",
- }
- local function entmenu()
- local menu = vgui.Create("DFrame")
- menu:SetSize(500,350)
- menu:MakePopup()
- menu:SetTitle("Entity Finder")
- menu:Center()
- --menu:SetKeyBoardInputEnabled()
- local noton = vgui.Create("DListView",menu)
- noton:SetSize(200,menu:GetTall()-40)
- noton:SetPos(10,30)
- noton:AddColumn("Not Being Tracked")
- local on = vgui.Create("DListView",menu)
- on:SetSize(200,menu:GetTall()-40)
- on:SetPos(menu:GetWide()-210,30)
- on:AddColumn("Being Tracked")
- local addent = vgui.Create("DButton",menu)
- addent:SetSize(50,25)
- addent:SetPos(menu:GetWide()/2-25,menu:GetTall()/2-20)
- addent:SetText(">")
- addent.DoClick = function()
- if noton:GetSelectedLine() != nil then
- local ent = noton:GetLine(noton:GetSelectedLine()):GetValue(1)
- if !table.HasValue(trackents,ent) then
- table.insert(trackents,ent)
- noton:RemoveLine(noton:GetSelectedLine())
- on:AddLine(ent)
- end
- end
- end
- local rement = vgui.Create("DButton",menu)
- rement:SetSize(50,25)
- rement:SetPos(menu:GetWide()/2-25,menu:GetTall()/2+20)
- rement:SetText("<")
- rement.DoClick = function()
- if on:GetSelectedLine() != nil then
- local ent = on:GetLine(on:GetSelectedLine()):GetValue(1)
- if table.HasValue(trackents,ent) then
- for k,v in pairs(trackents) do
- if v == ent then
- table.remove(trackents,k)
- end
- end
- on:RemoveLine(on:GetSelectedLine())
- noton:AddLine(ent)
- end
- end
- end
- local added = {}
- for _,v in pairs(ents.GetAll()) do
- if !table.HasValue(added,v:GetClass()) and !table.HasValue(trackents,v:GetClass()) and !string.find(v:GetClass(),"grav") and !string.find(v:GetClass(),"phys") and v:GetClass() != "player" then
- noton:AddLine(v:GetClass())
- table.insert(added,v:GetClass())
- end
- end
- for _,v in pairs(trackents) do
- on:AddLine(v)
- end
- local Entry = vgui.Create( "DTextEntry", menu )
- Entry:SetPos(menu:GetWide()/2-38,menu:GetTall()/2+60)
- Entry:SetSize( 77, 20)
- Entry.OnEnter = function( self )
- table.insert(trackents, self:GetValue())
- on:AddLine(self:GetValue())
- end
- end
- concommand.Add("_ents", entmenu)
- -- SeriousTTT specific
- CreateClientConVar( "server_ents", "1", true, false, "Enable server specific automatic entity addition" )
- if GetConVarNumber("server_ents") == 1 then
- if (string.find(string.lower(GetHostName()), string.lower("Serious TTT"))) then
- local M4A4 = ("weapon_ttt_m4a4")
- table.insert(trackents, M4A4)
- end
- if
- (string.find(string.lower(GetHostName()), string.lower("Xelanation"))) then
- local clickers = ("money_clicker")
- table.insert(trackents, clickers)
- end
- end
- // Drawing
- hook.Add("HUDPaint", "ShowEnts", function()
- for k,v in pairs(ents.GetAll()) do
- local drawing = false
- for i,p in pairs(trackents) do
- if v:GetClass() == p then
- drawing = true
- end
- end
- if drawing then
- local pos = v:GetPos():ToScreen()
- cam.Start3D();
- render.SuppressEngineLighting(true)
- render.MaterialOverride();
- render.SetColorModulation(1,1,1);
- cam.IgnoreZ(true);
- FindMetaTable("Entity").DrawModel(v);
- cam.IgnoreZ(false);
- render.SetColorModulation(1,1,1);
- render.MaterialOverride();
- render.SuppressEngineLighting(false)
- cam.End3D();
- if v:GetClass() == "spawned_money" then
- draw.DrawText("MONEY - $" .. v:Getamount(), "BudgetLabel", pos.x, pos.y, color_white, TEXT_ALIGN_LEFT)
- else
- if v:GetClass() == "spawned_shipment" then
- draw.DrawText("SHIPMENT - " .. v:Getcontents() .. ". Count: " .. v:Getcount(), "BudgetLabel", pos.x, pos.y, color_white, TEXT_ALIGN_LEFT)
- else
- draw.DrawText(v:GetClass(), "BudgetLabel", pos.x, pos.y, color_white, TEXT_ALIGN_LEFT)
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement