Quote:
Originally Posted by tedaimlocks
|
Fixed
PHP Code:
public Laser_TakeDamage(victim, inflictor, attacker, Float:f_Damage, bit_Damage)
{
if(get_pcvar_num(g_LBEO))
{
new i_Owner;
// Obtain the ID of the player who put mine
i_Owner = pev(victim, LASERMINE_OWNER);
// Check team and owner conditions
if(CsTeams:pev(victim, LASERMINE_TEAM) == cs_get_user_team(attacker) && i_Owner != attacker)
return HAM_SUPERCEDE;
// Display health and owner name
new ownerName[32], message[128];
get_user_name(i_Owner, ownerName, sizeof(ownerName)); // Get owner name
new Float:currentHealth = pev(victim, pev_health) - f_Damage; // Calculate new health after damage
// Format and display the message
format(message, sizeof(message), "Health: %.0f - Owner: %s", currentHealth, ownerName);
// Display the message at the center of the screen
client_print(attacker, print_center, message);
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}
To
PHP Code:
public Laser_TakeDamage(victim, inflictor, attacker, Float:f_Damage, bit_Damage)
{
new victimClassname[32];
pev(victim, pev_classname, victimClassname, sizeof(victimClassname));
if(!equal(victimClassname, ENT_CLASS_NAME))
return PLUGIN_CONTINUE;
if(get_pcvar_num(g_LBEO))
{
new i_Owner;
// Obtain the ID of the player who put mine
i_Owner = pev(victim, LASERMINE_OWNER);
// Check team and owner conditions
if(CsTeams:pev(victim, LASERMINE_TEAM) == cs_get_user_team(attacker) && i_Owner != attacker)
return HAM_SUPERCEDE;
// Display health and owner name
new ownerName[32], message[128];
get_user_name(i_Owner, ownerName, sizeof(ownerName)); // Get owner name
new Float:currentHealth = pev(victim, pev_health) - f_Damage; // Calculate new health after damage
// Format and display the message
format(message, sizeof(message), "Health: %.0f - Owner: %s", currentHealth, ownerName);
// Display the message at the center of the screen
client_print(attacker, print_center, message);
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}