i builted a Power Attack for basebuilder.
when some one is the last human he gets +10% bonus damage for each kill
maximum 200%
i tested the plugin in my home private server with cmd.
the debug show non errors then why the plugin dosent work ?
Code :
PHP Code:
/* Plugin generated by AMXX-Studio */
#include < amxmodx >
#include < cstrike >
#include < fakemeta >
#include < hamsandwich >
new iHumanKills[33 ], IsLast [ 33 ];
public plugin_init()
{
register_plugin( "Power Attack", "1.0", "Xdoctor" )
RegisterHam( Ham_TakeDamage, "player", "FwdHamTakeDamage" );
register_logevent( "EventRoundStart", 2, "1=Round_Start" );
register_event( "DeathMsg", "evDeathMsg", "a" );
register_forward( FM_PlayerPreThink, "fw_Player_PreThink" )
}
public client_putinserver( client ) iHumanKills[ client ] = 0;
public client_disconnect( client ) iHumanKills[ client ] = 0;
public EventRoundStart( client )
return iHumanKills[ client ] = 0;
public fw_Player_PreThink( client )
{
new Players[ 32 ], iNum;
get_players( Players, iNum, "aceh", "CT" );
if( iNum == 1 )
return IsLast[ client ] = true;
else
return IsLast[ client ] = false;
if( !is_user_alive( client ) || !IsLast[ client ] )
return 1;
if( is_user_alive( client ) )
{
if( IsLast[ client ] )
{
set_hudmessage( 0, 255, 0, 0.30, 0.78, 0, 6.0, 1.0 )
show_hudmessage( client, "Power Attack [ %i% ]^n [ %s%s%s%s%s%s%s%s%s%s ]", 100 + iHumanKills[ client ] * 10,
iHumanKills[ client ] < 1 ? "-" : "+",
iHumanKills[ client ] < 2 ? "-" : "+",
iHumanKills[ client ] < 3 ? "-" : "+",
iHumanKills[ client ] < 4 ? "-" : "+",
iHumanKills[ client ] < 5 ? "-" : "+",
iHumanKills[ client ] < 6 ? "-" : "+",
iHumanKills[ client ] < 7 ? "-" : "+",
iHumanKills[ client ] < 8 ? "-" : "+",
iHumanKills[ client ] < 9 ? "-" : "+",
iHumanKills[ client ] < 10 ? "-" : "+" )
}
}
return 1;
}
public evDeathMsg( client )
{
new iAttacker = read_data( 1 );
new iVictim = read_data( 2 );
if( !is_user_connected( iAttacker ) || !is_user_connected( iVictim ) || !is_user_alive( iAttacker ) )
return 1;
if( is_user_bot( iVictim ) || is_user_hltv( iVictim ) )
return 1;
if( cs_get_user_team( iAttacker ) == CS_TEAM_CT && cs_get_user_team( iVictim ) == CS_TEAM_T )
{
if( IsLast[ iAttacker ] )
{
if( iHumanKills[ iAttacker ] <= 9 )
{
iHumanKills[ iAttacker ] += 1;
ColorChat( iAttacker, "You recived^4 10%^3 damage bonus^1 for ^3for^1 killing a^4 Zombie." );
}
}
}
return 1;
}
public FwdHamTakeDamage( iVictim, Inflicator, iAttacker, Float: fDamage, DamageBits )
{
if( IsLast[ iAttacker ] && cs_get_user_team( iAttacker ) == CS_TEAM_CT )
{
if( iHumanKills[ iAttacker ] <= 10 )
{
SetHamParamFloat( 4, fDamage + iHumanKills[ iAttacker ] * 0.2 );
}
}
return 1;
}
stock ColorChat( const client, const string[ ], { Float, Sql, Resul, _ } :... )
{
new msg[ 191 ], players[ 32 ], count = 1;
static len; len = formatex( msg, charsmax(msg), "^1[ ^4BaseBuilder^1 ] " );
vformat( msg[ len ], charsmax( msg ) - len, string, 3 );
if( client ) players[ 0 ] = client;
else get_players( players,count, "ch" );
for( new i = 0; i < count; i++ )
{
if( is_user_connected( players[ i ] ) )
{
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ),_, players[ i ] );
write_byte( players[ i ] );
write_string( msg );
message_end( );
}
}
}