Dilong Posted June 5, 2018 Report Share Posted June 5, 2018 Estaba aburrido y me puse a hacer este evento clasico algo mejorado Spoiler quest tanaka begin state start begin when 20094.chat."GM Evento tanaka" with pc.is_gm() begin permisos_gm = mysql_query("SELECT * FROM player.GM_tanaka") if not permisos_gm.GM[1] == pc.get_name() then -- No dejara abrir el panel del evento si los GM´s no estan registrados return end say_title("[DELAY value;1]Npc evento[/DELAY]") say("[DELAY value;1]Cada vez que maten un pirata volverá a aparecer otro.[ENTER]No activar cerca de zonas seguras de un mapa[/DELAY]") say_reward("[DELAY value;1]1 = Activo, 0 = No activo[/DELAY]") say("[DELAY value;1]Evento Tanaka: "..game.get_event_flag("tanaka1").."[/DELAY]") local evento = select("Activar","Cancelar","Cerrar") if evento == 1 then if game.get_event_flag("tanaka1")== 1 then say("El evento ya está activo") return end say_title("Npc evento") say("El maximo es de 24 (24hs)") local tiempo = tonumber(input()) if tiempo > 24 then say("Tiempo excedido") return end if tiempo < 1 then say("Debes escribir almenos un numero de 1 al 24") return end game.set_event_flag("tanaka1",1) server_timer("tanaka2", 60*60*tiempo) command("m idmob 20") mysql_query("INSERT INTO player.evento_tanaka(nombre_gm, duracion) VALUES('"..pc.get_name().."' , '"..tiempo.."')") notice_all("Evento tanaka activo [Duración: "..tiempo.." horas]") elseif evento == 2 then if game.get_event_flag("tanaka1")== 0 then say("El evento no está activo") return end game.set_event_flag("tanaka1",0) clear_server_timer("tanaka2") notice_all("Evento tanaka cancelado") return end end when tanaka2.server_timer begin game.set_event_flag("tanaka1",0) notice_all("El evento tanaka ha terminado") end when idmob.kill with game.get_event_flag("tanaka1")== 1 begin mob.spawn(idmob, pc.get_local_x()+20, pc.get_local_y()+20, 1) local s = number(1, 20) if s <= 5 then pc.give_item2(id_item_tanaka,1) end end when 20094.chat."Comerciar Oreja de Tanaka" with game.get_event_flag("tanaka1")== 1 begin say_title("Npc evento") say("texto") local objetos = { -- 1- Nombre objeto 2- Item a entregar 3- Cantidad a entregar 4- Item que pide el npc -5 Cantidad de item que pide el npc {"Objeto1 (10 Orejas)", 30192, 2, 30202, 10}, {"Objeto2 (20 Orejas)", 30193, 4, 30202, 20}, {"Objeto3 (30 Orejas)", 30194, 6, 30202, 30}, {"Objeto4 (40 Orejas)", 30195, 8, 30202, 40}, {"Objeto5 (50 Orejas)", 30196, 10, 30202, 50}, {"Nada"}, } local objetos2 = {} for i=1, table.getn(objetos) do table.insert(objetos2, objetos[i][1]) end local menu = select_table(objetos2) if pc.count_item(objetos[menu][4]) < objetos[menu][5] then say("necesitas "..objetos[menu][5].." orejas") return end pc.remove_item(objetos[menu][4], objetos[menu][5]) pc.give_item2(objetos[menu][2], objetos[menu][3]) end when 20094.chat."ADM Permisos" with pc.is_gm() and pc.get_name()=="[GM]Test" begin -- Cambiar el nombre por el de administrador say_title("Npc evento") say("Conceder permisos para utilizar el npc") local permisos = select("Agregar GM","Quitar GM","Cerrar") if permisos == 1 then say_title("Npc evento") say("Escribe el nombre del GM") local gm_name = input() mysql_query("INSERT INTO player.GM_tanaka(GM) VALUES('"..gm_name.."')") elseif permisos == 2 then say_title("Npc evento") say("Escribe el nombre del GM a quitar") local gm_name2 = input() mysql_query("DELETE FROM player.GM_tanaka WHERE GM = '"..gm_name2.."'") return end end end end Agregar estas tablas en player, para logs y permisos de GM´s: Spoiler /* Navicat MySQL Data Transfer Source Server : SF Akron Source Server Type : MySQL Source Server Version : 50630 Source Host : 127.0.0.1:3306 Source Schema : player Target Server Type : MySQL Target Server Version : 50630 File Encoding : 65001 Date: 05/06/2018 13:51:04 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for GM_tanaka -- ---------------------------- DROP TABLE IF EXISTS `GM_tanaka`; CREATE TABLE `GM_tanaka` ( `GM` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, PRIMARY KEY (`GM`) USING BTREE ) ENGINE = MyISAM CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; Spoiler /* Navicat MySQL Data Transfer Source Server : SF Akron Source Server Type : MySQL Source Server Version : 50630 Source Host : 127.0.0.1:3306 Source Schema : player Target Server Type : MySQL Target Server Version : 50630 File Encoding : 65001 Date: 05/06/2018 13:59:58 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for evento_tanaka -- ---------------------------- DROP TABLE IF EXISTS `evento_tanaka`; CREATE TABLE `evento_tanaka` ( `nombre_gm` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL, `duracion` int(8) NULL DEFAULT NULL, `fecha_evento` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) ) ENGINE = MyISAM CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; aaron fdz, NazoX, Break and 4 others 4 1 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.