Raised This Month: $32 Target: $400
 8% 

Solved bone detecting problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 02-17-2018 , 03:18   bone detecting problem
Reply With Quote #1

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
}
__________________

Last edited by man_s_our; 03-22-2018 at 18:06.
man_s_our is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-22-2018 , 18:06   Re: bone detecting problem
Reply With Quote #2

the problem was caused by the bad hitboxes
__________________
man_s_our is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode