Upgrading from 0.7.x to 0.8.x
Download the entire zip again and extract it. NativeVotes gained translation files between 0.7.12 and 0.8.0 and they are required in order for revoting to work.
Transparent vote HUD (client mod)
For clients wanting a transparent vote HUD for TF2, download tf2_transvote.zip and unzip it to your steamapps\common\team fortress 2\tf\custom\ folder. Note: If you use a custom hud, it may already be using a different vote HUD.
CS:GO isn't currently working with Map votes or other Multiple Choice votes. This appears to be something that got broken when Valve changed the end of map vote to the current vote style in mid-March 2013.
(I apologize if you got here because this is marked as "Any". It only supports the 4 games listed up top.)
Requires MetaMod: Source 1.10.x
Requires SourceMod 1.5 or newer to compile
However, the plugin itself should run on SourceMod 1.4.
Changelog
Spoiler
A lot of versions here were only posted as test versions, so if you missed them... that's why.
0.8.3
Fix Valve breaking NativeVotes on TF2.
Remove deprecated callvote hooking.
Remove deprecated NativeVotes_RegisterVoteManager function and its NativeVotes_CallVoteSetupHandler and NativeVotes_CallVoteHandler functags and forwards.
0.8.2
Fix issues with revote not checking if a vote was in progress.
Remove extra unused variable.
0.8.1
NativeVotes_RedrawVoteTitle and NativeVotes_RedrawVoteItem return Plugin_Changed if they succeeded or Plugin_Continue if they didn't... you can return this value directly in your menu callback
New natives NativeVotes_SetTitle and NativeVotes_GetTitle. These are only used in custom votes. As a fallback, NativeVotes_GetTitle will return the vote's details string if SetTitle was never called.
Updated .inc file so that all natives are now marked as optional if NativeVotes is loaded as an optional dependency.
Now includes Spanish and Hungarian translation files
0.8.0
Translations are now supported for Vote Title, Vote Items, and Vote Passed in L4D2, CS:GO, and TF2. Sorry L4D people.
Note that Vote Items only works on TF2 since L4D2 never supported multiple choice votes and CS:GO broke them at one point.
Vote Title translation is supported via the MenuHandler's MenuAction_Display callback and NativeVotes_RedrawVoteTitle native. param1 is the client, param2 isn't passed.
Vote Item translation is supported via the MenuHandler's MenuAction_DisplayItem callback and the NativeVotes_RedrawVoteItem native. param1 is the client, param2 is the item position.
Vote Passed translation is supported by the VotePassCustom stock and VotePassCustomToOne native.
Examples of how to use these is in the new nativevotes_votetest script.
Note that MenuAction_Display and MenuAction_DisplayItem are not activated by default, so you have to pass them in NativeVotes_Create's third argument.
NativeVotes now has a translation file. Right now, it contains two phrases but only one is currently used.
Revote (part of nativevotes-basecommands) now shows a success phrase instead of a fail screen. It uses the "NativeVotes Revote" translation phrase.
nativevotes.inc has some fixes in it. This *should* fix the 'NativeVotes_Cancel not bound' and 'undefined symbol "NativeVotes_SetTeam"' errors.
Yes/No votes now return false for the commands to add, insert, and remove items. These votes are locked with two options: "Yes" and "No"
Vote counts are now updated when a person uses the revote command.
0.7.12
Fixed vote controller not being found correctly at all due to a logic error in 0.7.11.
0.7.11
Vote Controller no is now detected through a different method.
Vote Controller values are now reset when a NativeVotes vote ends.
In-game votes should now be blocked while a NativeVotes vote is in progress.
0.7.10
Switched to using GetEngineVersion instead of GuessSDKVersion... GuessSDKVersion doesn't work properly in newer versions.
0.7.9
Fixed NativeVotes_CheckVoteDelay... should actually work now!
0.7.8
Players can no longer call an in-game vote while a NativeVotes vote is ongoing. This is to prevent NativeVotes and the server from fighting over whose vote is running.
The Vote Controller's data is now cleared whenever the internal vote data is reset (generally before and after a vote). This fixes an issue where game-created votes had the wrong vote counts.
L4D: The team is now set correctly for the vote. If you were having issues with votes not appearing, this may have fixed the issue.
L4D2: The Vote Controller's values are now set (mostly) properly at the start of a vote.
0.7.7
CS:GO no longer properly supports multiple argument votes and NativeVotes_IsVoteTypeSupported will return as such.
NativeVotes_IsVoteTypeSupported is now marked as optional
0.7.6
Fixed issues with RedrawToClient sending a fail message to everyone. This SHOULD fix nativevotes-basecommands revote.
0.7.5
nativevotes.inc: Now has a new NativeVotesCallFailType: NativeVotesCallFail_Generic. Necessary for L4D/L4D2 support.
L4D: NativeVotes_DisplayFail should now work.
L4D: Casting a vote now sends the VoteRegistered usermessage instead of the vote_cast_yes or vote_cast_no events. Let me know if this version breaks the vote counters on L4D for you.
L4D/L4D2: NativeVotes_DisplayCallVoteFail should now work on these, but probably only for NativeVotesCallFail_Generic and NativeVotesCallFail_Loading.
votediagnostics: Now logs VoteRegistered in L4D and CallVoteFailed in L4D/L4D2.
0.7.4
Fixes that a vote's details or winner were one character shorter than they should be.
0.7.3
If hintboxes are enabled, the hintbox is now drawn once when the vote starts. This is to clear the previous vote's entries
Eliminated duplicate code from the function that builds the hintbox list.
The above shared code now only sorts the votes that actually exist. Shouldn't make a difference, but just in case...
0.7.2
Votes should be registered again. 0.7.0 accidentally had some code removed that really is necessary for the plugin to work.
Fixed votes ending early if votes not on the list were selected (i.e. hitting F5 when there are 4 or less options).
0.7.1
Now calls correct checking method when a client disconnects.
0.7.0
Another callvote fix, this time due to a previous fix only being changed in two of three places.
Fixed issue with vote item count not being used when preparing vote results and instead using the array size.
Changed method for clearing vote counts. No longer resizes array, but instead sets all values to 0. Resizing caused the bug immediately before this.
Various vote counts are now correctly updated when a client disconnects.
Vote will now end if the last player whose vote was pending disconnects.
New method to update client count on server's votecontroller entity.
0.6.3
When a player disconnects, their vote wasn't being cleared.
0.6.2
Fixed MenuAction_VoteEnd callback looping around the wrong value.
Moved bot check code to more appropriate location.
Clients were not being properly returned to the VoteResults callback.
No longer allow plugins to ask for an item one past the end of the vote list in NativeVotes_GetItem.
0.6.1
Changed numbering scheme to 3 digit. 0.60 was a typo (or braino) on my part and kinda stuck; it needs to be 0.6.1 in the future for Updater compatibility (which isn't yet present).
Updated callvote handling. The forward declaration was missing the second argument and would cause errors when someone used the callvote command.
Updated NativeVotes_CallVoteHandler in .inc file. It now returns an Action. This was a design flaw; previously it was impossible for a registered vote manager to tell NativeVotes it wasn't handling a specific vote.
0.60
Initial Release
What is NativeVotes?
NativeVotes is an API to generate vote panels using the game's own vote panels. It is the next version of the BuiltinVotes extension, but as a plugin.
What's new since BuiltinVotes 0.5.8?
NativeVotes_Close must be called instead of CloseHandle or the plugin will leak handles.
The API was completed redesigned. Whenever possible, the API was moved to be closer to the SourceMod menu API.
Unfortunately, that doesn't apply to the Vote Results callback. Plugins can't send back multi-dimensional arrays from natives. If you need to, you can call the NativeVotes_FixResults stock to change the votes back to multi-dimensional. An example of this is in NativeVotes MapChooser.
NativeVotes has its own configuration file now.
CS:GO is now supported. Needs testing.
Fail screen is no longer automatically shown if you close a vote without sending a fail or pass screen. Closing it without sending one IS a mistake on the plugin developers part.
NativeVotes manipulates the server's vote_controller entity. This should address issues where vote counts weren't showing up.
CVars
Edit these in cfg/sourcemod/nativevotes.cfg
nativevotes_version - NativeVotes API version
nativevotes_progress_hintbox - [0/1] def. 0 - Show current vote progress in a hint box
nativevotes_progress_chat - [0/1] def. 0 - Show current vote progress as chat messages
nativevotes_progress_console - [0/1] def. 0 - Show current vote progress as console messages
nativevotes_progress_client_console - [0/1] def 0 - Show current vote progress as console messages to clients
nativevotes_vote_delay - def 30 - Sets the recommended time in between public votes. This is only for votes that check NativeVotes_CheckVoteDelay or NativeVotes_IsNewVoteAllowed
Known Issues
Unloading NativeVotes while a vote panel is open may do bad things if the plugin isn't expecting it. The example plugin, NativeVotes MapChooser, doesn't expect it and will bomb.
NativeVotes_RegisterVoteManager currently does nothing and instead returns an error. This functionality will be added at a later time.
Yes/No votes may work, but "Yes" and "No" aren't being registered as answers correctly.
Natives dealing with adding and removing items shouldn't work on L4D and L4D2, but this isn't currently restricted.
NativeVotes_DisplayCallVoteFail does nothing on L4D and L4D2. I need more data about what they display when a vote fails to start.
NativeVotes API is in the attached nativevotes.inc. This is a work in progress and enum values in particular may change.
What is votediagnostics.smx?
votediagnostics is a special tool for people using the real vote panels that the game itself provides. It creates a logfile named vote_diagnostics.txt
I need people to do this to gather information on the vote IDs and also what CS:GO does with its other team strings.
__________________
Not currently working on SourceMod plugin development.
Last edited by Powerlord; 10-16-2014 at 00:30.
Reason: Updated to 0.8.1
Warning: L4D, L4D2, and CS:GO only support Yes/No votes at this time
NativeVotes has 2 general types of votes: Specific votes and Custom votes. Specific votes use the game's own vote phrase titles. Custom votes use a vote title provided by the developer. [b]As of NativeVotes 0.8.0, this phrase can be translated using the MenuAction_Display callback and the NativeVotes_RedrawVoteTitle.
These two categories are further divided into two categories: Yes/No and Multiple Choice. L4D and L4D2 only support Yes/No votes and the Add/Insert/Remove item methods will simply do nothing for them. As of this writing, Multiple Choice votes are not displaying correctly on CSGO.
NativeVotes_Create requires a vote type as its second argument. The valid vote types are:
PHP Code:
NativeVotesType_Custom_YesNo, /**< Yes/No, details are vote text. */ NativeVotesType_Custom_Mult, /**< TF2/CS:GO: Multiple-choice, details are vote text. */ NativeVotesType_ChgCampaign, /**< L4D/L4D2: Yes/No, details are campaign name */ NativeVotesType_ChgDifficulty, /**< L4D/L4D2: Yes/No, details are difficulty number in L4D/L4D2 */ NativeVotesType_ReturnToLobby, /**< L4D/L4D2: Yes/No, details are ignored */ NativeVotesType_AlltalkOn, /**< L4D2: Yes/No, details are ignored (handled internally by extension) */ NativeVotesType_AlltalkOff, /**< L4D2: Yes/No, details are ignored (handled internally by extension) */ NativeVotesType_Restart, /**< Yes/No, details are ignored */ NativeVotesType_Kick, /**< Yes/No, target is player userid, details are auto-set by target */ NativeVotesType_KickIdle, /**< TF2/CS:GO: Yes/No, target is player userid, details are auto-set by target */ NativeVotesType_KickScamming, /**< TF2/CS:GO: Yes/No, target is player userid, details are auto-set by target */ NativeVotesType_KickCheating, /**< TF2/CS:GO: Yes/No, target is player userid, details are auto-set by target */ NativeVotesType_ChgLevel, /**< Yes/No, details are level number in L4D/L4D2 or map name in TF2 */ NativeVotesType_NextLevel, /**< TF2/CS:GO: Yes/No, details are map name */ NativeVotesType_NextLevelMult, /**< TF2/CS:GO: Multiple-choice, details are ignored */ NativeVotesType_ScrambleNow, /**< TF2/CS:GO: Yes/No, details are ignored */ NativeVotesType_ScrambleEnd, /**< TF2: Yes/No, details are ignored */ NativeVotesType_ChgMission, /**< TF2: Yes/No, details are popfile */ NativeVotesType_SwapTeams, /**< CS:GO: Yes/No, details are ignored */ NativeVotesType_Surrender, /**< CS:GO: Yes/No, details are ignored */ NativeVotesType_Rematch, /**< CS:GO: Yes/No, details are ignored */ NativeVotesType_Continue, /**< CS:GO: Yes/No, details are ignored */
You can find out if the current game supports a vote type using NativeVotes_IsVoteTypeSupported:
PHP Code:
if (NativeVotes_IsVoteTypeSupported(NativeVotesType_Custom_Mult))
Non-custom votes may require Details to display correctly. This can be set and retrieved using NativeVotes_SetDetails or NativeVotes_GetDetails.
__________________
Not currently working on SourceMod plugin development.
Whoops. The callvote stuff isn't really done and I didn't comment it out. 0.6.1 should fix this. Let me know if it doesn't.
What's new in 0.6.1
Changed numbering scheme to 3 digit. 0.60 was a type on my part and kinda stuck; it needs to be 0.6.1 in the future for Updater compatibility (which isn't yet present).
Updated callvote handling. The forward declaration was missing the second argument and would cause errors when someone used the callvote command.
Updated NativeVotes_CallVoteHandler in .inc file. It now returns an Action. This was a design flaw; previously it was impossible for a registered vote manager to tell NativeVotes it wasn't handling a specific vote.
RegisterVoteManager still isn't written, but this fixes the actual handlers for when it is.
__________________
Not currently working on SourceMod plugin development.
That's because I derped and made the string field for game name one character shorter than I needed. It's just long enough for "left4dead" (9 characters plus string terminator).
The attached version should log the correct game name.
__________________
Not currently working on SourceMod plugin development.
It's called NativeVotes BaseCommands. Basically, it adds NativeVotes support for /revote and /votecancel (and their alternates). /votecancel uses the sm_votecancel override, just like the SourceMod votecancel does.
It also adds Cancel Vote to the Voting Commands admin menu when a NativeVotes vote is running.
Known bugs:
If a SourceMod vote and a NativeVotes vote are running at the same same, Cancel Vote will appear in the admin menu twice.
If SourceMod's basecommands isn't loaded, you may get "Unknown command" errors in certain situations. This plugin is meant to complement basecommands, not replace it.
There is a 2 second delay on the !revote command. This is due to the games themselves requiring a Cancel box be shown before a new vote can be registered.
__________________
Not currently working on SourceMod plugin development.
Last edited by Powerlord; 02-14-2013 at 13:11.
Reason: Updated source attachment to include license header
NativeVotes is now on GitHub. In addition to hosting the source code there (which was imported from the BuiltinVotes repo), it also has a bug tracker where you can file bug reports.
I moved this to repo to GitHub due to Valve's increasing reliance on GitHub for its own bug report tools.
__________________
Not currently working on SourceMod plugin development.