itak365

ESP

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