Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <csx>
#include <fun>
#if !defined MAX_AUTHID_LENGTH
const MAX_AUTHID_LENGTH = 64
#endif
#if !defined MAX_NAME_LENGTH
const MAX_NAME_LENGTH = 32
#endif
#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif
new const Version[ ] = "1.0";
new bool:g_isDead[ MAX_PLAYERS + 1 ];
public plugin_init( )
{
register_plugin( "C4 Kill Award", Version, "Supremache" );
register_cvar("C4KillAward", Version, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED );
RegisterHam( Ham_Spawn, "player", "OnPlayerSpawn", 1 )
RegisterHam( Ham_Killed, "player", "OnPlayerKilled", 1 )
}
public client_connect( id )
{
g_isDead[ id ] = false;
}
public OnPlayerSpawn( id )
{
g_isDead[ id ] = false;
}
public OnPlayerKilled( iVictim )
{
g_isDead[ iVictim ] = true;
}
public bomb_explode( iPlanter, iDefuser )
{
new szName[ MAX_PLAYERS + 1 ][ MAX_NAME_LENGTH ],
szSteamID[ MAX_PLAYERS + 1 ][ MAX_AUTHID_LENGTH ],
szTeam[ MAX_PLAYERS + 1 ][ 10 ],
iPlayers[ MAX_PLAYERS ],
iNum,
iAward;
get_user_name( iPlanter, szName[ iPlanter ], charsmax( szName[ ] ) );
get_user_authid( iPlanter, szSteamID[ iPlanter ], charsmax( szSteamID[ ] ) );
get_user_team( iPlanter, szTeam[ iPlanter ], charsmax( szTeam[ ] ) );
get_players( iPlayers, iNum, "bche", "CT" );//szTeam[ iPlanter ][ 7 ] == 'c' ? "TERRORIST" : "CT" );
for( new i, iPlayer; i < iNum; i++ )
{
iPlayer = iPlayers[ i ];
if( is_user_connected( iPlayer ) && !g_isDead[ iPlayer ] )
{
message_begin( MSG_BROADCAST, 83, { 0, 0, 0 }, 0 );
write_byte( iPlanter );
write_byte( iPlayer );
write_byte( 0 );
write_string( "c4" );
message_end( );
iAward++;
log_message( "%s | %s | %s Killed %s | %s | %s By C4", szName[ iPlanter ], szSteamID[ iPlanter ], szTeam[ iPlanter ], szName[ iPlayer ], szSteamID[ iPlayer ], szTeam[ iPlayer ] );
}
}
if( iAward )
{
set_user_frags( iPlanter, get_user_frags( iPlanter ) + iAward )
}
}