IsPlayerNearATM custom function
#1

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.
Reply
#2

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

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}
};
Reply
#4

Yes!

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

Did mine work?
Reply
#6

Which one worked!!
The world will never know!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)