This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

TF2 Vote Usermessages


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-24-2011 , 20:27   TF2 Vote Usermessages
Reply With Quote #1

This is a continuation of something Afronanny and I were discussing in the Game Data thread

He informed me of 5 Usermessages:

Code:
VoteStart
    - Byte
    - Byte
    - String
    - String
    - Bool


VoteSetup
    - Byte
    * String (multiple strings, presumably the vote options. put "  (Disabled)" without the quotes after the option text to disable one of  the options?)


VotePass
    - Byte
    - String
    - String

CallVoteFailed
    - Byte
    - Short

VoteFailed
    - Byte
    - Byte
I've done some investigating via a simple plugin I wrote.

My first discovery was that the VoteSetup UserMessage event isn't for setting up a vote menu, but rather for displaying the main Vote menu.

Specifically, when I used a callvote, it returned this:
Code:
VoteSetup usermessage:
Byte = 5
String = Kick
String = RestartGame
String = ChangeLevel
String = NextLevel
String = ScrambleTeams
Which just happen to be the allowed vote types on my server.

Essentially, it returned the number of elements it was going to return, then the choices.

Choosing one of the vote types on my client also yielded some interesting results. I chose Change Level. It brought up a list of maps. I did not see any usermessages with the map list, so I am unsure how it was communicated. I chose cp_gravelpit from the list.

This is what I saw:

Code:
VoteStart usermessage
Byte = 255
Byte = 1
String = #TF_vote_changelevel
String = cp_gravelpit
Bool = true
I'm not sure what the bytes mean, but every map vote I've done has had the first byte as 255. The first string is the vote type translation phrase. The second string is the map. The boolean appears to true for votes that are yes/no.

The vote passed and gave me this usermessage:
Code:
VotePass usermessage
Byte = 255
String = #TF_vote_passed_changelevel
String = cp_gravelpit
Again, this one is easy. First byte is still unknown. The first String is the vote type translation phrase. The second String is the map that won. The map changed shortly afterwards.

More complicated is the end of map vote. End of map vote shows 5 voting choices rather than a yes/no vote for one.

The end of map vote comes quite late in a map, with just 1 minute remaining. This is what I captured:

Code:
VoteStart usermessage
Byte = 255
Byte = 99
String = #TF_vote_nextlevel_choices
String =
Bool = false
Notice that the second byte has changed. The first String is clearly the vote type translation string, the second String is blank, which came as a surprise. Nevertheless, the number of bytes came out correct, so I must assume this is accurate. The boolean is false here, because it is not a yes/no vote.

This raises an interesting question, though: Where does the list of maps to vote on come from? I was under the impression that they were sent from the server, but if they are, it is on a communication method that I was not watching.

Unless the second byte (and the first?) make up some sort of bitfield that represents the maps on the server. However, I find this rather unlikely, as 48 maps would require a many more than 2 bytes.

Unfortunately, I tabbed out to capture my server logs, and didn't vote.

Not voting gave me the following usermessage:
Code:
VoteFailed usermessage
Byte: 255
Byte: 4
Again, the first byte is unknown. The second byte is likely a status code of some sort.

After changing some things around, I waited around for an end of map vote again. I got the same vote thing as earlier.

The vote passed this time:
Code:
VotePass usermessage
Byte = 255
String = #TF_vote_passed_nextlevel
String = cp_mountainlab
Just as expected.

However, I can only draw the conclusion, particularly since no custom maps appeared in the map vote, that the list of maps is done entirely on the client side. I would need to compare notes with someone else on the same server to be sure.

It's possible, then, that the boolean value to VoteStart is actually the value of the sv_vote_issue_nextlevel_choicesmode cvar when it's an nextlevel choices vote.

This is all the farther I've gotten so far. If someone has any insights, I'd love to hear them.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 05-24-2011 at 21:06.
Powerlord is offline
 



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 22:56.


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