I'm editing the RBT plugin to fix the headshot problem.
I used some bone-related functions from the
FakeMeta Functions Detailed Descriptions but it looks like it didn't work.
can you tell me the problem?
Code:
new multiply = get_bone_hit(gunshot_bone(touched, torigin));
//torigin is bullet's origin and multiply is the damage multiplication for the shooted organ
Code:
stock get_bone_hit(number)
{
switch (number)
{
case HEAD_NECK:
{
return 200;
}
case BONE_L_BUTT:
{
return 20;
}
case BONE_R_BUTT:
{
return 20;
}
}
if (1 <= number <= BONE_HIT_STOMACH)
return 30;
if (BONE_HIT_STOMACH < number <= BONE_HIT_CHEST)
return 100;
if (BONE_HIT_CHEST < number <= BONE_HIT_HEAD)
return 200;
if (BONE_HIT_HEAD < number <= BONE_HIT_LEFTARM)
return 20;
if (BONE_HIT_LEFTARM < number <= BONE_HIT_RIGHTARM)
return 20;
if (BONE_HIT_RIGHTARM < number <= BONE_HIT_LEFTLEG)
return 20;
if (BONE_HIT_LEFTLEG < number <= BONE_HIT_RIGHTLEG)
return 20;
return 20;
}
stock gunshot_bone(victim, Float:endtrace[3])
{
new Float:angles[3], Float:origin[3], Float:dist = 9999999.99, Float:curorigin[3], bone_nr
for (new i=1;i<=54;i++)
{
// Get the bone position
engfunc(EngFunc_GetBonePosition, victim, i, curorigin, angles)
// Calculate the distance vector
xs_vec_sub(curorigin, endtrace, angles)
// If this is smaller than the last small distance remember the value!
if (xs_vec_len(angles) <= dist)
{
origin = curorigin
dist = xs_vec_len(angles)
bone_nr = i
}
}
// Return the bone
return bone_nr
}
__________________