Tag mismatch [SOLVED]
#1

pawn Код:
stock PlayerDistanceToPoint(playerid,Float:x,Float:y,Float:z)
{
  new Float:px,Float:py,Float:pz;
  GetPlayerPos(playerid,px,py,pz);
  return floatsqroot ( ( (x-px)*(x-px) ) + ( (y-py)*(y-py) ) + ( (z-pz)*(z-pz) ) );//<---------
}
Why do i get tag mismatch error at this line?
Reply
#2

You can't return a float.
Reply
#3

Quote:
Originally Posted by Backwardsman97
You can't return a float.
Not true
Код:
Float:PlayerDistanceToPoint(playerid,Float:x,Float:y,Float:z)
{
  new Float:px,Float:py,Float:pz;
  GetPlayerPos(playerid,px,py,pz);
  return floatsqroot ( ( (x-px)*(x-px) ) + ( (y-py)*(y-py) ) + ( (z-pz)*(z-pz) ) );//<---------
}
Reply
#4

It didnt work. But you gave me the idea to try it with Public.
pawn Код:
forward Float:PlayerDistanceToPoint(playerid,Float:x,Float:y,Float:z);
public Float:PlayerDistanceToPoint(playerid,Float:x,Float:y,Float:z)
{
  new Float:px,Float:py,Float:pz;
  GetPlayerPos(playerid,px,py,pz);
    return floatsqroot ( ( (x-px)*(x-px) ) + ( (y-py)*(y-py) ) + ( (z-pz)*(z-pz) ) );
}
This is working. Problem SOLVED.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)