Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.90 KB | None | 0 0
  1. -- 092009
  2.  
  3. local esp = true;
  4.  
  5. surface.CreateFont("Verdana", 10, 400, true, false, "espfont");
  6. surface.CreateFont("Courier New", 10, 400, true, false, "statusf");
  7.  
  8. local weapon_good = {};
  9. weapon_good["weapon_physgun"] = true;
  10. weapon_good["gmod_tool"] = true;
  11.  
  12. local weapon_dumb = {};
  13. weapon_dumb["hands"] = true;
  14. weapon_dumb["ts_hands"] = true;
  15. weapon_dumb["ts2_hands"] = true;
  16. weapon_dumb["ts_keys"] = true;
  17. weapon_dumb["ts2_keys"] = true;
  18. weapon_dumb["ts_medic"] = true;
  19. weapon_dumb["ks_hands"] = true;
  20. weapon_dumb["ks_keys"] = true;
  21. weapon_dumb["weapon_physcannon"] = true;
  22. weapon_dumb["weapon_ts_case"] = true;
  23.  
  24. local noshow = {};
  25. local spot = {};
  26.  
  27. local function setesp(ply, cmd, args)
  28.     if esp then
  29.         esp = false;
  30.     else
  31.         esp = true;
  32.     end
  33. end
  34. concommand.Add(".esp", setesp);
  35.  
  36. local function status(ply)
  37.     out = "";
  38.     if ply:IsSuperAdmin() then
  39.         out = out.."S";
  40.     else
  41.         out = out.." ";
  42.     end
  43.     if ply:IsAdmin() then
  44.         out = out.."A";
  45.     else
  46.         out = out.." ";
  47.     end
  48.     if ply:GetFriendStatus() == "friend" then
  49.         out = out.."F  ";
  50.     elseif ply == LocalPlayer() then
  51.         out = out.."-- ";
  52.     else
  53.         out = out.."   ";
  54.     end
  55.     return out;
  56. end
  57.  
  58. local function listplayers(ply, cmd, args)
  59.     local i = 0;
  60.     for _, v in ipairs(player.GetAll()) do
  61.         i = i + 1;
  62.         Msg(status(v)..v:Name().."  ");print(v:Nick());
  63.     end
  64.     print(i.." players total.");
  65. end
  66. concommand.Add(".lp", listplayers);
  67.  
  68. local function listadmins(ply, cmd, args)
  69.     local i = 0;
  70.     for _, v in ipairs(player.GetAll()) do
  71.         if v:IsAdmin() then
  72.             i = i + 1;
  73.             Msg(status(v)..v:Name().."  ");print(v:Nick());
  74.         end
  75.     end
  76.     print(i.." admins total.");
  77. end
  78. concommand.Add(".la", listadmins);
  79.  
  80. local function listweapons(ply, cmd, args)
  81.     for _, v in ipairs(player.GetAll()) do
  82.         for __, weapon in ipairs(v:GetWeapons()) do
  83.             if weapon_dumb[weapon:GetClass()] or weapon_good[weapon:GetClass()] then
  84.             else
  85.                 Msg(status(v)..v:Nick().."  ");print(weapon:GetClass());
  86.             end
  87.         end
  88.     end
  89. end
  90. concommand.Add(".lw", listweapons);
  91.  
  92. local function listmoney(ply, cmd, args)
  93.     for _, v in ipairs(player.GetAll()) do
  94.         Msg(status(v)..tostring(v:GetNWFloat("money")).."  ");print(v:Nick());
  95.     end
  96. end
  97. concommand.Add(".lm", listmoney);
  98.  
  99. local function search(ply, cmd, args)
  100.     if !args then return; end
  101.     local i = 0;
  102.     for _, v in ipairs(player.GetAll()) do
  103.         if string.match(v:Nick(), args[1]) or
  104.            string.match(v:Name(), args[1]) or
  105.            string.match(v:GetNWFloat("title"), args[1]) or
  106.            string.match(v:GetNWFloat("title2"), args[1]) or
  107.            string.match(v:GetModel(), args[1]) then
  108.             i = i+1;
  109.             Msg(status(v)..v:Name().."  ");print(v:Nick());
  110.             if string.match(v:Name(), args[1]) then
  111.                 Msg("           OOC: ");print(v:Name());
  112.             end
  113.             if string.match(v:Nick(), args[1]) then
  114.                 Msg("            IC: ");print(v:Nick());
  115.             end
  116.             if string.match(v:GetNWFloat("title"), args[1]) then
  117.                 Msg("         Title: ");print(v:GetNWFloat("title"));
  118.             end
  119.             if string.match(v:GetNWFloat("title2"), args[1]) then
  120.                 Msg("        Title2: ");print(v:GetNWFloat("title2"));
  121.             end
  122.             if string.match(v:GetModel(), args[1]) then
  123.                 Msg("         Model: ");print(v:GetModel());
  124.             end
  125.         end
  126.     end
  127.     print("Found "..i.." matches.");
  128. end
  129. concommand.Add(".s", search);
  130.  
  131. local function who(ply, cmd, args)
  132.     local i = 0;
  133.     for _, v in ipairs(player.GetAll()) do
  134.         if string.match(v:Nick(), args[1]) or string.match(v:Name(), args[1]) then
  135.             i = i+1;
  136.             if i == 1 then
  137.                 LocalPlayer():ConCommand("rp_whohaschar \""..v:Nick().."\"");
  138.                 Msg(status(v));print(v:Nick());
  139.                 print("     "..v:Name());
  140.                 print("");
  141.                 Msg("     Title1: ");print(v:GetNWFloat("title"));
  142.                 Msg("     Title2: ");print(v:GetNWFloat("title2"));
  143.                 print("");
  144.                 Msg("     Tokens: ");print(tostring(v:GetNWFloat("money")));
  145.                 Msg("     Health: ");print(tostring(v:Health().." ["..v:Armor().."]"));
  146.                 print("");
  147.                 Msg("      Model: ");print(v:GetModel());
  148.                 print("");
  149.                 Msg("   Strength: ");print(math.Round(v:GetNWFloat("stat.Strength")));
  150.                 Msg("  Endurance: ");print(math.Round(v:GetNWFloat("stat.Endurance")));
  151.                 Msg("      Speed: ");print(math.Round(v:GetNWFloat("stat.Speed")));
  152.                 Msg("     Sprint: ");print(math.Round(v:GetNWFloat("stat.Sprint")));
  153.                 Msg("        Aim: ");print(math.Round(v:GetNWFloat("stat.Aim")));
  154.                 print("");
  155.                 Msg("    Weapons:\n");
  156.                 for _, weapon in ipairs(v:GetWeapons()) do
  157.                     if !weapon_dumb[weapon:GetClass()] then
  158.                         print("      "..weapon:GetClass());
  159.                     end
  160.                 end
  161.                 print("");
  162.             end
  163.         end
  164.     end
  165.     if i != 1 then
  166.         print("Found "..i.." matches.");
  167.     end
  168. end
  169. concommand.Add(".who", who);
  170.  
  171. local function cmdall(ply, cmd, args)
  172.     for _, v in ipairs(player.GetAll()) do
  173.         if v != LocalPlayer() then
  174.             if string.match(v:Nick(), ".") then
  175.                 LocalPlayer():ConCommand(args[1].."\""..string.Right(v:Nick(), 5).."\" "..tostring(args[2]));
  176.             else
  177.                 LocalPlayer():ConCommand(args[1].."\""..v:Nick().."\" "..tostring(args[2]));
  178.             end
  179.         end
  180.     end
  181. end
  182. concommand.Add(".cmdall", cmdall);
  183.  
  184. local function selfbring(ply, cmd, args)
  185.     if string.match(LocalPlayer():Nick(), ".") then
  186.         LocalPlayer():ConCommand("rp_bring \""  ..string.Right(LocalPlayer():Nick(), 5).. "\"");
  187.     else
  188.         LocalPlayer():ConCommand("rp_bring \""  ..LocalPlayer():Nick().. "\"");
  189.     end
  190. end
  191. concommand.Add(".selfbring", selfbring);
  192.  
  193. local function selfclip(ply, cmd, args)
  194.     if LocalPlayer():IsAdmin() then
  195.         LocalPlayer():ConCommand("rp_cloak");
  196.     end
  197.     if LocalPlayer():IsSuperAdmin() then
  198.         LocalPlayer():ConCommand("rp_noclip");
  199.     end
  200.     LocalPlayer():ConCommand("noclip");
  201. end
  202. concommand.Add(".selfclip", selfclip);
  203.  
  204. local function spotplayer(ply, cmd, args)
  205.     local i = 0;
  206.     for _, v in ipairs(player.GetAll()) do
  207.         if string.match(v:Nick(), args[1]) or string.match(v:Name(), args[1]) then
  208.             i = i+1;
  209.             spot[v] = true;
  210.         end
  211.     end
  212.     print("Highlighting "..i.." matches.");
  213. end
  214. concommand.Add(".spot", spotplayer);
  215.  
  216. local function unspot(ply, cmd, args)
  217.     spot = {};
  218. end
  219. concommand.Add(".unspot", unspot);
  220.  
  221. local function help(ply, cmd, args)
  222.     Msg("       .esp  ");print("Enable/disable weapon/item/player esp.");
  223.     Msg(".who ooc/ic  ");print("List information on a certain player.");
  224.     Msg("     .s str  ");print("List players with that in their info.");
  225.     Msg("        .la  ");print("List all admins/superadmins in game.");
  226.     Msg("        .lm  ");print("List all players' money.");
  227.     Msg("        .lp  ");print("List all players and their IC names.");
  228.     Msg("        .lw  ");print("List all players' weapons.");
  229.     Msg("      .spot  ");print("Highlight player(s) on your ESP.");
  230.     Msg("    .unspot  ");print("Clear all highlights.");
  231.     Msg(" .selfbring  ");print("Bring yourself.");
  232.     Msg("  .selfclip  ");print("Cloak/noclip yourself.");
  233.     Msg(".cmdall cmd  ");print("Do a command to everyone but yourself.");
  234. end
  235. concommand.Add(".help", help);
  236.  
  237. local function trace_aim(length)
  238.     local trace = {};
  239.     trace.start = LocalPlayer():EyePos();
  240.     trace.endpos = trace.start + LocalPlayer():GetAimVector()*length;
  241.     trace.filter = LocalPlayer();
  242.     return util.TraceLine(trace);
  243. end
  244.  
  245. local function hookdraw()
  246.     if esp then
  247.         surface.SetFont("espfont");
  248.         local tr = trace_aim(2000);
  249.         local base = 0;
  250.         local diff = 1;
  251.         if tr.HitNonWorld then
  252.             if tr.Entity:IsPlayer() then
  253.                 base = tr.Entity:EyePos():ToScreen();
  254.                 if spot[tr.Entity] then
  255.                     draw.RoundedBox(0,base.x-2,base.y-10,150,20,Color(255,0,255,100));
  256.                 end
  257.                 local teamcolor = team.GetColor(tr.Entity:Team());
  258.                 surface.SetTextColor(math.Clamp(teamcolor.r+150, 0, 255), math.Clamp(teamcolor.g +150, 0, 255), math.Clamp(teamcolor.b +150, 0, 255), 255);
  259.                 if tr.Entity:Nick() != tr.Entity:Name() then
  260.                     surface.SetTextPos(base.x, base.y-10);
  261.                     surface.DrawText(tr.Entity:Nick());
  262.                     surface.SetTextColor(255, 255, 255, 255);
  263.                 end
  264.                 surface.SetTextPos(base.x, base.y);
  265.                 surface.DrawText(tr.Entity:Name());
  266.                 surface.SetTextColor(255, 255, 255, 255);
  267.                 surface.SetFont("statusf");
  268.                 surface.SetTextPos(base.x-20, base.y+2);
  269.                 surface.DrawText(status(tr.Entity));
  270.                 surface.SetFont("espfont");
  271.                 surface.SetTextPos(base.x+40, base.y+10);
  272.                 surface.DrawText(math.Round(tr.Entity:EyePos():Distance(LocalPlayer():EyePos())/39.37).."m");
  273.                 surface.SetTextPos(base.x+40, base.y+20);
  274.                 surface.DrawText(tr.Entity:Health().." ["..tr.Entity:Armor().."]");
  275.                 surface.SetTextPos(base.x+40, base.y+30);
  276.                 surface.DrawText("$"..tr.Entity:GetNWFloat("money"));
  277.                 surface.SetTextPos(base.x+15, base.y+10);
  278.                 surface.DrawText(math.floor(tr.Entity:GetNWFloat("stat.Strength")));
  279.                 surface.SetTextPos(base.x+15, base.y+20);
  280.                 surface.DrawText(math.floor(tr.Entity:GetNWFloat("stat.Endurance")));
  281.                 surface.SetTextPos(base.x+15, base.y+30);
  282.                 surface.DrawText(math.floor(tr.Entity:GetNWFloat("stat.Speed")));
  283.                 surface.SetTextPos(base.x+15, base.y+40);
  284.                 surface.DrawText(math.floor(tr.Entity:GetNWFloat("stat.Sprint")));
  285.                 surface.SetTextPos(base.x+15, base.y+50);
  286.                 surface.DrawText(math.floor(tr.Entity:GetNWFloat("stat.Aim")));
  287.                 for _, v in ipairs(tr.Entity:GetWeapons()) do
  288.                     local wepc = v:GetClass();
  289.                     if weapon_good[wepc] then
  290.                         surface.SetTextColor(148, 255, 148, 255);
  291.                         surface.SetTextPos(base.x+100, base.y+(diff*10));
  292.                         surface.DrawText(v:GetClass());
  293.                         diff = diff + 1;
  294.                     elseif weapon_dumb[wepc] then
  295.                     else
  296.                         surface.SetTextColor(255, 148, 148, 255);
  297.                         surface.SetTextPos(base.x+100, base.y+(diff*10));
  298.                         surface.DrawText(wepc);
  299.                         diff = diff + 1;
  300.                     end
  301.                 end
  302.                 tr = tr.Entity;
  303.             end
  304.         else
  305.             tr = LocalPlayer();
  306.         end
  307.         for _, v in ipairs(player.GetAll()) do
  308.             if v == LocalPlayer() then
  309.                 for __, selfweapons in ipairs(v:GetWeapons()) do
  310.                     noshow[selfweapons] = true;
  311.                 end
  312.             elseif v != LocalPlayer() and v != tr then
  313.                 base = v:EyePos():ToScreen();
  314.                 local teamcol = team.GetColor(v:Team());
  315.                 surface.SetTextColor(math.Clamp(teamcol.r+160 , 0 , 255), math.Clamp(teamcol.g+160 , 0 , 255), math.Clamp(teamcol.b+160, 0 , 255), 255);
  316.                 if spot[v] then
  317.                     draw.RoundedBox(0,base.x-2,base.y-10,150,20,Color(255,0,255,100));
  318.                 end
  319.                 surface.SetTextPos(base.x, base.y-10);
  320.                 if v:Nick() != v:Name() then
  321.                     surface.DrawText(v:Nick());
  322.                     surface.SetTextColor(255, 255, 255, 255);
  323.                 end
  324.                 surface.SetTextPos(base.x, base.y);
  325.                 surface.DrawText(v:Name());
  326.                 surface.SetTextColor(255, 255, 255, 255);
  327.                 surface.SetFont("statusf");
  328.                 surface.SetTextPos(base.x-20, base.y+2);
  329.                 surface.DrawText(status(v));
  330.                 surface.SetFont("espfont");
  331.                 surface.SetTextPos(base.x+40, base.y+10);
  332.                 surface.DrawText(tostring(math.Round(v:EyePos():Distance(LocalPlayer():EyePos())/39.37)).."m");
  333.                 for __, playerweapons in ipairs(v:GetWeapons()) do
  334.                     noshow[playerweapons] = true;
  335.                 end
  336.             end
  337.         end
  338.         for _, v in ipairs(ents.GetAll()) do
  339.             if v:IsWeapon() and !noshow[v] then
  340.                 local base = v:GetPos():ToScreen();
  341.                 surface.SetTextColor(255, 148, 148, 255);
  342.                 surface.SetTextPos(base.x, base.y);
  343.                 surface.DrawText(v:GetClass());
  344.                 surface.SetTextPos(base.x+40, base.y+10);
  345.                 surface.DrawText(tostring(math.Round(v:GetPos():Distance(LocalPlayer():EyePos())/39.37)).."m");
  346.             end
  347.             if string.sub(v:GetClass(), 1, 4) == "item" then
  348.                 local base = v:GetPos():ToScreen();
  349.                 surface.SetTextColor(148, 148, 255, 255);
  350.                 surface.SetTextPos(base.x, base.y);
  351.                 surface.DrawText(v:GetModel());
  352.                 surface.SetTextPos(base.x+40, base.y+10);
  353.                 surface.DrawText(tostring(math.Round(v:GetPos():Distance(LocalPlayer():EyePos())/39.37)).."m");
  354.             end
  355.         end
  356.     end
  357. end
  358. hook.Add("HUDPaint", hookdraw, hookdraw);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement