Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cols = {
- [0] = Color(0,0,0,0);
- [1] = Color(0,0,0,0);
- [2] = Color(255,0,0,255);
- [3] = Color(0,0,255,255);
- };
- local w = ScrW();
- local h = ScrH();
- local function GetCorners(origin, mins, maxs)
- local minx, maxx, miny, maxy = w + 1, -1, h + 1, -1;
- local vecadd = Vector();
- for i = 1, 8 do
- if(i % 2 < 1) then
- vecadd.x = mins.x;
- else
- vecadd.x = maxs.x;
- end
- if(i % 4 < 2) then
- vecadd.y = mins.y;
- else
- vecadd.y = maxs.y;
- end
- if(i % 8 < 4) then
- vecadd.z = mins.z;
- else
- vecadd.z = maxs.z;
- end
- local pos = (origin + vecadd):ToScreen();
- pos.x = math.max(math.min(pos.x, w + 1), -1)
- pos.y = math.max(math.min(pos.y, h + 1), -1)
- if(pos.x < minx) then
- minx = pos.x;
- end
- if(pos.x > maxx) then
- maxx = pos.x;
- end
- if(pos.y < miny) then
- miny = pos.y;
- end
- if(pos.y > maxy) then
- maxy = pos.y;
- end
- end
- return minx, miny,maxx,maxy;
- end
- hook.Add("DrawOverlay", "x", function()
- for k,v in pairs(player.GetAll()) do
- if(not v:IsDormant()) then
- local pos = v:GetVar("m_vecOrigin") or SHIT_VECTOR;
- local minx, miny, maxx, maxy = GetCorners(pos, v:OBBMins(), v:OBBMaxs());
- local col = cols[v:GetVar("m_iTeamNum")] or cols[0];
- surface.SetDrawColor(col.r, col.g, col.b, col.a);
- surface.DrawOutlinedRect(minx, miny, maxx, maxy);
- end
- end
- end);
Advertisement
Add Comment
Please, Sign In to add comment