SA-MP Forums Archive
IsPlayerNearATM custom function - 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)
+--- Thread: IsPlayerNearATM custom function (/showthread.php?tid=352021)



IsPlayerNearATM custom function - mrcoolballs - 18.06.2012

I have just created a function that is suppose to return 1 if the player is near an atm.

pawn Code:
new Float:ATM[][3] =
    {
        {1928.62145996,-1780.08044434,13.18977451},
        {928.42968750,-1385.49902344,12.98833847},
        {1343.94079590,-1587.08764648,13.18079376},
        {2241.16918945,-1722.89660645,13.19229412},
        {304.12026978,-1557.89233398,35.68196106}
    };
^^ the locations of the ATM's


now the function
pawn Code:
stock IsPlayerNearATM(playerid)
{

    for(new i; i < 5; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid,2,ATM[i][0],ATM[i][1],ATM[i][2]))
        {
                return 1;
        }
       
    }
    return 0;
}
So far it only returns 1 if the player is near the first co ordinates, "1928.62145996,-1780.08044434,13.18977451".

I'm sure there is a very simple way around this problem, but I cannot figure it out.

If anyone could help me I will appreciate it.


Re: IsPlayerNearATM custom function - ViniBorn - 18.06.2012

If you replace
pawn Code:
new Float:ATM[][3] =
with
pawn Code:
new Float:ATM[5][3] =
It works?


Re: IsPlayerNearATM custom function - Dubya - 18.06.2012

pawn Code:
// Try changing it to this:

new Float:ATM[5][3] =
{
    {1928.62145996,-1780.08044434,13.18977451},
    {928.42968750,-1385.49902344,12.98833847},
    {1343.94079590,-1587.08764648,13.18079376},
    {2241.16918945,-1722.89660645,13.19229412},
    {304.12026978,-1557.89233398,35.68196106}
};



Re: IsPlayerNearATM custom function - mrcoolballs - 18.06.2012

Yes!

thanks alot, you have saved me a lot of trouble.


Re: IsPlayerNearATM custom function - Dubya - 18.06.2012

Did mine work?


Re: IsPlayerNearATM custom function - Unfriendly - 18.06.2012

Which one worked!!
The world will never know!