$text_script = 'TELEPORT ' . $map_id . ',' . $map_left . ',' . $map_top . $map_dir; $event_name = $lang->teleport . ' : ' . $map_id . '. ' . $map_name . ' [' . $map_left . ',' . $map_left . ']'; $size = @getimagesize($config->path . 'images/sprites/' . $config->preset_teleport_sprite); if (!is_array($size)) { $width = 0; $height = 0; } else { $width = intval($size[0]); $height = intval($size[1]); } $result = $db->sql_query('SELECT MAX(id) AS max FROM ' . EVENTS_TABLE); $id = $db->sql_fetchrow($result); $id = $id['max'] + 1; require $config->path . 'includes/functions_map.' . $config->phpex; $event_script = new event_script(); list($compiled, $result) = $event_script->compile($text_script); if (!$compiled) { js_eval('alert(\'' . quotes($result) . '\');', $refresh_id, 1); } $db->sql_query('INSERT INTO ' . EVENTS_TABLE . '(id, name, picture, pic_width, pic_height, dir, text_script, script, layer) VALUES(' . $id . ', \'' . quotes($event_name) . '\', \'' . quotes($config->preset_teleport_sprite) . '\', ' . $width . ', ' . $height . ', \'\', \'' . quotes($text_script) . '\', \'' . quotes(serialize($result)) . '\', 0)'); $lang->load_keys('event_editor'); js_eval('alert(\'' . quotes($lang->event_saved) . '\');remake_event_list(' . $id . ', \'' . quotes($event_name) . '\', \'' . quotes($config->preset_teleport_sprite) . '\', ' . $width . ', ' . $height . ', false);', $refresh_id, 1); } else { exit; } } elseif ($mode == 'GET.event_editor') { if (empty($_GET['event_id'])) { header('Location: ' . $config->path . $config->index . '?mod=admin.map&mode=select_event_to_edit'); exit; } $lang->load_keys('event_editor');