Jump to content

Buenas Quest sobre navidad


[GL]DarkSheep

Mensajes recomendados

Spoiler

quest event2 begin
state start begin
when 20091.chat."Evento navidad" with pc.is_gm() begin
say_title("Npc")
local e = select("Activar","Desactivar","Cerrar")
if e == 1 then
	local cronom = tonumber(input())
	if cronom "" then
		say("error")
		return end
		if cronom > 120 then
			say("Maximo 120 horas")
			return end
			if cronom < 1 then
				say("error2")
				return end
				game.set_event_flag("event_navidad",1)
				server_timer("navidad", 60*60*cronom)
				notice_all("Evento arbol de navidad activo")
				notice_all("Duracion "..cronom.." Horas")
				elseif e == 2 then
					clear_server_timer("cronom")
					game.set_event_flag("event_navidad",0)
					mysql_direct_query("TRUNCATE TABLE player.arbol_navidad")
					notice_all("Evento arbol de navidad cancelado")
					return end end
					when navidad.server_timer begin
					game.set_event_flag("event_navidad",0)
					mysql_direct_query("TRUNCATE TABLE player.arbol_navidad")
					notice_all("El evento arbol de navidad ha terminado")
				end
				when kill with not npc_is_pc() and game.get_event_flag("event_navidad")==1 begin
				local drop = number(1, 250)
				if drop <= 5 then
					game.drop_item_with_ownership(iditem,1)
					end end
					when arbol_id.chat."Navidad" with game.get_event_flag("event_navidad")==1 begin
					say_title("Arbol:")
					say("Info:")
					say("Arrastra el item sobre el arbol")
				end
				when arbol_id.take with item.get_vnum(iditem) and game.get_event_flag("event_navidad")==1 begin
				local registro, s = mysql_direct_query("SELECT id FROM player.arbol_navidad")
				for i=1,registro do
				if pc.get_account_id()==s[i].id then
				notice("Ya has participado")
				return end end
				local objetos = {19,29,39,49,59,69,79,89,99,109,119,129,139,149,159,169,179}
				local objetos2 = math.random(1,17)
				pc.remove_item(iditem,1)
				pc.give_item2(objetos[objetos2],1)
				mysql_direct_query("INSERT INTO player.arbol_navidad(nombre, id) VALUES ('"..pc.get_name().."', '"..pc.get_account_id().."')")
				notice("Al colgar un calcetin has recibido un objeto aleatorio")
			end
			when login with game.get_event_flag("event_navidad")==0 and pc.getqf("item")==0 begin
			pc.remove_item("idcalcetin",900) -- Se debe modificar el proto del item para que no se pueda guardar en el almacen
			pc.setqf("item",1)
		end
		when login with game.get_event_flag("event_navidad")==1 and pc.getqf("item")==1 begin
		pc.setqf("item",0)
	end
end
end





 

Spoiler

/*
 Navicat MySQL Data Transfer

 Source Server         : metin2server
 Source Server Type    : MySQL
 Source Server Version : 50634
 Source Host           : 127.0.0.1:3306
 Source Schema         : player

 Target Server Type    : MySQL
 Target Server Version : 50634
 File Encoding         : 65001

 Date: 04/12/2018 18:12:30
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for arbol_navidad
-- ----------------------------
DROP TABLE IF EXISTS `arbol_navidad`;
CREATE TABLE `arbol_navidad`  (
  `nombre` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `id` int(8) NOT NULL,
  PRIMARY KEY (`nombre`, `id`) USING BTREE
) ENGINE = MyISAM CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

 

 

Enlace para comentar
Compartir en otros sitios

  • Dilong locked this tema
Guest
Este tema está cerrado a otras respuestas.
  • Recientemente navegando por este tema   0 miembros

    • No hay usuarios registrados visitando esta página.
×
×
  • Crear nuevo...