[HELP]Help me with getdistancetopoint plz..
#1

Hi,
I have a bank system, and i wanted to check if the player is near a bank position
so i have this in my command:

pawn Код:
if(GetDistanceToPoint(playerid,CashDispensers[0], CashDispensers[1], CashDispensers[2])>2) // ERROR LINE <-----
    {
SystemMessage(playerid, "You must be near a cash machine to withdraw money.");
return 1;
    }
and this on top of my script
pawn Код:
new Float:CashDispensers[5][3] = {
{2202.316895, 2010.168091, 11.420787},
{1326.405151, -893.362244, 40.011265},
{1834.592407, -1850.649902, 13.768372},
{-2399.150391, 760.003479, 36.177097},
{1342.210449, -1760.475708, 14.424191}
};
and I get this error:
Код:
Line:(1905) : error 035: argument type mismatch (argument 2)
I marked the line in the code.
So why doesn't it work?
Reply
#2

Nobody knows this?
Reply
#3

I think it needs to be like this.

pawn Код:
if(GetDistanceToPoint(playerid,CashDispensers[0][0], CashDispensers[0][1], CashDispensers[0][2])>2)
{
    SystemMessage(playerid, "You must be near a cash machine to withdraw money.");
    return 1;
}
But you may want to do like this to see if he's near any of them.

pawn Код:
for(new i; i<4; i++)
{
   if(GetDistanceToPoint(playerid,CashDispensers[i][0], CashDispensers[i][1], CashDispensers[i][2])>2)
   {
       SystemMessage(playerid, "You must be near a cash machine to withdraw money.");
       return 1;
   }
}
Reply
#4

Works fine, thanks man
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)