210 lines
7.0 KiB
Lua
210 lines
7.0 KiB
Lua
function tl_clear()
|
|
local url = "http://25.67.21.137:8081/clear"
|
|
http.Fetch(url,
|
|
function(body, size, headers, code)
|
|
print("Cleared Lists")
|
|
end,
|
|
function(error)
|
|
print("Request failed:", error)
|
|
end
|
|
)
|
|
end
|
|
|
|
function tl_set(player, to)
|
|
local url = "http://25.67.21.137:8081/move"
|
|
local playerName = player:Name()
|
|
local queryString = "?name=" .. string.Replace(playerName, " ", "/") .. "&to=" .. to
|
|
http.Fetch(url .. queryString,
|
|
function(body, size, headers, code)
|
|
print("Request successful!")
|
|
end,
|
|
function(error)
|
|
print("Request failed:", error)
|
|
end
|
|
)
|
|
end
|
|
|
|
|
|
local radar_draw = false -- TTT radar enable
|
|
local radar_entities = {}
|
|
local cleared = false
|
|
|
|
local function geopos( ent )
|
|
local min, max = ent:OBBMins(), ent:OBBMaxs()
|
|
local corners = {
|
|
Vector( min.x, min.y, min.z ),
|
|
Vector( min.x, min.y, max.z ),
|
|
Vector( min.x, max.y, min.z ),
|
|
Vector( min.x, max.y, max.z ),
|
|
Vector( max.x, min.y, min.z ),
|
|
Vector( max.x, min.y, max.z ),
|
|
Vector( max.x, max.y, min.z ),
|
|
Vector( max.x, max.y, max.z )
|
|
}
|
|
|
|
local minX, minY, maxX, maxY = ScrW() * 2, ScrH() * 2, 0, 0
|
|
for _, corner in pairs( corners ) do
|
|
local onScreen = ent:LocalToWorld( corner ):ToScreen()
|
|
minX, minY = math.min( minX, onScreen.x ), math.min( minY, onScreen.y )
|
|
maxX, maxY = math.max( maxX, onScreen.x ), math.max( maxY, onScreen.y )
|
|
end
|
|
|
|
return minX, minY, maxX, maxY
|
|
end
|
|
|
|
-- radar func
|
|
surface.CreateFont( "SteakFont", {
|
|
font = "MV Boli", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
|
|
extended = false,
|
|
size = 12,
|
|
weight = 500,
|
|
blursize = 0,
|
|
scanlines = 0,
|
|
antialias = true,
|
|
underline = false,
|
|
italic = false,
|
|
strikeout = false,
|
|
symbol = false,
|
|
rotary = false,
|
|
shadow = false,
|
|
additive = false,
|
|
outline = false,
|
|
} )
|
|
|
|
|
|
function GS_radar_off()
|
|
radar_draw = false
|
|
end
|
|
concommand.Add("gs_tf_r0", GS_radar_off)
|
|
|
|
function GS_radar_on()
|
|
radar_draw = true
|
|
end
|
|
concommand.Add("gs_tf_r1", GS_radar_on)
|
|
|
|
|
|
--tl_clear()
|
|
|
|
hook.Add("TTTBeginRound", "ttt_map_intro", function()
|
|
-- On start, add each player to the innocent list
|
|
for _, ply in ipairs(player.GetAll()) do
|
|
-- Do something with each player here
|
|
--print(ply:Nick() .. " joined the round!")
|
|
tl_set(ply, "lb_inno")
|
|
end
|
|
end)
|
|
|
|
-- SteakRadar
|
|
hook.Add("HUDPaint", "gm_think_player", function()
|
|
if radar_draw then
|
|
for _,v in pairs(radar_entities) do
|
|
if IsValid(v) then
|
|
if v != LocalPlayer() and v:Alive() then
|
|
|
|
|
|
local x1,y1,x2,y2 = geopos(v)
|
|
local pColor = color_white
|
|
|
|
if v:IsDetective() then
|
|
pColor = Color( 0, 0, 255, 255 )
|
|
elseif v.HatTraitor then
|
|
pColor = Color( 255, 0, 0, 255 )
|
|
end
|
|
|
|
surface.SetTextColor( pColor )
|
|
surface.SetDrawColor(pColor)
|
|
surface.SetFont( "SteakFont" )
|
|
|
|
|
|
surface.DrawLine( x1, y1, math.min( x1 + 5, x2 ), y1 )
|
|
surface.DrawLine( x1, y1, x1, math.min( y1 + 5, y2 ) )
|
|
|
|
|
|
surface.DrawLine( x2, y1, math.max( x2 - 5, x1 ), y1 )
|
|
surface.DrawLine( x2, y1, x2, math.min( y1 + 5, y2 ) )
|
|
|
|
|
|
surface.DrawLine( x1, y2, math.min( x1 + 5, x2 ), y2 )
|
|
surface.DrawLine( x1, y2, x1, math.max( y2 - 5, y1 ) )
|
|
|
|
|
|
surface.DrawLine( x2, y2, math.max( x2 - 5, x1 ), y2 )
|
|
surface.DrawLine( x2, y2, x2, math.max( y2 - 5, y1 ) )
|
|
|
|
if LocalPlayer():Alive() then
|
|
-- Name
|
|
surface.SetTextPos( x1 + 5, y1 )
|
|
surface.DrawText(v:Name())
|
|
|
|
-- Health
|
|
surface.SetTextPos( x2 - 5, y2 )
|
|
surface.DrawText(v:Health())
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- SteakScan, a independent T-Test
|
|
hook.Add("PostDrawOpaqueRenderables", "wire_animations_idle", function()
|
|
-- Don't do anything. Clear any entity state and send a clear command to the GUI.
|
|
if GAMEMODE.round_state != ROUND_ACTIVE then
|
|
for _,v in pairs(player.GetAll()) do
|
|
-- Hat doesn't really mean anything in this context, just hides the obvious meaning.
|
|
v.HatTraitor = nil
|
|
v.HatDead = nil
|
|
v.HatInno = nil
|
|
if !cleared then
|
|
cleared = true
|
|
tl_clear()
|
|
end
|
|
end
|
|
return
|
|
end
|
|
cleared = false
|
|
for _,v in pairs( ents.GetAll() ) do
|
|
if v and IsValid(v) then
|
|
-- Terror check
|
|
if table.HasValue(v.CanBuy, 1) then
|
|
local pl = v.Owner
|
|
if pl and IsValid(pl) and pl:IsTerror() and not pl.HatTraitor then
|
|
if not pl:IsDetective() then
|
|
if not pl.HatTraitor then
|
|
-- This is a player with a traitor weapon, which is unlikely a false-positive.
|
|
-- Many servers have a scoreboard plugin that we can exploit to show a traitor in-game
|
|
pl.sb_tag = {txt = "sb_tag_kill", color = Color(255, 0, 0, 255)}
|
|
-- Add an attribute to prevent running actions on the player again.
|
|
pl.HatTraitor = true
|
|
chat.AddText( pl, Color(255,125,0), " is a ",Color(255,0,0), "TRAITOR",Color(255,125,0), " with a ",Color(255,0,0),v:GetClass().."!")
|
|
tl_set(pl, "lb_traitor")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-- Dead check and radar
|
|
if v:IsPlayer() then
|
|
if !v:Alive() and !v.HatDead then
|
|
v.HatDead = true
|
|
tl_set(v, "lb_dead")
|
|
else
|
|
-- ESP them
|
|
-- prerequisite check
|
|
if radar_draw then
|
|
-- This is a crude pass-through to HUDPaint to allow us to get all the players without having access to player getall
|
|
-- Check if the entity already exists in the table
|
|
if radar_entities[v:Name()] then
|
|
-- Update the entity in the table
|
|
--print("UPD: ".. v:Name())
|
|
radar_entities[v:Name()] = v
|
|
else
|
|
-- Add the entity to the table
|
|
--print("ADD: ".. v:Name())
|
|
radar_entities[v:Name()] = v
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end) |