SAMP Hit detection isn't accurate?
#1

It detected a headshot and chest shot when I shot them in the leg with a desert eagle...Why would this happen?

Is there something wrong with my code or is it a SAMP problem?

This is all under OnPlayerTakeDamage.
pawn Код:
if(bodypart == 3)
    {
        TextDrawShowForPlayer(playerid,TorsoBlTD);
        if(TorsoBl[playerid] < 5)
        {
           TorsoBl[playerid] ++;
            printf("Hits %d", TorsoBl[playerid]);
            if(IsMaxDamageWep(weaponid) == 1)
            {
                BodyPartAmount[playerid][3] = 6;
            }
            else if(IsMaxDamageWep(weaponid) == 0)
            {
                BodyPartAmount[playerid][3] = 3;
            }
        }
    }
    if(bodypart == 4)
    {
        TextDrawShowForPlayer(playerid,GroinBlTD);
        if(GroinBl[playerid] < 5)
        {
           GroinBl[playerid] ++;
            printf("Hits %d", GroinBl[playerid]);
            if(IsMaxDamageWep(weaponid) == 1)
            {
                BodyPartAmount[playerid][4] = 3;
            }
            else if(IsMaxDamageWep(weaponid) == 0)
            {
                BodyPartAmount[playerid][4] = 1;
            }
        }
    }
    if(bodypart == 5)
    {
        TextDrawShowForPlayer(playerid,LArmBlTD);
        if(LArmBl[playerid] < 5)
        {
           LArmBl[playerid] ++;
            if(IsMaxDamageWep(weaponid) == 1)
            {
                BodyPartAmount[playerid][5] = 1;
                new num = RandomEx(1,5);
                if(num == 3)
                {
                    TextDrawHideForPlayer(playerid,LArmBlTD);
                    TextDrawShowForPlayer(playerid,LArmBlab);
                    LArmBr[playerid] = 1;
                }
            }
            else if(IsMaxDamageWep(weaponid) == 0)
            {
                BodyPartAmount[playerid][5] = 1;
            }
        }
    }
    if(bodypart == 6)
    {
        TextDrawShowForPlayer(playerid,RArmBlTD);
        if(RArmBl[playerid] < 5)
        {
           RArmBl[playerid] ++;
            if(IsMaxDamageWep(weaponid) == 1)
            {
                BodyPartAmount[playerid][6] = 2;
                new num = RandomEx(1,5);
                if(num == 2)
                {
                    TextDrawHideForPlayer(playerid,RArmBlTD);
                    TextDrawShowForPlayer(playerid,RArmBlab);
                    RArmBr[playerid] = 1;
                }
            }
            else if(IsMaxDamageWep(weaponid) == 0)
            {
                BodyPartAmount[playerid][6] = 1;
            }
        }
    }
    if(bodypart == 7)
    {
        TextDrawShowForPlayer(playerid,LLegBlTD);
        if(LLegBl[playerid] < 5)
        {
           LLegBl[playerid] ++;
            if(IsMaxDamageWep(weaponid) == 1)
            {
                BodyPartAmount[playerid][7] = 2;
                new num = RandomEx(1,5);
                if(num == 2)
                {
                    TextDrawHideForPlayer(playerid,LLegBlTD);
                    TextDrawShowForPlayer(playerid,LLegBlab);
                    LLegBr[playerid] = 1;
                }
            }
            else if(IsMaxDamageWep(weaponid) == 0)
            {
                BodyPartAmount[playerid][7] = 1;
            }
        }
    }
    if(bodypart == 8)
    {
        TextDrawShowForPlayer(playerid,RLegBlTD);
        if(RLegBl[playerid] < 5)
        {
            RLegBl[playerid] ++;
            if(IsMaxDamageWep(weaponid) == 1)
            {
                BodyPartAmount[playerid][8] = 1;
                new num = RandomEx(1,5);
                if(num == 2)
                {
                    TextDrawHideForPlayer(playerid,RLegBlTD);
                    TextDrawShowForPlayer(playerid,RLegBlab);
                    RLegBr[playerid] = 1;
                }
            }
            else if(IsMaxDamageWep(weaponid) == 0)
            {
                BodyPartAmount[playerid][8] = 1;
            }
        }
    }
Reply
#2

It's possible one of you has a skin modification(which is most likely). Another cause is that it may have appeared you were shooting at his legs; while the client was sending data to the server saying otherwise.
Reply
#3

OnPlayerTakeDamage tends to be inaccurate while dealing with laggers. OnPlayerGiveDamage is more accurate than OnPlayerTakeDamage, but if you set the damaged player's health to 0 under OnPlayerGiveDamage, the death reason of the damaged player's intends to get mixed up (default reason) in some cases.
Reply
#4

Okay, I was doing this on local server with 2 computers to test.

It seemed more accurate when I removed the headshot script.

However, I was shooting in the legs and it didn't come up with the textdraw, but on arms it would and chest etc.
Reply
#5

Quote:
Originally Posted by Dokins
Посмотреть сообщение
Okay, I was doing this on local server with 2 computers to test.

It seemed more accurate when I removed the headshot script.

However, I was shooting in the legs and it didn't come up with the textdraw, but on arms it would and chest etc.
You should also take into consideration that bullets don't take straight paths.
Reply
#6

What do you mean? I'm not sure this happens in SAMP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)