Advertisement
itak365

ESP

Apr 20th, 2012
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.35 KB | None | 0 0
  1. -- tSAT 5.1
  2. -- milk@phail.net
  3. -- money, crosshair, HP+Armor on trace, SteamID in .who, and model in trace added and neutral weapons by Marlan
  4. ------------------------------------------------------------------------
  5.  
  6.  
  7. local esp = true;
  8.  
  9.  
  10. local weapons =
  11. {
  12. neutral =
  13. {
  14. "ts2_hands",
  15. "ts2_keys",
  16. "ts_hands",
  17. "ts_keys",
  18. "ts_medic",
  19. "weapon_physcannon",
  20. "gmod_camera",
  21. },
  22.  
  23. good =
  24. {
  25. "weapon_physgun",
  26. "gmod_tool",
  27. },
  28. };
  29.  
  30.  
  31. local colors =
  32. {
  33. default = Color(235, 235, 235, 255);
  34. outline = Color(0, 0, 0, 60);
  35. highlight = Color(70, 255, 70, 100);
  36. neutralweapon = Color(200, 75, 200, 255);
  37. badweapon = Color(240, 82, 58, 255);
  38. goodweapon = Color(94, 232, 81, 255);
  39. item = Color(247, 185, 52, 255);
  40. npc = Color(240, 102, 88, 255);
  41. status = Color(150, 150, 150, 255);
  42. };
  43.  
  44.  
  45. local noshow = {};
  46. local spot = {};
  47.  
  48.  
  49. surface.CreateFont("Tahoma", 11, 400, true, false, "TS2AdminFont", true);
  50.  
  51.  
  52. ------------------------------------------------------------------------
  53.  
  54.  
  55. local function status(ply)
  56.  
  57. out = "";
  58.  
  59. if ply:IsSuperAdmin() then
  60. out = out .. "S";
  61. else
  62. out = out .. " ";
  63. end
  64.  
  65. if ply:IsAdmin() then
  66. out = out .. "A";
  67. else
  68. out = out .. " ";
  69. end
  70.  
  71. if ply:GetFriendStatus() == "friend" then
  72. out = out .. "F ";
  73. elseif ply == LocalPlayer() then
  74. out = out .. "-- ";
  75. else
  76. out = out .. " ";
  77. end
  78.  
  79. return out;
  80.  
  81. end
  82.  
  83.  
  84. local function rpname(ply)
  85.  
  86. if ply:GetNWFloat("RPName") != 0 then
  87. return ply:GetNWFloat("RPName");
  88. elseif ply:GetNWFloat("charname") != 0 then
  89. return ply:GetNWFloat("charname");
  90. elseif ply:Nick() == ply:Name() then
  91. return "Connecting...";
  92. else
  93. return ply:Nick();
  94. end
  95.  
  96. end
  97.  
  98.  
  99. local function alpha(ent)
  100.  
  101. if spot[ent] then return 255 end;
  102.  
  103. local trace =
  104. {
  105. start = LocalPlayer():EyePos();
  106. endpos = ent:EyePos() or ent:GetPos();
  107. filter = LocalPlayer();
  108. };
  109.  
  110. local tr = util.TraceLine(trace);
  111.  
  112. if tr.Entity == ent then
  113. return 255;
  114. end
  115.  
  116. return 120;
  117.  
  118. end
  119.  
  120.  
  121. local function drawtext(text, x, y, color, a, align)
  122.  
  123. draw.SimpleTextOutlined(text, "TS2AdminFont", x, y, Color(color.r, color.g, color.b, a), align, align, 1, Color(colors.outline.r, colors.outline.g, colors.outline.b, a));
  124.  
  125. end
  126.  
  127.  
  128. local function teamcolor(ply)
  129.  
  130. 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);
  131.  
  132. end
  133.  
  134.  
  135. local function printplayer(ply)
  136.  
  137. chat.AddText(colors.status, status(ply), teamcolor(ply), rpname(ply), colors.default, " " .. ply:Name());
  138.  
  139. end
  140.  
  141.  
  142. local function output(text)
  143.  
  144. chat.AddText(colors.default, text);
  145.  
  146. end
  147.  
  148.  
  149. ------------------------------------------------------------------------
  150.  
  151.  
  152. local function drawesp()
  153.  
  154. if esp then
  155.  
  156. for k, v in pairs(player.GetAll()) do
  157. if v != LocalPlayer() then
  158.  
  159. local base = v:EyePos():ToScreen();
  160.  
  161. if spot[v] then
  162. draw.RoundedBox(4, base.x - 3, base.y - 11, 150, 26, colors.highlight);
  163. end
  164.  
  165. local distance = tostring(math.Round(v:EyePos():Distance(LocalPlayer():EyePos()) / 39.37)) .. "m";
  166.  
  167. drawtext(rpname(v), base.x, base.y - 10, teamcolor(v), alpha(v), TEXT_ALIGN_LEFT);
  168.  
  169. drawtext(v:Name(), base.x, base.y, colors.default, alpha(v), TEXT_ALIGN_LEFT);
  170. drawtext(distance, base.x + 20, base.y + 10, colors.default, alpha(v), TEXT_ALIGN_LEFT);
  171. drawtext(string.Trim(status(v)), base.x - 6, base.y, colors.default, alpha(v), TEXT_ALIGN_RIGHT);
  172. end
  173. for k, v in pairs(v:GetWeapons()) do
  174. if not noshow[v] then
  175. noshow[v] = true;
  176. end
  177. end
  178. end
  179.  
  180. local trace =
  181. {
  182. start = LocalPlayer():EyePos();
  183. endpos = LocalPlayer():EyePos() + LocalPlayer():GetAimVector() * 2000;
  184. filter = LocalPlayer();
  185. };
  186.  
  187. local tr = util.TraceLine(trace);
  188.  
  189. if tr.HitNonWorld and tr.Entity:IsPlayer() then
  190.  
  191. local diff = 1;
  192. local diff2 = 1;
  193. local base = tr.Entity:EyePos():ToScreen();
  194.  
  195. drawtext("HP:"..tr.Entity:Health().." ["..tr.Entity:Armor().."]",base.x + 45,base.y + (diff2 * 10),colors.default, 255,TEXT_ALIGN_RIGHT);
  196. diff2 = diff2 + 1;
  197.  
  198. drawtext("Money: $"..tr.Entity:GetNWFloat( "money" ),base.x + 45,base.y + (diff2 * 10),colors.default, 255,TEXT_ALIGN_RIGHT);
  199. diff2 = diff2 + 1;
  200.  
  201. for k, v in pairs(tr.Entity:GetWeapons()) do
  202.  
  203. local weapon = v:GetClass();
  204.  
  205. if table.HasValue(weapons.good, weapon) then
  206.  
  207. drawtext(weapon, base.x + 50, base.y + (diff * 10), colors.goodweapon, 255, TEXT_ALIGN_LEFT);
  208. diff = diff + 1;
  209.  
  210. elseif table.HasValue(weapons.neutral, weapon) then
  211.  
  212. drawtext(weapon, base.x + 50, base.y + (diff * 10), colors.neutralweapon, 255, TEXT_ALIGN_LEFT);
  213. diff = diff + 1;
  214.  
  215. elseif not table.HasValue(weapons.neutral, weapon) then
  216.  
  217. drawtext(weapon, base.x + 50, base.y + (diff * 10), colors.badweapon, 255, TEXT_ALIGN_LEFT);
  218. diff = diff + 1;
  219.  
  220. end
  221.  
  222. end
  223.  
  224. end
  225.  
  226. if ChatVGUI then
  227. item = "weapon*";
  228. else
  229. item = "ts2_item";
  230. end
  231.  
  232. for k, v in pairs(ents.FindByClass(item)) do
  233.  
  234. if not noshow[v] then
  235.  
  236. local base = v:GetPos():ToScreen();
  237. local distance = tostring(math.Round(v:GetPos():Distance(LocalPlayer():EyePos()) / 39.37)) .. "m";
  238. local itemname = v.ItemName or v:GetModel();
  239.  
  240. drawtext(string.gsub(itemname, "models/", ""), base.x, base.y, colors.item, alpha(v), TEXT_ALIGN_LEFT);
  241. drawtext(distance, base.x + 20, base.y + 10, colors.item, alpha(v), TEXT_ALIGN_LEFT);
  242.  
  243. end
  244.  
  245. end
  246.  
  247. for k, v in pairs(ents.FindByClass("npc*")) do
  248.  
  249. local base = v:GetPos():ToScreen();
  250. local distance = tostring(math.Round(v:GetPos():Distance(LocalPlayer():EyePos()) / 39.37)) .. "m";
  251. local itemname = v.ItemName or v:GetModel();
  252.  
  253. drawtext(string.gsub(itemname, "models/", ""), base.x, base.y, colors.npc, alpha(v), TEXT_ALIGN_LEFT);
  254. drawtext(distance, base.x + 20, base.y + 10, colors.npc, alpha(v), TEXT_ALIGN_LEFT);
  255.  
  256. end
  257.  
  258. end
  259.  
  260. end
  261. hook.Add("HUDPaint", "drawesp", drawesp);
  262.  
  263.  
  264. ------------------------------------------------------------------------
  265.  
  266.  
  267. local function esptoggle()
  268.  
  269. esp = !esp;
  270.  
  271. end
  272. concommand.Add(".esp", esptoggle);
  273.  
  274.  
  275. local function listplayers()
  276.  
  277. local i = 0;
  278.  
  279. for k, v in pairs(player.GetAll()) do
  280.  
  281. i = i + 1;
  282. printplayer(v);
  283.  
  284. end
  285.  
  286. output(i .. " players total.");
  287.  
  288. end
  289. concommand.Add(".lp", listplayers);
  290.  
  291.  
  292. local function listmoney()
  293.  
  294. for k, v in pairs(player.GetAll()) do
  295.  
  296. printplayer(v)
  297. print(" $"..v:GetNWFloat( "money" ));
  298.  
  299. end
  300.  
  301. end
  302. concommand.Add(".lm", listmoney);
  303.  
  304.  
  305. local function crosshairon()
  306. draw.SimpleTextOutlined(".", "ScoreboardText", ScrW()/2.0025, ScrH()/2.015, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 0, Color(255,255,255,255)) --center
  307. draw.SimpleTextOutlined(".", "ScoreboardText", ScrW()/2.0205, ScrH()/2.015, Color(0,100,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 0, Color(255,255,255,255)) --left
  308. draw.SimpleTextOutlined(".", "ScoreboardText", ScrW()/2.0025, ScrH()/1.990, Color(0,100,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 0, Color(255,255,255,255)) --bottom
  309. draw.SimpleTextOutlined(".", "ScoreboardText", ScrW()/1.9855, ScrH()/2.015, Color(0,100,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 0, Color(255,255,255,255)) --right
  310. draw.SimpleTextOutlined(".", "ScoreboardText", ScrW()/2.0025, ScrH()/2.045, Color(0,100,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 0, Color(255,255,255,255)) --top
  311. end
  312. hook.Add("HUDPaint","crosshair",crosshairon)
  313.  
  314.  
  315. local function crosshair()
  316.  
  317.  
  318. crosshairon()
  319.  
  320. concommand.Add(".ch", crosshair);
  321.  
  322.  
  323. end
  324.  
  325.  
  326. local function listadmins()
  327.  
  328. local i = 0;
  329.  
  330. for k, v in pairs(player.GetAll()) do
  331. if v:IsAdmin() then
  332.  
  333. i = i + 1;
  334. printplayer(v);
  335.  
  336. end
  337. end
  338.  
  339. output(i .. " admins total.");
  340.  
  341. end
  342. concommand.Add(".la", listadmins);
  343.  
  344.  
  345. local function listweapons()
  346.  
  347. local i = 0;
  348.  
  349. for k, v in pairs(player.GetAll()) do
  350.  
  351. printplayer(v);
  352.  
  353. for _, weapon in pairs(v:GetWeapons()) do
  354.  
  355. i = i + 1
  356.  
  357. if not table.HasValue(weapons.neutral, weapon:GetClass()) and not table.HasValue(weapons.good, weapon:GetClass()) then
  358. chat.AddText(colors.badweapon, " " .. weapon:GetClass());
  359. end
  360.  
  361. end
  362.  
  363. end
  364.  
  365. output(i .. " weapons total.");
  366.  
  367. end
  368. concommand.Add(".lw", listweapons);
  369.  
  370.  
  371. local function search(ply, cmd, args)
  372.  
  373. if !args[1] then return; end
  374.  
  375. term = args[1];
  376.  
  377. local i = 0;
  378.  
  379. for k, v in pairs(player.GetAll()) do
  380.  
  381. if string.match(string.lower(rpname(v)), string.lower(term))
  382. or string.match(string.lower(v:Name()), string.lower(term)) then
  383.  
  384. i = i + 1;
  385. printplayer(v);
  386.  
  387. end
  388.  
  389. end
  390.  
  391. output("Found " .. i .. " matches.");
  392.  
  393. end
  394. concommand.Add(".s", search);
  395.  
  396.  
  397. local function who(ply, cmd, args)
  398.  
  399. if !args[1] then return; end
  400.  
  401. local name = string.lower(args[1]);
  402. local i = 0;
  403.  
  404. for k, v in pairs(player.GetAll()) do
  405. if string.match(string.lower(rpname(v)), name) or string.match(string.lower(v:Name()), name) then
  406.  
  407. i = i + 1;
  408. target = v;
  409.  
  410. end
  411. end
  412.  
  413. if i == 1 then
  414.  
  415. if target:GetNWFloat("RPName") != 0 then
  416. LocalPlayer():ConCommand("rpa_getinfo \"" .. rpname(target) .. "\"");
  417. else
  418.  
  419. printplayer(target);
  420. print(" Health: " .. target:Health() .. " [" .. target:Armor() .. "]");
  421. print(" Model: " .. target:GetModel());
  422. print(" SteamID: " .. target:SteamID());
  423. print(" Money: $" .. target:GetNWFloat( "money" ))
  424. print(" Frags: " .. target:Frags())
  425. print(" Business $: ".. target:GetNWFloat( ".bankamount" ))
  426. print(" Weapons:");
  427. for k, weapon in pairs(target:GetWeapons()) do
  428.  
  429. if not table.HasValue(weapons.neutral, weapon:GetClass()) and not table.HasValue(weapons.good,weapon:GetClass()) then
  430. print(" " .. weapon:GetClass());
  431. end
  432. end
  433.  
  434. end
  435.  
  436. else
  437. output("Found " .. i .. " matches.");
  438. end
  439.  
  440. end
  441. concommand.Add(".who", who);
  442.  
  443.  
  444. local function cmdall(ply, cmd, args)
  445.  
  446. if !args[1] then return; end
  447.  
  448. local command = args[1];
  449. local arg = args[2];
  450.  
  451. for k, v in pairs(player.GetAll()) do
  452. if v != LocalPlayer() or !v:IsAdmin() then
  453.  
  454. local torun = command .. "\"" .. rpname(v) .. "\"";
  455.  
  456. if arg then
  457. torun = torun .. " " .. tostring(arg);
  458. end
  459.  
  460. LocalPlayer():ConCommand(torun);
  461.  
  462. end
  463. end
  464.  
  465. end
  466. concommand.Add(".cmdall", cmdall);
  467.  
  468.  
  469. local function spotplayer(ply, cmd, args)
  470.  
  471. if !args[1] then return; end
  472.  
  473. local name = string.lower(args[1]);
  474. local i = 0;
  475.  
  476. for k, v in pairs(player.GetAll()) do
  477. if string.match(string.lower(rpname(v)), name) or string.match(string.lower(v:Name()), name) then
  478.  
  479. i = i + 1;
  480. spot[v] = true;
  481.  
  482. end
  483. end
  484. output("Highlighting " .. i .. " matches.");
  485.  
  486. end
  487. concommand.Add(".spot", spotplayer);
  488.  
  489.  
  490. local function unspot()
  491.  
  492. spot = {};
  493.  
  494. end
  495. concommand.Add(".unspot", unspot);
  496.  
  497.  
  498. local function help()
  499.  
  500. output(" .esp Toggle item/player ESP.");
  501. output(" .who name List information on a certain player.");
  502. output(" .s term List players with term as their IC/OOC name.");
  503. output(" .la List all admins/superadmins in game.");
  504. output(" .lp List all players and their IC names.");
  505. output(" .lw List all players' weapons.");
  506. output(" .lm List all players' tokens.");
  507. output(" .ch Displays a centered dot.");
  508. output(" .spot name Highlight player(s) on your ESP.");
  509. output(" .unspot Clear all highlighted players.");
  510. output(".cmdall cmd arg Do a command to everyone but yourself.");
  511.  
  512. end
  513. concommand.Add(".help", help);
  514. output("================================================================\ntSAT Intialized and Enabled. Made by Milk, edited by Marlan.\nType .help for commands.\n================================================================")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement