What function would i use.
#5

IsPlayerInRangeOfPoint is the most sufficient function for distance checking.

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
pawn Код:
stock Float:GetPointAngleToPoint(Float:x2, Float:y2, Float:X, Float:Y)
{
    new Float:DX, Float:DY;
    new Float:angle;
    DX = floatabs(floatsub(x2,X));
    DY = floatabs(floatsub(y2,Y));
    if (DY == 0.0 || DX == 0.0)
    {
        if(DY == 0 && DX > 0) angle = 0.0;
        else if(DY == 0 && DX < 0) angle = 180.0;
        else if(DY > 0 && DX == 0) angle = 90.0;
        else if(DY < 0 && DX == 0) angle = 270.0;
        else if(DY == 0 && DX == 0) angle = 0.0;
    }
    else
    {
        angle = atan(DX/DY);
        if(X > x2 && Y <= y2) angle += 90.0;
        else if(X <= x2 && Y < y2) angle = floatsub(90.0, angle);
        else if(X < x2 && Y >= y2) angle -= 90.0;
        else if(X >= x2 && Y > y2) angle = floatsub(270.0, angle);
    }
    return floatadd(angle, 90.0);
}
Maybe this, a friend gave it to me.
You realize that's for facing angles and not player positions, right?
Reply


Messages In This Thread
What function would i use. - by Haydz - 20.12.2010, 00:28
Re: What function would i use. - by blackwave - 20.12.2010, 00:30
Re: What function would i use. - by Haydz - 20.12.2010, 00:32
Re: What function would i use. - by Lorenc_ - 20.12.2010, 00:37
Re: What function would i use. - by Calgon - 20.12.2010, 04:37
Re: What function would i use. - by Scenario - 20.12.2010, 05:24
Re: What function would i use. - by Sledge - 20.12.2010, 07:15
Re: What function would i use. - by CrucixTM - 20.12.2010, 07:41
Re: What function would i use. - by Lorenc_ - 20.12.2010, 08:10
Re: What function would i use. - by Nibblet - 20.12.2010, 08:51

Forum Jump:


Users browsing this thread: 1 Guest(s)