diff --git a/admin.php b/admin.php
index 3d23199..2254c8f 100644
--- a/admin.php
+++ b/admin.php
@@ -107,6 +107,34 @@ if (empty($_POST) === false) {
}
}
+ // Teleport Player
+ if (in_array($_POST['from'], ['all', 'only'])) {
+ $from = $_POST['from'];
+ if ($from === 'only') {
+ if (empty($_POST['player_name']) || !user_character_exist($_POST['player_name'])) {
+ $errors[] = 'Character '. getValue($_POST['player_name']) .' does not exist.';
+ }
+ }
+
+ if (!sizeof($errors)) {
+ $to = $_POST['to'];
+ $teleportQuery = 'UPDATE `players` SET ';
+
+ if ($to == 'home') {
+ $teleportQuery .= '`posx` = 0, `posy` = 0, `posz` = 0 ';
+ } else if ($to == 'town') {
+ $teleportQuery .= '`posx` = 0, `posy` = 0, `posz` = 0, `town_id` = ' . (int) getValue($_POST['town']) . ' ';
+ } else if ($to == 'xyz') {
+ $teleportQuery .= '`posx` = ' . (int) getValue($_POST['x']) . ', `posy` = ' . (int) getValue($_POST['y']) . ', `posz` = ' . (int) getValue($_POST['z']) . ' ';
+ }
+
+ if ($from === 'only') {
+ $teleportQuery .= ' WHERE `name` = \'' . getValue($_POST['player_name']). '\'';
+ }
+
+ mysql_update($teleportQuery);
+ }
+ }
// If empty post
}
@@ -237,6 +265,62 @@ echo "Last cached on: ". getClock($basic['cached'], true) .".
";
+