Talk:Left 4 Voting 2

From AlliedModders Wiki
Jump to: navigation, search

Wouldn't it be a better idea to hook the user message "VoteRegistered" and use const players[] (which length would be 1 and would contain the userid or clientid(?)) to determine which player did the vote? This would be more accurate than parsing the vote command and filtering out who has already voted since "VoteRegistered" would only be sent when the vote was actually accepted and not when someone attempts to vote (again or isn't allowed to).

If you're manually creating the vote, the game server won't handle the vote processing for you and you will be responsible for sending the VoteRegistered UserMessage yourself based on what Vote command they send to you.
Granted, at this point you might as well use the SourceMod NativeVotes plugin as it's a wrapper for the L4D, L4D2, TF2, and CS:GO vote systems.
--Powerlord (talk) 22:46, 12 June 2013 (CDT)
You're right, it's already mentioned in the explanation on how it works. However, the usermessage is not created and sent in the example. At this point I'm wondering what might happen in that case considering visual acknowledgement aka box getting checked. Does the engine handle it automatically with/on each vote command that's been received, is it the "vote_changed"-event that checks the box or is there no box-checking at all (and it's the usermessage that actually triggers this)? I guess I'll just check that out by my own later when I'll have time to play around with the usermessages.
And yes, your plugin should usually be used as a wrapper, however, I'm actually interested in making it possible for a plugin to register votes and their momentary status and parameters. I was only mentioning the above because it crossed my mind during the read.
--Dr. Greg House (talk) 02:37, 13 June 2013 (CDT)