Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < amxmodx >
- #include < amxmisc >
- #include < cstrike >
- enum TeamData {
- CsTeams:TD_iTeam,
- TD_szInput[ 20 ]
- };
- new const g_iTeamData[ ][ TeamData ] = {
- { CS_TEAM_UNASSIGNED, "U" },
- { CS_TEAM_UNASSIGNED, "UNASSIGNED" },
- { CS_TEAM_T, "T" },
- { CS_TEAM_T, "TS" },
- { CS_TEAM_T, "TER" },
- { CS_TEAM_T, "TERR" },
- { CS_TEAM_T, "TERROR" },
- { CS_TEAM_T, "TERRORIST" },
- { CS_TEAM_T, "TERRORISTS" },
- { CS_TEAM_CT, "CT" },
- { CS_TEAM_CT, "CTS" },
- { CS_TEAM_CT, "COUNTERTERRORIST" },
- { CS_TEAM_CT, "COUNTERTERRORISTS" },
- { CS_TEAM_CT, "COUNTER-TERRORIST" },
- { CS_TEAM_CT, "COUNTER-TERRORISTS" },
- { CS_TEAM_SPECTATOR, "S" },
- { CS_TEAM_SPECTATOR, "SPEC" },
- { CS_TEAM_SPECTATOR, "SPECS" },
- { CS_TEAM_SPECTATOR, "SPECTATOR" },
- { CS_TEAM_SPECTATOR, "SPECTATORS" }
- };
- new Trie:g_tTeamData;
- new const g_szTeamNames[ CsTeams ][ ] = {
- "Unassigned",
- "Terrorist",
- "Counter-Terrorist",
- "Spectator"
- };
- public plugin_init( ) {
- register_plugin( "Ban Team", "0.0.1", "Exolent" );
- register_concmd( "amx_banteam", "CmdBanTeam", ADMIN_BAN, "<team name> <time> [ban type=0] -- ban type: 0 = amx_ban, 1 = amx_banip" );
- g_tTeamData = TrieCreate( );
- for( new i = 0; i < sizeof( g_iTeamData ); i++ ) {
- TrieSetCell( g_tTeamData, g_iTeamData[ i ][ TD_szInput ], g_iTeamData[ i ][ TD_iTeam ] );
- }
- }
- public plugin_end( ) {
- TrieDestroy( g_tTeamData );
- }
- public CmdBanTeam( iPlayer, iLevel, iCId ) {
- if( !cmd_access( iPlayer, iLevel, iCId, 3 ) ) {
- return PLUGIN_HANDLED;
- }
- new szTeam[ 20 ];
- read_argv( 1, szTeam, 19 );
- strtoupper( szTeam );
- new CsTeams:iTeam;
- if( !TrieGetCell( g_tTeamData, szTeam, iTeam ) ) {
- console_print( iPlayer, "Invalid team." );
- return PLUGIN_HANDLED;
- }
- read_argv( 2, szTeam, 19 );
- new iTime = str_to_num( szTeam );
- read_argv( 3, szTeam, 19 );
- new bool:bBanIP = ( str_to_num( szTeam ) == 1 );
- new iPlayers[ 32 ], iNum, iTarget;
- get_players( iPlayers, iNum, "c" );
- for( new i = 0; i < iNum; i++ ) {
- iTarget = iPlayers[ i ];
- if( cs_get_user_team( iTarget ) == iTeam ) {
- client_cmd( iPlayer, "%s #%i %i", bBanIP ? "amx_banip" : "amx_ban", get_user_userid( iTarget ), iTime );
- }
- }
- console_print( iPlayer, "Banned all %s players.", g_szTeamNames[ iTeam ] );
- return PLUGIN_HANDLED;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement