Team Kills Plugin v0.1 [ UNTESTED ]
PHP Code:
#include < amxmodx >
new const PLUGIN[ ] = "Team Kills";
new const VERSION[ ] = "0.1";
new const AUTHOR[ ] = "ZOF 'X";
#pragma semicolon 1
#define MAX_PLAYERS 32
#define IsPlayer(%1) ( 1 <= %1 <= iMaxPlayers )
new iMaxPlayers, iSyncHud;
new gTeamKills[ MAX_PLAYERS + 1 ];
public plugin_init( ) {
register_plugin( PLUGIN, VERSION, AUTHOR );
register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" );
set_task( 0.9, "TASK_SHOWHUD", _, _, _, "b" );
iSyncHud = CreateHudSyncObj( );
iMaxPlayers = get_maxplayers( );
}
public client_death( iKiller, iVictim, iWeaponID, iHitPlace, iTeamKill ) {
if( iTeamKill && IsPlayer( iKiller ) && IsPlayer( iVictim ) ) {
gTeamKills[ iKiller ]++;
}
}
public EventNewRound( ) {
static Players[ MAX_PLAYERS ], iNum, id;
get_players( Players, iNum );
while( --iNum >= 0 ) {
id = Players[ iNum ];
gTeamKills[ id ] = 0;
}
}
public TASK_SHOWHUD( ) {
static Players[ MAX_PLAYERS ], iNum, id;
get_players( Players, iNum );
while( --iNum >= 0 ) {
id = Players[ iNum ];
set_hudmessage( 000, 160, 000, _, 0.00, _, 1.0, 1.0 );
ShowSyncHudMsg( id, iSyncHud, "Team Kill: %d", gTeamKills[ id ] );
}
}