Player to point
#3

That one sucks and is inaccurate.

pawn Код:
Float:DistFromPlayerToPoint(playerid,Float:X,Float:Y,Float:Z) //Slower, but gives you the distance
{
  new Float:tmpx,Float:tmpy,Float:tmpz;
  GetPlayerPos(playerid,tmpx,tmpy,tmpz);
  return floatsqroot(floatpower(X-tmpx,2)+floatpower(Y-tmpy,2)+floatpower(Z-tmpz,2));
}

IsPlayerNearPoint(playerid,Float:X,Float:Y,Float:Z,Float:radius) //Faster to compute
{
  new Float:tmpx,Float:tmpy,Float:tmpz;
  GetPlayerPos(playerid,tmpx,tmpy,tmpz);
  return ((X-tmpx)*(X-tmpx))+((Y-tmpy)*(Y-tmpy))+((Z-tmpz)*(Z-tmpz))<(radius*radius);
}
EDIT* Windows 7 messed up my post pretty bad lol, *cleaned*
Reply


Messages In This Thread
Player to point - by Geekzor - 11.08.2009, 16:43
Re: Player to point - by Basss - 11.08.2009, 17:01
Re: Player to point - by Joe Staff - 11.08.2009, 17:02
Re: Player to point - by Geekzor - 11.08.2009, 18:18

Forum Jump:


Users browsing this thread: 1 Guest(s)