Skip to content

Commit 2c31b51

Browse files
authored
Make recent maps use a function instead of halting hook (#60)
1 parent a605d89 commit 2c31b51

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lua/mapvote/server/modules/map_vote.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ function MapVote.isMapAllowed( m )
44
local hookResult = hook.Run( "MapVote_IsMapAllowed", m )
55
if hookResult ~= nil then return hookResult end
66

7+
if MapVote.wasMapRecentlyPlayed( m ) then return false end -- dont allow recently played maps in vote
78
if not conf.AllowCurrentMap and m == game.GetMap():lower() then return false end -- dont allow current map in vote
89

910
if conf.MapConfig and conf.MapConfig[m] then

lua/mapvote/server/modules/recent_maps.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
hook.Add( "MapVote_IsMapAllowed", "MapVote_CheckRecentMaps", function( map )
1+
function MapVote.wasMapRecentlyPlayed( map )
22
local conf = MapVote.GetConfig()
33

44
if MapVote.config.EnableCooldown ~= true then return end
@@ -10,8 +10,8 @@ hook.Add( "MapVote_IsMapAllowed", "MapVote_CheckRecentMaps", function( map )
1010
end
1111
end
1212

13-
if MapVote.recentMaps[map] then return false end
14-
end )
13+
if MapVote.recentMaps[map] then return true end
14+
end
1515

1616
hook.Add( "Initialize", "MapVote_UpdateDB", function()
1717
MapVote.DB.MapPlayed( game.GetMap() )

0 commit comments

Comments
 (0)