Senior Member
Join Date: Jan 2015
Location: India,kolkata
|
01-18-2021
, 16:23
Weird bug / issue
|
#1
|
Hey guys.
In my ZP before round start i.e. before infection and after round end when I shoot my teammates i.e. other humans they start bleeding. I cant seem to fix it.
Can anyone tell me whats wrong in my code whixh is causing the problem ?
Ham_TraceAttack function --
PHP Code:
// Ham Trace Attack Forward
public OnTraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type, ptr)
{
// Non-player damage or self damage
if (victim == attacker || !is_user_valid_connected(attacker))
return HAM_IGNORED
// New round starting or round ended
if (g_newround || g_endround)
return HAM_SUPERCEDE
// Victim shouldn't take damage or victim is frozen
if (g_nodamage[victim] || g_frozen[victim])
return HAM_SUPERCEDE
// Prevent friendly fire
if (g_zombie[attacker] == g_zombie[victim])
return HAM_SUPERCEDE
// Victim isn't a zombie or not bullet damage, nothing else to do here
if (!g_zombie[victim] || !(damage_type & DMG_BULLET))
return HAM_IGNORED
// Knockback disabled, nothing else to do here
if (KNOCKBACK_ENABLED == 0)
return HAM_IGNORED
// Get whether the victim is in a crouch state
static ducking
ducking = pev(victim, pev_flags) & (FL_DUCKING | FL_ONGROUND) == (FL_DUCKING | FL_ONGROUND)
// Zombie knockback when ducking disabled
if (ducking && KNOCKBACK_DUCKING == 0.0)
return HAM_IGNORED
// Get distance between players
static origin1[3], origin2[3]
get_user_origin(victim, origin1)
get_user_origin(attacker, origin2)
// Max distance exceeded
if (get_distance(origin1, origin2) > KNOCKBACK_DISTANCE)
return HAM_IGNORED
// Get victim's velocity
static Float:velocity[3]
pev(victim, pev_velocity, velocity)
// Use damage on knockback calculation
xs_vec_mul_scalar(direction, damage, direction)
// Use weapon power on knockback calculation
xs_vec_mul_scalar(direction, kb_weapon_power[g_currentweapon[attacker]], direction)
// Apply ducking knockback multiplier
if (ducking)
xs_vec_mul_scalar(direction, KNOCKBACK_DUCKING, direction)
// Apply zombie class/nemesis knockback multiplier
if (g_nemesis[victim])
xs_vec_mul_scalar(direction, KNOCKBACK_NEMESIS, direction)
else if (g_assassin[victim])
xs_vec_mul_scalar(direction, KNOCKBACK_ASSASSIN, direction)
else if (g_bombardier[victim])
xs_vec_mul_scalar(direction, KNOCKBACK_BOMBARDIER, direction)
else
xs_vec_mul_scalar(direction, g_zombie_knockback[victim], direction)
// Add up the new vector
xs_vec_add(velocity, direction, direction)
// Make knockback also affect vertical velocity
direction[2] = velocity[2]
return HAM_IGNORED
}
and Ham_TakeDamage function --
PHP Code:
// Ham Take Damage Forward
public OnTakeDamage(victim, inflictor, attacker, Float:damage, damage_type, ptr)
{
// Non-player damage or self damage
if (victim == attacker || !is_user_valid_connected(attacker))
return HAM_IGNORED
// New round starting or round ended
if (g_newround || g_endround)
return HAM_SUPERCEDE
// Victim shouldn't take damage
if (g_nodamage[victim])
return HAM_SUPERCEDE
// Prevent friendly fire
if (g_zombie[attacker] == g_zombie[victim])
return HAM_SUPERCEDE
// Set Sniper's damage
if (g_sniper[attacker] && g_currentweapon[attacker] == CSW_AWP)
SetHamParamFloat(4, SNIPER_DAMAGE)
// Set Zadoc's damage // Abhinash
if (g_zadoc[attacker] && g_currentweapon[attacker] == CSW_KNIFE)
SetHamParamFloat(4, ZADOC_DAMAGE)
// Reward ammo packs to human classes
// Attacker is human...
if (!g_zombie[attacker])
{
// Armor multiplier for the final damage on normal zombies
if (!g_nemesis[victim] && !g_assassin[victim] && !g_bombardier[victim] && !g_sniper[attacker] && !g_zadoc[attacker]) // Abhinash
{
damage *= ZOMBIE_ARMOR
SetHamParamFloat(4, damage)
}
g_damagedealt_human[attacker] += floatround(damage)
if(g_survivor[attacker])
{
if(SURVIVOR_IGNOREAMMO == 0)
{
while (g_damagedealt_human[attacker] > 500)
{
g_ammopacks[attacker]++
g_damagedealt_human[attacker] -= 500
}
}
}
else if(!g_sniper[attacker] && !g_survivor[attacker] && !g_zadoc[attacker])
{
while (g_damagedealt_human[attacker] > 500)
{
g_ammopacks[attacker]++
g_damagedealt_human[attacker] -= 500
}
}
return HAM_IGNORED
}
// Attacker is zombie...
// Prevent infection/damage by HE grenade (bugfix)
if (damage_type & DMG_HEGRENADE)
return HAM_SUPERCEDE
// Nemesis?
if (g_nemesis[attacker])
{
// Ignore nemesis damage override if damage comes from a 3rd party entity
// (to prevent this from affecting a sub-plugin's rockets e.g.)
if (inflictor == attacker)
{
// Set nemesis damage
SetHamParamFloat(4, NEMESIS_DAMAGE)
}
return HAM_IGNORED
}
else if (g_assassin[attacker])
{
// Ignore assassin damage override if damage comes from a 3rd party entity
// (to prevent this from affecting a sub-plugin's rockets e.g.)
if (inflictor == attacker)
{
// Set assassin damage
SetHamParamFloat(4, ASSASSIN_DAMAGE)
}
return HAM_IGNORED
}
else if (g_bombardier[attacker])
{
// Ignore assassin damage override if damage comes from a 3rd party entity
// (to prevent this from affecting a sub-plugin's rockets e.g.)
if (inflictor == attacker)
{
// Set assassin damage
SetHamParamFloat(4, BOMBARDIER_DAMAGE)
}
return HAM_IGNORED
}
// Last human or not an infection round
if (g_survround || g_sniround || g_nemround || g_assaround || g_bombardierround || g_zadocround || g_swarmround || g_plagueround || g_armageround || g_apocround || g_nightround || fnGetHumans() == 1)
return HAM_IGNORED // human is killed
// Does human armor need to be reduced before infecting?
if (HUMAN_ARMOR_PROTECT == 1)
{
//if (g_survivor[victim]) return
// Get victim armor
static Float:armor
pev(victim, pev_armorvalue, armor)
// If he has some, block the infection and reduce armor instead
if (armor > 0.0)
{
emit_sound(victim, CHAN_BODY, sound_armorhit, 1.0, ATTN_NORM, 0, PITCH_NORM)
if (armor - damage > 0.0)
set_pev(victim, pev_armorvalue, armor - damage)
else
cs_set_user_armor(victim, 0, CS_ARMOR_NONE)
return HAM_SUPERCEDE
}
}
// Infection allowed
SendDeathMsg(attacker, victim) // send death notice
FixDeadAttrib(victim) // fix the "dead" attrib on scoreboard
UpdateFrags(attacker, victim, ZOMBIE_REWARD_INFECT_FRAG, 1, 1) // add corresponding frags and deaths
set_user_health(attacker, pev(attacker, pev_health) + 250)
zombieme(victim, attacker, none) // turn into zombie
g_points[attacker]++ // Abhinash
SavePoints(attacker) // Abhinash
return HAM_SUPERCEDE
}
Somebody please help me.
Thanks.
Last edited by Abhinash; 01-19-2021 at 07:40.
|
|