Skip to content

Commit

Permalink
Add log messages for cast votes
Browse files Browse the repository at this point in the history
  • Loading branch information
TomyLobo committed Jun 13, 2016
1 parent e1c687d commit c9c3135
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mp/src/game/server/sdk/sdk_eventlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "sdk_player.h"
#include "sdk_team.h"
#include "vote_controller.h"

class CSDKEventLog : public CEventLog
{
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions mp/src/game/server/vote_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit c9c3135

Please sign in to comment.