Simple Map Voting Addon

Simple Map Voting Addon

This is a wonderful little addon that allows you to easily invoke a map vote from within any gamemode of your choosing. (You can find a tutorial for setting this up with TTT below)

Starting a vote from within lua is rather simple.
[lua]MapVote.Start(voteLength, allowCurrentMap, mapLimit, mapPrefix)[/lua]
All arguments to this function are optional and the map prefix is acquired from the gamemode.txt file if available. You can also set up defaults within lua/autorun/mapvote.lua. mapPrefix can be an array of prefixes, if not defined the script attempts to read from the gamemode’s txt file for the map pattern.

It is also possible to cancel map votes from within lua with: [lua]MapVote.Cancel()[/lua]

You can give players extra voting power in lua/autorun/mapvote.lua with the MapVote.HasExtraVotePower function.

How to use this with Trouble in Terrorist Town
Just install the addon and place ttt_mapvote.lua (click here to download this file separately!) in to lua/autorun/server/ttt_mapvote.lua

This file can be edited to meet your preferences:
If you plan on using different map prefixes, you can replace {“ttt_”, “cs_italy”} with (for example): {“ttt_”, “dm_”} to allow both TTT and HL2:DM maps.

This causes a map vote to start at the end of the game that lasts 15 seconds, doesn’t include the current map, includes a maximum of 8 choices, and ensures all maps begin with “ttt_” or “cs_italy”. It should also notify users that the map will be chosen from a map vote after each round.

Download!

Download Link: https://github.com/wiox/gmod-mapvote/releases/download/1/mapvote.zip
GitHub Repository: https://github.com/wiox/gmod-mapvote

Also, do whatever you like with it. I can’t honestly say how much code I borrowed from Fretta, but any that I did borrow was for the voting panel.

If you have any issues feel free to contact me over steam.

One day I hope to create a ~way~ better version of this. This was originally meant for use by developers but clearly hasn’t been, so any future versions will be easier on the user.

TTT VIDEO TUTORIAL! Made especially for MrGreen

https://dl.dropbox.com/u/14265905/share/2014-05/2014-05-15_23-05-38.webm

OMG THANK YOU SO MUCH <3

LOVE YOU MAN! EXACTLY WHAT I WANTED

[editline]5th May 2013[/editline]

Well… This Just F**cked up my server -_-

Want to be more descriptive?

Don’t worry, I just got TONS of lua errors when i changed the init.lua but dont worry ill fix it :slight_smile:

It’s possible you accidentally changed more lines than intended, the exact replacement I put in the OP should work fine.

Ok and when i fix it ill post a download link for the init.lua :slight_smile:

Shouldn’t the de_, cs_, and dm_ map prefixes be in there for the TTT map vote?

kk ty

That’s true, but the issue is all of the maps would be popping up. I’ll see about making a whitelist some-when so you can enable just the maps you want + ttt_.

why not just make it so they pull from a list ?

Good idea, I’ll add this in some-when soon unless somebody else wants to.

Also, There should be a continue on this map Willox!

No, mainly because everyone would want to play 67thway

Also this is a lovely addon thank you very much

I am going to and try and fix my code a bit from here because this does something I never did

So, I should just remove my init file (Make a backup first of coarse)
Then, replace the file?
Thanks!
~kpj :eng101:

You also need the addon installed

Just to make sure this is correct…
What is the file location for the init.lua file?
I found a bunch of ones mixed in with some addons…
Thanks!
~kpj :eng101:

gamemodes/terrortown/gamemode/init.lua

Thanks! I added it to my server but it appears to be blue…
How can I modify it to make it transparent like the one in your picture?
Thanks!

Now how would a lazy person like my self set this up with DeathRun?