InRangeOfPoint
#1

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

Quote:
Originally Posted by SymonClash
View Post
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]);
Reply
#3

turn it off and on again it should do the trick
Reply
#4

@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?
Reply
#5

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

Quote:
Originally Posted by SymonClash
View Post
@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
    }
}
Reply
#7

Thank you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)