I just noticed my post was in the wrong section.
Could anybody help me turning this code into having chances? I seem to have a few problems.
Here is the code:
[code=php]<?php
$items = array(
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build1’, ‘look’ => 1, ‘color’ => ‘#96281B’, ‘image’ => ‘assets/img/ak/1.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build2’, ‘look’ => 1, ‘color’ => ‘#D24D57’, ‘image’ => ‘assets/img/ak/2.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build3’, ‘look’ => 1, ‘color’ => ‘#DB0A5B’, ‘image’ => ‘assets/img/ak/3.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build4’, ‘look’ => 1, ‘color’ => ‘#663399’, ‘image’ => ‘assets/img/ak/4.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build5’, ‘look’ => 1, ‘color’ => ‘#674172’, ‘image’ => ‘assets/img/ak/5.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build6’, ‘look’ => 1, ‘color’ => ‘#9A12B3’, ‘image’ => ‘assets/img/ak/6.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build7’, ‘look’ => 1, ‘color’ => ‘#446CB3’, ‘image’ => ‘assets/img/ak/7.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build8’, ‘look’ => 1, ‘color’ => ‘#2C3E50’, ‘image’ => ‘assets/img/ak/8.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build9’, ‘look’ => 1, ‘color’ => ‘#3A539B’, ‘image’ => ‘assets/img/ak/9.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build10’, ‘look’ => 1, ‘color’ => ‘#26A65B’, ‘image’ => ‘assets/img/ak/10.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build11’, ‘look’ => 1, ‘color’ => ‘#2ECC71’, ‘image’ => ‘assets/img/ak/11.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build12’, ‘look’ => 1, ‘color’ => ‘#E87E04’, ‘image’ => ‘assets/img/ak/12.png’),
array(‘weapon’ => ‘AK-47’, ‘name’ => ‘Elite Build13’, ‘look’ => 1, ‘color’ => ‘#D35400’, ‘image’ => ‘assets/img/ak/13.png’)
);
$winitem = $items[array_rand($items)];
$winpos = array(29 => array(-37, -1), 30 => array(1, 37), 31 => array(38, 74));
$winnr = rand(29,31);
$winpos = $winpos[$winnr];
$tape = ”;
for($i=1;$i<=34;$i++){
if($winnr == $i){
$item = $winitem;
}else{
$item = $items[array_rand($items)];
}
$tape .= ‘<div><div class=”image”><img src=”‘.$item[‘image’].'” alt=”” /></div><div class=”info” style=”background: ‘.$item[‘color’].’;”>’.$item[‘weapon’].'<br />’.$item[‘name’].'</div></div>’;
}
echo json_encode(array(‘tape’ => $tape, ‘dtime’ => rand($winpos[0], $winpos[1]), ‘item’ => $winitem));
?>
Sincerely, Martijn