Firearms Compatible Vote Plugin
by Anders Dog, <[email protected]
modded from the AMX Mod X AdminVote plugin. 28, April 2005.
This is a simple modification of the default AMX MOD X AdminVote plugin to enable voting in Firearms (http://firearmsmod.com
Some time ago the Firearms coder Mazor removed support for text only menus in Firearms because the code was fuXXored beyond repair. This plugin works around that limitation by outputting menu options to the HUD, and collecting votes from say and team say instead. There's some info about the original problem here: http://forums.firearmsmod.com/showthread.php?t=68595
All of the rest of the AdminVote functionality should remain intact. The vote result acceptance menu is also replaced by the same system.
Compile, copy to amxmodx/plugins, and add: fadminvote.amxx to the list of plugins in amxmodx/configs/plugins.ini. You should comment out adminvote.amxx as well, if you haven't already.
Start a vote as you normally would with AMXx, except use amx_fvote instead of amx_vote, amx_fvotemap insteam of amx_votemap, etc. Select a vote option by typing /x where x is the number of your choice in say or team say. e.g.:
say "/1" will select option 1, say "/2" will select option 2... etc.
I take no credit for the voting system, only for the mangling I gave it so it utilized HUD messages and reads from say and team say.
The same basic principle could be applied to many other menu systems in AMXx. e.g., the mapchooser (EDIT: I've already made an attempt at the mapchooser for firearms, see below). If this plugin is approved (and I'm not sure if I'm stepping on toes by hacking a standard plugin...) then I could easily go through the rest of the standard plugins with the same system.
There's only one static string message that has been added to adminvote. This should probably be moved to the language data files. Again, if there's sufficient interest and/or approval, then I will do this.
This is my first attempt at hacking in small. I don't believe there are any bugs, and I have tried to follow the coding conventions used by the AMXx team. There may well be better ways to achieve the same end. I have tried to work out how to code VGUI menus, but it seems the menu config has to reside as a static file on the client's machine. That's obviously no good for map votes, or kick votes. Perhaps there's a way around that with fakemeta...
- As of 1.03 of fadminvote and 1.02 of fmapchooser, I've abandoned HUD 'menus' entirely in favour of MOTDs. The MOTD behaves far more predictably, and has the advantage of staying on screen until the user dismisses it.
- As of 1.02 -- Better HUD positioning. Menus always align top left now.
- A pause for 2 seconds before voting for console-initiated votes so the vote caller has a chance to get out of console.
- The votes should disappear as soon as you have made your choice.
- The map chooser plugin has been mangled to support firearms.
It's still nowhere near as elegant as amx menus on a show_menu() compatible mod, but it should be a bit better than nothing at all.
- Adapt the fmapchooser to check the number of regenerations for each team. Show the menu when there are less than 3 for one team, or use a cvar to set the number.
- Test a few hunches regarding getting true VGUI menus with buttons, etc...