Detect Aiming?
#8

pawn Код:
stock IsPlayerAiming(playerid, aimid)
{
    // Luby's function.
    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;
}
Reply


Messages In This Thread
Detect Aiming? - by PeteShag - 11.01.2011, 06:18
Re: Detect Aiming? - by Infamous - 11.01.2011, 06:21
Re: Detect Aiming? - by PeteShag - 11.01.2011, 06:24
Re: Detect Aiming? - by PeteShag - 11.01.2011, 07:31
Re: Detect Aiming? - by dawidek11 - 11.01.2011, 07:37
Re: Detect Aiming? - by PeteShag - 11.01.2011, 07:47
Re: Detect Aiming? - by [BEP]AcerPilot - 11.01.2011, 09:19
Re: Detect Aiming? - by [UG]Scripter - 11.01.2011, 10:05

Forum Jump:


Users browsing this thread: 1 Guest(s)