I followed your method exactly and got it working fully. Thank you, zturtleman.
For anyone else trying to do this in the future, hopefully this will help you:
/server/server.h
extern cvar_t *skipVote;
/qcommon/cmd.c
void Cbuf_ExecuteText
// Custom callvote
int skipVote = (int)Cvar_Get("sv_skipVote", "0", 0)->integer;
if( skipVote == 1) {
Cvar_Set("sv_skipVote", "0");
return;
}
/server/sv_game.c
void SV_GameSendServerCommand( int clientNum, const char *text ) {
if ( clientNum == -1 ) {
if( strcmp(first,"print") == 0 ) {
if( strcmp(second,"\"^2Vote") == 0 && strcmp(third,"FAILED!") == 0 ) {
SV_SendServerCommand(NULL, "chat \"^2Vote FAILED!\n\"");
}
// print "^5Vote passed!\n"
else if( strcmp(second,"\"^5Vote") == 0 && strcmp(last,"passed!\"") == 0 ) {
SV_SendServerCommand(NULL, "chat \"^5Vote passed!\n\"");
}
intptr_t SV_GameSystemCalls( intptr_t *args ) {
case G_PRINT:
Com_Printf( "%s", (const char*)VMA(1) );
SV_ParsePrint( (const char*)VMA(1) );
void SV_ParsePrint( const char *Msg ) {
// Vote Passed: map_restart shuffle_teams
if( strcmp(first,"Vote_Passed") == 0 ){
if( strcmp(last,"shuffle_teams") == 0 ) {
// Custom callvote function
Cvar_Set("sv_skipVote", "1");
}
/server/sv_client.c
static qboolean SV_ClientCommand( client_t *cl, msg_t *msg ) {
if( strcmp(first,"callvote") == 0 ){
// Disable spectators from callvoting
if( ps->persistant[PERS_TEAM] != 0 ){
if( intermission[0] == '1' ){
SV_SendServerCommand( cl, "print \"^3You're not allowed to callvote during intermission.\n\"" );
proceed = 0;
} else {
if( strncmp(last,"callvote",8) == 0 ) {
proceed = 0;
SV_SendServerCommand( cl, "print \"\n^7Valid ^3callvote ^7commands are:\n^3----------------------------\n ^5map\n ^5map_restart\n ^5nextmap\n ^5promode\n ^5shuffle_teams\n\n\"" );
SV_SendServerCommand( cl, "print \"^7Usage: ^3/callvote <command> <params>\n^7For help type: ^3/callvote <command>\n\n\"" );
} else if( strncmp(first,"callvote",8) == 0 && strncmp(last,"callvote",8) != 0 ) {
if( strcmp(second,"map") != 0 && strcmp(second,"map_restart") != 0 && strcmp(second,"nextmap") != 0 && strcmp(second,"promode") != 0 && strcmp(second,"shuffle_teams") != 0 ){
proceed = 0;
}
else if(strcmp(second,"shuffle_teams")==0) {
int clientID = cl - svs.clients;
Cbuf_ExecuteText( EXEC_NOW, va( "spoof %i callvote map_restart shuffle_teams\n", clientID ) );
SV_SetConfigstring( CS_VOTE_STRING, "shuffle_teams" );
proceed = 0;
}
}
}
}