PlayerToPoint Help
#1

My PlayerToPoint isent working, It lets me type the command anywhere,
But its only supposed to let me type the command in certain place,

pawn Код:
forward PlayerToPoint (Float:radi, playerid, Float:x, Float:y, Float:z);

    if (strcmp("/buyc4", cmdtext, true) == 0)
    {
      if(PlayerToPoint(1.0,playerid,-2044.0804,149.9467,28.8359))
      {
        if (C4BUY[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, "You already have C4");
        else
        {
        SendClientMessage(playerid, 0xFF0000AA, "You have purchased C4");
        C4BUY[playerid] = 1;
        }
        }
        return 1;
    }



public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  new Float:oldposx, Float:oldposy, Float:oldposz;
  new Float:tempposx, Float:tempposy, Float:tempposz;
  GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  tempposx = (oldposx -x);
  tempposy = (oldposy -y);
  tempposz = (oldposz -z);
  //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  {
    return 1;
  }
  return 0;
}
Reply
#2

You can't just forward a function that doesn't exist.

Please learn how to code at least a little bit, before asking silly questions on here.

Also, PlayerToPoint doesn't need to be a public function.
Reply
#3

Quote:
Originally Posted by Blacklite
You can't just forward a function that doesn't exist.

Please learn how to code at least a little bit, before asking silly questions on here.

Also, PlayerToPoint doesn't need to be a public function.
Dude make sure you read it properly before posting,
Scroll down and you see the PlayerToPoint
Its right here look infront of your eyes,
If you was to scrolldown on the code provided on the first post,
You would realise that

pawn Код:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  new Float:oldposx, Float:oldposy, Float:oldposz;
  new Float:tempposx, Float:tempposy, Float:tempposz;
  GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  tempposx = (oldposx -x);
  tempposy = (oldposy -y);
  tempposz = (oldposz -z);
  //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  {
    return 1;
  }
  return 0;
}
Reply
#4

pawn Код:
if (strcmp("/buyc4", cmdtext, true) == 0)
{
  if(PlayerToPoint(1.0,playerid,-2044.0804,149.9467,28.8359))
  {
    if (C4BUY[playerid]) return SendClientMessage(playerid, 0xFF0000AA, "You already have C4");
    else
    {
      C4BUY[playerid] = 1;
      return SendClientMessage(playerid, 0xFF0000AA, "You have purchased C4");
    }
  }
  SendClientMessage(playerid, 0xFF0000AA, "You are not at the right location to purchase C4");
  return 1;
}

PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  if(IsPlayerConnected(playerid))
  {
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
      return 1;
    }
  }
  return 0;
}
There should be nothing wrong with that. Also, you don't need 5 lines to tell me that I forgot to scroll down.

And there is no need to make PlayerToPoint a public function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)