Matchmode..

This commit is contained in:
Daniel Simoes 2002-02-02 16:34:02 +00:00
parent cba8eedc9f
commit 66bb85d216
2 changed files with 48 additions and 0 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.43 2002/02/02 16:34:02 slicer
// Matchmode..
//
// Revision 1.42 2002/01/31 02:53:28 blaze
// err, make that playerstats command
//
@ -2553,6 +2556,7 @@ void Cmd_PlayerStats_f( gentity_t *ent )
ClientCommand
=================
*/
void ClientCommand( int clientNum ) {
gentity_t *ent;
char cmd[MAX_TOKEN_CHARS];
@ -2654,6 +2658,10 @@ void ClientCommand( int clientNum ) {
Cmd_SetViewpos_f( ent );
else if (Q_stricmp (cmd, "stats") == 0)
Cmd_Stats_f( ent );
//Slicer: matchmode
else if (Q_stricmp (cmd, "captain") == 0 && g_matchmode.integer)
MM_Captain_f( ent );
// Begin Duffman
else if (Q_stricmp (cmd, "reload") == 0)
{

View file

@ -2,6 +2,18 @@
/* Slicer - This will work on all MatchMode Aspects..
timers, votes, etc etc. Called on each Frame*/
qboolean checkCaptain(team_t team) {
gentity_t *ent;
int i;
for (i = 0; i < level.maxclients; i++) {
ent = &g_entities[i];
if (!ent->inuse)
continue;
if(ent->client->sess.sessionTeam == team && ent->client->pers.captain == team)
return qtrue;
}
return qfalse;
}
void MM_RunFrame(void) {
int fps;
@ -15,5 +27,33 @@ void MM_RunFrame(void) {
break;
}
}
void MM_Captain_f( gentity_t *ent ) {
if(ent->client->sess.sessionTeam == TEAM_FREE) {
trap_SendServerCommand(ent-g_entities, "print \"You need to be on a team for that\n\"");
return;
}
if(ent->client->pers.captain != TEAM_FREE) {
if(ent->client->sess.sessionTeam == TEAM_RED) {
level.team1ready = qfalse;
trap_SendServerCommand( -1, va("print \"%s is no longer %s's Captain!\n\"",
ent->client->pers.netname,"Red Team"));// Teams will have names in the future..
}
else {
level.team2ready = qfalse;
trap_SendServerCommand( -1, va("print \"%s is no longer %s's Captain!\n\"",
ent->client->pers.netname,"Blue Team"));// Teams will have names in the future..
}
ent->client->pers.captain = TEAM_FREE;
}
if(checkCaptain(ent->client->sess.sessionTeam)) {
trap_SendServerCommand(ent-g_entities, va("print \"Your team already has a Captain\n\""));
return;
}
}