Hi, I haven't touched anything Pawn in many years and I'm a little green.
I want to get the owner of a third entity such as a bazooka.
The plugin works like this:
1-You buy the Item, you receive a flag.
2-If the victim receives 500HP of damage from a Player (the player receives another flag).
3-If the victim dies, all the attackers that inflicted a damage of 500HP, will also die.
So far everything works fine,
the problem comes when we handle third entities, such as the famous plugins of:
1-ZP Bazooka.
2-ZP Taun Cannon.
3-ZP Plasma Rifle.
4-Other entities that cause harm to the victim "Player".
I have tried everything and searched but without success, I do not handle the issue of entities well.
PHP Code:
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if (flag_get(g_IsSweetRevenge, victim) && !zp_core_is_zombie(attacker))
{
if (victim == attacker || !is_user_alive(attacker))
return HAM_IGNORED;
if(is_user_alive(victim) && !zp_core_is_zombie(attacker) || is_user_alive(victim) && !zp_core_is_zombie(inflictor))
{
g_fDamage[attacker] += damage;
set_hudmessage(255, 255, 0, 0.03, 0.88, 0, 6.0, 4.0, 0.1, 0.2, 4)
ShowSyncHudMsg(attacker, g_hudmsg1, "Zombie Hurt Limit: %.2fHP/%iHP.", g_fDamage[attacker], 500) // Example damage
if (g_fDamage[attacker] >= 500) // Example damage
{
flag_set(g_IsAttacker, attacker)
if (flag_get(g_IsAttacker, attacker))
set_user_rendering(attacker, kRenderFxGlowShell, 255, 255, 0, kRenderNormal , 15)
}
}
}
return HAM_IGNORED;
}
public fw_PlayerKilled(victim, attacker, shouldgib)
{
if (flag_get(g_IsSweetRevenge, victim))
{
if (is_user_alive(victim) || !zp_core_is_zombie(victim))
return;
static victim_name[33]
get_user_name(victim, victim_name, sizeof victim_name -1)
ChatColor(0, "!gZombie %s !tbought '!gSweet Revenge!t' and everyone who !gHurt Zombie!t: !g500HP !talso !gDied!t!", victim_name)
for( new id = 1; id <= 32; id++ )
{
if (flag_get(g_IsAttacker, id))
{
set_user_rendering(id)
user_kill(id);
g_fDamage[id] = 0.0;
}
}
flag_unset(g_IsSweetRevenge, victim)
}
}