Dilong Posted August 24, 2018 Report Share Posted August 24, 2018 Es similar al objeto de almacenar exp del metin2dream Quest: Spoiler quest item_exp begin state start begin when 70007.use begin mysql_query("INSERT INTO player.item_exp(id_item) VALUES ('"..item.get_id().."')") exp3 = mysql_query("SELECT experiencia FROM player.item_exp WHERE id_item = "..item.get_id()..";") say_title("Item:") say_reward("Solo se puede almacenar experiencia[ENTER]una vez por objeto") say_reward("Contiene "..exp3.experiencia[1].." puntos de experiencia") local exp = select("Almacenar Exp","Usar Exp","Cerrar") if exp == 1 then local exp2 = mysql_query("SELECT uso FROM player.item_exp WHERE id_item = "..item.get_id()..";") if exp2.uso[1] > 0 then say("Ya no se puede almacenar[ENTER]experiencia") return end if pc.get_exp() < 1 then say("No tienes experiencia") return end mysql_query("UPDATE player.item_exp SET experiencia = '"..pc.get_exp().."', uso = 1, player_exp = '"..pc.get_name().."' WHERE id_item = '"..item.get_id().."'") pc.give_exp2(-pc.get_exp()) notice("Puntos de experiencia almacenados") elseif exp == 2 then local exp4 = tonumber(input()) if exp4 == "" then say("Debes escribir un numero") return end if exp3.experiencia[1] < 1 then say("No contiene experiencia") return end if exp4 > exp3.experiencia[1] then say("Cantidad incorrecta") return end if pc.get_level() > 70 then say("Solo puede ser utilizado hasta el[ENTER]nivel 70") return end mysql_query("UPDATE player.item_exp SET experiencia = experiencia - "..exp4.." WHERE id_item = "..item.get_id()..";") pc.give_exp2(exp4,exp3.experiencia[1]) notice("Has recibido "..exp4.." puntos de experiencia") return end end end end Sql: Spoiler /* Navicat MySQL Data Transfer Source Server : SF Akron2 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: 24/08/2018 16:16:03 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for item_exp -- ---------------------------- DROP TABLE IF EXISTS `item_exp`; CREATE TABLE `item_exp` ( `id_item` int(8) NOT NULL, `experiencia` int(8) NULL DEFAULT 0, `uso` int(8) NULL DEFAULT 0, `player_exp` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL, PRIMARY KEY (`id_item`) USING BTREE ) ENGINE = MyISAM CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Fixed; SET FOREIGN_KEY_CHECKS = 1; TheZurka, Marcos Pinheiro, drakulaura and 1 other 4 Quote Link to comment Share on other sites More sharing options...
drakulaura Posted August 24, 2018 Report Share Posted August 24, 2018 gracias por el aporte 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.