-- Traitor radar functionality -- should mirror client local chargetime = 30 local function RadarScan(ply, cmd, args) if IsValid(ply) and ply:IsTerror() then if ply:HasEquipmentItem(EQUIP_RADAR) then if ply.radar_charge > CurTime() then ply:ChatPrint("Your radar is still charging!") return end ply.radar_charge = CurTime() + chargetime local targets = {} for k, p in pairs(player.GetAll()) do if ply != p and ValidEntity(p) and p:IsTerror() and ((not p:GetNWBool("disguised", false)) or ply:IsTraitor())then local pos = p:LocalToWorld(p:OBBCenter()) -- Round off, easier to send and inaccuracy does not matter pos.x = math.Round(pos.x) pos.y = math.Round(pos.y) pos.z = math.Round(pos.z) table.insert(targets, {idx=p:EntIndex(), pos=pos}) end end umsg.Start("radar", ply) umsg.Char(#targets) for k, tgt in pairs(targets) do umsg.Short(tgt.idx) umsg.Short(tgt.pos.x) umsg.Short(tgt.pos.y) umsg.Short(tgt.pos.z) end umsg.End() else ply:ChatPrint("You do not have a radar!") end end end concommand.Add("ttt_radar_scan", RadarScan)