Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions lua/mapvote/cl_mapvote.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function PANEL:Init()
end

self.closeButton.DoClick = function()
print("HI")
chat.AddText("To re-open the map vote, type !openmapvote")
self:SetVisible(false)
end

Expand Down Expand Up @@ -310,8 +310,12 @@ function PANEL:Paint()
surface.DrawRect(0, 0, ScrW(), ScrH())
end

function PANEL:Flash(id)
function PANEL:Show()
self:SetVisible(true)
end

function PANEL:Flash(id)
self:Show()

local bar = self:GetMapButton(id)

Expand All @@ -326,3 +330,13 @@ function PANEL:Flash(id)
end

derma.DefineControl("RAM_VoteScreen", "", PANEL, "DPanel")


net.Receive("RAM_MapVoteOpenUI", function()
if(IsValid(MapVote.Panel) == false) then
chat.AddText("You can only use this command when a mapvote in progress.")
return
end

MapVote.Panel:Show()
end)
10 changes: 10 additions & 0 deletions lua/mapvote/sv_mapvote.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
util.AddNetworkString("RAM_MapVoteStart")
util.AddNetworkString("RAM_MapVoteUpdate")
util.AddNetworkString("RAM_MapVoteCancel")
util.AddNetworkString("RAM_MapVoteOpenUI")
util.AddNetworkString("RTV_Delay")

MapVote.Continued = false
Expand Down Expand Up @@ -210,3 +211,12 @@ function MapVote.Cancel()
timer.Destroy("RAM_MapVote")
end
end


hook.Remove("PlayerSay", "mapvote_playersay")
hook.Add("PlayerSay", "mapvote_playersay", function(ply, text)
if(string.lower(text) != "!openmapvote") then return end

net.Start("RAM_MapVoteOpenUI")
net.Send(ply)
end)