In criminolz source worden nu 3x3 coordinaten getoond om te kunnen bouwen. Maar ik wil deze map vergroten zodat er 10x10 locaties direct zichtbaar zijn, hoe kan ik dit veranderen? (ik denk dat dit script nodig is)
PHP
<?php
$empty = 'empty' . @$_SESSION['empty'];
if(empty($_GET['x'])) {
$_GET['x'] = 0;
}
if(empty($_GET['y'])) {
$_GET['y'] = 0;
}
echo'
<div id="content_top"> </div>
<script type="text/javascript">
var x = 0;
var y = 0;
function gotox(value) {
destination = (250 - value) * -1;
if(destination <= 249) {
if(destination >= -249) {
if(destination != x) {
x = destination;
sendReq(\'ajax/townmap.php?x=\' + x + \'&y=\' + y + \'&ajaxsession=' . rand(10000, 99999) . '\', \'map\');
}
} else if(x != -249) {
x = -249;
sendReq(\'ajax/townmap.php?x=\' + x + \'&y=\' + y + \'&ajaxsession=' . rand(10000, 99999) . '\', \'map\');
}
} else if(x != 249) {
x = 249;
sendReq(\'ajax/townmap.php?x=\' + x + \'&y=\' + y + \'&ajaxsession=' . rand(10000, 99999) . '\', \'map\');
}
}
function gotoy(value) {
destination = (250 - value) * -1;
if(destination <= 249) {
if(destination >= -249) {
if(destination != y) {
y = destination;
sendReq(\'ajax/townmap.php?x=\' + x + \'&y=\' + y + \'&ajaxsession=' . rand(10000, 99999) . '\', \'map\');
}
} else if(y != -249) {
y = -249;
sendReq(\'ajax/townmap.php?x=\' + x + \'&y=\' + y + \'&ajaxsession=' . rand(10000, 99999) . '\', \'map\');
}
} else if(y != 249) {
y = 249;
sendReq(\'ajax/townmap.php?x=\' + x + \'&y=\' + y + \'&ajaxsession=' . rand(10000, 99999) . '\', \'map\');
}
}
</script>
<div id="content">
<h1 class="titel">Plattegrond van ' . $steden[$own['stad']] . '</h1>
Hier staan jouw woningen en woningen geplaatst door anderen. Klik op een woning om naar het profiel te gaan, waar je de woningen kunt aanvallen of repareren. Klik op een stukje grond om er een woning te plaatsen.<br /><br />
<center>Ga naar: <input type="text" onkeyup="gotox(value)" size="3" value="250" class="input"> x <input type="text" onkeyup="gotoy(value)" size="3" value="250" class="input"></center>
<div style="float: left"><a href="#" onclick="if(y > -249) {sendReq(\'ajax/townmap.php?x=\' + x + \'&y=\' + (y - 1) + \'&ajaxsession=' . rand(10000, 99999) . '\', \'map\');y--;} return false;"><img src="images/map/arrow_up.gif" border="0"></a><br /><br /><a href="#" onclick="if(y < 249) {sendReq(\'ajax/townmap.php?x=\' + x + \'&y=\' + (y + 1) + \'&ajaxsession=' . rand(10000, 99999) . '\', \'map\');y++;} return false;"><img src="images/map/arrow_down.gif" border="0"></a></div>
<div id="map">
<table cellpadding="0" cellspacing="0" align="center">';
$xcenter = 250;
$ycenter = 250;
$i = $ycenter - 1;
while($i <= $ycenter + 1) {
echo'
<tr>
<td width="30">' . $i . '</td>';
$j = $xcenter - 1;
while($j <= $xcenter + 1) {
echo'
<td style="background: url(images/map/' . $empty . '.jpg) no-repeat; width: 100px; height: 100px;">';
$house = mysql_fetch_query("SELECT soort, eigenaar, id FROM woningen WHERE geplaatst = 'Ja' AND stad = '" . $own['stad'] . "' AND coordinaten_y = '" . $i . "' AND coordinaten_x = '" . $j . "'");
if(!empty($house)) {
$woning = mysql_fetch_query("SELECT naam FROM woningenmarkt WHERE id = '" . $house['soort'] . "'");
if($house['eigenaar'] == $own['login']) {
$plaatje = 'house_' . ($house['soort'] - 1) . 'stars_own.gif';
$titel = 'Jouw ' . strtolower($woning['naam']);
} else {
$plaatje = 'house_' . ($house['soort'] - 1) . 'stars.gif';
$titel = $woning['naam'] . ' van ' . $house['eigenaar'];
}
echo'<a href="index.php?p=woning&id=' . $house['id'] . '"><img src="images/map/' . $plaatje . '" title="' . $titel . '" border="0"></a>';
} else {
echo'<a href="index.php?p=build&x=' . $j . '&y=' . $i . '"><img src="images/map/' . $empty . '.jpg" border="0"></a>';
}
echo'</td>';
$j++;
}
echo'
</tr>';
$i++;
}
echo'
<tr>
<td> </td>';
$j = $xcenter - 1;
while($j <= $xcenter + 1) {
echo'<td align="center">' . $j . '</td>';
$j++;
}
echo'
</tr>
</table>
</div>
<table align="center">
<tr>
<td align="center"><a href="#" onclick="if(x > -249) {sendReq(\'ajax/townmap.php?x=\' + (x - 1) + \'&y=\' + y + \'&ajaxsession=' . rand(10000, 99999) . '\', \'map\');x--;} return false;"><img src="images/map/arrow_left.gif" border="0"></a></td>
<td align="center"><a href="#" onclick="if(x < 249) {sendReq(\'ajax/townmap.php?x=\' + (x + 1) + \'&y=\' + y + \'&ajaxsession=' . rand(10000, 99999) . '\', \'map\');x++;} return false;"><img src="images/map/arrow_right.gif" border="0"></a></td>
</tr>
</table><br />
<a href="index.php?p=listbuildings&owner=' . $own['id'] . '">Mijn woningen weergeven</a>';
echo'
</div>
<div id="content_bottom"> </div>';
?>
Toon Meer