06.03.2015, 23:14
Well,i'm working on a easter egg system with random coordinates,at this point,it just fine.
But,i'm worried about the random function,how can i use it without repeat any of the coordinates ?
My last try was that,from other system with other ends:
So,what you think guys ?Did you know some method to not repeat with the random function ?
But,i'm worried about the random function,how can i use it without repeat any of the coordinates ?
My last try was that,from other system with other ends:
PHP код:
new Float:EasterEggs[][]=
{
{X, Y, Z},
{X, Y, Z},
{X, Y, Z},
//etc..
};
new cCheck[sizeof(EasterEggs)];
public OnFilterScriptInit()
{
new randomCoord, SelectCoord;
do{
for(new i = 0; i < sizeof(cCheck);i++)
{
if(cCheck[i] != 0) SelectCoord++;
if(SelectCoord == sizeof(cCheck[i]))
{
for(new i = 0; i < sizeof(cCheck); i++)
{
cCheck[i] = 0;
randomCoord = random(sizeof(EasterEggs));
}while(cCheck[randomCoord])
{
CreateEE(EasterEggs[randomCoord][0],EasterEggs[randomCoord][1],EasterEggs[randomCoord][2]);
}
}
}
}
}