SA-MP Forums Archive
checking position - 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: checking position (/showthread.php?tid=525067)



checking position - SeniorGamer - 09.07.2014

what is the best way to check for IsPlayerInRangeOfPoint if you have many coordinates?

I tried with

Код:
new Float:Tests[0][2] = //x,y,z,World
{
	{-540.75262, -122.25552, 71.17383,0},
	{-521.55115, -130.04494, 71.17383,1},
}
And then using

Код:
if(IsPlayerInRangeOfPoint(playerid,2.0,Tests[0][0],Tests[0][1],Tests[0][2]))
but it says tag missmatch. the 4th one is for this
Код:
if(IsPlayerInRangeOfPoint(playerid,2.0,Tests[0][0],Tests[0][1],Tests[0][2]) && GetPlayerVirtualWorld(Tests[0][3]))
but me gets
Код:
warning 213: tag mismatch



Re: checking points - Ihateyou - 09.07.2014

use 0.0/1.0 in the array for virtual world and then do floatround(Texts[0][3])


Re: checking position - SeniorGamer - 09.07.2014

can edit my code and show me please, i am bad at pawno


Re: checking position - Virtual1ty - 09.07.2014

First:
Код:
new Float:Tests[0][2] = //x,y,z,World
{
	{-540.75262, -122.25552, 71.17383,0},
	{-521.55115, -130.04494, 71.17383,1},
}
No good, your first dimension is "2" and second is the amount of data inside those curly braces, which is clearly 4, therefore the second dimension is "4".
For the tag mismatch part:
Код:
if(IsPlayerInRangeOfPoint(playerid,2.0,x,y,z) && GetPlayerVirtualWorld(Tests[0][3]))
Always check the wiki for documentation, there you are missing the "playerid" parameter! Also, you must make a separate array if you want to check for virtual worlds, or use floatround if you wish to use it like that!


Re: checking position - Ihateyou - 09.07.2014

ah shit u right i fcked up


Re: checking position - SeniorGamer - 09.07.2014

ty sir


Re: checking position - Ihateyou - 09.07.2014

GetPlayerVirtualWorld(playerid)== Tests[0][3]

is what you probably want.. if your going to use one array, then u need floatround