Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- tsat 5.7
- -- milk@phail.net
- ------------------------------------------------------------------------
- local esp = true;
- local playeresp = true;
- local itemesp = true;
- local npcesp = true;
- local showdate = true;
- local colors =
- {
- default = Color(255, 255, 255, 255);
- outline = Color(0, 0, 0, 255);
- highlight = Color(255, 0, 255, 100);
- badweapon = Color(255, 0, 0, 255);
- goodweapon = Color(0, 255, 0, 255);
- item = Color(255, 255, 0, 255);
- npc = Color(255, 0, 0, 255);
- status = Color(255, 255, 255, 255);
- opaque = 255;
- transparent = 128;
- };
- local weapons =
- {
- bad =
- {
- "ts2_hands",
- "ts2_keys",
- "ts_hands",
- "ts_keys",
- "ts_medic",
- "weapon_physcannon"
- },
- good =
- {
- "weapon_physgun",
- "gmod_tool"
- },
- };
- local noshow = {};
- local spot = {};
- local prox = {};
- local height = 10;
- local currentfont = "TS2AdminFontTest2Small";
- ------------------------------------------------------------------------
- CreateClientConVar(".esp_fontsize", "0", true, false);
- surface.CreateFont("TS2AdminFontTest2Small", { font = "Calibri", size = 14, weight = 700, antialias = true, additive = false});
- surface.CreateFont("TS2AdminFontTest2Medium", { font = "Calibri", size = 15, weight = 700, antialias = true, additive = false});
- surface.CreateFont("TS2AdminFontTest2Large", { font = "Calibri", size = 16, weight = 700, antialias = true, additive = false});
- surface.CreateFont("TS2AdminFontTest2Huge", { font = "Calibri", size = 17, weight = 700, antialias = true, additive = false});
- ------------------------------------------------------------------------
- local function status(ply)
- local out = "";
- if ply:IsSuperAdmin() then
- out = "s";
- else
- out = " ";
- end
- if ply:IsAdmin() then
- out = out.."a";
- else
- out = out.." ";
- end
- if ply:GetFriendStatus() == "friend" then
- out = out.."f ";
- elseif ply == LocalPlayer() then
- out = out.."- ";
- else
- out = out.." ";
- end
- return out;
- end
- local function rpname(ply)
- if ply:GetNWFloat("RPName") != 0 then
- return ply:GetNWFloat("RPName");
- elseif ply:GetNWFloat("charname") != 0 then
- return ply:GetNWFloat("charname");
- elseif ply:Nick() == ply:Name() then
- return "Connecting...";
- else
- return ply:Nick();
- end
- end
- local function teamcolor(ply)
- return Color(math.Clamp(team.GetColor(ply:Team()).r+50, 0, 255), math.Clamp(team.GetColor(ply:Team()).g+50, 0, 255), math.Clamp(team.GetColor(ply:Team()).b+50, 0, 255), colors.default.a);
- end
- local cache = {};
- local nextrefresh = RealTime();
- local function alpha(ent)
- if (nextrefresh or 0) <= RealTime() then
- cache = {};
- nextrefresh = RealTime()+1;
- end
- if cache[ent] ~= nil then return cache[ent] end;
- if spot[ent] then return colors.opaque end;
- local trace =
- {
- start = LocalPlayer():EyePos();
- endpos = (ent:EyePos()-Vector(0, 0, 14) or ent:GetPos());
- filter = LocalPlayer();
- };
- local tr = util.TraceLine(trace);
- if tr.Entity == ent then
- cache[ent] = colors.opaque;
- else
- cache[ent] = colors.transparent;
- end
- return cache[ent];
- end
- local function getfontsize()
- if GetConVarNumber(".esp_fontsize") == 1 then
- height = 15;
- currentfont = "TS2AdminFontTest2Medium";
- elseif GetConVarNumber(".esp_fontsize") == 2 then
- height = 16;
- currentfont = "TS2AdminFontTest2Large";
- elseif GetConVarNumber(".esp_fontsize") == 3 then
- height = 17;
- currentfont = "TS2AdminFontTest2Huge";
- else
- height = 13;
- currentfont = "TS2AdminFontTest2Small";
- end
- end
- timer.Create("updatefont", 5, 0, getfontsize);
- local function drawtext(text, x, y, color, a, align)
- draw.SimpleTextOutlined(text, currentfont, x, y, Color(color.r, color.g, color.b, a), align, align, 1, Color(colors.outline.r, colors.outline.g, colors.outline.b, a));
- end
- local function printplayer(ply)
- chat.AddText(Color(colors.status.r,colors.status.g,colors.status.b,255), status(ply), teamcolor(ply), rpname(ply), colors.default, " "..ply:Name());
- end
- local function output(text)
- chat.AddText(colors.default, text);
- end
- ------------------------------------------------------------------------
- local num = (3/160);
- local dist = {};
- local pos, nextflush, item;
- if ChatVGUI then
- item = "weapon*";
- else
- item = "ts2_item";
- end
- local function drawesp()
- if esp then
- local LP = LocalPlayer();
- local LPE = LP:EyePos();
- if (nextflush or 0) <= RealTime() then
- dist = {};
- nextflush = RealTime()+0.1;
- end
- pos = {};
- if playeresp then
- for k, v in pairs(player.GetAll()) do
- if v != LocalPlayer() then
- local ep = pos[v];
- if ep == nil then
- pos[v] = v:EyePos();
- ep = pos[v];
- end
- local base = ep:ToScreen();
- if base.visible then
- if spot[v] then
- draw.RoundedBox(4, base.x-3, base.y-height-1, 175, height*2+7, colors.highlight);
- end
- local distance = dist[v];
- if distance == nil then
- dist[v] = string.format("%0.2fm", ep:Distance(LPE)*num);
- distance = dist[v];
- end
- drawtext(rpname(v), base.x, base.y-height, teamcolor(v), alpha(v), TEXT_ALIGN_LEFT);
- drawtext(v:Name(), base.x, base.y, colors.default, alpha(v), TEXT_ALIGN_LEFT);
- drawtext(distance, base.x+height*2, base.y+height, colors.default, alpha(v), TEXT_ALIGN_LEFT);
- drawtext(string.Trim(status(v)), base.x-6, base.y, colors.status, alpha(v), TEXT_ALIGN_RIGHT);
- end
- end
- for k, v in pairs(v:GetWeapons()) do
- if not noshow[v] then
- noshow[v] = true;
- end
- end
- end
- local tr = LP:GetEyeTrace();
- if tr.HitNonWorld and tr.Entity:IsPlayer() then
- local diff = 1;
- local ep = pos[tr.Entity];
- if ep == nil then
- pos[tr.Entity] = tr.Entity:EyePos();
- ep = pos[tr.Entity];
- end
- local base = ep:ToScreen();
- for k, v in pairs(tr.Entity:GetWeapons()) do
- local weapon = v:GetClass();
- if table.HasValue(weapons.good, weapon) then
- drawtext(weapon, base.x+height*6, base.y+(diff*height), colors.goodweapon, 255, TEXT_ALIGN_LEFT);
- diff = diff+1;
- elseif not table.HasValue(weapons.bad, weapon) then
- drawtext(weapon, base.x+height*6, base.y+(diff*height), colors.badweapon, 255, TEXT_ALIGN_LEFT);
- diff = diff+1;
- end
- end
- end
- end
- if itemesp then
- for k, v in pairs(ents.FindByClass(item)) do
- if not noshow[v] then
- local ep = pos[v];
- if ep == nil then
- pos[v] = v:GetPos();
- ep = pos[v];
- end
- local base = ep:ToScreen();
- if base.visible then
- local distance = dist[v];
- if distance == nil then
- dist[v] = string.format("%0.2fm", ep:Distance(LPE)*num);
- distance = dist[v];
- end
- local itemname
- if v.ItemName == nil then
- itemname = v:GetModel();
- if (v.NextReqData or 0) <= CurTime() then
- RunConsoleCommand("eng_reciteminfo", v:EntIndex());
- v.NextReqData = CurTime()+5;
- end
- else
- itemname = v.ItemName;
- end
- drawtext(string.gsub(itemname, "models/", ""), base.x, base.y, colors.item, alpha(v), TEXT_ALIGN_LEFT);
- drawtext(distance, base.x+height, base.y+height, colors.item, alpha(v), TEXT_ALIGN_LEFT);
- end
- end
- end
- end
- if npcesp then
- for k, v in pairs(ents.FindByClass("npc*")) do
- local ep = pos[v];
- if ep == nil then
- pos[v] = v:GetPos();
- ep = pos[v];
- end
- local base = ep:ToScreen();
- if base.visible then
- local distance = dist[v];
- if distance == nil then
- dist[v] = string.format("%0.2fm", ep:Distance(LPE)*num);
- distance = dist[v];
- end
- local itemname = v:GetModel();
- drawtext(string.gsub(itemname, "models/", ""), base.x, base.y, colors.npc, alpha(v), TEXT_ALIGN_LEFT);
- drawtext(distance, base.x+height, base.y+height, colors.npc, alpha(v), TEXT_ALIGN_LEFT);
- end
- end
- end
- if showdate then
- drawtext(math.Round(1/RealFrameTime())..os.date(" %d/%m/%y %I:%M:%S"), ScrW()-2, ScrH()-height-2, colors.default, colors.transparent, TEXT_ALIGN_RIGHT);
- end
- end
- end
- hook.Add("HUDPaint", "drawesp", drawesp);
- ------------------------------------------------------------------------
- local function esptoggle()
- esp = not esp;
- end
- concommand.Add(".esp", esptoggle);
- local function esptoggle_player()
- playeresp = not playeresp;
- end
- concommand.Add(".esp_player", esptoggle_player);
- local function esptoggle_item()
- itemesp = not itemesp;
- end
- concommand.Add(".esp_item", esptoggle_item);
- local function esptoggle_npc()
- npcesp = not npcesp;
- end
- concommand.Add(".esp_npc", esptoggle_npc);
- local function esptoggle_date()
- showdate = not showdate;
- end
- concommand.Add(".esp_date", esptoggle_date);
- local function listplayers()
- local i = 0;
- for k, v in pairs(player.GetAll()) do
- i = i+1;
- printplayer(v);
- end
- output(i.." players total.");
- end
- concommand.Add(".lp", listplayers);
- local function listadmins()
- local i = 0;
- for k, v in pairs(player.GetAll()) do
- if v:IsAdmin() then
- i = i+1;
- printplayer(v);
- end
- end
- output(i.." admins total.");
- end
- concommand.Add(".la", listadmins);
- local function listweapons()
- local i = 0;
- for k, v in pairs(player.GetAll()) do
- printplayer(v);
- for _, weapon in pairs(v:GetWeapons()) do
- if not table.HasValue(weapons.bad, weapon:GetClass()) and not table.HasValue(weapons.good, weapon:GetClass()) then
- i = i+1;
- chat.AddText(colors.badweapon, " "..weapon:GetClass());
- end
- end
- end
- output(i.." weapons total.");
- end
- concommand.Add(".lw", listweapons);
- local function search(ply, cmd, args)
- if !args[1] then return end;
- term = args[1];
- local i = 0;
- for k, v in pairs(player.GetAll()) do
- if string.match(string.lower(rpname(v)), string.lower(term))
- or string.match(string.lower(v:Name()), string.lower(term)) then
- i = i+1;
- printplayer(v);
- end
- end
- output("Found "..i.." matches.");
- end
- concommand.Add(".s", search);
- local function who(ply, cmd, args)
- if !args[1] then return end;
- local name = string.lower(args[1]);
- local i = 0;
- for k, v in pairs(player.GetAll()) do
- if string.match(string.lower(rpname(v)), name) or string.match(string.lower(v:Name()), name) then
- i = i+1;
- target = v;
- end
- end
- if i == 1 then
- if target:GetNWFloat("RPName") != 0 and LocalPlayer():IsAdmin() then
- LocalPlayer():ConCommand("rpa_getinfo \""..rpname(target).."\"");
- else
- printplayer(target);
- output(" Health: "..target:Health().." ["..target:Armor().."]");
- output(" Model: "..target:GetModel());
- output(" Weapons:");
- for k, weapon in pairs(target:GetWeapons()) do
- if not table.HasValue(weapons.bad, weapon:GetClass()) and not table.HasValue(weapons.good,weapon:GetClass()) then
- output(" "..weapon:GetClass());
- end
- end
- end
- else
- output("Found "..i.." matches.");
- end
- end
- concommand.Add(".who", who);
- local function cmdall(ply, cmd, args)
- if !args[1] then return end;
- local command = args[1];
- local arg = args[2];
- for k, v in pairs(player.GetAll()) do
- if v != LocalPlayer() or !v:IsAdmin() then
- local torun = command.."\""..rpname(v).."\"";
- if arg then
- torun = torun.." "..tostring(arg);
- end
- LocalPlayer():ConCommand(torun);
- end
- end
- end
- concommand.Add(".cmdall", cmdall);
- local function spotplayer(ply, cmd, args)
- if !args[1] then return end;
- local name = string.lower(args[1]);
- local i = 0;
- for k, v in pairs(player.GetAll()) do
- if string.match(string.lower(rpname(v)), name) or string.match(string.lower(v:Name()), name) then
- i = i+1;
- spot[v] = true;
- end
- end
- output("Highlighting "..i.." matches.");
- end
- concommand.Add(".spot", spotplayer);
- local function unspot()
- spot = {};
- end
- concommand.Add(".unspot", unspot);
- local function createprox(ply, cmd, args)
- if !args[1] then return end
- local name = string.lower(args[1])
- local radius = tonumber(args[2]) or 512
- local pos = ply:GetPos()
- prox[name] = {pos, radius, {}}
- end
- concommand.Add(".prox", createprox)
- local function clearprox(ply, cmd, args)
- if !args[1] then
- prox = {}
- else
- for k, v in pairs(prox) do
- if k == args[1] then
- prox[k] = nil
- end
- end
- end
- end
- concommand.Add(".proxremove", clearprox)
- local function listprox()
- for k, v in pairs(prox) do
- MsgN(k)
- end
- end
- concommand.Add(".proxlist", listprox)
- local function proxdetector()
- for k, v in pairs( prox ) do
- local t_ents = player.GetAll()
- for _, data in pairs( t_ents ) do
- if ( IsValid( data ) && data:GetPos():Distance( v[1] ) <= v[2] && not v[3][data] ) then
- v[3][data] = true
- AddChat( {1}, "", "Player [" .. data:GetRPName() .. "] is within the radius of proximity [" .. k .. "].", "NewChatFont", Color( 255, 0, 0 ), Color( 255, 0, 0 ) )
- MsgN("Player [" .. data:GetRPName() .. "] is within the radius of proximity [" .. k .. "].")
- end
- if ( IsValid( data ) && v[3][data] && not( data:GetPos():Distance( v[1] )<= v[2] ) ) then
- v[3][data] = nil
- AddChat( {1}, "", "Player [" .. data:GetRPName() .. "] has left proximity [" .. k .. "].", "NewChatFont", Color( 255, 0, 0 ), Color( 255, 0, 0 ) )
- MsgN("Player [" .. data:GetRPName() .. "] has left proximity [" .. k .. "].")
- end
- end
- end
- t_ents = {}
- end
- hook.Add("Think", "proxdetector", proxdetector)
- local adminradius = 200;
- local admindetector = true;
- /*
- local function changeadminradius(ply, cmd, args)
- if (!args[1]) then
- MsgN("Enter a radius, noob!")
- AddChat({1}, "", "Enter a radius, noob!", "NewChatFont", Color( 255, 0, 0 ), Color( 255, 0, 0 ))
- else
- adminradius = args[1];
- MsgN("Radius set to: " .. args[1] .. "!")
- end
- end
- concommand.Add(".ar", changeadminradius)
- */
- local function toggleadmindetector()
- if(admindetector) then
- MsgN("Admin Detector Off.")
- admindetector = false;
- else
- MsgN("Admin Detector On.")
- admindetector = true;
- end
- end
- concommand.Add(".ad", toggleadmindetector)
- local CloakedAdmins = {}
- local function AdminDetector()
- if( admindetector ) then
- local t_players = player.GetAll()
- for i = 1, #t_players do
- local data = t_players[i]
- local distance = data:GetPos():Distance( LocalPlayer():GetPos() )
- if ( IsValid( data ) ) then
- if ( data:GetMoveType() == MOVETYPE_NOCLIP && data != LocalPlayer() && distance <= adminradius ) then
- if not ( CloakedAdmins[data] ) then
- AddChat( {1}, "", "Admin [" .. data:GetRPName() .. "] is probably watching you!", "NewChatFont", Color( 255, 0, 0 ), Color( 255, 0, 0 ) )
- MsgN("Admin [" .. data:GetRPName() .. "] is probably watching you!")
- surface.PlaySound("alarm.mp3")
- CloakedAdmins[data] = true
- end
- end
- if ( distance > adminradius && data != LocalPlayer() ) then
- if ( CloakedAdmins[data] ) then
- AddChat( {1}, "", "Admin [" .. data:GetRPName() .. "] has left your area.", "NewChatFont", Color( 255, 0, 0 ), Color( 255, 0, 0 ) )
- MsgN("Admin [" .. data:GetRPName() .. "] has left your area.")
- CloakedAdmins[data] = nil
- end
- end
- end
- end
- else
- CloakedAdmins = {}
- end
- end
- hook.Add( "Think", "AdminDetector", AdminDetector )
- local function help()
- output(".ad Toggle the Admin Detector.")
- output(".esp Toggle the entire ESP.");
- output(".esp_player Toggle player ESP.");
- output(".esp_item Toggle item ESP.");
- output(".esp_npc Toggle NPC ESP.");
- output(".esp_date Toggle time/date on ESP.");
- output(".esp_fontsize [0-3] Set the ESP's font size.");
- output(".who [name] List information of a certain player.");
- output(".s [term] List players with term in their IC/OOC name.");
- output(".la List all admins/superadmins in game.");
- output(".lp List all players and their IC names.");
- output(".lw List all players' weapons.");
- output(".maps List all maps on the server.");
- output(".spot [name] Highlight player(s) on your ESP.");
- output(".unspot Clear all highlighted players.");
- output(".proxlist List all current proximities set.");
- output(".prox [name] (radius) Creates a proximity point at your position, radius defaults to 512 units.");
- output(".proxremove (name) Clears all proximity points, or the one specified.");
- output(".cmdall [cmd] [arg] Do a command to everyone but yourself.");
- end
- concommand.Add(".help", help);
- output("tsat initialized");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement