InRangeOfPoint - 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: InRangeOfPoint (
/showthread.php?tid=665289)
InRangeOfPoint -
SymonClash - 29.03.2019
I need a way to loop through this coordinates and check if the player is in a range of them.
pawn Code:
static const Float:RandomSpawn[][4] =
{
{1320.7914,1262.0884,10.8203,357.0813},
{408.3192,2452.5623,16.5000,5.9386},
{-1321.2762,-219.7926,14.1484,12.5747 },
{1910.8484,-2419.6887,13.5391,182.4597},
{-2310.8376,-1616.5333,483.8190,176.1664},
{-2416.7188,332.4720,34.9688,240.4801},
{-2594.4063,460.8942,14.6094,0.4960},
{-2898.3438,486.8863,4.9141,271.0871},
{-2873.9099,735.1693,29.9604,278.4891},
{-2894.7317,1077.8719,31.4435,269.9459},
{-2897.3389,1175.7565,12.2720,266.9634},
};
How?
Re: InRangeOfPoint -
Lirbo - 29.03.2019
Quote:
Originally Posted by SymonClash
I need a way to loop through this coordinates and check if the player is in a range of them.
pawn Code:
static const Float:RandomSpawn[][4] = { {1320.7914,1262.0884,10.8203,357.0813}, {408.3192,2452.5623,16.5000,5.9386}, {-1321.2762,-219.7926,14.1484,12.5747 }, {1910.8484,-2419.6887,13.5391,182.4597}, {-2310.8376,-1616.5333,483.8190,176.1664}, {-2416.7188,332.4720,34.9688,240.4801}, {-2594.4063,460.8942,14.6094,0.4960}, {-2898.3438,486.8863,4.9141,271.0871}, {-2873.9099,735.1693,29.9604,278.4891}, {-2894.7317,1077.8719,31.4435,269.9459}, {-2897.3389,1175.7565,12.2720,266.9634}, };
How?
|
never used this before but a gross guess would be
Code:
new rand = random(12);
SpawnPlayer(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1], RandomSpawn[rand][2]);
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
Re: InRangeOfPoint -
Pizzy - 29.03.2019
turn it off and on again it should do the trick
Re: InRangeOfPoint -
SymonClash - 29.03.2019
@Lirbo: As i can see you haven't read my post. I don't need a random spawn system (which i have it already), but i just need the IsInRangeOfPoint check.
@Pizzy: What?
Re: InRangeOfPoint -
bgedition - 29.03.2019
You could probably use this in a timer or in OnPlayerUpdate. To get the number of spawns you could use
sizeof and then in a
for loop you could check each point with
IsPlayerInRangeOfPoint.
Re: InRangeOfPoint -
Lirbo - 29.03.2019
Quote:
Originally Posted by SymonClash
@Lirbo: As i can see you haven't read my post. I don't need a random spawn system (which i have it already), but i just need the IsInRangeOfPoint check.
@Pizzy: What?
|
Code:
#define MAX_LOCATIONS 12
new Float:F[3];
GetPlayerPos(playerid, F[0], F[1], F[2]);
for(new i; i < MAX_LOCATIONS; i++)
{
if(IsPlayerInRangeOfPoint(playerid, DISTANCE, RandomSpawn[i][0], RandomSpawn[i][1], RandomSpawn[i][2]))
{
//code
}
}
Re: InRangeOfPoint -
SymonClash - 29.03.2019
Thank you.