XP_onDeath( iVictim, iAttacker, iWeaponIndex, iHeadshot )
{
// We don't want to give XP to the world
if ( iAttacker == 0 )
{
return;
}
// We don't want to give XP to suiciders
else if ( iAttacker == iVictim )
{
return;
}
new iLevel = p_data[iVictim][P_LEVEL]
new iBonusXP, iXP = floatround( XP_GivenByLevel( iLevel ) * fWpnXPMultiplier[iWeaponIndex] );
// Check for a team kill
if ( !iAttacker )
{
}
// Otherwise the player killed the other team
else
{
// Award XP for a kill
iBonusXP = XP_Give( iAttacker, iXP );
if ( iBonusXP != 0 && get_pcvar_num( CVAR_wc3_show_kill_obj ) )
{
client_print( iAttacker, print_chat, "%s You have been awarded %d XP for killing the enemy", g_MODclient, iBonusXP );
}
// User had a headshot? Give bonus XP!
if ( iHeadshot )
{
iBonusXP = XP_Give( iAttacker, KILL_HEADSHOT );
if ( iBonusXP != 0 && get_pcvar_num( CVAR_wc3_show_kill_obj ) )
{
client_print( iAttacker, print_chat, "%s You have been awarded %d XP for getting a headshot", g_MODclient, iBonusXP );
}
}
new iAssistLevel, iAssistXP, iVictimMaxHealth;
new Float:fMultiplier;
// Award XP for other people doing damage to this victim
for ( new i = 0; i < MAXPLAYERS; i++ )
{
// Then this player dealt some damage to this player this round
if ( g_iDamageDealt[iVictim] > 0 && iAttacker != i )
{
iVictimMaxHealth = get_user_maxhealth( iVictim );
fMultiplier = float( g_iDamageDealt[iVictim] ) / float( iVictimMaxHealth );
iAssistLevel = p_data[P_LEVEL];
iAssistXP = XP_GivenByLevel( iAssistLevel );
// Need a ratio of XP to award to person who dealt damage
iBonusXP = XP_Give( i, ( floatround( float( iAssistXP ) * fMultiplier ) / 2 ) );
if ( iBonusXP != 0 && get_pcvar_num( CVAR_wc3_show_kill_obj ) )
{
client_print( i, print_chat, "%s You have been awarded %d XP for a kill assist!", g_MODclient, iBonusXP );
}
// victim may respawn, so reset the counter
g_iDamageDealt[iVictim] = 0;
}
}
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
// User killed a hostage rescuer
if ( g_iPlayerRole[iVictim] == PLR_HOSTAGE_RESCUER )
{
iBonusXP = XP_Give( iAttacker, KILL_HOSTAGE_SAVER );
if ( iBonusXP != 0 && get_pcvar_num( CVAR_wc3_show_kill_obj ) )
{
client_print( iAttacker, print_chat, "%s You have been awarded %d XP for killing the hostage rescuer", g_MODclient, iBonusXP );
}
}
// User killed the bomb defuser
else if ( g_iPlayerRole[iVictim] == PLR_BOMB_DEFUSER )
{
iBonusXP = XP_Give( iAttacker, KILL_DEFUSER );
if ( iBonusXP != 0 && get_pcvar_num( CVAR_wc3_show_kill_obj ) )
{
client_print( iAttacker, print_chat, "%s You have been awarded %d XP for killing the bomb defuser", g_MODclient, iBonusXP );
}
}
// User killed the bomb planter
else if ( g_iPlayerRole[iVictim] == PLR_BOMB_PLANTER )
{
iBonusXP = XP_Give( iAttacker, KILL_PLANTER );
if ( iBonusXP != 0 && get_pcvar_num( CVAR_wc3_show_kill_obj ) )
{
client_print( iAttacker, print_chat, "%s You have been awarded %d XP for killing the bomb planter", g_MODclient, iBonusXP );
}
}
// User killed the bomb carrier
else if ( g_iPlayerRole[iVictim] == PLR_BOMB_CARRIER )
{
iBonusXP = XP_Give( iAttacker, KILL_BOMB_CARRIER );
if ( iBonusXP != 0 && get_pcvar_num( CVAR_wc3_show_kill_obj ) )
{
client_print( iAttacker, print_chat, "%s You have been awarded %d XP for killing the bomb carrier", g_MODclient, iBonusXP );
}
}
// user killed the VIP
else if ( g_iPlayerRole[iVictim] == PLR_VIP )
{
iBonusXP = XP_Give( iAttacker, KILL_VIP );
if ( iBonusXP != 0 && get_pcvar_num( CVAR_wc3_show_objectives ) )
{
client_print( iAttacker, print_chat, "%s You have been awarded %d XP for killing the VIP", g_MODclient, iBonusXP );
}
}
}
else if ( g_MOD == GAME_DOD )
{
}
// Player died, so lets reset their data
g_iPlayerRole[iVictim] = 0;
}
}
piemeram es to visu uzrakstiju xp.inl un man war3.sma liekt compile? un nebus vairs lost exp?
piemeram es to visu uzrakstiju xp.inl un man war3.sma liekt compile? un nebus vairs lost exp?