SA-MP Forums Archive
[HELP]Help me with getdistancetopoint plz.. - 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: [HELP]Help me with getdistancetopoint plz.. (/showthread.php?tid=111825)



[HELP]Help me with getdistancetopoint plz.. - Rzzr - 04.12.2009

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?


Re: [HELP]Help me with getdistancetopoint plz.. - Rzzr - 04.12.2009

Nobody knows this?


Re: [HELP]Help me with getdistancetopoint plz.. - Backwardsman97 - 04.12.2009

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;
   }
}



Re: [HELP]Help me with getdistancetopoint plz.. - Rzzr - 04.12.2009

Works fine, thanks man