From f5a50af87f59725366aef23a9ce7acc35db9a1bc Mon Sep 17 00:00:00 2001 From: edshot99 Date: Fri, 29 Nov 2024 01:57:34 -0600 Subject: [PATCH] allow solo players to be able to change the map moved from edshot99/ulx repository --- solo_votemap/lua/autorun/server/svotemap.lua | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 solo_votemap/lua/autorun/server/svotemap.lua diff --git a/solo_votemap/lua/autorun/server/svotemap.lua b/solo_votemap/lua/autorun/server/svotemap.lua new file mode 100644 index 0000000..bdfa58a --- /dev/null +++ b/solo_votemap/lua/autorun/server/svotemap.lua @@ -0,0 +1,26 @@ + +local function svotemap() + local votemap = GetConVar("ulx_votemapminvotes") + local votemap2 = GetConVar("ulx_votemap2minvotes") + + if ((votemap ~= nil) and (votemap2 ~= nil)) then + local plys = player.GetHumans() + + if #plys == 2 or #plys == 3 then + votemap:SetInt(2) + votemap2:SetInt(2) + elseif #plys <= 1 then + votemap:SetInt(1) + votemap2:SetInt(1) + else + votemap:SetInt(3) + votemap2:SetInt(3) + end + end +end + +gameevent.Listen("player_connect") +gameevent.Listen("player_disconnect") + +hook.Add("player_connect", "edshot_svotemap_connect", function() svotemap() end) +hook.Add("player_disconnect", "edshot_svotemap_disconnect", function() svotemap() end)