diff options
author | M. Kristall <mkpdev@gmail.com> | 2007-07-16 21:37:23 +0000 |
---|---|---|
committer | M. Kristall <mkpdev@gmail.com> | 2007-07-16 21:37:23 +0000 |
commit | 32685fe5624f4f7a722ebf27388b24711e772ff1 (patch) | |
tree | 1cddd999859567178672b67884797830e84f78cc /src | |
parent | ffbf946dd63dccf0d6b6553c8bc1c9da4d3c89b3 (diff) |
* (bug 3047) send team commands to spectating admins who can see team chat
* remove some more redundant checks and fix some command flags
* fix a number of spelling misteaks in messages
* show denybuild indicator in !listplayers
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_admin.c | 16 | ||||
-rw-r--r-- | src/game/g_cmds.c | 62 | ||||
-rw-r--r-- | src/game/g_utils.c | 6 |
3 files changed, 29 insertions, 55 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 0b3da10b..af9f6cb5 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -44,7 +44,7 @@ g_admin_cmd_t g_admin_cmds[ ] = }, {"allowbuild", G_admin_denybuild, "d", - "restore a player's ablity to build", + "restore a player's ability to build", "[^3name|slot#^7]" }, @@ -66,7 +66,7 @@ g_admin_cmd_t g_admin_cmds[ ] = }, {"denybuild", G_admin_denybuild, "d", - "take away a player's ablity to build", + "take away a player's ability to build", "[^3name|slot#^7]" }, @@ -2248,7 +2248,7 @@ qboolean G_admin_listplayers( gentity_t *ent, int skiparg ) char lname[ MAX_NAME_LENGTH ]; char lname2[ MAX_NAME_LENGTH ]; char guid_stub[ 9 ]; - char muted[ 2 ]; + char muted[ 2 ], denied[ 2 ]; int l; char lname_fmt[ 5 ]; @@ -2290,6 +2290,11 @@ qboolean G_admin_listplayers( gentity_t *ent, int skiparg ) { Q_strncpyz( muted, "M", sizeof( muted ) ); } + denied[ 0 ] = '\0'; + if( p->pers.denyBuild ) + { + Q_strncpyz( denied, "B", sizeof( denied ) ); + } l = 0; G_SanitiseName( p->pers.netname, n2 ); @@ -2332,7 +2337,7 @@ qboolean G_admin_listplayers( gentity_t *ent, int skiparg ) } - ADMBP( va( "%2i %s%s^7 %-2i %s^7 (*%s) ^1%1s^7 %s^7 %s%s^7%s\n", + ADMBP( va( "%2i %s%s^7 %-2i %s^7 (*%s) ^1%1s%1s^7 %s^7 %s%s^7%s\n", i, c, t, @@ -2340,6 +2345,7 @@ qboolean G_admin_listplayers( gentity_t *ent, int skiparg ) ( *lname ) ? lname2 : "", guid_stub, muted, + denied, p->pers.netname, ( *n ) ? "(a.k.a. " : "", n, @@ -2541,7 +2547,7 @@ qboolean G_admin_help( gentity_t *ent, int skiparg ) } ADMBP( va( "^3!help: ^7help for '!%s':\n", g_admin_cmds[ i ].keyword ) ); - ADMBP( va( " ^3Funtion: ^7%s\n", g_admin_cmds[ i ].function ) ); + ADMBP( va( " ^3Function: ^7%s\n", g_admin_cmds[ i ].function ) ); ADMBP( va( " ^3Syntax: ^7!%s %s\n", g_admin_cmds[ i ].keyword, g_admin_cmds[ i ].syntax ) ); ADMBP( va( " ^3Flag: ^7'%c'\n", g_admin_cmds[ i ].flag[ 0 ] ) ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 0d7a7b65..e362b40c 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -496,12 +496,6 @@ Cmd_Kill_f */ void Cmd_Kill_f( gentity_t *ent ) { - if( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) - return; - - if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE ) - return; - if( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) return; @@ -511,9 +505,6 @@ void Cmd_Kill_f( gentity_t *ent ) return; } - if( ent->health <= 0 ) - return; - if( g_cheats.integer ) { ent->flags &= ~FL_GODMODE; @@ -529,7 +520,7 @@ void Cmd_Kill_f( gentity_t *ent ) } else if( ent->suicideTime > level.time ) { - trap_SendServerCommand( ent-g_entities, "print \"Suicide cancelled\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Suicide canceled\n\"" ); ent->suicideTime = 0; } } @@ -1022,7 +1013,7 @@ void Cmd_CallVote_f( gentity_t *ent ) && !G_admin_permission( ent, ADMF_NO_VOTE_LIMIT ) ) { trap_SendServerCommand( ent-g_entities, va( - "print \"You have already called the maxium number of votes (%d)\n\"", + "print \"You have already called the maximum number of votes (%d)\n\"", g_voteLimit.integer ) ); return; } @@ -1269,7 +1260,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) && !G_admin_permission( ent, ADMF_NO_VOTE_LIMIT ) ) { trap_SendServerCommand( ent-g_entities, va( - "print \"You have already called the maxium number of votes (%d)\n\"", + "print \"You have already called the maximum number of votes (%d)\n\"", g_voteLimit.integer ) ); return; } @@ -1311,7 +1302,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) // make sure this player is on the same team if( clientNum != -1 && level.clients[ clientNum ].pers.teamSelection != - ent->client->pers.teamSelection ) + team ) { clientNum = -1; } @@ -1447,11 +1438,10 @@ Cmd_TeamVote_f */ void Cmd_TeamVote_f( gentity_t *ent ) { - int team, cs_offset = 0; + int cs_offset = 0; char msg[ 64 ]; - team = ent->client->pers.teamSelection; - if( team == PTE_ALIENS ) + if( ent->client->pers.teamSelection == PTE_ALIENS ) cs_offset = 1; if( !level.teamVoteTime[ cs_offset ] ) @@ -1897,12 +1887,6 @@ void Cmd_ActivateItem_f( gentity_t *ent ) upgrade = BG_FindUpgradeNumForName( s ); weapon = BG_FindWeaponNumForName( s ); - if( ent->client->pers.teamSelection != PTE_HUMANS ) - return; - - if( ent->client->pers.classSelection == PCL_NONE ) - return; - if( upgrade != UP_NONE && BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) ) BG_ActivateUpgrade( upgrade, ent->client->ps.stats ); else if( weapon != WP_NONE && BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ) ) @@ -1927,12 +1911,6 @@ void Cmd_DeActivateItem_f( gentity_t *ent ) trap_Argv( 1, s, sizeof( s ) ); upgrade = BG_FindUpgradeNumForName( s ); - if( ent->client->pers.teamSelection != PTE_HUMANS ) - return; - - if( ent->client->pers.classSelection == PCL_NONE ) - return; - if( BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) ) BG_DeactivateUpgrade( upgrade, ent->client->ps.stats ); else @@ -1954,9 +1932,6 @@ void Cmd_ToggleItem_f( gentity_t *ent ) upgrade = BG_FindUpgradeNumForName( s ); weapon = BG_FindWeaponNumForName( s ); - if( ent->client->pers.teamSelection != PTE_HUMANS ) - return; - if( weapon != WP_NONE ) { //special case to allow switching between @@ -2028,10 +2003,6 @@ void Cmd_Buy_f( gentity_t *ent ) trap_Argv( 1, s, sizeof( s ) ); - //aliens don't buy stuff - if( ent->client->pers.teamSelection != PTE_HUMANS ) - return; - weapon = BG_FindWeaponNumForName( s ); upgrade = BG_FindUpgradeNumForName( s ); @@ -2228,10 +2199,6 @@ void Cmd_Sell_f( gentity_t *ent ) trap_Argv( 1, s, sizeof( s ) ); - //aliens don't sell stuff - if( ent->client->pers.teamSelection != PTE_HUMANS ) - return; - //no armoury nearby if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) ) { @@ -2500,8 +2467,7 @@ void Cmd_Boost_f( gentity_t *ent ) if( ent->client->pers.cmd.buttons & BUTTON_WALKING ) return; - if( ( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) && - ( ent->client->ps.stats[ STAT_STAMINA ] > 0 ) ) + if( ent->client->ps.stats[ STAT_STAMINA ] > 0 ) ent->client->ps.stats[ STAT_STATE ] |= SS_SPEEDBOOST; } @@ -2898,13 +2864,13 @@ commands_t cmds[ ] = { { "build", CMD_TEAM|CMD_LIVING, Cmd_Build_f }, { "deconstruct", CMD_TEAM|CMD_LIVING, Cmd_Destroy_f }, - { "buy", CMD_HUMAN, Cmd_Buy_f }, - { "sell", CMD_HUMAN, Cmd_Sell_f }, - { "itemact", CMD_HUMAN, Cmd_ActivateItem_f }, - { "itemdeact", CMD_HUMAN, Cmd_DeActivateItem_f }, - { "itemtoggle", CMD_HUMAN, Cmd_ToggleItem_f }, - { "reload", CMD_HUMAN, Cmd_Reload_f }, - { "boost", CMD_HUMAN, Cmd_Boost_f } + { "buy", CMD_HUMAN|CMD_LIVING, Cmd_Buy_f }, + { "sell", CMD_HUMAN|CMD_LIVING, Cmd_Sell_f }, + { "itemact", CMD_HUMAN|CMD_LIVING, Cmd_ActivateItem_f }, + { "itemdeact", CMD_HUMAN|CMD_LIVING, Cmd_DeActivateItem_f }, + { "itemtoggle", CMD_HUMAN|CMD_LIVING, Cmd_ToggleItem_f }, + { "reload", CMD_HUMAN|CMD_LIVING, Cmd_Reload_f }, + { "boost", CMD_HUMAN|CMD_LIVING, Cmd_Boost_f } }; static int numCmds = sizeof( cmds ) / sizeof( cmds[ 0 ] ); diff --git a/src/game/g_utils.c b/src/game/g_utils.c index fb8a54dd..2206341a 100644 --- a/src/game/g_utils.c +++ b/src/game/g_utils.c @@ -162,8 +162,10 @@ void G_TeamCommand( pTeam_t team, char *cmd ) { if( level.clients[ i ].pers.connected == CON_CONNECTED ) { - if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == team ) - trap_SendServerCommand( i, va( "%s", cmd ) ); + if( level.clients[ i ].pers.teamSelection == team || + ( level.clients[ i ].pers.teamSelection == PTE_NONE && + G_admin_permission( &g_entities[ i ], ADMF_SPEC_ALLCHAT ) ) ) + trap_SendServerCommand( i, cmd ); } } } |