Ir para conteúdo

Vodkart

Héroi
  • Registro em

Solutions

  1. Vodkart's post in [7.72] Info Monster - Talkaction was marked as the answer   
    tenta usar assim:
     
    function ExistMonsterByName(name) -- by vodka local monster = io.open("data/monster/monsters.xml", "r"):read("*all") local get = monster:lower():match('name="' .. name:lower() ..'"') if get == nil or get == "" then return false end return true end function getDirMonsterByNameMonster(name) local t = {} local monster = io.open("data/monster/monsters.xml", "r") for i in monster:read("*a"):gmatch('<monster name="'..tostring(name)..'" file="(.-)"/>') do table.insert(t, tostring(i)) end return t[1] or 0 end function getMonsterLootItens(name) local dir = "data/monster/"..getDirMonsterByNameMonster(name).."" local monster = io.open(""..dir.."", "r") str = "" for i in monster:read("*a"):gmatch('id="(.-)"') do str = ""..str.." - "..getItemNameById(i).."" end return str end function getAllMonster() local str = "" local monster = io.open("data/monster/monsters.xml", "r") str = "Voce digitou incorretamente o nome do monstro veja a lista de monstro\n" for i in monster:read("*a"):gmatch('<monster name="(.-)"') do str = ""..str.." - "..i.."" end return str end function getAttrMonster(name) return "Life = "..getMonsterInfo(name).health.."\nExp = "..getMonsterInfo(name).experience.."\n" end function onSay(cid, words, param, channel) if param == "" or not param or param == " " then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce precisa dizer o nome do monstro") return true end local name = param:lower() if not ExistMonsterByName(name) then doShowTextDialog(cid, 1397, getAllMonster()) return true end local name = name:gsub("(%l)(%w*)", function(a,b) return string.upper(a)..b end) doShowTextDialog(cid, 1397, "Info Monster "..name.."\n"..getAttrMonster(name).."\n\nLoots = "..getMonsterLootItens(name).."") return true end  
  2. Vodkart's post in Script de virar para o Alvo Não vira se o alvo tiver em diagonal was marked as the answer   
    https://tibiaking.com/forums/topic/47275-direção-de-ataque/
  3. Vodkart's post in Quest diaria por IP was marked as the answer   
    Query para executar
     
    CREATE TABLE `ip_storages` ( `ip` int NOT NULL default 0, `key` int NOT NULL default 0, `value` varchar(255) NOT NULL default 0 )  
     
    funções para adicionar
     
    function setIpStorageValue(ip, key, value) local func = db.executeQuery or db.query local query = db.getResult("SELECT `value` FROM `ip_storages` WHERE `key` = "..key.." AND `ip` = "..ip) if query:getID() == -1 then return func("INSERT INTO `ip_storages` (`ip`, `key`, `value`) VALUES ("..ip..", "..key..", "..value..")") end return func("UPDATE `ip_storages` SET `value` = "..value.." WHERE `key` = "..key.." AND `ip` = "..ip) end function getIpStorageValue(ip, key) local ret = db.getResult("SELECT `value` FROM `ip_storages` WHERE `ip` = "..ip.." AND `key` = "..key) if ret:getID() == -1 then return -1 end return ret:getDataInt("value") or ret:getDataString("value") end function timeString(timeDiff) local dateFormat = { {"day", timeDiff / 60 / 60 / 24}, {"hour", timeDiff / 60 / 60 % 24}, {"minute", timeDiff / 60 % 60}, {"second", timeDiff % 60} } local out = {} for k, t in ipairs(dateFormat) do local v = math.floor(t[2]) if(v > 0) then table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or '')) end end local ret = table.concat(out) if ret:len() < 16 and ret:find("second") then local a, b = ret:find(" and ") ret = ret:sub(b+1) end return ret end  
     
    exemplo de báu:
     
    function onUse(cid, item, fromPosition, itemEx, toPosition) local storage, hours = 18000, 24 local ip = getPlayerIp(cid) local item = 2160 if getIpStorageValue(ip, storage) - os.time() <= 0 then doPlayerSendTextMessage(cid,22,"Tome seu prêmio.") setIpStorageValue(ip, storage, os.time()+hours*3600) doPlayerAddItem(cid, item, 100) return true end return doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"Espere " .. timeString(getIpStorageValue(ip, storage) - os.time()) .. " para pegar um novo item!") end  
  4. Vodkart's post in Lottery system com limitação a trainers was marked as the answer   
    Justamente, por isso a adaptação...
     
     
    usa o código lá do global events assim:
     
     
    local config = { lottery_hour = "2 hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message) rewards_id = {2494, 2472, 2514, 2160}, -- ID dos Itens Sorteados na Loteria crystal_counts = 10, -- Usado somente se a rewards_id for crystal coin (ID: 2160). website = "yes", -- Only if you have php scripts and table `lottery` in your database! days = { "Monday-08:00", "Monday-13:00", "Monday-19:30", "Tuesday-08:00", "Tuesday-13:00", "Tuesday-19:30", "Wednesday-08:00", "Wednesday-13:00", "Wednesday-19:30", "Thursday-08:00", "Thursday-13:00", "Thursday-19:30", "Friday-01:22", "Friday-13:00", "Friday-19:30", "Saturday-21:27", "Saturday-21:28", "Saturday-21:29", "Sunday-08:00", "Sunday-13:00", "Sunday-19:30" } } local function getPlayerWorldId(cid) if not(isPlayer(cid)) then return false end local pid = getPlayerGUID(cid) local worldPlayer = 0 local result_plr = db.getResult("SELECT * FROM `players` WHERE `id` = "..pid..";") if(result_plr:getID() ~= -1) then worldPlayer = tonumber(result_plr:getDataInt("world_id")) result_plr:free() return worldPlayer end return false end local function getOnlineParticipants() local players = {} for _, pid in pairs(getPlayersOnline()) do if getPlayerAccess(pid) <= 2 and getPlayerStorageValue(pid, 281821) <= os.time() and getPlayerStorageValue(pid, 281822) <= os.time() then table.insert(players, pid) end end if #players > 0 then return players end return false end function onThink(cid, interval) if table.find(config.days, os.date("%A-%H:%M")) then if(getWorldCreatures(o) <= 0)then return true end local query = db.query or db.executeQuery local random_item = config.rewards_id[math.random(1, #config.rewards_id)] local item_name = getItemNameById(random_item) local data = os.date("%d/%m/%Y - %H:%M:%S") local online = getOnlineParticipants() if online then local winner = online[math.random(1, #online)] local world = tonumber(getPlayerWorldId(winner)) if(random_item == 2160) then doPlayerSetStorageValue(winner, 281821, os.time() + 3600 * 24) doPlayerAddItem(winner, random_item, config.crystal_counts) doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. config.crystal_counts .." " .. getItemNameById(random_item) .. "s! Congratulations! (Next lottery in " .. config.lottery_hour .. ")") else doPlayerSetStorageValue(winner, 281821, os.time() + 3600 * 24) doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " ..getItemNameById(random_item) .. "! Congratulations! (Next lottery in " .. config.lottery_hour .. ")") doPlayerAddItem(winner, random_item, 1) end if(config.website == "yes") then query("INSERT INTO `lottery` (`name`, `item`, `world_id`, `item_name`, `date`) VALUES ('".. getCreatureName(winner).."', '".. random_item .."', '".. world .."', '".. item_name .."', '".. data .."');") end else print("Ninguem OnLine pra ganhar na loteria") end end return true end  
     
     
    e o script que eu te passei vc coloca em creaturescript
     
     
    lotrainer.lua
    function onLogin(cid) registerCreatureEvent(cid, "LoterryTreiner") setPlayerStorageValue(cid, 281822, 0) return true end function onCombat(cid, target) local treiners = {"Trainer", "Training Monk"} -- nome dos trainera do seu ot if isPlayer(cid) and isMonster(target) and isInArray(treiners, getCreatureName(target)) then setPlayerStorageValue(cid, 281822, os.time()+15) end return true end  
    TAG no xml
     
    <event type="login" name="LoterryLogin" event="script" value="lotrainer.lua"/> <event type="combat" name="LoterryTreiner" event="script" value="lotrainer.lua"/>  
  5. Vodkart's post in Erro em NPC de quest com tasks was marked as the answer   
    Bom dia, me chama discord qualquer hora que eu te ajudo a fazer esse npc!
  6. Vodkart's post in Ativar script depois de 5 segundos was marked as the answer   
    tile_storage = 876448 function doTeleportWithDelay(cid, pos, delay) -- by vodkart if not isCreature(cid) then return LUA_ERROR end if delay > 0 then if #getPlayersInArea(battleroyale.area) > 1 then setPlayerStorageValue(cid, tile_storage, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Battle Royale Teleport} O teletransporte foi desativado ainda existem pessoas na area.") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Battle Royale Teleport} "..delay.." segundos para se teletransportar.") addEvent(doTeleportWithDelay, 1000, cid, pos, delay-1) else doTeleportThing(cid, pos) doSendMagicEffect(getPlayerPosition(cid), 10) local battlewin = 1 local item = doPlayerAddItem(cid, 5805, 1) doItemSetAttribute(item, "description", getCreatureName(cid).." conquistou este trofeu apos vencer uma partida no Battle Royale.") doBroadcastMessage(""..getCreatureName(cid).." Venceu o evento Battle Royale") doPlayerAddItem(cid,12618,1) doPlayerAddItem(cid,2152,30) addTopbattle(cid, battlewin) setPlayerStorageValue(cid, tile_storage, -1) end end function onStepIn(cid, item, position, fromPosition) local pos = {x = 1037, y = 1034, z = 7} local time = 5 -- segundos if #getPlayersInArea(battleroyale.area) > 1 then return true end if getPlayerStorageValue(cid, tile_storage) <= 0 then doTeleportWithDelay(cid, pos, time) setPlayerStorageValue(cid, tile_storage, 1) end return true end  
  7. Vodkart's post in (Resolvido)Contagem de tempo por Storage was marked as the answer   
    #Resolvido via Discord TK!
     
    Foi modificado action/lib e criado talkactions + função que retorna em tempo real o tempo, exemplo da alavanca + rank em tempo real em uso (para teste)
     

     
     
    e depois final do evento (teste)
     

     
  8. Vodkart's post in (Resolvido)System transform por tempo was marked as the answer   
    Certo, preciso de algumas informações...
     
    1 - Quando morrer, volta para a voc antiga?
     
    2 - Pode voltar a voc antiga a qualquer hora?
     
    3 - Quando eu estiver transformado por exemplo em sasuke (voc por tempo) e quiser me transformar em naruto, sem ser a voc antiga mas sim uma nova, eu posso?
     
    4 - Vale a pena fazer por DB para pegar a voc e transmitir pelo site?
    -----------------------------------
     
    OBS: quanto mais informação melhor... não vou fazer por agora pq estou terminando mais alguns sistemas, mas posso olhar quando tiver tempo.
  9. Vodkart's post in (Resolvido)[TFS 1.3] Erro ao usar potions was marked as the answer   
    if potion.health then target:addHealth(math.random(potion.health[1], potion.health[2])) end if potion.mana then target:addMana(math.random(potion.mana[1], potion.mana[2])) end  
  10. Vodkart's post in (Resolvido)Erro script trade OFF was marked as the answer   
    ué, testa assim
     
     
    local config = { level_add = 20, max_ofertas = 5, ofertas_pz = true, itens_bloqueados = {2165, 2152, 2148, 2160, 2166, 2167, 2168, 2169, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2343, 2433, 2640, 6132, 6300, 6301, 9932, 9933} } function onSay(player, words, param) if (param == 'saldo') then local consulta = db.storeQuery("SELECT * FROM `players` WHERE `id` = " .. player:getGuid() .. ";") local saldo = result.getNumber(consulta, "auction_balance") player:sendTextMessage(MESSAGE_INFO_DESCR, "Seu saldo é de " .. saldo .. " gps de suas vendas no mercado!") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Seu saldo é de " .. saldo .. " gps de suas vendas no mercado!") return true end if(param == '') or (param == 'info') then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Comandos para utilizar este sistema:\n!oferta saldo\nUse este comando para verificar o saldo de suas vendas.\n!oferta add, nomedoitem, preço, qtd\nexemplo: !oferta add,plate armor,500,1\n\n\n!oferta comprar,id_da_compra\nexemplo: !oferta comprar,1943\n\n\n!oferta remover,id_da_compra\nexemplo: !oferta remover,1943\n\n\n!oferta sacar, qtd\nexemplo: !oferta sacar, 1000.\n") return true end local split = param:split(",") if split[2] == nil then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Parâmetros necessários. Use !oferta info para mais informações!") return false end split[2] = split[2]:gsub("^%s*(.-)$", "%1") _BUSCA_DB = db.storeQuery("SELECT * FROM `auction_system` WHERE `player` = " .. player:getGuid()) if(split[1] == "add") then if(not tonumber(split[3]) or (not tonumber(split[4]))) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Use somente números.") return true end if(string.len(split[3]) > 7 or (string.len(split[4]) > 3)) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Este preço ou a quantidade itens é muito alta.") return true end local itemType, item_s = ItemType(split[2]), ItemType(split[2]):getId() if(not item_s) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "O item "..itemType.." não existe!") return true end if(player:getLevel() < config.level_add) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas vcê precisa de level igual ou superior a (" .. config.level_add .. ") para continuar.") return true end if(isInArray(config.itens_bloqueados, item_s)) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode adicionar este item.") return true end if(player:getItemCount(item_s) < tonumber(split[4])) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas você não tem este item.") return true end local amount, tmp_BUSCA_DB = 0, _BUSCA_DB while tmp_BUSCA_DB ~= false do tmp_BUSCA_DB = result.next(_BUSCA_DB) amount = amount + 1 end if _BUSCA_DB ~= false then local limit = amount >= config.max_ofertas if limit then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas você atingiu o limite máximo(" .. config.max_ofertas .. ") de publicações de venda de itens.") return true end if(config.SendOffersOnlyInPZ) then if(not getTilePzInfo(player:getPosition())) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas você só pode usar este comando estando em protection zone.") return true end end end if(tonumber(split[4]) < 1 or (tonumber(split[3]) < 1)) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas você precisa informar um número maior que 0.") return true end local itemcount, costgp = math.floor(split[4]), math.floor(split[3]) player:removeItem(item_s, itemcount) db.query("INSERT INTO `auction_system` (`player`, `item_name`, `item_id`, `count`, `cost`, `date`) VALUES (" .. player:getGuid() .. ", \"" .. split[2] .. "\", " .. item_s .. ", " .. itemcount .. ", " .. costgp ..", " .. os.time() .. ")") player:sendTextMessage(MESSAGE_INFO_DESCR, "Parabéns! Você adicionou para à venda " .. itemcount .." " .. split[2] .." por " .. costgp .. " gps!") end if(split[1] == "comprar") then _BUSCA_DB = db.storeQuery("SELECT * FROM `auction_system` WHERE `id` = ".. tonumber(split[2])) local player_id, player_vendas, item_ids, costs, item_names, counts = player:getGuid(), result.getNumber(_BUSCA_DB, "player"), result.getNumber(_BUSCA_DB, "item_id"), result.getNumber(_BUSCA_DB, "cost"), result.getString(_BUSCA_DB, "item_name"), result.getNumber(_BUSCA_DB, "count") if(not tonumber(split[2])) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas somente números são aceitos.") return true end if(_BUSCA_DB ~= false) then local total_custo = costs - player:getMoney() if(player:getMoney() < costs) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas você não possuí a quantia necessária para comprar. São necessários: "..costs.."gps para comprar o item: "..item_names..". Você tem: " .. player:getMoney() .. "gps. Você precisa de: "..total_custo.." gps.") return true end if(player_id == player_vendas) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas você não pode comprar seu próprio item.") return true end if player:removeMoney(costs) then if(isItemStackable((item_ids))) then player:addItem(item_ids, counts) else for i = 1, counts do player:addItem(item_ids, 1) end end db.query("DELETE FROM `auction_system` WHERE `id` = " .. split[2] .. ";") player:sendTextMessage(MESSAGE_INFO_DESCR, "Parabéns! Você comprou " .. counts .. " ".. item_names .. " por " .. costs .. " gps com sucesso!") db.query("UPDATE `players` SET `auction_balance` = `auction_balance` + " .. costs .. " WHERE `id` = " .. player_vendas .. ";") end else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas o ID "..split[2].." não existe!.") end end if(split[1] == "remover") then local _BUSCA_DB = db.storeQuery("SELECT * FROM `auction_system` WHERE `id` = ".. tonumber(split[2])) local player_id, player_vendas, item_ids, costs, item_names, counts = player:getGuid(), result.getNumber(_BUSCA_DB, "player"), result.getNumber(_BUSCA_DB, "item_id"), result.getNumber(_BUSCA_DB, "cost"), result.getString(_BUSCA_DB, "item_name"), result.getNumber(_BUSCA_DB, "count") if((not tonumber(split[2]))) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas somente números são aceitos.") return true end if(config.SendOffersOnlyInPZ) then if(not getTilePzInfo(player:getPosition())) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You must be in PZ area when you remove offerts from database.") return true end end if(_BUSCA_DB ~= false) then if(player_id == player_vendas) then db.query("DELETE FROM `auction_system` WHERE `id` = " .. split[2] .. ";") if(isItemStackable(item_ids)) then player:addItem(item_ids, counts) else for i = 1, counts do player:addItem(item_ids, 1) end end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns! A oferta "..split[2].." foi removida com sucesso do mercado.\nVocê recebeu: "..counts.." "..item_names..".") else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas essa oferta não é sua.") end result.free(resultado) else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas este ID não existe.") end end if(split[1] == "sacar") then if((not tonumber(split[2]))) then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas somente números são aceitos.") return true end local balance = db.storeQuery("SELECT * FROM `players` WHERE `id` = " .. player:getGuid() .. ";") local auction_balance = result.getNumber(balance, "auction_balance") <= 0 and 0 or result.getNumber(balance, "auction_balance") if(auction_balance < 1) then player:sendTextMessage(MESSAGE_INFO_DESCR, "Você não possuí saldo suficiente para sacar.") result.free(balance) return true elseif tonumber(split[2]) <= 0 or tonumber(split[2]) > auction_balance then player:sendTextMessage(MESSAGE_INFO_DESCR,tonumber(split[2]) <= 0 and "Você tem que digitar um valor maior que 0." or "Você somente pode sacar o total de "..auction_balance..".") result.free(balance) return true end local tz = auction_balance - tonumber(split[2]) player:sendTextMessage(MESSAGE_INFO_DESCR, "Você sacou " .. split[2] .. " gps de suas vendas no mercado! Seu saldo é de: "..tz.."gps.") player:addMoney(tz) db.query("UPDATE `players` SET `auction_balance` = ".. tz .." WHERE `id` = " .. player:getGuid() .. ";") result.free(balance) end return true end  
  11. Vodkart's post in (Resolvido)Dar 10% a mais de exp + skills para quem está dominando o castle. was marked as the answer   
    local rate = 1 local rate_castle = 0.10 local storage = 211320111636 local skills = {SKILL_FIST, SKILL_CLUB, SKILL_SWORD, SKILL_AXE, SKILL_DISTANCE, SKILL_SHIELD, SKILL__MAGLEVEL} function onLogin(cid) if getPlayerGuildId(cid) > 0 and getGlobalStorageValue(storage) == getPlayerGuildName(cid) then doPlayerSetExperienceRate(cid, rate + rate_castle) for _, ret in pairs(skills) do doPlayerSetRate(cid, ret, rate + rate_castle) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você tem "..((rate_castle)*100).."% a mais de experiencia e skills Agora. (Bonus Castle).") end return true end  
  12. Vodkart's post in (Resolvido)NPC REBORN was marked as the answer   
    @Vorkhon erro meu!!! usa assim essa linha:
     
    db.executeQuery("UPDATE `players` SET `vocation` = "..config.voc..", `level` = "..config.level..", `experience` = "..config.exp..", `health` = "..config.life..", `healthmax` = "..config.life..", `mana` = "..config.mana..", `manamax` = "..config.mana.." WHERE `id` = "..player_id)  
  13. Vodkart's post in (Resolvido)Script Boss tfs 0.4 was marked as the answer   
  14. Vodkart's post in (Resolvido)Colocar contagem de mob nesse script was marked as the answer   
    @leozincorsair 
     
    local tab = { ["Renegade"] = {storage = 19100, amount = 75, storage_reward = 9100}, ["Nukenin"] = {storage = 19101, amount = 100, storage_reward = 9101}, ["Anbu"] = {storage = 19102, amount = 100, storage_reward = 9102}, ["Konan"] = {storage = 19104, amount = 100, storage_reward = 9104}, ["Larva"] = {storage = 19105, amount = 200, storage_reward = 9105}, ["Aranha"] = {storage = 19106, amount = 100, storage_reward = 9106}, ["Black Dragon"] = {storage = 19107, amount = 10, storage_reward = 9107}, ["Black Machine"] = {storage = 19108, amount = 10, storage_reward = 9108}, ["Evill Ghost"] = {storage = 19109, amount = 10, storage_reward = 9109}, ["Evill Snake"] = {storage = 191010, amount = 300, storage_reward = 9110} } function onKill(cid, target) if(isPlayer(target) == TRUE and getPlayerStorageValue(cid,9103) ~= 1) then setPlayerStorageValue(cid, 9103, 1) end local ret = tab[getCreatureName(target)] if isMonster(target) == true and ret then local amount = getPlayerStorageValue(cid, ret.storage) <= 0 and 0 or getPlayerStorageValue(cid, ret.storage) if amount < ret.amount then setPlayerStorageValue(cid, ret.storage, amount+1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou "..getPlayerStorageValue(cid, ret.storage).."/"..ret.amount.." "..getCreatureName(target)..".") end if getPlayerStorageValue(cid, ret.storage) >= ret.amount then setPlayerStorageValue(cid, ret.storage_reward, 1) end end return true end  
  15. Vodkart's post in (Resolvido)Mining System Buga? was marked as the answer   
    tenta usar assim:
     
    levels = { {level = {0,19}, quant = {1,1}, percent = 5}, {level = {10,19}, quant = {1,1}, percent = 6}, {level = {20,59}, quant = {1,1}, percent = 7}, {level = {60,89}, quant = {1,2}, percent = 8}, {level = {90,99}, quant = {1,2}, percent = 9}, {level = {100, math.huge}, quant = {1,3}, percent = 10} },  
  16. Vodkart's post in (Resolvido)entrar no teleport por determinado tempo e depois ser teleportado depois de 10m was marked as the answer   
    @poko360 Testei aqui e funcionou.
     
    18:33 [Vodkart]:  Iniciou uma hunt em Nishapur 1 [PVP]  18:34 seu tempo na sala acabou  
    e fui jogado para o Templo.
     
    Unica coisa que esqueci foi de colocar no TP final a coordenadas para sair... 
     
    Use assim os movements
     

    roomkick1.lua
    function onStepIn(cid, item, position, fromPosition)     local getP = getPoints(cid)     local minutos = 1 -- 1 minuto          if not isPlayer(cid) then         return true     end          if getPoints(cid) < 800 then         doCreatureSay(cid, "Voce nao possui 800 online coins na sua account.", TALKTYPE_ORANGE_1)         doTeleportThing(cid, fromPosition, true)         return true     end     doTeleportThing(cid, {x=56, y=1463, z=7})     doPlayerRemovePoints(cid, 800)     setPlayerStorageValue(cid, 982301, 1)     setPlayerStorageValue(cid, 982300, os.time()+ minutos*60)     doBroadcastMessage("["..getCreatureName(cid).."]: \ Iniciou uma hunt em Nishapur 1 [PVP] \n Gastou: 800x Online coins \n Account balance: [".. getP .."] online coins", 25)     doBroadcastMessage("["..getCreatureName(cid).."]: \ Iniciou uma hunt em Nishapur 1 [PVP] \n Gastou: 800x Online coins \n Account balance: [".. getP .."] online coins", MESSAGE_STATUS_CONSOLE_BLUE)     return true end roomkick2.lua
    function onStepIn(cid, item, position, fromPosition)     if not isPlayer(cid) then         return true     end     doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))     setPlayerStorageValue(cid, 982301, 0)     return true end TAG
    <movevent type="StepIn" actionid="16530" event="script" value="roomkick1.lua"/> <movevent type="StepIn" actionid="16531" event="script" value="roomkick2.lua"/>  
    @poko360 acabei de arrumar os movements que estavam errado... favor atualizar eles agr!!
  17. Vodkart's post in (Resolvido)MSG POP UP na tela com tempo pra aparecer was marked as the answer   
    function getPlayerLastLogout(cid) local check = db.getResult("SELECT `lastlogout` FROM `players` WHERE `id`= "..getPlayerGUID(cid)) return check:getDataInt("lastlogout") <= 0 and 0 or check:getDataInt("lastlogout") end local time = 30 -- em minutos function onLogin(cid) if getPlayerLastLogout(cid) < os.time() - (time*60) then doPlayerPopupFYI(cid, "\nWelcome to back ") end return true end  
  18. Vodkart's post in (Resolvido)Erro Raids System was marked as the answer   
    @subhe as position tem que ser sempre do MENOR para o MAIOR
     
     
    <?xml version="1.0" encoding="UTF-8"?> <mod name="Automatic Raids" version="1.0" author="Vodkart And xotservx" contact="xtibia.com" enabled="yes"> <config name="raids_func"><![CDATA[ days = { ["Monday"] = { ["20:00"] = {nome = "Orshabaal", pos = {fromPosition = {x=2153, y=2389, z=7},toPosition = {x=2159, y=2392, z=7}},m = {"5 Demon", "1 Orshabaal"}, Time = 60}, ["21:30"] = {nome = "Ferumbras", pos = {fromPosition = {x=518, y=141, z=4},toPosition = {x=519, y=145, z=4}},m = {"5 Demon", "1 Ferumbras"}, Time = 60} }, ["Tuesday"] = { ["19:30"] = {nome = "Ghazbaran", pos = {fromPosition = {x=473, y=408, z=11},toPosition = {x=476, y=410, z=11}}, m = {"1 Ghazbaran"}, Time = 60}, ["20:30"] = {nome = "Morgaroth", pos = {fromPosition = {x=1266, y=250, z=14},toPosition = {x=1271, y=256, z=14}}, m = {"1 Morgaroth"}, Time = 60} }, ["Wednesday"] = { ["20:40"] = {nome = "Orshabaal", pos = {fromPosition = {x=2153, y=2389, z=7},toPosition = {x=2159, y=2392, z=7}},m = {"5 Demon", "1 Orshabaal"}, Time = 60}, ["21:40"] = {nome = "Ferumbras", pos = {fromPosition = {x=518, y=141, z=4},toPosition = {x=519, y=145, z=4}},m = {"5 Demon", "1 Ferumbras"}, Time = 60} }, ["Thursday"] = { ["21:00"] = {nome = "Ghazbaran", pos = {fromPosition = {x=473, y=408, z=11},toPosition = {x=476, y=410, z=11}}, m = {"1 Ghazbaran"}, Time = 60}, ["22:00"] = {nome = "Morgaroth", pos = {fromPosition = {x=1266, y=250, z=14},toPosition = {x=1271, y=256, z=14}}, m = {"1 Morgaroth"}, Time = 60} }, ["Friday"] = { ["19:40"] = {nome = "Orshabaal", pos = {fromPosition = {x=2153, y=2389, z=7},toPosition = {x=2159, y=2392, z=7}},m = {"5 Demon", "1 Orshabaal"}, Time = 60}, ["21:20"] = {nome = "Ferumbras", pos = {fromPosition = {x=518, y=141, z=4},toPosition = {x=519, y=145, z=4}},m = {"5 Demon", "1 Ferumbras"}, Time = 60} }, ["Saturday"] = { ["18:00"] = {nome = "Ghazbaran", pos = {fromPosition = {x=473, y=408, z=11},toPosition = {x=476, y=410, z=11}}, m = {"1 Ghazbaran"}, Time = 60}, ["16:00"] = {nome = "Morgaroth", pos = {fromPosition = {x=1266, y=250, z=14},toPosition = {x=1271, y=256, z=14}}, m = {"1 Morgaroth"}, Time = 60} }, ["Sunday"] = { ["15:00"] = {nome = "Orshabaal", pos = {fromPosition = {x=2153, y=2389, z=7},toPosition = {x=2159, y=2392, z=7}},m = {"5 Demon", "1 Orshabaal"}, Time = 60}, ["17:30"] = {nome = "Ferumbras", pos = {fromPosition = {x=518, y=141, z=4},toPosition = {x=519, y=145, z=4}},m = {"5 Demon", "1 Ferumbras"}, Time = 60} } } ]]></config> <globalevent name="AutomaticRaids" interval="60" event="script"><![CDATA[ domodlib('raids_func') function onThink(interval, lastExecution) if days[os.date("%A")] then hours = tostring(os.date("%X")):sub(1, 5) tb = days[os.date("%A")][hours] if tb then function removeCreature(tb) for x = ((tb.pos.fromPosition.x)-10), ((tb.pos.toPosition.x)+10) do for y = ((tb.pos.fromPosition.y)-10), ((tb.pos.toPosition.y)+10) do local m = getTopCreature({x=x, y=y, z= tb.pos.fromPosition.z}).uid if m ~= 0 and isMonster(m) then doRemoveCreature(m) end end end end doBroadcastMessage("The invasion of " .. tb.nome .. " started") for _,x in pairs(tb.m) do for s = 1, tonumber(x:match("%d+")) do pos = {x = math.random(tb.pos.fromPosition.x, tb.pos.toPosition.x), y = math.random(tb.pos.fromPosition.y, tb.pos.toPosition.y), z = tb.pos.fromPosition.z} doSummonCreature(x:match("%s(.+)"), pos) end end addEvent(removeCreature, tb.Time*60*1000, tb) end end return true end ]]></globalevent> </mod>  
    OBS: USA ESSA NOVA VERSÃO SEM BUGS
     
    https://tibiaking.com/forums/topic/94479-raid-automatica-mod-raid-automatica-edit-brunds/
  19. Vodkart's post in (Resolvido)[PEDIDO] Simples Task 3.0 by VodKart was marked as the answer   
    @subhe 
     
    troca essa parte
     
    if isInArray({"task","tasks","missao","mission"}, msg) then npcHandler:say("Me diga o nome do monstro que você deseja fazer a task!", cid) talkState[talkUser] = 1 por
     
    if isInArray({"task","tasks","missao","mission"}, msg) then local str = "" for a , b in pairs(tasktabble) do str = str .. " {" .. a .."}," end npcHandler:say("Lista de tasks:"..str.." Qual deseja fazer?", cid) talkState[talkUser] = 1  
  20. Vodkart's post in (Resolvido)[PEDIDO] [MOD] Evento Metin Stone was marked as the answer   
    @subhe 
    <?xml version="1.0" encoding="UTF-8"?> <mod name="Stones_Event Items" enabled="yes"> <config name="Stones_config"><![CDATA[ names = {'earth stone', 'icy stone', 'fire stone', 'wind stone'} stones_name = { [1] = {name="Earth Stone"}, [2] = {name="Icy Stone"}, [3] = {name="Fire Stone"}, [4] = {name="Wind Stone"} } pos = { {x=95, y=57, z=7}, {x=103, y=57, z=7}, {x=90, y=58, z=7}, {x=80, y=58, z=7} } days = {['Tuesday'] = {'05:29:00'}, ['Sunday'] = {'03:46:20'} } stones = { ["earth stone"] = { [90] = {m = {'carniphila','earth elemental','bog raider'}, n = {6, 7}}, [80] = {m = {'bog raider','earth elemental'}, n = {6, 7}}, [70] = {m = {'giant spider','bog raider'}, n = {6, 7}}, [60] = {m = {'hydra','lich','giant spider','bog raider'}, n = {6, 7}}, [50] = {m = {'hydra','bog raider','serpent spawn'}, n = {6, 7}}, [40] = {m = {'hydra','defiler','serpent spawn'}, n = {6, 7}}, [30] = {m = {'medusa','hydra','serpent spawn','defiler'}, n = {6, 7}}, [20] = {m = {'medusa','lost soul','hydra','serpent spawn'}, n = {6, 7}}, [10] = {m = {'juggernaut','son of verminor','medusa'}, n = {5, 6}}, [1] = {m = {'medusa','juggernaut'}, n = {5,7}} }, ["icy stone"] = { [90] = {m = {'ice golem','frost dragon'}, n = {6, 7}}, [80] = {m = {'frost dragon','frost dragon hatchling'}, n = {6, 7}}, [70] = {m = {'frost dragon','crystal spider'}, n = {6, 7}}, [60] = {m = {'frost dragon','crystal spider'}, n = {7, 7}}, [50] = {m = {'frost dragon','crystal spider'}, n = {7, 7}}, [40] = {m = {'frost dragon'}, n = {7, 7}}, [30] = {m = {'frost dragon'}, n = {7, 8}}, [20] = {m = {'frost dragon'}, n = {7, 8}}, [10] = {m = {'yeti','frost dragon'}, n = {5, 7}}, [1] = {m = {'yeti'}, n = {2,3}} }, ["fire stone"] = { [90] = {m = {'fire elemental','dragon','dragon lord',' dragon lord hatchling'}, n = {6, 7}}, [80] = {m = {'dragon lord hatchling','dragon lord'}, n = {6, 7}}, [70] = {m = {'dragon lord','diabolic imp'}, n = {6, 7}}, [60] = {m = {'dragon lord','diabolic imp'}, n = {6, 7}}, [50] = {m = {'dragon lord','demodras','diabolic imp'}, n = {6, 7}}, [40] = {m = {'dragon lord','diabolic imp','hellfire fighter'}, n = {5, 7}}, [30] = {m = {'diabolic imp','hellfire fighter','demon'}, n = {6, 7}}, [20] = {m = {'hellfire fighter','demon'}, n = {5, 6}}, [10] = {m = {'demon','hellhound'}, n = {5, 5}}, [1] = {m = {'demon'}, n = {5,5}} }, ["wind stone"] = { [90] = {m = {'gargoyle','stone golem','black knight'}, n = {6, 7}}, [80] = {m = {'black knight','behemoth'}, n = {5, 7}}, [70] = {m = {'black knight','behemoth'}, n = {6, 7}}, [60] = {m = {'behemoth','destroyer'}, n = {6, 7}}, [50] = {m = {'behemoth','destroyer','betrayed wraith'}, n = {6, 7}}, [40] = {m = {'behemoth','destroyer','betrayed wraith'}, n = {6, 7}}, [30] = {m = {'dark torturer','betrayed wraith'}, n = {3, 5}}, [20] = {m = {'dark torturer','grim reaper'}, n = {5, 6}}, [10] = {m = {'blightwalker','undead dragon','grim reaper'}, n = {5, 6}}, [1] = {m = {'undead dragon'}, n = {5,5}} } } function getPercent(number, all) return (number / all) * 100 end function choose(arg) return arg[math.random(#arg)] end ]]></config> <event type="combat" name="Kamulec" event="script"><![CDATA[ domodlib("Stones_config") function onCombat(cid, target) if isMonster(target) then registerCreatureEvent(target, 'Kamulec') end local t = getPercent(getCreatureHealth(target), getCreatureMaxHealth(target)) if isMonster(target) and isInArray(names, getCreatureName(target):lower()) then if t > 90 then doCreatureSetStorage(target, 1000, 91) end for k, v in pairs(stones[getCreatureName(target):lower()]) do if k >= t and getCreatureStorage(target, 1000) > k then local pos = getThingPos(target) for i = 1, math.random(v.n[1], v.n[2]) do local s = {x=pos.x,y=pos.y,z=pos.z} s.x = pos.x + math.random(-2,2) s.y = pos.y + math.random(-2,2) doCreateMonster(choose(v.m), pos, false, false, false) end return doCreatureSetStorage(target, 1000, k) end end end return TRUE end ]]></event> <talkaction log="yes" words="!metin" access="4" event="script"> <![CDATA[ domodlib("Stones_config") function onSay(cid,words,param,channel) local monst = stones_name[math.random(1, #stones_name)] local poss = pos[math.random(1, #pos)] doCreateMonster(monst.name,poss) doBroadcastMessage('[Event Stones]\n '.. monst.name ..' have been spawn. Find and defeat it!', 22) return true end ]]> </talkaction> <globalevent name="metinStoneStart" interval="1000" event="script"><![CDATA[ domodlib("Stones_config") local daysOpen = {} local monst = stones_name[math.random(1, #stones_name)] local poss = pos[math.random(1, #pos)] for k, v in pairs(days) do table.insert(daysOpen, k) end function onThink(interval) if isInArray(daysOpen, os.date('%A')) then if isInArray(days[os.date('%A')], os.date('%X', os.time())) then doCreateMonster(monst.name,poss) doBroadcastMessage('[Event Stones]\n '.. monst.name ..' have been spawn. Find and defeat it!', 22) end end return true end ]]></globalevent> <event type="login" name="metinStoneLogin" event="buffer"><![CDATA[ registerCreatureEvent(cid, 'Kamulec') ]]></event> </mod>  
  21. Vodkart's post in (Resolvido)[SCRIPT] Por tempo na quest was marked as the answer   
    @OfWar Verdade, esqueci de adicionar a linha.
     
    local storage, minutos = 48748, 10 -- 10 minutos local lvl = 130 local t = { {vocations = {1, 5}, Pos = {{x=1127, y=1155, z=6},{x=1114, y=1142, z=8}}}, --primeira pos é onde o jogador tem que estar e a segunda para onde ele vai ser teleportado {vocations = {2, 6}, Pos = {{x=1123, y=1157, z=6},{x=1114, y=1142, z=8}}}, {vocations = {3, 7}, Pos = {{x=1117, y=1150, z=6},{x=1114, y=1142, z=8}}}, {vocations = {4, 8}, Pos = {{x=1123, y=1147, z=6},{x=1114, y=1142, z=8}}} } function doTeleportTimer(pos, seconds) doSendAnimatedText(pos, seconds, 145) if seconds ~= 1 then addEvent(doTeleportTimer, 1000, pos, seconds-1) end end function onUse(cid, item, fromPosition, itemEx, toPosition) if getGlobalStorageValue(storage) - os.time() > 0 then doPlayerSendTextMessage(cid, 25, "Você não pode usar a alavanca agora.") return true end local check = {} for _, k in ipairs(t) do local x = getTopCreature(k.Pos[1]).uid if x == 0 or not isPlayer(x) then doPlayerSendCancel(cid, 'Não há jogadores suficientes.') return true elseif not isInArray(k.vocations, getPlayerVocation(x)) then doPlayerSendCancel(cid, 'Todos os jogadores devem estar em seus respectivos pisos!') return true elseif getPlayerLevel(x) < lvl then doPlayerSendCancel(cid, 'Todos os players devem ser level ' .. lvl .. ' ou maior.') return true end table.insert(check, x) end for k, tid in ipairs(check) do doSendMagicEffect(getCreaturePosition(tid), CONST_ME_POFF) doTeleportThing(tid, t[k].Pos[2]) doSendMagicEffect(getCreaturePosition(tid), CONST_ME_TELEPORT) end setGlobalStorageValue(storage, os.time() + minutos*60) doTeleportTimer(toPosition, minutos*60) doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) return true end  
  22. Vodkart's post in (Resolvido)Como usar getItemIdByName? was marked as the answer   
    local items = { 2365, -- backpack of holding 10518, -- demon backpack 10016, -- batwing hat 2152 -- platinum coin } function onUse(cid, item, fromPosition, itemEx, toPosition) local r = items[math.random(#items)] return doPlayerSendTextMessage(cid,22,"O item gerado foi: "..getItemNameById(r)) end  
  23. Vodkart's post in (Resolvido)[PEDIDO] [MODS] - [8.6] Perfect Zombie System [Automático] was marked as the answer   
    @subhe vc está testando com char de gm ou god?
  24. Vodkart's post in (Resolvido)[AJUDA] adicionar nova moeda na loterry was marked as the answer   
    local config = { lottery_hour = "2 hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message) rewards = { {itemid = 2494, amount = 1}, {itemid = 2472, amount = 1}, {itemid = 2514, amount = 1}, {itemid = 2160, amount = 10}, {itemid = 12672, amount = 1} }, crystal_counts = 10, -- Usado somente se a rewards_id for crystal coin (ID: 2160). website = "yes", -- Only if you have php scripts and table `lottery` in your database! days = { "Monday-08:00", "Monday-13:00", "Monday-19:30", "Tuesday-08:00", "Tuesday-13:00", "Tuesday-19:30", "Wednesday-08:00", "Wednesday-13:00", "Wednesday-19:30", "Thursday-08:00", "Thursday-13:00", "Thursday-19:30", "Friday-01:22", "Friday-13:00", "Friday-19:30", "Saturday-21:27", "Saturday-21:28", "Saturday-21:29", "Sunday-08:00", "Sunday-13:00", "Sunday-19:30" } } local function getPlayerWorldId(cid) if not(isPlayer(cid)) then return false end local pid = getPlayerGUID(cid) local worldPlayer = 0 local result_plr = db.getResult("SELECT * FROM `players` WHERE `id` = "..pid..";") if(result_plr:getID() ~= -1) then worldPlayer = tonumber(result_plr:getDataInt("world_id")) result_plr:free() return worldPlayer end return false end local function getOnlineParticipants() local players = {} for _, pid in pairs(getPlayersOnline()) do if getPlayerAccess(pid) <= 2 and getPlayerStorageValue(pid, 281821) <= os.time() then table.insert(players, pid) end end if #players > 0 then return players end return false end function onThink(cid, interval) if table.find(config.days, os.date("%A-%H:%M")) then if(getWorldCreatures(o) <= 0)then return true end local query = db.query or db.executeQuery local data = os.date("%d/%m/%Y - %H:%M:%S") local online = getOnlineParticipants() if online then local x = config.rewards[math.random(1, #config.rewards)] local winner = online[math.random(1, #online)] local world = tonumber(getPlayerWorldId(winner)) doPlayerSetStorageValue(winner, 281821, os.time() + 3600 * 24) if isItemStackable(x.itemid) or x.amount == 1 then doPlayerAddItem(winner, x.itemid, x.amount) else for i = 1, x.amount do doPlayerAddItem(winner, x.itemid, 1) end end doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: "..x.amount.."x " ..getItemNameById(x.itemid).. "! Congratulations! (Next lottery in " .. config.lottery_hour .. ")") if(config.website == "yes") then query("INSERT INTO `lottery` (`name`, `item`, `world_id`, `item_name`, `date`) VALUES ('".. getCreatureName(winner).."', '".. x.itemid .."', '".. world .."', '".. getItemNameById(x.itemid) .."', '".. data .."');") end else print("Ninguem OnLine pra ganhar na loteria") end end return true end  
  25. Vodkart's post in (Resolvido)Script com erro no time. was marked as the answer   
    @maleskinho de boa, usa a mesma TAG que te passei e no código assim:
     
     
    function onUse(cid, item, fromPosition, itemEx, toPosition) local minutes = 2 local rand = math.random(1, 100) if item.itemid ~= 11253 then return true end if getPlayerStorageValue(cid, 45490) <= 0 then doPlayerSendCancel(cid, "Speak with Sandomo to use this item.") return true end if rand > 25 then doCreateMonster("guzzlemaw", getCreaturePosition(cid)) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You ransack the pile but fail to find any useful parts.") doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED) else setPlayerStorageValue(cid, 45491, getPlayerStorageValue(cid, 45491)+1) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Amidst the pile of various bones you find a large, hollow part, similar to a pipe."); doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN) end doTransformItem(item.uid, 12688) addEvent(function() doTransformItem(getThingfromPos(toPosition).uid, 11253) end, minutes*60000) return true end  

Informação Importante

Confirmação de Termo