diff --git a/mp/src/game/server/sdk/sdk_eventlog.cpp b/mp/src/game/server/sdk/sdk_eventlog.cpp index 6af8d3250..e6a78bf64 100644 --- a/mp/src/game/server/sdk/sdk_eventlog.cpp +++ b/mp/src/game/server/sdk/sdk_eventlog.cpp @@ -11,6 +11,7 @@ #include "sdk_player.h" #include "sdk_team.h" +#include "vote_controller.h" class CSDKEventLog : public CEventLog { @@ -43,6 +44,7 @@ class CSDKEventLog : public CEventLog #if defined ( SDK_USE_PLAYERCLASSES ) ListenForGameEvent( "player_changeclass" ); #endif // SDK_USE_PLAYERCLASSES + ListenForGameEvent( "vote_cast" ); return true; } @@ -104,6 +106,22 @@ class CSDKEventLog : public CEventLog return true; } #endif // SDK_USE_PLAYERCLASSES + if ( FStrEq( eventName, "vote_cast" ) ) + { + CSDKPlayer *pVoter = ToSDKPlayer(UTIL_EntityByIndex(event->GetInt("entityid"))); + if (!pVoter) + return false; + + CTeam *team = pVoter->GetTeam(); + + UTIL_LogPrintf("Vote cast: \"%s<%i><%s><%s>\" voted for option \"%s\"\n", + pVoter->GetPlayerName(), + pVoter->GetUserID(), + pVoter->GetNetworkIDString(), + team ? team->GetName() : "", + g_voteController->GetVoteOption(event->GetInt("vote_option")) + ); + } return false; } diff --git a/mp/src/game/server/vote_controller.h b/mp/src/game/server/vote_controller.h index fc10e3683..eaf89a71b 100644 --- a/mp/src/game/server/vote_controller.h +++ b/mp/src/game/server/vote_controller.h @@ -101,6 +101,7 @@ class CVoteController : public CBaseEntity void TrackVoteCaller( CBasePlayer *pPlayer ); bool CanEntityCallVote( CBasePlayer *pPlayer, int &nCooldown ); bool IsVoteActive( void ) { return m_iActiveIssueIndex != INVALID_ISSUE; } + const char * GetVoteOption( int iIndex ) { return m_VoteOptions[iIndex]; } protected: void ResetData( void );