Raised This Month: $89 Target: $400
 22% 

[L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Plugin ID:
3519
Plugin Version:
0.8.3
Plugin Category:
Technical/Development
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    352 
    Plugin Description:
    Voting API for L4D, L4D2, TF2, and CSGO
    Old 02-09-2013 , 02:05   [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
    Reply With Quote #1

    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.)

    Source Code on GitHub
    Bug Tracker on GitHub

    Like my work? Now taking donations.

    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


    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.
    Attached Files
    File Type: smx nativevotes.smx (34.5 KB, 815 views)
    File Type: smx nativevotes-basecommands.smx (5.3 KB, 532 views)
    File Type: smx votediagnostics.smx (9.6 KB, 599 views)
    File Type: inc nativevotes.inc (35.1 KB, 1229 views)
    File Type: zip tf2_transvote.zip (2.2 KB, 1031 views)
    File Type: zip nativevotes-0.8.3.zip (95.0 KB, 2568 views)
    __________________
    Am I back? Well, we'll see.

    Last edited by Powerlord; 10-16-2014 at 00:30. Reason: Updated to 0.8.1
    Powerlord is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 02-09-2013 , 02:34   Re: [L4D,L4D2,TF2,CSGO] NativeVotes [Beta] (v0.60, 2013-02-08)
    Reply With Quote #2

    RESERVED

    (I'll be adding more developer stuff here)

    Porting SourceMod votes to NativeVotes
    __________________
    Am I back? Well, we'll see.

    Last edited by Powerlord; 09-11-2013 at 10:40.
    Powerlord is offline
    eric0279
    AlliedModders Donor
    Join Date: May 2007
    Old 02-11-2013 , 15:37   Re: [L4D,L4D2,TF2,CSGO] NativeVotes [Beta] (v0.60, 2013-02-08)
    Reply With Quote #3

    Hello,

    Quote:
    L 02/11/2013 - 19:59:08: SourceMod error session started
    L 02/11/2013 - 19:59:08: Info (map "c8m1_apartment") (file "errors_20130211.log")
    L 02/11/2013 - 19:59:08: [SM] Plugin encountered error 4: Invalid parameter or parameter type
    L 02/11/2013 - 19:59:08: [SM] Native "Call_PushCell" reported:
    L 02/11/2013 - 19:59:08: [SM] Displaying call stack trace for plugin "nativevotes.smx":
    L 02/11/2013 - 19:59:08: [SM] [0] Line 293, F:\L4D2\l4d2\Server\addons\sourcemod\scriptin g\nativevotes.sp::Command_CallVote()
    L 02/11/2013 - 20:06:28: Error log file session closed.
    L 02/11/2013 - 20:49:49: SourceMod error session started
    L 02/11/2013 - 20:49:49: Info (map "c8m3_sewers") (file "errors_20130211.log")
    L 02/11/2013 - 20:49:49: [SM] Plugin encountered error 4: Invalid parameter or parameter type
    L 02/11/2013 - 20:49:49: [SM] Native "Call_PushCell" reported:
    L 02/11/2013 - 20:49:49: [SM] Displaying call stack trace for plugin "nativevotes.smx":
    L 02/11/2013 - 20:49:49: [SM] [0] Line 293, F:\L4D2\l4d2\Server\addons\sourcemod\scriptin g\nativevotes.sp::Command_CallVote()
    L 02/11/2013 - 20:50:10: [SM] Plugin encountered error 4: Invalid parameter or parameter type
    L 02/11/2013 - 20:50:10: [SM] Native "Call_PushCell" reported:
    L 02/11/2013 - 20:50:10: [SM] Displaying call stack trace for plugin "nativevotes.smx":
    L 02/11/2013 - 20:50:10: [SM] [0] Line 293, F:\L4D2\l4d2\Server\addons\sourcemod\scriptin g\nativevotes.sp::Command_CallVote()
    L 02/11/2013 - 20:52:42: [SM] Plugin encountered error 4: Invalid parameter or parameter type
    L 02/11/2013 - 20:52:42: [SM] Native "Call_PushCell" reported:
    L 02/11/2013 - 20:52:42: [SM] Displaying call stack trace for plugin "nativevotes.smx":
    L 02/11/2013 - 20:52:42: [SM] [0] Line 293, F:\L4D2\l4d2\Server\addons\sourcemod\scriptin g\nativevotes.sp::Command_CallVote()
    L 02/11/2013 - 20:52:44: [SM] Plugin encountered error 4: Invalid parameter or parameter type
    L 02/11/2013 - 20:52:44: [SM] Native "Call_PushCell" reported:
    L 02/11/2013 - 20:52:44: [SM] Displaying call stack trace for plugin "nativevotes.smx":
    L 02/11/2013 - 20:52:44: [SM] [0] Line 293, F:\L4D2\l4d2\Server\addons\sourcemod\scriptin g\nativevotes.sp::Command_CallVote()
    L 02/11/2013 - 21:07:26: Error log file session closed.

    Last edited by eric0279; 02-11-2013 at 15:38.
    eric0279 is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 02-11-2013 , 15:57   Re: [L4D,L4D2,TF2,CSGO] NativeVotes [Beta] (v0.60, 2013-02-08)
    Reply With Quote #4

    Quote:
    Originally Posted by eric0279 View Post
    Hello,
    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.
    Attached Files
    File Type: smx nativevotes.smx (32.3 KB, 147 views)
    File Type: sp Get Plugin or Get Source (nativevotes.sp - 172 views - 43.1 KB)
    File Type: inc nativevotes.inc (29.0 KB, 146 views)
    __________________
    Am I back? Well, we'll see.

    Last edited by Powerlord; 02-11-2013 at 16:31.
    Powerlord is offline
    eric0279
    AlliedModders Donor
    Join Date: May 2007
    Old 02-11-2013 , 19:13   Re: [L4D,L4D2,TF2,CSGO] NativeVotes [Beta] (v0.6.1, 2013-02-11)
    Reply With Quote #5

    Thanks for fix.

    vote_diagnostics.txt :

    Quote:
    L 02/11/2013 - 16:51:59: [votediagnostics.smx] Game: left4dead

    server L4D2 and not L4D for me ^^
    Attached Files
    File Type: txt vote_diagnostics.txt (9.3 KB, 217 views)
    eric0279 is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 02-11-2013 , 19:26   Re: [L4D,L4D2,TF2,CSGO] NativeVotes [Beta] (v0.6.1, 2013-02-11)
    Reply With Quote #6

    Quote:
    Originally Posted by eric0279 View Post
    Thanks for fix.

    vote_diagnostics.txt :




    server L4D2 and not L4D for me ^^
    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.
    Attached Files
    File Type: sp Get Plugin or Get Source (votediagnostics.sp - 346 views - 17.0 KB)
    File Type: smx votediagnostics.smx (9.0 KB, 139 views)
    __________________
    Am I back? Well, we'll see.

    Last edited by Powerlord; 02-11-2013 at 19:28.
    Powerlord is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 02-14-2013 , 12:55   Re: [L4D,L4D2,TF2,CSGO] NativeVotes [Beta] (v0.6.1, 2013-02-11)
    Reply With Quote #7

    So, here's something new to test.

    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:
    1. If a SourceMod vote and a NativeVotes vote are running at the same same, Cancel Vote will appear in the admin menu twice.
    2. 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.
    3. 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.
    Attached Files
    File Type: sp Get Plugin or Get Source (nativevotes-basecommands.sp - 144 views - 4.6 KB)
    File Type: smx nativevotes-basecommands.smx (5.1 KB, 135 views)
    __________________
    Am I back? Well, we'll see.

    Last edited by Powerlord; 02-14-2013 at 13:11. Reason: Updated source attachment to include license header
    Powerlord is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 02-15-2013 , 16:54   Re: [L4D,L4D2,TF2,CSGO] NativeVotes [Beta] (v0.6.1, 2013-02-11)
    Reply With Quote #8

    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.
    __________________
    Am I back? Well, we'll see.
    Powerlord is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 02-21-2013 , 20:24   Re: [L4D,L4D2,TF2,CSGO] NativeVotes [Beta] (v0.6.1, 2013-02-11)
    Reply With Quote #9

    Here's a new version of nativevotes.inc that gets rid of this error:
    Code:
    [SM] Unable to load plugin "mapchooser_extended.smx": Native "NativeVotes_Close" was not found
    It only happens if NativeVotes is an optional dependency and isn't loaded.

    Plugins with an optional NativeVotes dependency should be recompiled against this new .inc file.
    Attached Files
    File Type: inc nativevotes.inc (29.1 KB, 135 views)
    __________________
    Am I back? Well, we'll see.
    Powerlord is offline
    alongub
    Veteran Member
    Join Date: Aug 2009
    Location: Israel
    Old 02-21-2013 , 21:22   Re: [L4D,L4D2,TF2,CSGO] NativeVotes [Beta] (v0.6.1, 2013-02-11)
    Reply With Quote #10

    L485-486:

    Code:
    new num_items = 1;
    for (new i = 1; i < num_items; i++)
    {
    What?

    L836:

    Code:
    if (clients[i] < 1 || clients[i] > MaxClients || IsFakeClient(clients[i]) || !IsClientInGame(clients[i]))
    It's probably better to check if the client is in-game before calling IsFakeClient:

    Code:
    if (clients[i] < 1 || clients[i] > MaxClients || !IsClientInGame(clients[i]) || IsFakeClient(clients[i]))
    By the way, nice framework!
    __________________

    Last edited by alongub; 02-21-2013 at 21:23.
    alongub is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 15:43.


    Powered by vBulletin®
    Copyright ©2000 - 2017, vBulletin Solutions, Inc.
    Theme made by Freecode