Distance
#2

pawn Код:
forward GetPlayerDistanceToPoint(playerid,Float:x,Float:y);
public GetPlayerDistanceToPoint(playerid,Float:x,Float:y)
{
    new Float:x1,Float:y1,Float:z1;
    new Float:tmpdis;
    GetPlayerPos(playerid,x1,y1,z1);
    tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(y,y1)),2));
    return floatround(tmpdis);
}
pawn Код:
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerDistanceToPoint(OTHERID,X,Y);
If there's a faster/better method tell me, I'd like to use that to have my script as efficient as possible.
Reply


Messages In This Thread
Distance - by GiS - 17.03.2011, 13:24
Re: Distance - by Mike Garber - 17.03.2011, 13:35
Re: Distance - by Mauzen - 17.03.2011, 13:44
Re: Distance - by AH.1990 - 17.03.2011, 14:10
Re: Distance - by ricardo178 - 17.03.2011, 14:13
Re: Distance - by AH.1990 - 17.03.2011, 14:15

Forum Jump:


Users browsing this thread: 1 Guest(s)