SA-MP Forums Archive
Pickup + Textdraw - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Pickup + Textdraw (/showthread.php?tid=75332)



Pickup + Textdraw - Khelif - 01.05.2009

how to make when player stands on/near pickup, textdraw is shown. when he goes away, textdraw will disappear.


Re: Pickup + Textdraw - [HiC]TheKiller - 01.05.2009

Use PlayerToPoint

pawn Код:
stock 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);
  if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  {
    return 1;
  }
  return 0;
}
Example:

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
  if(PlayerToPoint(Float:radi, i, Float:x, Float:y, Float:z)//Change Radi to the radius away from the pickup and x, y and Z as the pickup co-ordonates!
  {
    //Show the Textdraw. Although a Gametext would be easier.