• Simple Map Voting Addon
    235 replies, posted
[QUOTE=DooBiiE;40562794]is there anyway to like initiate this like an !rtv command?[/QUOTE] I've made this for my own admin mod (although if I release the command code you won't be able to use it), what admin mod are you using?
[QUOTE=Willox;40562814]I've made this for my own admin mod (although if I release the command code you won't be able to use it), what admin mod are you using?[/QUOTE] just using ulx oh and when it was going to load i got this error [code] [ERROR] gamemodes/terrortown/gamemode/cl_scoring.lua:274: attempt to perform arithmetic on field 'StartTime' (a nil value) 1. BuildHilitePanel - gamemodes/terrortown/gamemode/cl_scoring.lua:274 2. ShowPanel - gamemodes/terrortown/gamemode/cl_scoring.lua:396 3. ReportEvents - gamemodes/terrortown/gamemode/cl_scoring.lua:520 4. func - gamemodes/terrortown/gamemode/cl_scoring.lua:548 5. unknown - lua/includes/modules/net.lua:31 [/code]
[QUOTE=DooBiiE;40562848]just using ulx oh and when it was going to load i got this error [code] [ERROR] gamemodes/terrortown/gamemode/cl_scoring.lua:274: attempt to perform arithmetic on field 'StartTime' (a nil value) 1. BuildHilitePanel - gamemodes/terrortown/gamemode/cl_scoring.lua:274 2. ShowPanel - gamemodes/terrortown/gamemode/cl_scoring.lua:396 3. ReportEvents - gamemodes/terrortown/gamemode/cl_scoring.lua:520 4. func - gamemodes/terrortown/gamemode/cl_scoring.lua:548 5. unknown - lua/includes/modules/net.lua:31 [/code][/QUOTE] That doesn't appear related to my code
yea must have just been a glitch got it working now :), i must have done something wrong with annother addon, love this voting pannel much more than my old one, thanks for letting us use it :D
That error typically happens when you break the gamemode's init file or editing live. For unlucky people it means it's trying to read as a different gamemode while still using ttt resulting in an evil basegamemode. If your lucky you only need to change the map.
I cannibalized the rock the vote addon on garrysmod.org to work with this. Just extract the link below into your addons folder. Just edit the variables at the top of the lua/rtv/rtv.lua to chage what commands to use, and how long you need to wait before voting. [URL="http://www.mediafire.com/?s8bi6o285bngaau"]RTV addon for Simple Map Vote[/URL] To make this work with ttt, change line 31 in the above mentioned file to: [CODE]MapVote.Start(15, false, 24, "ttt_")[/CODE]
[QUOTE=Eccid;40564564]I cannibalized the rock the vote addon on garrysmod.org to work with this. Just extract the link below into your addons folder. Just edit the variables at the top of the lua/rtv/rtv.lua to chage what commands to use, and how long you need to wait before voting. [URL="http://www.mediafire.com/?s8bi6o285bngaau"]RTV addon for Simple Map Vote[/URL] To make this work with ttt, change line 31 in the above mentioned file to: [CODE]MapVote.Start(15, false, 24, "ttt_")[/CODE][/QUOTE] Whenever players type !rtv. /rtv in-game it does nothing but say "Name has voted to Rock The Vote!" Do you know what the problem is?
[QUOTE=M60warrior;40567177]Whenever players type !rtv. /rtv in-game it does nothing but say "Name has voted to Rock The Vote!" Do you know what the problem is?[/QUOTE] I just re tested it on both single player and my server, and it's working fine. are you sure you installed it right? Edit: I found a rather big bug (for me at least). when the map vote is up, my mouse can't do anything but cote for maps. My mic key is bound to my mouse and is unusable, as well, I can't use my ulx menu when the vote is active.
[QUOTE=Eccid;40567380]I just re tested it on both single player and my server, and it's working fine. are you sure you installed it right? Edit: I found a rather big bug (for me at least). when the map vote is up, my mouse can't do anything but cote for maps. My mic key is bound to my mouse and is unusable, as well, I can't use my ulx menu when the vote is active.[/QUOTE] I may be adding a minimize button in the future (today or tomorrow)
I modified the rock the vote to allow for a minimum playercount to be set. Just change [code]RTV.PlayerCount = 3[/code] to whatever number you need. Just replace your /garrysmod/addons/SMVrtv/lua/rtv/rtv.lua with this [URL="http://pastebin.com/0S1dsNt6"]pastebin link[/URL] [QUOTE=Willox;40568023]I may be adding a minimize button in the future (today or tomorrow)[/QUOTE] Awesome, looking forward to it. You have no idea how long I've been waiting for a good version of this map vote system to exist again. You're the man.
Just chucked up the update for the close button (It hides the vote until the vote finishes). I haven't had much time so that's the only change.
Would it be possible to add an extend map option to this vote?
Has anyone figured out how to make this call from a list yet? i have a few maps for ttt that we play that are not ttt_* maps like dm_richland de_dolls.
[QUOTE=GriM!;40583057]Has anyone figured out how to make this call from a list yet? i have a few maps for ttt that we play that are not ttt_* maps like dm_richland de_dolls.[/QUOTE] He's working on a way to use a table of wildcards as a list.
You can now use a table for the prefix, so {"ttt_", "dm_"}. You can also be more specific with prefixes and put in entire map names such as {"ttt_", "gm_flatgrass"} to allow all ttt_ maps as well as flatgrass. I'm not too happy with the code so one day I'll be cleaning it up, but it'll always work like this.
[QUOTE=Willox;40583862]You can now use a table for the prefix, so {"ttt_", "dm_"}. You can also be more specific with prefixes and put in entire map names such as {"ttt_", "gm_flatgrass"} to allow all ttt_ maps as well as flatgrass. I'm not too happy with the code so one day I'll be cleaning it up, but it'll always work like this.[/QUOTE] Sweet thanks! i only have a few non ttt_ maps so i can make due with just adding the whole name. I will give it a try later when i get home from work. Thanks again for the free map vote tool!
[QUOTE=J.R.;40555031]Actually I breezed through the code of this addon real quick, I don't there are any dependencies for TTT, you just got to put [lua] MapVote.Start(voteLength, allowCurrentMap, mapLimit, mapPrefix) [/lua] Where it would normally do the "next map" part in the gamemode(yours being jail break) So yours would be something like [lua] MapVote.Start(15, false, 24, "jb_") [/lua] Just find the right place to put it, probably the part of the gamemode that handles the next map.[/QUOTE] DeathRun, not JB :P Any one know how to set this up for DeathRun, iv been looking in the scripts and I can't really find the map vote... I think I'm going blind. Edit Here is the map vote code, but what would I do to it so it works with DeathRun? [lua]if SERVER then return end RTV.Voter = nil RTV.Maps = {} RTV.Keys = {} local menuText = "Core-Gaming Map Vote" surface.CreateFont( "GoodDefault", { font = "Tahoma", size = 14, weight = 500, antialias = false } ) surface.CreateFont( "GoodDefaultBold", { font = "Tahoma", size = 14, weight = 1000, antialias = false } ) function RTV.CreatePanel() if (RTV.Voter and RTV.Voter:IsVisible()) then RTV.Voter:Remove() end if not GetGlobalBool( "In_Voting" ) then RTV.Keys = {} return end RTV.Voter = vgui.Create( "DFrame" ) local pn = RTV.Voter -- It gets annoying typing that pn:SetSize( 300, 20 + (26*#RTV.Maps) ) pn:SetPos( 5, ScrH() * 0.4 ) pn:SetTitle( "" ) pn:ShowCloseButton(false) pn:SetDraggable(false) pn.Paint = function( self, w, h ) surface.SetDrawColor( Color( 45, 55, 65, 200 ) ) surface.DrawRect( 0, 0, w, 24 ) surface.SetDrawColor( Color( 35, 45, 55, 220 ) ) surface.DrawRect( 0, 24, 12, h - 24 ) surface.SetDrawColor( Color( 40, 40, 40, 235 ) ) surface.DrawRect( 12, 24, w - 12, h - 24 ) surface.SetTextColor( Color( 255, 255, 255, 255 ) ) surface.SetFont( "GoodDefault" ) local w2, h2 = surface.GetTextSize( menuText ) surface.SetTextPos( w/2 - w2/2, 5 ) surface.DrawText( menuText ) end local voted = false for k, v in ipairs( RTV.Maps ) do local text = vgui.Create( "DLabel", pn ) text:SetFont( "GoodDefault" ) text:SetColor( Color( 255, 255, 255, 255 ) ) text:SetText( tostring(k).." "..v ) text:SetPos( 4, (26 * k-1) ) text:SizeToContents() RTV.Keys[k+1] = { text, v == "Extend Current Map" and "EXTEND" or k } end pn.Think = function( self ) if not voted and GetGlobalBool( "In_Voting" ) and #RTV.Keys > 0 then for k, v in pairs( RTV.Keys ) do if input.IsKeyDown( k ) and v[1] then voted = true v[1]:SetColor( Color( 0, 255, 0, 255 ) ) RunConsoleCommand( "rtv_vote", v[2] ) surface.PlaySound( "garrysmod/save_load1.wav" ) end end end end end usermessage.Hook( "RTVoting", function() timer.Simple( 1, function() RTV.CreatePanel() end ) end ) net.Receive( "RTVMaps", function() RTV.Maps = net.ReadTable() end )[/lua]
[QUOTE=Sgt. Sicknezz;40584559]DeathRun, not JB :P Any one know how to set this up for DeathRun, iv been looking in the scripts and I can't really find the map vote... I think I'm going blind.[/QUOTE] You've sent clientside code for another map voting script, look around for something related to that but serverside. Add me on steam if it's easier.
I guess I am either doing something wrong or just being stupid. Using this for TTT, and since I have ttt, de, cs, dm and clue I tried changing the following line. MapVote.Start(15, false, 24, "ttt_") to MapVote.Start(15, false, 24, "ttt_", "dm_", "cs_", "de_", "clue") however it only ever shows the ttt_ maps in the vote.
[QUOTE=NaRyan;40587378]I guess I am either doing something wrong or just being stupid. Using this for TTT, and since I have ttt, de, cs, dm and clue I tried changing the following line. MapVote.Start(15, false, 24, "ttt_") to MapVote.Start(15, false, 24, "ttt_", "dm_", "cs_", "de_", "clue") however it only ever shows the ttt_ maps in the vote.[/QUOTE] MapVote.Start(15, false, 24, {"ttt_", "dm_", "cs_", "de_", "clue"})
[QUOTE=Willox;40587784]MapVote.Start(15, false, 24, {"ttt_", "dm_", "cs_", "de_", "clue"})[/QUOTE] if you use varargs, the other system would be valid to, might be easier for people then having to create a table for it themselves.
[QUOTE=SB2DevTeam;40592418]if you use varargs, the other system would be valid to, might be easier for people then having to create a table for it themselves.[/QUOTE] It already supports a string or a table argument
If you want this to work with Excl's Jailbreak simply: In jailbreak/core Open sv_mapvotes.lua find line 141 change it to: MapVote.Start(30, true, 24, {"ba_", "jb_"})
[QUOTE=Willox;40587784]MapVote.Start(15, false, 24, {"ttt_", "dm_", "cs_", "de_", "clue"})[/QUOTE] i can confirm that this method works. i mainly have ttt_ maps but with the few non ttt maps and i just added the whole map name and it comes up. Thanks again!
Thank you for this addon, it's just what I was looking for. [IMG]http://farm2.staticflickr.com/1118/1065172191_9437450e4b.jpg[/IMG]
Does this have a map cooldown?
[QUOTE=ZachPL;40609438]Does this have a map cooldown?[/QUOTE] No
Willox, Just wanted to contribute to your awesome votemap addon, thanks again for this great addition :) The below is a really simple bit of code I've added which will allow you to use ULX to initiate and cancel a votemap through your system. [code] ------------------------------ VoteMap ------------------------------ function AMB_mapvote( calling_ply, votetime, should_cancel ) if not should_cancel then MapVote.Start(votetime, false, 48, {"ttt_"}) ulx.fancyLogAdmin( calling_ply, "#A called a votemap!" ) else MapVote.Cancel() ulx.fancyLogAdmin( calling_ply, "#A canceled the votemap" ) end end local mapvotecmd = ulx.command( CATEGORY_NAME, "mapvote", AMB_mapvote, "!mapvote" ) mapvotecmd:addParam{ type=ULib.cmds.NumArg, min=15, default=25, hint="time", ULib.cmds.optional, ULib.cmds.round } mapvotecmd:addParam{ type=ULib.cmds.BoolArg, invisible=true } mapvotecmd:defaultAccess( ULib.ACCESS_ADMIN ) mapvotecmd:help( "Invokes the map vote logic" ) mapvotecmd:setOpposite( "unmapvote", {_, _, true}, "!unmapvote" ) [/code]
So.. I know that this is more of a ME problem.. But anyone think they can make this work with ULX to where vip's+ get twice the voting power than regular members?
[QUOTE=John Elam;40613809]So.. I know that this is more of a ME problem.. But anyone think they can make this work with ULX to where vip's+ get twice the voting power than regular members?[/QUOTE] go into sv_mapvote.lua and look for this section, [code] for k2, v2 in pairs(player.GetAll()) do if(v2:SteamID() == k) then --[[if(v2:IsAdmin() or v2:IsDonator()) then map_results[v] = map_results[v] + 2 else]] map_results[v] = map_results[v] + 1 --end end end [/code] Just uncomment out this portion: [code] --[[if(v2:IsAdmin() or v2:IsDonator()) then map_results[v] = map_results[v] + 2 else]] [/code] and instead add something like, if(v2:IsUserGroup("vip")) then
Sorry, you need to Log In to post a reply to this thread.