-- Some popup window stuff ---- Round start local function GetTextForRole(role) if role == ROLE_INNOCENT then return "You are an innocent Terrorist! But there are traitors around...\nWho can you trust, and who is out to fill you with bullets?\n\nWatch your back and work with your comrades to get out of this alive!" elseif role == ROLE_DETECTIVE then return "You are a Detective! Terrorist HQ has given you special resources to find the traitors.\nUse them to help the innocent survive, but be careful: the traitors will be looking to take you down first!\n\nPress ".. Key("+menu_context", "C") .." ('Context Menu') to receive your equipment!" else local traitors = {} for _, ply in pairs(player.GetAll()) do if ply:IsTraitor() then table.insert(traitors, ply) end end local text = "You are a TRAITOR!" if #traitors > 1 then text = text .. " Work with fellow traitors to kill all others to win.\n" local w = string.len(text) text = text .. "But take care, or your treason may be discovered...\n\n" text = text .. "These are your comrades:\n" local spacing = 42 for k, ply in pairs(traitors) do if ply != LocalPlayer() then local nick = ply:Nick() local nw = string.len(nick) text = text .. string.rep(" ", spacing) .. nick .. "\n" end end else text = text .. " You have no fellow traitors this round.\n\nKill all others to win!" end text = text .. "\n\nPress ".. Key("+menu_context", "C") .." ('Context Menu') to receive special equipment!" return text end end local startshowtime = CreateConVar("ttt_startpopup_duration", "17", FCVAR_ARCHIVE) -- shows info about goal and fellow traitors (if any) local function RoundStartPopup() -- based on Derma_Message if startshowtime:GetInt() <= 0 then return end if not LocalPlayer() then return end local dframe = vgui.Create( "Panel" ) dframe:SetDrawOnTop( true ) dframe:SetMouseInputEnabled(false) dframe:SetKeyboardInputEnabled(false) local color = Color(0,0,0, 200) dframe.Paint = function(s) draw.RoundedBox(8, 0, 0, s:GetWide(), s:GetTall(), color) end local text = GetTextForRole(LocalPlayer():GetRole()) local dtext = vgui.Create( "DLabel", dframe ) dtext:SetFont("TabLarge") dtext:SetText(text) dtext:SizeToContents() dtext:SetContentAlignment( 5 ) dtext:SetTextColor( color_white ) local w, h = dtext:GetSize() local m = 10 dtext:SetPos(m,m) dframe:SetSize( w + m*2, h + m*2 ) dframe:Center() dframe:AlignBottom( 10 ) timer.Simple(startshowtime:GetInt(), function() dframe:Remove() end) end concommand.Add("ttt_cl_startpopup", RoundStartPopup) --- Idle message local function IdlePopup() local w, h = 300, 180 local dframe = vgui.Create("DFrame") dframe:SetSize(w, h) dframe:Center() dframe:SetTitle("Idle") dframe:SetVisible(true) dframe:SetMouseInputEnabled(true) local inner = vgui.Create("DPanel", dframe) inner:StretchToParent(5, 25, 5, 45) local idle_limit = GetGlobalInt("ttt_idle_limit", 300) or 300 local text = vgui.Create("DLabel", inner) text:SetWrap(true) text:SetText("You were idle for " .. idle_limit .. " seconds and were moved into Spectator-only mode as a result. While you are in this mode, you will not spawn when a new round starts.\n\nYou can toggle Spectator-only mode at any time by pressing " .. Key("gm_showhelp", "F1") .. " and (un)checking the box in the Settings tab. You can also choose to disable it right now.") text:SetTextColor(COLOR_WHITE) text:StretchToParent(10,5,10,5) local bw, bh = 75, 25 local cancel = vgui.Create("DButton", dframe) cancel:SetPos(10, h - 40) cancel:SetSize(bw, bh) cancel:SetText("Do nothing") cancel.DoClick = function() dframe:Close() end local disable = vgui.Create("DButton", dframe) disable:SetPos(w - 185, h - 40) disable:SetSize(175, bh) disable:SetText("Disable Spectator-only mode now") disable.DoClick = function() RunConsoleCommand("ttt_spectator_mode", "0") dframe:Close() end dframe:MakePopup() end concommand.Add("ttt_cl_idlepopup", IdlePopup)