From 60692771589309319ea571ffaabefdd500b5c512 Mon Sep 17 00:00:00 2001
From: "Tony J. White" <tjw@tjw.org>
Date: Mon, 13 Nov 2006 23:53:01 +0000
Subject: * (bug 2921) don't allow team switch until build timer expires

---
 src/game/g_cmds.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 56446139..9c1dd05b 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -743,6 +743,20 @@ void Cmd_Team_f( gentity_t *ent )
     return;
   }
 
+  //guard against build timer exploit
+  if( ent->client->pers.teamSelection != PTE_NONE &&
+     ( ent->client->ps.stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0 ||
+       ent->client->ps.stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0_UPG ||
+       BG_InventoryContainsWeapon( WP_HBUILD, ent->client->ps.stats ) ||
+       BG_InventoryContainsWeapon( WP_HBUILD2, ent->client->ps.stats ) ) &&
+      ent->client->ps.stats[ STAT_MISC ] > 0 )
+  {
+    trap_SendServerCommand( ent-g_entities,
+        va( "print \"You cannot change teams until build timer expires\n\"" ) );
+    return;
+  }
+
+
   G_ChangeTeam( ent, team );
 
   if( team == PTE_ALIENS )
-- 
cgit