Quote:
Originally Posted by OciXCrom
I don't see a problem there.
Other than that, show the full code so we can see how you're using it.
|
This is a small example of what I'm trying to do, again it works, but only 70% of the time, the other 30% I either don't get assists or the name of the assist belongs to a different player (which did not get assistance)
PHP Code:
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if (victim == attacker || !is_user_alive(attacker) || !is_user_alive(victim))
return
if(!g_hp_victim[victim])
g_hp_victim[victim] = get_user_health(victim) / 3
if(zp_core_is_zombie(attacker)
&& !zp_class_survivor_get(victim))
{
g_fDamage_Human[victim][attacker] += damage;
if(g_fDamage_Human[victim][attacker] >= g_hp_victim[victim] && !g_victim_done[victim][attacker])
{
g_count_victim_human[attacker]++;
g_victim_done[victim][attacker] = true;
new name[32]
get_user_name(victim, name, charsmax(name))
client_print(id, print_chat, "You got a assist of %s", name)
}
}
if(!zp_core_is_zombie(attacker)
&& !zp_core_is_first_zombie(victim)
&& !zp_class_nemesis_get(victim))
{
g_fDamage_Zombie[victim][attacker] += damage;
if(g_fDamage_Zombie[victim][attacker] >= g_hp_victim[victim] && !g_victim_done[victim][attacker])
{
g_count_victim_zombie[attacker]++;
g_victim_done[victim][attacker] = true;
new name[32]
get_user_name(victim, name, charsmax(name))
client_print(id, print_chat, "You got a assist of %s", name)
}
}
}
public fw_Killed(victim, attacker, shouldgib)
{
if (victim == attacker || !is_user_connected(attacker))
return
if(zp_core_is_zombie(attacker)
&& g_count_victim_human[attacker]
&& !zp_class_survivor_get(victim))
{
if(g_count_victim_human[attacker])
g_count_victim_human[attacker]--;
g_fDamage_Human[victim][attacker] = 0.0;
g_he_attacker[attacker] = true;
}
if(!zp_core_is_zombie(attacker)
&& g_count_victim_zombie[attacker]
&& !zp_core_is_first_zombie(victim)
&& !zp_class_nemesis_get(victim))
{
if(g_count_victim_zombie[attacker])
g_count_victim_zombie[attacker]--;
g_fDamage_Zombie[victim][attacker] = 0.0;
g_he_attacker[attacker] = true;
}
for(new id = 1; id <= 32; id++)
{
if(is_user_alive(id)
&& zp_core_is_zombie(id)
&& !g_he_attacker[id]
&& g_count_victim_human[id]
&& g_victim_done[victim][id]
&& !zp_class_survivor_get(victim))
{
new name[32]
get_user_name(victim, name, charsmax(name))
client_print(id, print_chat, "You got a assist of %s", name)
if(g_count_victim_human[id])
g_count_victim_human[id]--;
g_victim_done[victim][id] = false;
g_fDamage_Human[victim][id] = 0.0;
}
if(is_user_alive(id)
&& !zp_core_is_zombie(id)
&& !g_he_attacker[id]
&& g_count_victim_zombie[id]
&& g_victim_done[victim][id]
&& !zp_core_is_first_zombie(victim)
&& !zp_class_nemesis_get(victim))
{
new name[32]
get_user_name(victim, name, charsmax(name))
client_print(id, print_chat, "You got a assist of %s", name)
if(g_count_victim_zombie[id])
g_count_victim_zombie[id]--;
g_victim_done[victim][id] = false;
g_fDamage_Zombie[victim][id] = 0.0;
}
}
if(zp_core_is_zombie(victim))
{
g_count_victim_human[victim] = 0;
g_fDamage_Human[victim][attacker] = 0.0;
}
if(!zp_core_is_zombie(victim))
{
g_count_victim_zombie[victim] = 0;
g_fDamage_Zombie[victim][attacker] = 0.0;
}
g_victim_done[victim][attacker] = false;
g_hp_victim[victim] = 0;
g_he_attacker[attacker] = false;
}