Witam, mam pytanie... Czy pomógłby mi ktoś przerobić skrypt mapy 2d, aby wyświetlał on wszystkich graczy na mapie, a nie tylko nas? Oto kod tego skryptu:
tablicamapy.phphttp://wklej.org/id/318155/index.php<?php
/**
* Plik generujacy mape na podstawie wczesniej przygotowanej tablicy.
*/
// Zalaczanie pliku z polaczeniam do bazy
include('config.php');
// Zalaczane tablicy
include('tablicamapy.php');
/**
* Pobiera wspolrzedne gracza o ID podanym jako parametr
*
* @author: Meares (http://mearesligitharr.blogspot.com/)
* @name: GetYXForPlayer
* @param: integer $ID
* @return: array
*/
function GetYXForPlayer($ID) {
return $Fetched;
}
// Zdobycie wspolrzednych gracza
$YX = GetYXForPlayer(1);
// Zmiana miejsca gracza
if(($YX['y'] + 1 == $_GET['y'] || $YX['y'] - 1 == $_GET['y'] || $YX['y'] == $_GET['y']) && ($YX['x'] + 1 == $_GET['x'] || $YX['x'] - 1 == $_GET['x'] || $YX['x'] == $_GET['x']) && $Map[$_GET['y']][$_GET['x']]['CanBeOn'] === true) {
mysql_query('UPDATE `users` SET `y`='.$_GET['y'].', `x`='.$_GET['x'].' WHERE `id`=1 LIMIT 1'); } else {
}
}
// Zdobycie aktualnych wspolrzednych gracza
$YX = GetYXForPlayer(1);
// Generowanie
// $Key zawiera wspolrzedna Y
foreach($Map as $Key => $Value) {
// $Key2 zawiera wspolrzedna X, a $Value2 to tablica zawierajaca informacje o podlozu oraz o tym czy na dane pole mozna wejsc
foreach($Value as $Key2 => $Value2) {
$EchoString[0] = '<span style="position: relative; left: 1px; z-index: 1;"><img src="images/'.$Value2['Image'].'" alt="MapElement" style="width: 32px; height: 32px;" /></span>';
// Jesli mozna wejsc na pole
if($Value2['CanBeOn'] === true) {
// Generowanie "strzaleczek"
if($Key - 1 == $YX['y'] && $Key2 == $YX['x']) {
$EchoString[1] = '<span style="position: relative; left: 0px; z-index: 2;"><a href="genmapfile.php?y='.$Key.'&x='.$Key2.'"><img src="images/arrow_down.png" alt="Go!" style="position: absolute; right: 0px; width: 32px; height: 32px;" /></a></span>';
} else if($Key + 1 == $YX['y'] && $Key2 == $YX['x']) {
$EchoString[1] = '<span style="position: relative; left: 0px; z-index: 2;"><a href="genmapfile.php?y='.$Key.'&x='.$Key2.'"><img src="images/arrow_up.png" alt="Go!" style="position: absolute; right: 0px; width: 32px; height: 32px;" /></a></span>';
} else if($Key2 - 1 == $YX['x'] && $Key == $YX['y']) {
$EchoString[1] = '<span style="position: relative; left: 0px; z-index: 2;"><a href="genmapfile.php?y='.$Key.'&x='.$Key2.'"><img src="images/arrow_right.png" alt="Go!" style="position: absolute; right: 0px; width: 32px; height: 32px;" /></a></span>';
} else if($Key2 + 1 == $YX['x'] && $Key == $YX['y']) {
$EchoString[1] = '<span style="position: relative; left: 0px; z-index: 2;"><a href="genmapfile.php?y='.$Key.'&x='.$Key2.'"><img src="images/arrow_left.png" alt="Go!" style="position: absolute; right: 0px; width: 32px; height: 32px;" /></a></span>';
} else if($Key == $YX['y'] && $Key2 == $YX['x']) {
$EchoString[1] = '<span style="position: relative; left: 0px; z-index: 2;"><img src="images/character.png" alt="Character" style="position: absolute; right: 0px; width: 32px; height: 32px;" /></span>';
} else {
$EchoString[1] = '';
}
} else {
$EchoString[1] = '';
}
}
}
?>
Demo mapy można zobaczyć tutaj:
http://endoria.za.pl/test/login.php