Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.51 KB | None | 0 0
  1. -- tsat 5.7
  2. -- milk@phail.net
  3. ------------------------------------------------------------------------
  4.  
  5. local esp = true;
  6. local playeresp = true;
  7. local itemesp = true;
  8. local npcesp = true;
  9. local showdate = true;
  10.  
  11. local colors =
  12. {
  13. default = Color(255, 255, 255, 255);
  14. outline = Color(0, 0, 0, 255);
  15. highlight = Color(255, 0, 255, 100);
  16. badweapon = Color(255, 0, 0, 255);
  17. goodweapon = Color(0, 255, 0, 255);
  18. item = Color(255, 255, 0, 255);
  19. npc = Color(255, 0, 0, 255);
  20. status = Color(255, 255, 255, 255);
  21. opaque = 255;
  22. transparent = 128;
  23. };
  24.  
  25. local weapons =
  26. {
  27. bad =
  28. {
  29. "ts2_hands",
  30. "ts2_keys",
  31. "ts_hands",
  32. "ts_keys",
  33. "ts_medic",
  34. "weapon_physcannon"
  35. },
  36.  
  37. good =
  38. {
  39. "weapon_physgun",
  40. "gmod_tool"
  41. },
  42. };
  43.  
  44. local noshow = {};
  45. local spot = {};
  46. local prox = {};
  47.  
  48. local height = 10;
  49. local currentfont = "TS2AdminFontTest2Small";
  50.  
  51. ------------------------------------------------------------------------
  52.  
  53. CreateClientConVar(".esp_fontsize", "0", true, false);
  54.  
  55. surface.CreateFont("TS2AdminFontTest2Small", { font = "Calibri", size = 14, weight = 700, antialias = true, additive = false});
  56. surface.CreateFont("TS2AdminFontTest2Medium", { font = "Calibri", size = 15, weight = 700, antialias = true, additive = false});
  57. surface.CreateFont("TS2AdminFontTest2Large", { font = "Calibri", size = 16, weight = 700, antialias = true, additive = false});
  58. surface.CreateFont("TS2AdminFontTest2Huge", { font = "Calibri", size = 17, weight = 700, antialias = true, additive = false});
  59.  
  60. ------------------------------------------------------------------------
  61.  
  62. local function status(ply)
  63.  
  64. local out = "";
  65.  
  66. if ply:IsSuperAdmin() then
  67. out = "s";
  68. else
  69. out = " ";
  70. end
  71.  
  72. if ply:IsAdmin() then
  73. out = out.."a";
  74. else
  75. out = out.." ";
  76. end
  77.  
  78. if ply:GetFriendStatus() == "friend" then
  79. out = out.."f ";
  80. elseif ply == LocalPlayer() then
  81. out = out.."- ";
  82. else
  83. out = out.." ";
  84. end
  85.  
  86. return out;
  87.  
  88. end
  89.  
  90. local function rpname(ply)
  91.  
  92. if ply:GetNWFloat("RPName") != 0 then
  93. return ply:GetNWFloat("RPName");
  94. elseif ply:GetNWFloat("charname") != 0 then
  95. return ply:GetNWFloat("charname");
  96. elseif ply:Nick() == ply:Name() then
  97. return "Connecting...";
  98. else
  99. return ply:Nick();
  100. end
  101.  
  102. end
  103.  
  104. local function teamcolor(ply)
  105.  
  106. 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);
  107.  
  108. end
  109.  
  110. local cache = {};
  111. local nextrefresh = RealTime();
  112.  
  113. local function alpha(ent)
  114.  
  115. if (nextrefresh or 0) <= RealTime() then
  116. cache = {};
  117. nextrefresh = RealTime()+1;
  118. end
  119.  
  120. if cache[ent] ~= nil then return cache[ent] end;
  121.  
  122. if spot[ent] then return colors.opaque end;
  123.  
  124. local trace =
  125. {
  126. start = LocalPlayer():EyePos();
  127. endpos = (ent:EyePos()-Vector(0, 0, 14) or ent:GetPos());
  128. filter = LocalPlayer();
  129. };
  130.  
  131. local tr = util.TraceLine(trace);
  132.  
  133. if tr.Entity == ent then
  134. cache[ent] = colors.opaque;
  135. else
  136. cache[ent] = colors.transparent;
  137. end
  138.  
  139. return cache[ent];
  140.  
  141. end
  142.  
  143. local function getfontsize()
  144.  
  145. if GetConVarNumber(".esp_fontsize") == 1 then
  146. height = 15;
  147. currentfont = "TS2AdminFontTest2Medium";
  148. elseif GetConVarNumber(".esp_fontsize") == 2 then
  149. height = 16;
  150. currentfont = "TS2AdminFontTest2Large";
  151. elseif GetConVarNumber(".esp_fontsize") == 3 then
  152. height = 17;
  153. currentfont = "TS2AdminFontTest2Huge";
  154. else
  155. height = 13;
  156. currentfont = "TS2AdminFontTest2Small";
  157. end
  158.  
  159. end
  160. timer.Create("updatefont", 5, 0, getfontsize);
  161.  
  162. local function drawtext(text, x, y, color, a, align)
  163.  
  164. 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));
  165.  
  166. end
  167.  
  168. local function printplayer(ply)
  169.  
  170. chat.AddText(Color(colors.status.r,colors.status.g,colors.status.b,255), status(ply), teamcolor(ply), rpname(ply), colors.default, " "..ply:Name());
  171.  
  172. end
  173.  
  174. local function output(text)
  175.  
  176. chat.AddText(colors.default, text);
  177.  
  178. end
  179.  
  180. ------------------------------------------------------------------------
  181.  
  182. local num = (3/160);
  183.  
  184. local dist = {};
  185. local pos, nextflush, item;
  186.  
  187. if ChatVGUI then
  188. item = "weapon*";
  189. else
  190. item = "ts2_item";
  191. end
  192.  
  193. local function drawesp()
  194.  
  195. if esp then
  196.  
  197. local LP = LocalPlayer();
  198. local LPE = LP:EyePos();
  199.  
  200. if (nextflush or 0) <= RealTime() then
  201. dist = {};
  202. nextflush = RealTime()+0.1;
  203. end
  204.  
  205. pos = {};
  206.  
  207. if playeresp then
  208.  
  209. for k, v in pairs(player.GetAll()) do
  210.  
  211. if v != LocalPlayer() then
  212.  
  213. local ep = pos[v];
  214.  
  215. if ep == nil then
  216. pos[v] = v:EyePos();
  217. ep = pos[v];
  218. end
  219.  
  220. local base = ep:ToScreen();
  221.  
  222. if base.visible then
  223. if spot[v] then
  224. draw.RoundedBox(4, base.x-3, base.y-height-1, 175, height*2+7, colors.highlight);
  225. end
  226.  
  227. local distance = dist[v];
  228. if distance == nil then
  229. dist[v] = string.format("%0.2fm", ep:Distance(LPE)*num);
  230. distance = dist[v];
  231. end
  232.  
  233. drawtext(rpname(v), base.x, base.y-height, teamcolor(v), alpha(v), TEXT_ALIGN_LEFT);
  234.  
  235. drawtext(v:Name(), base.x, base.y, colors.default, alpha(v), TEXT_ALIGN_LEFT);
  236. drawtext(distance, base.x+height*2, base.y+height, colors.default, alpha(v), TEXT_ALIGN_LEFT);
  237. drawtext(string.Trim(status(v)), base.x-6, base.y, colors.status, alpha(v), TEXT_ALIGN_RIGHT);
  238. end
  239.  
  240. end
  241. for k, v in pairs(v:GetWeapons()) do
  242. if not noshow[v] then
  243. noshow[v] = true;
  244. end
  245. end
  246. end
  247.  
  248. local tr = LP:GetEyeTrace();
  249.  
  250. if tr.HitNonWorld and tr.Entity:IsPlayer() then
  251.  
  252. local diff = 1;
  253. local ep = pos[tr.Entity];
  254.  
  255. if ep == nil then
  256. pos[tr.Entity] = tr.Entity:EyePos();
  257. ep = pos[tr.Entity];
  258. end
  259.  
  260. local base = ep:ToScreen();
  261.  
  262. for k, v in pairs(tr.Entity:GetWeapons()) do
  263.  
  264. local weapon = v:GetClass();
  265.  
  266. if table.HasValue(weapons.good, weapon) then
  267.  
  268. drawtext(weapon, base.x+height*6, base.y+(diff*height), colors.goodweapon, 255, TEXT_ALIGN_LEFT);
  269. diff = diff+1;
  270.  
  271. elseif not table.HasValue(weapons.bad, weapon) then
  272.  
  273. drawtext(weapon, base.x+height*6, base.y+(diff*height), colors.badweapon, 255, TEXT_ALIGN_LEFT);
  274. diff = diff+1;
  275.  
  276. end
  277.  
  278. end
  279.  
  280. end
  281.  
  282. end
  283.  
  284. if itemesp then
  285.  
  286. for k, v in pairs(ents.FindByClass(item)) do
  287.  
  288. if not noshow[v] then
  289.  
  290. local ep = pos[v];
  291.  
  292. if ep == nil then
  293. pos[v] = v:GetPos();
  294. ep = pos[v];
  295. end
  296.  
  297. local base = ep:ToScreen();
  298.  
  299. if base.visible then
  300.  
  301. local distance = dist[v];
  302.  
  303. if distance == nil then
  304. dist[v] = string.format("%0.2fm", ep:Distance(LPE)*num);
  305. distance = dist[v];
  306. end
  307.  
  308. local itemname
  309. if v.ItemName == nil then
  310.  
  311. itemname = v:GetModel();
  312.  
  313. if (v.NextReqData or 0) <= CurTime() then
  314. RunConsoleCommand("eng_reciteminfo", v:EntIndex());
  315. v.NextReqData = CurTime()+5;
  316. end
  317.  
  318. else
  319. itemname = v.ItemName;
  320. end
  321.  
  322. drawtext(string.gsub(itemname, "models/", ""), base.x, base.y, colors.item, alpha(v), TEXT_ALIGN_LEFT);
  323. drawtext(distance, base.x+height, base.y+height, colors.item, alpha(v), TEXT_ALIGN_LEFT);
  324.  
  325. end
  326.  
  327. end
  328.  
  329. end
  330.  
  331. end
  332.  
  333. if npcesp then
  334.  
  335. for k, v in pairs(ents.FindByClass("npc*")) do
  336.  
  337. local ep = pos[v];
  338.  
  339. if ep == nil then
  340. pos[v] = v:GetPos();
  341. ep = pos[v];
  342. end
  343.  
  344. local base = ep:ToScreen();
  345.  
  346. if base.visible then
  347.  
  348. local distance = dist[v];
  349.  
  350. if distance == nil then
  351. dist[v] = string.format("%0.2fm", ep:Distance(LPE)*num);
  352. distance = dist[v];
  353. end
  354.  
  355. local itemname = v:GetModel();
  356.  
  357. drawtext(string.gsub(itemname, "models/", ""), base.x, base.y, colors.npc, alpha(v), TEXT_ALIGN_LEFT);
  358. drawtext(distance, base.x+height, base.y+height, colors.npc, alpha(v), TEXT_ALIGN_LEFT);
  359.  
  360. end
  361.  
  362. end
  363.  
  364. end
  365.  
  366. if showdate then
  367.  
  368. 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);
  369.  
  370. end
  371.  
  372. end
  373.  
  374. end
  375. hook.Add("HUDPaint", "drawesp", drawesp);
  376.  
  377. ------------------------------------------------------------------------
  378.  
  379. local function esptoggle()
  380.  
  381. esp = not esp;
  382.  
  383. end
  384. concommand.Add(".esp", esptoggle);
  385.  
  386. local function esptoggle_player()
  387.  
  388. playeresp = not playeresp;
  389.  
  390. end
  391. concommand.Add(".esp_player", esptoggle_player);
  392.  
  393. local function esptoggle_item()
  394.  
  395. itemesp = not itemesp;
  396.  
  397. end
  398. concommand.Add(".esp_item", esptoggle_item);
  399.  
  400. local function esptoggle_npc()
  401.  
  402. npcesp = not npcesp;
  403.  
  404. end
  405. concommand.Add(".esp_npc", esptoggle_npc);
  406.  
  407. local function esptoggle_date()
  408.  
  409. showdate = not showdate;
  410.  
  411. end
  412. concommand.Add(".esp_date", esptoggle_date);
  413.  
  414. local function listplayers()
  415.  
  416. local i = 0;
  417.  
  418. for k, v in pairs(player.GetAll()) do
  419.  
  420. i = i+1;
  421. printplayer(v);
  422.  
  423. end
  424.  
  425. output(i.." players total.");
  426.  
  427. end
  428. concommand.Add(".lp", listplayers);
  429.  
  430. local function listadmins()
  431.  
  432. local i = 0;
  433.  
  434. for k, v in pairs(player.GetAll()) do
  435. if v:IsAdmin() then
  436.  
  437. i = i+1;
  438. printplayer(v);
  439.  
  440. end
  441. end
  442.  
  443. output(i.." admins total.");
  444.  
  445. end
  446. concommand.Add(".la", listadmins);
  447.  
  448. local function listweapons()
  449.  
  450. local i = 0;
  451.  
  452. for k, v in pairs(player.GetAll()) do
  453.  
  454. printplayer(v);
  455.  
  456. for _, weapon in pairs(v:GetWeapons()) do
  457.  
  458. if not table.HasValue(weapons.bad, weapon:GetClass()) and not table.HasValue(weapons.good, weapon:GetClass()) then
  459. i = i+1;
  460. chat.AddText(colors.badweapon, " "..weapon:GetClass());
  461. end
  462.  
  463. end
  464.  
  465. end
  466.  
  467. output(i.." weapons total.");
  468.  
  469. end
  470. concommand.Add(".lw", listweapons);
  471.  
  472.  
  473.  
  474. local function search(ply, cmd, args)
  475.  
  476. if !args[1] then return end;
  477.  
  478. term = args[1];
  479.  
  480. local i = 0;
  481.  
  482. for k, v in pairs(player.GetAll()) do
  483.  
  484. if string.match(string.lower(rpname(v)), string.lower(term))
  485. or string.match(string.lower(v:Name()), string.lower(term)) then
  486.  
  487. i = i+1;
  488. printplayer(v);
  489.  
  490. end
  491.  
  492. end
  493.  
  494. output("Found "..i.." matches.");
  495.  
  496. end
  497. concommand.Add(".s", search);
  498.  
  499. local function who(ply, cmd, args)
  500.  
  501. if !args[1] then return end;
  502.  
  503. local name = string.lower(args[1]);
  504. local i = 0;
  505.  
  506. for k, v in pairs(player.GetAll()) do
  507. if string.match(string.lower(rpname(v)), name) or string.match(string.lower(v:Name()), name) then
  508.  
  509. i = i+1;
  510. target = v;
  511.  
  512. end
  513. end
  514.  
  515. if i == 1 then
  516.  
  517. if target:GetNWFloat("RPName") != 0 and LocalPlayer():IsAdmin() then
  518. LocalPlayer():ConCommand("rpa_getinfo \""..rpname(target).."\"");
  519. else
  520.  
  521. printplayer(target);
  522. output(" Health: "..target:Health().." ["..target:Armor().."]");
  523. output(" Model: "..target:GetModel());
  524. output(" Weapons:");
  525. for k, weapon in pairs(target:GetWeapons()) do
  526. if not table.HasValue(weapons.bad, weapon:GetClass()) and not table.HasValue(weapons.good,weapon:GetClass()) then
  527. output(" "..weapon:GetClass());
  528. end
  529. end
  530.  
  531. end
  532.  
  533. else
  534. output("Found "..i.." matches.");
  535. end
  536.  
  537. end
  538. concommand.Add(".who", who);
  539.  
  540. local function cmdall(ply, cmd, args)
  541.  
  542. if !args[1] then return end;
  543.  
  544. local command = args[1];
  545. local arg = args[2];
  546.  
  547. for k, v in pairs(player.GetAll()) do
  548. if v != LocalPlayer() or !v:IsAdmin() then
  549.  
  550. local torun = command.."\""..rpname(v).."\"";
  551.  
  552. if arg then
  553. torun = torun.." "..tostring(arg);
  554. end
  555.  
  556. LocalPlayer():ConCommand(torun);
  557.  
  558. end
  559. end
  560.  
  561. end
  562. concommand.Add(".cmdall", cmdall);
  563.  
  564. local function spotplayer(ply, cmd, args)
  565.  
  566. if !args[1] then return end;
  567.  
  568. local name = string.lower(args[1]);
  569. local i = 0;
  570.  
  571. for k, v in pairs(player.GetAll()) do
  572. if string.match(string.lower(rpname(v)), name) or string.match(string.lower(v:Name()), name) then
  573.  
  574. i = i+1;
  575. spot[v] = true;
  576.  
  577. end
  578. end
  579. output("Highlighting "..i.." matches.");
  580.  
  581. end
  582. concommand.Add(".spot", spotplayer);
  583.  
  584. local function unspot()
  585.  
  586. spot = {};
  587.  
  588. end
  589. concommand.Add(".unspot", unspot);
  590.  
  591. local function createprox(ply, cmd, args)
  592.  
  593. if !args[1] then return end
  594.  
  595. local name = string.lower(args[1])
  596. local radius = tonumber(args[2]) or 512
  597. local pos = ply:GetPos()
  598.  
  599. prox[name] = {pos, radius, {}}
  600.  
  601. end
  602. concommand.Add(".prox", createprox)
  603.  
  604. local function clearprox(ply, cmd, args)
  605.  
  606. if !args[1] then
  607. prox = {}
  608. else
  609. for k, v in pairs(prox) do
  610. if k == args[1] then
  611. prox[k] = nil
  612. end
  613. end
  614. end
  615.  
  616. end
  617. concommand.Add(".proxremove", clearprox)
  618.  
  619. local function listprox()
  620.  
  621. for k, v in pairs(prox) do
  622. MsgN(k)
  623. end
  624.  
  625. end
  626. concommand.Add(".proxlist", listprox)
  627.  
  628. local function proxdetector()
  629.  
  630. for k, v in pairs( prox ) do
  631. local t_ents = player.GetAll()
  632. for _, data in pairs( t_ents ) do
  633. if ( IsValid( data ) && data:GetPos():Distance( v[1] ) <= v[2] && not v[3][data] ) then
  634. v[3][data] = true
  635. AddChat( {1}, "", "Player [" .. data:GetRPName() .. "] is within the radius of proximity [" .. k .. "].", "NewChatFont", Color( 255, 0, 0 ), Color( 255, 0, 0 ) )
  636. MsgN("Player [" .. data:GetRPName() .. "] is within the radius of proximity [" .. k .. "].")
  637. end
  638.  
  639. if ( IsValid( data ) && v[3][data] && not( data:GetPos():Distance( v[1] )<= v[2] ) ) then
  640. v[3][data] = nil
  641. AddChat( {1}, "", "Player [" .. data:GetRPName() .. "] has left proximity [" .. k .. "].", "NewChatFont", Color( 255, 0, 0 ), Color( 255, 0, 0 ) )
  642. MsgN("Player [" .. data:GetRPName() .. "] has left proximity [" .. k .. "].")
  643. end
  644. end
  645. end
  646.  
  647. t_ents = {}
  648.  
  649. end
  650. hook.Add("Think", "proxdetector", proxdetector)
  651.  
  652.  
  653. local adminradius = 200;
  654. local admindetector = true;
  655. /*
  656. local function changeadminradius(ply, cmd, args)
  657.  
  658. if (!args[1]) then
  659. MsgN("Enter a radius, noob!")
  660. AddChat({1}, "", "Enter a radius, noob!", "NewChatFont", Color( 255, 0, 0 ), Color( 255, 0, 0 ))
  661. else
  662. adminradius = args[1];
  663. MsgN("Radius set to: " .. args[1] .. "!")
  664. end
  665. end
  666. concommand.Add(".ar", changeadminradius)
  667. */
  668. local function toggleadmindetector()
  669. if(admindetector) then
  670. MsgN("Admin Detector Off.")
  671. admindetector = false;
  672. else
  673. MsgN("Admin Detector On.")
  674. admindetector = true;
  675. end
  676. end
  677. concommand.Add(".ad", toggleadmindetector)
  678.  
  679. local CloakedAdmins = {}
  680.  
  681. local function AdminDetector()
  682. if( admindetector ) then
  683. local t_players = player.GetAll()
  684.  
  685. for i = 1, #t_players do
  686. local data = t_players[i]
  687. local distance = data:GetPos():Distance( LocalPlayer():GetPos() )
  688. if ( IsValid( data ) ) then
  689. if ( data:GetMoveType() == MOVETYPE_NOCLIP && data != LocalPlayer() && distance <= adminradius ) then
  690. if not ( CloakedAdmins[data] ) then
  691. AddChat( {1}, "", "Admin [" .. data:GetRPName() .. "] is probably watching you!", "NewChatFont", Color( 255, 0, 0 ), Color( 255, 0, 0 ) )
  692. MsgN("Admin [" .. data:GetRPName() .. "] is probably watching you!")
  693. surface.PlaySound("alarm.mp3")
  694. CloakedAdmins[data] = true
  695. end
  696. end
  697.  
  698. if ( distance > adminradius && data != LocalPlayer() ) then
  699. if ( CloakedAdmins[data] ) then
  700. AddChat( {1}, "", "Admin [" .. data:GetRPName() .. "] has left your area.", "NewChatFont", Color( 255, 0, 0 ), Color( 255, 0, 0 ) )
  701. MsgN("Admin [" .. data:GetRPName() .. "] has left your area.")
  702. CloakedAdmins[data] = nil
  703. end
  704. end
  705. end
  706. end
  707. else
  708. CloakedAdmins = {}
  709. end
  710. end
  711.  
  712. hook.Add( "Think", "AdminDetector", AdminDetector )
  713.  
  714. local function help()
  715. output(".ad Toggle the Admin Detector.")
  716. output(".esp Toggle the entire ESP.");
  717. output(".esp_player Toggle player ESP.");
  718. output(".esp_item Toggle item ESP.");
  719. output(".esp_npc Toggle NPC ESP.");
  720. output(".esp_date Toggle time/date on ESP.");
  721. output(".esp_fontsize [0-3] Set the ESP's font size.");
  722. output(".who [name] List information of a certain player.");
  723. output(".s [term] List players with term in their IC/OOC name.");
  724. output(".la List all admins/superadmins in game.");
  725. output(".lp List all players and their IC names.");
  726. output(".lw List all players' weapons.");
  727. output(".maps List all maps on the server.");
  728. output(".spot [name] Highlight player(s) on your ESP.");
  729. output(".unspot Clear all highlighted players.");
  730. output(".proxlist List all current proximities set.");
  731. output(".prox [name] (radius) Creates a proximity point at your position, radius defaults to 512 units.");
  732. output(".proxremove (name) Clears all proximity points, or the one specified.");
  733. output(".cmdall [cmd] [arg] Do a command to everyone but yourself.");
  734.  
  735. end
  736. concommand.Add(".help", help);
  737.  
  738. output("tsat initialized");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement