allow solo players to change the map

This commit is contained in:
edshot99 2024-02-09 21:07:30 -06:00
parent 63a773bdc1
commit 6dbdd73dc6

View File

@ -0,0 +1,36 @@
local votemap = GetConVar("ulx_votemapminvotes")
local votemap2 = GetConVar("ulx_votemap2minvotes")
local function svotemap()
local plys = player.GetHumans()
if ((votemap == nil) || (votemap2 == nil)) then
return
end
if #plys == 2 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
local function HPlayerConnect(bot, networkid, name, index, address)
svotemap()
end
local function HPlayerDisconnect(bot, networkid, name, userid, reason)
svotemap()
end
gameevent.Listen("player_connect")
gameevent.Listen("player_disconnect")
hook.Add("player_connect", "Hook_PlayerConnect", HPlayerConnect)
hook.Add("player_disconnect", "Hook_PlayerDisconnect", HPlayerDisconnect)