Jump to content

Weigh down a certain option when randomizing?


Cory94bailly

Recommended Posts

$maps = $_POST['maps'];
$mlg = array("Capture the Flag on Highrise", "Demolition on Highrise", "Search and Destroy on Highrise", "Capture the Flag on Invasion", "Demolition on Invasion", "Search and Destroy on Invasion", "Search and Destroy on Karachi", "Capture the Flag on Scrapyard", "Demolition on Scrapyard", "Search and Destroy on Scrapyard", "Capture the Flag on Terminal", "Demolition on Terminal", "Search and Destroy on Terminal");
$mlg_amount = "12"; //Make sure you take the # of MLG setups and subtract 1! (13 MLG setups = 12.)

$i=0;
while($i<$maps)
{
$i++;
echo $mlg[rand(0,$mlg_amount)];
echo "<br />";
}

 

Yes, I know.. It could be better but I am lazy and I made this when I was extremely tired.

 

How could I possibly weigh a certain option more?

 

I would guess obviously putting the same options in more than once would work but how would I go on making it like "$map_scrapyard = '30';", 30 being 30%?

 

Any ideas?

 

If more code is needed, I can do that.. (Also, if anyone is willing to help me clean-up the code, please tell me.. I think I have alot of un-needed code)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.