Need help with random functions.
#5

Quote:
Originally Posted by nuriel8833
Посмотреть сообщение
This is the code I've maid,it has a few errors,I will edit it once I fix e'm
pawn Код:
enum ALocation
{
    Name[24],
    Float: x,
    Float: y,
    Float: z
};

new
    Locations[][ALocation] =
{
    {"LS Gate 1", 1738.3202,-2425.8325,14.4741}, // Location 1
    {"LS Gate 2", 1641.5100,-2423.1333,14.4730}, // Location 2
    {"LS Gate 3", 1562.1697,-2428.0403,14.4765}, // Location 3
    {"SF Gate 2", 1574.6689,1539.6458,11.7481}, // Location 4
    {"SF Gate 3", -1382.1825,-225.9442,15.0717}, // Location 5
    {"LV Gate 2", -1323.3275,-255.5832,15.0703} // Location 6
};

//Put it wherever you want to
new locrand = random(sizeof(Locations));
new Float:Pos1,Float:Pos2,Float:Pos3; // Couldn't see why the MAX_PLAYERS was necessary
if(Pos1 == Locations[locrand][x] || Pos2 == Locations[locrand][y] || Pos3 == Locations[locrand][z]) return 0;
else {
Pos1 = Locations[locrand][x];
Pos2 = Locations[locrand][y];
Pos3 = Locations[locrand][z]; }
Edit: Fixed all errors,try this and tell me if it works
But it could still choose LS Gate 3, if you were at LS Gate 2. If you understand.


You get the LS Gate 2 Co-ords.
You want to find a random airport which is NOT LS Gate 1, 2 or 3 (Make a radius distance?)


:/. Thanks for helping though.

Also, that script would not check for another location? I need it to.
Reply


Messages In This Thread
Need help with random functions. - by GamingTurf - 01.12.2011, 17:08
Re: Need help with random functions. - by GamingTurf - 01.12.2011, 17:35
Re: Need help with random functions. - by nuriel8833 - 01.12.2011, 18:26
Re: Need help with random functions. - by ProdrifterX - 01.12.2011, 18:51
Re: Need help with random functions. - by GamingTurf - 01.12.2011, 18:52
Re: Need help with random functions. - by nuriel8833 - 01.12.2011, 18:54
Re: Need help with random functions. - by GamingTurf - 01.12.2011, 18:56

Forum Jump:


Users browsing this thread: 1 Guest(s)