Soooo I need help with my map vote for TTT.
Here is my first attempt:
init.lua:
util.AddNetworkString("mv_start")
hook.Add("TTTEndRound", "Checkforroundend", function()
net.Start("mv_start")
net.Broadcast()
print("Hook checked and sended!")
end)
cl_init.lua:
net.Receive("mv_start", function()
local mv_frame = vgui.Create("DFrame")
mv_frame:SetSize(ScrW(), ScrH())
mv_frame:Center()
mv_frame:SetVisible(true)
mv_frame:MakePopup()
mv_frame:SetDraggable(false)
mv_frame:SetSizable(false)
mv_frame.Paint = function(s, w, h)
draw.RoudedBox(0, 0, 0, w, h, Color(5, 5, 5, 240))
end
print("Frame created and received!")
end)
And here is my second attempt:
init.lua:
util.AddNetworkString("mv_start")
hook.Add( "Initialize", "AutoTTTMapVote", function()
print("Hook checked and sended!")
if GAMEMODE_NAME == "terrortown" then
function CheckForMapSwitch()
-- Check for mapswitch
local rounds_left = math.max(0, GetGlobalInt("ttt_rounds_left", 3) - 1)
SetGlobalInt("ttt_rounds_left", rounds_left)
local time_left = math.max(0, (GetConVar("ttt_time_limit_minutes"):GetInt() * 60) - CurTime())
local switchmap = false
local nextmap = string.upper(game.GetMapNext())
if rounds_left <= 0 then
LANG.Msg("limit_round", {mapname = nextmap})
switchmap = true
elseif time_left <= 0 then
LANG.Msg("limit_time", {mapname = nextmap})
switchmap = true
end
if switchmap then
timer.Stop("end2prep")
net.Start("mv_start")
net.Broadcast()
end
end
end
end)
cl_init.lua is the same as in the first attempt
So the prints just doesn’t work… and derma doesn’t open.
Both attempts were failed.
Thanks