SA-MP Forums Archive
how to make command work in certain coords? - 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: how to make command work in certain coords? (/showthread.php?tid=139256)



how to make command work in certain coords? - hardstop - 04.04.2010

i have certin coords where i want command to work how can i make like that?


Re: how to make command work in certain coords? - Torran - 04.04.2010

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: how to make command work in certain coords? - Backwardsman97 - 04.04.2010

In your command, you can call this function to check if they are within a certain range of coordinates. Unless you want it to only work in a square area.

pawn Код:
stock IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
{
    new
        Float:px,
        Float:py,
        Float:pz;
    GetPlayerPos(playerid, px, py, pz);
    px -= x;
    py -= y;
    pz -= z;
    return ((px * px) + (py * py) + (pz * pz)) < (range * range);
}



Re: how to make command work in certain coords? - hardstop - 04.04.2010

Got it working Thnx