Sorry I only got back now but I finally figured it out. I'm using
GHW_Chronic's code. The reason
ExecuteHam(Ham_TakeDamage) wasn't working on it was just a simple thing I overlooked.
Chronic's shoot thru walls code uses weapon indexes (CSW_AWP) while as Ham_TakeDamage uses weapon classnames (weapon_awp). I simply changed Chronic's code to accept weapon classnames so I can use Ham_TakeDamage inside it. It eliminated half of Chronic's code.
The only weird thing is there are two codes handling both damage, but one for shooting thru walls and one when the target is out in the open. I guess it's okay since the plugin works now.
Here's some snippets of what I've done so far. Thanks again for the help!
PHP Code:
public Fw_Weapon_PrimaryAttack(weapon)
{
static id;
id = pev(weapon, pev_owner);
pev(id, pev_punchangle, g_recoil[id]);
if(!is_user_connected(id) || !is_user_alive(id))
return HAM_IGNORED
if(!Get_BitVar(g_has_weapon, id))
return HAM_IGNORED
new iclip = cs_get_weapon_ammo(weapon)
get_pdata_int(id, m_iClip, 4);
if(iclip > 0 && (get_gametime() - g_gametime[id]) > RATEOFIRE)
{
set_weapon_anim(id, SHOOT_ANIM);
emit_sound(id, CHAN_WEAPON, FIRE_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
make_shells(id);
cs_set_weapon_ammo(weapon, iclip - 1);
g_gametime[id] = get_gametime()
new target, body;
get_user_aiming(id, target, body, 9999);
if(0 < target < 33)
{
g_killmsg = "awpns";
ExecuteHam(Ham_TakeDamage, target, weapon, id, DAMAGE * hitgroups[body], body, DMG_BULLET);
static CsArmorType:armortype
static armor
armor = cs_get_user_armor(target, armortype)
if(cs_get_user_shield(target) && body == 8)
{
cs_set_user_armor(target, armor - random_num(45, 50), armortype)
return HAM_SUPERCEDE
}
else
cs_set_user_armor(target, 0, CS_ARMOR_NONE)
new body_origin[3];
get_user_origin(target, body_origin);
if(cs_get_user_team(id)==cs_get_user_team(target) && !get_pcvar_num(cvar_friendly_fire))
return HAM_SUPERCEDE
make_blood(body_origin, 2);
}
else
{
new bullet_origin[3];
get_user_origin(id, bullet_origin, 3);
make_bullet_hole(id, bullet_origin);
}
}
Wall_Shot(id, weapon);
return HAM_SUPERCEDE
}
PHP Code:
public Wall_Shot(id, wpn) //by GHW_Chronic
{
if(!is_user_connected(id) || !is_user_alive(id))
return PLUGIN_CONTINUE
if(!Get_BitVar(g_has_weapon, id))
return PLUGIN_CONTINUE
static Porigin[3]
static Borigin[3]
get_user_origin(id,Porigin,1)
get_user_origin(id,Borigin,4)
static Float:Delta1[3]
Delta1[0]=float(Borigin[0]) - float(Porigin[0])
Delta1[1]=float(Borigin[1]) - float(Porigin[1])
Delta1[2]=float(Borigin[2]) - float(Porigin[2])
static Float:XYSlope
XYSlope = Delta1[1] / Delta1[0]
static Float:YZSlope
YZSlope = Delta1[2] / Delta1[1]
//Let's check all players to see if we hit anyone.
static players[32], num, i2, i
get_players(players,num,"ah")
for(i2=0;i2<num;i2++)
{
//We don't want any DEBUG errors in console, we don't want to hit a spec, and we dont want to hurt ourselves either.
if(players[i2]!=id)
{
i=players[i2]
//Need to know if the player is now within the max distance.
static Iorigin[3]
get_user_origin(i,Iorigin)
static disti
disti = get_distance(Iorigin,Borigin)
//Checking...
if(disti<=2000)
{
//If they are infront of the person. Added to fix bug reported by that one guy whos name escapes me.
static deltaIB[3]
deltaIB[0] = Iorigin[0] - Borigin[0]
deltaIB[1] = Iorigin[1] - Borigin[1]
deltaIB[2] = Iorigin[2] - Borigin[2]
//Checking...
if((deltaIB[0]>=0 && Delta1[0]>=0.0) || (deltaIB[0]<=0 && Delta1[0]<=0.0) && ((deltaIB[1]>=0 && Delta1[1]>=0) || (deltaIB[1]<=0 && Delta1[1]<=0)))
{
//If they're ducking, their height is changed.
static Float:mp
mp = 74.0
if(get_user_button(i) & IN_DUCK)(mp=32.0)
//Calculate where their origin would be if they were DIRECTLY in the path of the bullet.
static Float:on_line[3]
on_line[0] = (((Borigin[1] - Iorigin[1]) / XYSlope) - Borigin[0]) * (-1)
on_line[1] = (-1) * ((XYSlope * Borigin[0]) - (XYSlope * Iorigin[0]) - Borigin[1])
on_line[2] = (-1) * ((YZSlope * Borigin[1]) - (YZSlope * Iorigin[1]) - Borigin[2])
//Check if we hit them anywhere on the body.
if(Iorigin[0]<on_line[0]+32 && Iorigin[0]>on_line[0]-32 && Iorigin[1]<on_line[1]+32 && Iorigin[1]>on_line[1]-32 && Iorigin[2]<on_line[2]+mp && Iorigin[2]>on_line[2]-mp)
{
//"I" is now reffered to as "ent". This is because this section of script was made AND THEN placed into a for sequence.
static ent
ent = i
//Let's Obey Friendly Fire.
static bool:continue3=false
if(cs_get_user_team(id)==cs_get_user_team(ent) && get_pcvar_num(cvar_friendly_fire))
continue3=true
if(cs_get_user_team(id)!=cs_get_user_team(ent))
continue3=true
if(cs_get_user_shield(ent))
continue3=false
if(continue3)
{
//Here are tHe hitplaces that I uUsed below for refference.
//1=head +20z
//2=torso >=8 side, >=20z, <=0z
//4=arm <8 side, 0<z
//5=foot -z
//Calculate what hitbox we will register the hit as hitting.
static hitplace, body;
hitplace=7
static Float:endyoffset
endyoffset = on_line[1] - Iorigin[1]
static Float:endzoffset
endzoffset = on_line[2] - Iorigin[2]
if(endzoffset>=15)//8 && endyoffset<5 && endyoffset>-5)
{
hitplace = 1 //HeadShot!
body = 1;
}
else if(endzoffset<=-5)
{
hitplace=5 //Foot
body = random_num(6, 7);
}
else if(endzoffset>-5 && endzoffset<15)
{
hitplace=2 //Torso
if(endyoffset<-13 || endyoffset>13)
{
hitplace=4 //arm
body = random_num(2, 5);
}
}
else if(endzoffset>25 || endzoffset<-39)
{
hitplace=7 //Error, mistake, didn't actually hit them X_X
}
//Since there is this height error, we're gonna stop here.
if(hitplace!=7)
{
//Find out what weapon player is using so we can calculate how much damage the player will do (IE: Pistols do less than rifles)
static weapon
weapon = get_user_weapon(id);
if(weapon==CSW_AWP && Get_BitVar(g_has_weapon,id))
{
//Find armor.
static CsArmorType:armortype
static armor
armor = cs_get_user_armor(ent, armortype)
g_killmsg = "awpns_thru_the_wall";
new Float:dmg = (DAMAGE * hitgroups[body]) * 0.50;
ExecuteHam(Ham_TakeDamage, ent, wpn, id, dmg, body, DMG_BULLET);
if(cs_get_user_shield(ent))
cs_set_user_armor(ent, armor - random_num(40, 45), armortype)
else
cs_set_user_armor(ent, 0, CS_ARMOR_NONE)
new targ_origin[3];
get_user_origin(ent, targ_origin);
if(cs_get_user_team(id) == cs_get_user_team(ent) && !get_pcvar_num(cvar_friendly_fire))
return PLUGIN_CONTINUE
make_blood(targ_origin, body);
return PLUGIN_HANDLED
}
}
}
}
}
}
}
}
return PLUGIN_HANDLED
}
__________________