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


Messages In This Thread
How can i make this ony work for headshot? - by Don_Cage - 21.03.2013, 14:50
Re: How can i make this ony work for headshot? - by Scenario - 21.03.2013, 15:04
Re: How can i make this ony work for headshot? - by Don_Cage - 21.03.2013, 15:17
Re: How can i make this ony work for headshot? - by RajatPawar - 21.03.2013, 15:29
Re: How can i make this ony work for headshot? - by Don_Cage - 21.03.2013, 15:33

Forum Jump:


Users browsing this thread: 3 Guest(s)