Postado Julho 23, 2018 6 anos Não vai funcionar, vc não colocou junto a função string.diff que originalmente não existe nas libs do TFS/OTX. E seria mais inteligente mudar isso: for _, table in pairs(config.items) do for i=1, #config.items do player:addItem(table[i]) end end table é uma variável já existente nativa do lua, onde existem todas as funções de tabelas, não é bom ficar sobre-escrevendo assim, por mais que do jeito que está seja datada como uma local. Editado Julho 23, 2018 6 anos por Snowsz (veja o histórico de edições) _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Julho 23, 2018 6 anos Autor 1 hora atrás, Snowsz disse: Não vai funcionar, vc não colocou junto a função string.diff que originalmente não existe nas libs do TFS/OTX. E seria mais inteligente mudar isso: for _, table in pairs(config.items) do for i=1, #config.items do player:addItem(table[i]) end end table é uma variável já existente nativa do lua, onde existem todas as funções de tabelas, não é bom ficar sobre-escrevendo assim, por mais que do jeito que está seja datada como uma local. Eu fiz o teste aqui @Snowsz Mas obrigado pela dica Ele ta funcionando mesmo com o table, mas vou trocar nos próximos scripts !! Meus trabalhos: [Movements] TFS 1.1+ Area Hardcore [Movements] TFS 1.1+ Tile Party [Action] TFS 1.1+ Bau diário [Action] TFS 1.1+ Guild Dungeon Lever [Talkactions] TFS 0.3.6 / 0.4 Quest Hunt por Tempo Contato: Discord: Tataboy67#4934
Postado Julho 24, 2018 6 anos Autor @Maniaco local config = { items = { [1] = {2160, 10}, [2] = {2159, 10} }, level = 100, days = 1 } function onUse(player, item, fromPosition, itemEx, toPosition) check = false if player:getLevel() < config.level then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce nao tem level "..config.level..".") return true end local query = db.storeQuery("SELECT `player_ip`, `date` FROM `reward_daily` WHERE `player_ip` = "..player:getIp()) if query ~= false then if result.getDataInt(query, "date") <= os.time() then check = true db:query("UPDATE `reward_daily` SET `date` = ".. os.time()+config.days*24*60*60 .." WHERE `player_ip` = "..player:getIp()) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Desculpe, mas voce deve aguardar ate "..os.date("%d %B %Y %X ", result.getDataInt(query, "date")).." para pegar o bau novamente.") return true end else check = true db:query("INSERT INTO `reward_daily` (`player_ip`, `date`) VALUES ('".. player:getIp() .."','".. os.time()+config.days*24*60*60 .."');") -- adiciona na query end if check then for _, table in pairs(config.items) do for i=1, #config.items do player:addItem(table[i]) end end end return true end executa no banco de dados CREATE TABLE reward_daily ( id INT NOT NULL AUTO_INCREMENT, player_ip INTEGER NOT NULL, date INTEGER NOT NULL, PRIMARY KEY ( id ) ); Creditos totais ao @Vodkart ! Parabens ? Pena que ainda não sei fazer nada em database Meus trabalhos: [Movements] TFS 1.1+ Area Hardcore [Movements] TFS 1.1+ Tile Party [Action] TFS 1.1+ Bau diário [Action] TFS 1.1+ Guild Dungeon Lever [Talkactions] TFS 0.3.6 / 0.4 Quest Hunt por Tempo Contato: Discord: Tataboy67#4934
Postado Janeiro 16, 2019 6 anos Em 23/07/2018 em 11:34, tataboy67 disse: Opa galera beleza? Eu vi um cidadão aqui do forum pedindo, e para não reviver o tópico resolvi desenvolver 1 e postar @ADM Mayk on BaiakME Ta ai o script que tu pediu. Crie um arquivo com o nome de Bau_Diario.lua local config = { items = { [1] = {2160, 10}, [2] = {2159, 10} }, level = 100, tempo = 24*60*60, -- 24 horas stoTime = 31402 } function onUse(player, item, fromPosition, itemEx, toPosition) if player:getLevel() >= config.level then if player:getStorageValue(config.stoTime) - os.time() < 0 then player:setStorageValue(config.stoTime, os.time() + config.tempo) for _, table in pairs(config.items) do for i=1, #config.items do player:addItem(table[i]) end end else player:getStorageValue(config.stoTime, 0) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("Wait: %s.", string.diff(player:getStorageValue(config.stoTime)-os.time()))) end else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce nao tem level "..config.level..".") end end Adicione a TAG em actions.xml <action actionid="22164" script="Bau_Diario.lua"/> Créditos: Eu não teria para tfs 0.4 ??
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.