How can i make this ony work for headshot?
#1

Like the tite say, this is what i got
pawn Код:
stock IsPlayerAiming(playerid, aimid)
{
    new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2;
    GetPlayerPos(playerid, X1, Y1, Z1);
    GetPlayerPos(aimid, X2, Y2, Z2);
    new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
    if(Distance < 100)
    {
        new Float:A;
        GetPlayerFacingAngle(playerid, A);
        X1 += (Distance * floatsin(-A, degrees));
        Y1 += (Distance * floatcos(-A, degrees));
        Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
        if(Distance < 0.5)
        {
            return true;
        }
    }
    return false;
}
pawn Код:
for(new i = 0; i < GetMaxPlayers(); i++)
        {
            if(IsPlayerConnected(i) && playerid != i && !IsPlayerNPC(i))
            {
                if(IsPlayerAiming(playerid, i))
                {
                    if (newkeys & KEY_FIRE && newkeys & 128)
                    {
                        if(GetPlayerWeapon(playerid) == 34)
                        {
                            if(IsPlayerInAnyVehicle(i) || IsPlayerInAnyVehicle(i))
                            {
                                return 0;
                            }
                            SetPlayerHealth(i, 0);
                            return 1;
                        }
                    }
                }
            }
        }
    }
Also how can i make it so if the target is on admin duty nothing will happen?
Reply
#2

You can use this to detect which bodypart someone is aiming at: http://forum.sa-mp.com/showthread.ph...light=headshot

And in order to stop a player from shooting an admin (only if they aim at the admin, will this work) you can use this: https://sampwiki.blast.hk/wiki/ClearAnimations
Reply
#3

I have tried that headshot include and it didnt work
Reply
#4

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
I have tried that headshot include and it didnt work
How come it does for hundreds of people, but doesn't, for you? (Really, I am curious)
Anyways, if you do want to do this on your own, it's quite difficult and mostly quite inaccurate considering lag between players.
Reply
#5

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
How come it does for hundreds of people, but doesn't, for you? (Really, I am curious)
Anyways, if you do want to do this on your own, it's quite difficult and mostly quite inaccurate considering lag between players.
I got help with it too and they couldnt get it to work either so idk, hm ok well thanks anyway
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)