NativeVotes is here!

By Asterisk3 minutes read

Important

PF2 server owners, you should really update to Sourcemod 1.12 ASAP. Everything works just fine and you’ll be able to run all sorts of newer plugins. If you’re still too lazy to do that, NativeVotes works on 1.11 too (you’ll have to compile it yourself).

People don’t like the voice command vote screen because you can easily fatfinger the wrong option. Mapchooser Extended adds dummy options to prevvent this, but it’s still not enough. Some HUDs also make the voice command menu hard to read (not a really bad problem though). The legacy menu requires you to pause the game to use (not ideal during gameplay, obviously).

The solution to this is, of course, NativeVotes. Instead of using the voice command menu, this plugin lets you use the votemenu systems of newer Source games (TF2, L4D, L4D2, CSGO, etc).

However, this plugin will say that the current game is unsupported and crash when used with PF2. It doesn’t try to import TF2 Tools or anything, so what was wrong?

I had no idea how some servers fixed this until I finally rubbed two brain cells together and looked at the code some more.

Behold, addons/sourcemod/scripting/nativevotes/game.sp, lines 394-405:

if ( g_EngineVersion == Engine_SDK2013 && ( StrEqual(gameDir, "open_fortress") || StrEqual(gameDir, "tf2classic") ) )
	{
		g_EngineVersion = Engine_TF2;
	}

	switch (g_EngineVersion)
	{
		case Engine_Left4Dead, Engine_Left4Dead2, Engine_CSGO, Engine_TF2:
		{
			return true;
		}
	}
-if ( g_EngineVersion == Engine_SDK2013 && ( StrEqual(gameDir, "open_fortress") || StrEqual(gameDir, "tf2classic") ) )
+if ( g_EngineVersion == Engine_SDK2013 && ( StrEqual(gameDir, "open_fortress") || StrEqual(gameDir, "tf2classic") || StrEqual(gameDir, "pf2") ) )
	{
		g_EngineVersion = Engine_TF2;
	}

	switch (g_EngineVersion)
	{
		case Engine_Left4Dead, Engine_Left4Dead2, Engine_CSGO, Engine_TF2:
		{
			return true;
		}
	}

Tip

NASA should hire me, I’m so smart.

Suddently, everything worked! 😱

However, unlike most server owners, I have put this incredibly complex and difficult fix on the Github org for all to see (with precompiled releases available), as well as a PR to the original repo to add the fix there.

The final result of all of this is votes look visually distinct and are voted on using the function keys instead of the number keys. Votes also disappear after you vote and the result is shown temporarily when finished.

Two soyjacks pointing at a TF2-style vote screen behind them

Made with GIMP and the native Linux Source SDK 🐧

This should reduce mapvoting troubles and show vote results without setting up the Ultimate Mapchooser (which is a huge pain).

Notes

Note

This is merely a library, you will need to find plugins that use it to take advantage of it (or make some yourself).

The nativevotes package comes with nativevotes versions of basecommands, mapchooser, nominations, and rockthevote. You will need to disable the normal versions for these to work.

Current Issues

Examples

(you can also demo these on the server :D)

The above image without the soyjacks

“VOTE PASSED: changing map to thebeefhammer_deluxe_a1…”

“Nativevotes is the best: yes/no” with a vote progress hintbox at the bottom. A red Scout and the map garbage_day can also be seen.