// Request for ref status or lists ref commands. void G_ref_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fValue) { char arg[MAX_TOKEN_CHARS]; // Roll through ref commands if already a ref if(ent == NULL || ent->client->sess.referee) { voteInfo_t votedata; trap_Argv(1, arg, sizeof(arg)); memcpy( &votedata, &level.voteInfo, sizeof( voteInfo_t ) ); if( Cmd_CallVote_f(ent, 0, qtrue) ) { memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) ); return; } else { memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) ); if(G_refCommandCheck(ent, arg)) { return; } else { G_refHelp_cmd(ent); } } return; } if(ent) { if(!Q_stricmp(refereePassword.string, "none") || !refereePassword.string[0]) { CP("cpm \"Sorry, referee status disabled on this server.\n\""); return; } if(trap_Argc() < 2) { CP("cpm \"Usage: ref [password]\n\""); return; } trap_Argv(1, arg, sizeof(arg)); if(Q_stricmp(arg, refereePassword.string)) { CP("cpm \"Invalid referee password!\n\""); return; } ent->client->sess.referee = 1; ent->client->sess.spec_invite = TEAM_AXIS | TEAM_ALLIES; AP(va("cp \"%s\n^3has become a referee\n\"", ent->client->pers.netname)); ClientUserinfoChanged( ent-g_entities ); } }
// Request for ref status or lists ref commands. void G_ref_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fValue) { char arg[MAX_TOKEN_CHARS]; // forty - in mod flood protection // yada - dont check this on console if( ent && ClientIsFlooding(ent, qfalse) ){ CP("print \"^1Spam Protection: ^7dropping ref\n\""); return; } // Roll through ref commands if already a ref if(ent == NULL || ent->client->sess.referee) { voteInfo_t votedata; trap_Argv(1, arg, sizeof(arg)); memcpy( &votedata, &level.voteInfo, sizeof( voteInfo_t ) ); if( Cmd_CallVote_f(ent, 0, qtrue) ) { memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) ); return; } else { memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) ); if(G_refCommandCheck(ent, arg)) { return; } else { G_refHelp_cmd(ent); } } return; } if(ent) { if(!Q_stricmp(refereePassword.string, "none") || !refereePassword.string[0]) { // CHRUKER: b046 - Was using the cpm command, but this is really just for the console. CP("print \"Sorry, referee status disabled on this server.\n\""); return; } if(trap_Argc() < 2) { // CHRUKER: b046 - Was using the cpm command, but this is really just for the console. CP("print \"Usage: ref [password]\n\""); return; } trap_Argv(1, arg, sizeof(arg)); if(Q_stricmp(arg, refereePassword.string)) { // CHRUKER: b046 - Was using the cpm command, but this is really just for the console. CP("print \"Invalid referee password!\n\""); return; } ent->client->sess.referee = 1; ent->client->sess.spec_invite = TEAM_AXIS | TEAM_ALLIES; AP(va("cp \"%s\n^3has become a referee\n\"", ent->client->pers.netname)); ClientUserinfoChanged( ent-g_entities ); } }
/* ================= ClientCommand ================= */ void ClientCommand( int clientNum ) { gentity_t *ent; char cmd[MAX_TOKEN_CHARS]; ent = g_entities + clientNum; if ( !ent->client ) { return; // not fully in game yet } trap_Argv( 0, cmd, sizeof( cmd ) ); if (Q_stricmp (cmd, "say") == 0) { Cmd_Say_f (ent, SAY_ALL, qfalse); return; } if (Q_stricmp (cmd, "say_team") == 0) { Cmd_Say_f (ent, SAY_TEAM, qfalse); return; } if (Q_stricmp (cmd, "tell") == 0) { Cmd_Tell_f ( ent ); return; } if (Q_stricmp (cmd, "vsay") == 0) { Cmd_Voice_f (ent, SAY_ALL, qfalse, qfalse); return; } if (Q_stricmp (cmd, "vsay_team") == 0) { Cmd_Voice_f (ent, SAY_TEAM, qfalse, qfalse); return; } if (Q_stricmp (cmd, "vtell") == 0) { Cmd_VoiceTell_f ( ent, qfalse ); return; } if (Q_stricmp (cmd, "vosay") == 0) { Cmd_Voice_f (ent, SAY_ALL, qfalse, qtrue); return; } if (Q_stricmp (cmd, "vosay_team") == 0) { Cmd_Voice_f (ent, SAY_TEAM, qfalse, qtrue); return; } if (Q_stricmp (cmd, "votell") == 0) { Cmd_VoiceTell_f ( ent, qtrue ); return; } if (Q_stricmp (cmd, "vtaunt") == 0) { Cmd_VoiceTaunt_f ( ent ); return; } if (Q_stricmp (cmd, "score") == 0) { Cmd_Score_f (ent); return; } // ignore all other commands when at intermission if (level.intermissiontime) { Cmd_Say_f (ent, qfalse, qtrue); return; } if (Q_stricmp (cmd, "give") == 0) Cmd_Give_f (ent); else if (Q_stricmp (cmd, "god") == 0) Cmd_God_f (ent); else if (Q_stricmp (cmd, "notarget") == 0) Cmd_Notarget_f (ent); else if (Q_stricmp (cmd, "noclip") == 0) Cmd_Noclip_f (ent); else if (Q_stricmp (cmd, "kill") == 0) Cmd_Kill_f (ent); else if (Q_stricmp (cmd, "teamtask") == 0) Cmd_TeamTask_f (ent); else if (Q_stricmp (cmd, "levelshot") == 0) Cmd_LevelShot_f (ent); else if (Q_stricmp (cmd, "follow") == 0) Cmd_Follow_f (ent); else if (Q_stricmp (cmd, "follownext") == 0) Cmd_FollowCycle_f (ent, 1); else if (Q_stricmp (cmd, "followprev") == 0) Cmd_FollowCycle_f (ent, -1); else if (Q_stricmp (cmd, "team") == 0) Cmd_Team_f (ent); else if (Q_stricmp (cmd, "where") == 0) Cmd_Where_f (ent); else if (Q_stricmp (cmd, "callvote") == 0) Cmd_CallVote_f (ent); else if (Q_stricmp (cmd, "vote") == 0) Cmd_Vote_f (ent); else if (Q_stricmp (cmd, "callteamvote") == 0) Cmd_CallTeamVote_f (ent); else if (Q_stricmp (cmd, "teamvote") == 0) Cmd_TeamVote_f (ent); else if (Q_stricmp (cmd, "gc") == 0) Cmd_GameCommand_f( ent ); else if (Q_stricmp (cmd, "setviewpos") == 0) Cmd_SetViewpos_f( ent ); else if (Q_stricmp (cmd, "stats") == 0) Cmd_Stats_f( ent ); else trap_SendServerCommand( clientNum, va("print \"unknown cmd %s\n\"", cmd ) ); }