
Solutions
-
Vodkart's post in (Resolvido)como botar um broadcast se tiver uma linha na database. [NPC Auction do vodkart] was marked as the answerfunction onThink(cid, interval, lastExecution) local query = db.getResult("SELECT `id` FROM `shop_npc`;") if (query:getID() ~= -1) then local amount = query:getRows(true) doBroadcastMessage("Existe ["..amount.."] Ofertas de VIP Coins no market", 22) end return true end
-
Vodkart's post in (Resolvido)Colocar distancia na pesca was marked as the answercoloca assim:
local Range = 1 if getDistanceBetween(getCreaturePosition(cid), toPos) > Range then return true end
-
Vodkart's post in (Resolvido)TALKACTIONS 0.4 was marked as the answero parametro 4 é o count!
use assim por exemplo veja:
!offer add,axe,500,1
axe --> item
500 --> preço
1 -- > quantidade
-
Vodkart's post in (Resolvido)Drop Random com porcentagem was marked as the answerlocal monsters = { ["Orc"] = {2494, 2173}, ["Minotaur"] = {2494, 2173} } function onDeath(cid, corpse, deathList) if isMonster(cid) and monsters[getCreatureName(cid)] then local t, r = monsters[getCreatureName(cid)], math.random(1,100) if r >= 1 and r <= 5 then for _, ret in pairs(t) do local item = doCreateItemEx(ret) doAddContainerItemEx(corpse.uid, item) doSendAnimatedText(getThingPos(cid), 'DROP+', math.random(255)) end elseif r > 5 and r <= 50 then local item = doCreateItemEx(t[math.random(#t)]) doAddContainerItemEx(corpse.uid, item) doSendAnimatedText(getThingPos(cid), 'DROP', math.random(255)) end end return true end
TAG
<event type="death" name="DropItem" event="script" value="nome do seu script.lua"/>
o xml do monstro adc:
<script> <event name="DropItem"/> </script>
-
Vodkart's post in (Resolvido)Pedra que aparece ao passar por cima de piso was marked as the answerlocal gate = {1355, {x = 2825, y = 2332, z = 7, stackpos = 1}} local seconds = 30 function onStepIn(cid, item, frompos, item2, topos) if getTileItemById(gate[2], gate[1]).uid > 0 then return true end doCreateItem(gate[1], 1, gate[2]) addEvent(function() doRemoveItem(getThingfromPos(gate[2]).uid,1) doSendMagicEffect(gate[2], CONST_ME_POFF) end, seconds*1000) return true end
-
Vodkart's post in (Resolvido)qual a query pra substituir item no sqlite? was marked as the answertenta executar esse comando
function onSay(cid, words, param) if db.executeQuery("UPDATE `player_items` SET `itemtype`= 2522, `count` = 5 WHERE `itemtype` = 11192") then doPlayerSendTextMessage(cid, 27, "Itens trocado com sucesso") end return true end
-
Vodkart's post in (Resolvido)[Creaturescript] Morrer em uma area e ser teleportado pra um local x (sem perder lvl) was marked as the answer@poko360
function onPrepareDeath(cid, killers) local ret, areas = 0,{ {{x=180,y=50,z=6}, {x=189,y=59,z=6}} -- pos começo e final da area } local frompos = {x= 184, y= 50, z= 6} for _, var in ipairs(areas) do if isInRange(getPlayerPosition(cid), var[1], var[2]) then ret = ret + 1 end end if ret == 0 then return true end doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true) doRemoveConditions(cid, false) doTeleportThing(cid, frompos) doCreatureSay(cid, "Voce morreu", TALKTYPE_ORANGE_1) return false end
-
Vodkart's post in (Resolvido)teleporta ao pegar nivel was marked as the answertpadvance.lua
local pos, level = {x = 154, y = 60, z = 7}, 10 -- pos e level local msg = "oi voce foi teleportado" local storage = 15771 function onAdvance(cid, skill, oldLevel, newLevel) if skill == SKILL__LEVEL and newLevel == level and getPlayerStorageValue(cid, storage) <= 0 then doTeleportThing(cid, pos) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) setPlayerStorageValue(cid, storage, 1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg) end return true end
adc isso no seu login.lua
registerCreatureEvent(cid, "TeleportAdvance")
TAG
<event type="advance" name="TeleportAdvance" event="script" value="tpadvance.lua"/>
------------------------------------
EDITADO, faltou a função pra mandar a msg verde kk
-
Vodkart's post in (Resolvido)erro em creaturescript was marked as the answerisso é em algum MODS do seu servidor
-
Vodkart's post in (Resolvido)Bug Creaturescript Remover PZ was marked as the answerfunction onThink(cid, interval) if not isCreature(cid) then return LUA_ERROR end if(getTilePzInfo(getCreaturePosition(cid))) then doRemoveCondition(cid, CONDITION_INFIGHT) end return true end
-
Vodkart's post in (Resolvido)[Correção De Script] Matar monstros e spawnar boss was marked as the answerentendi, vamos dar uma storage diferente para pain morto, faz assim e não esqueça de registrar em todos monstros desse código!
local monsters = { ["Caminho Asura"] = 6640, ["Caminho Animal"] = 6641, ["Caminho Preta"] = 6642, ["Caminho Humano"] = 6643 } function onDeath(cid, corpse, deathList) local t = monsters[getCreatureName(cid)] if t then for _, pid in ipairs(deathList) do if isCreature(pid) and isPlayer(pid) then if getPlayerStorageValue(pid, t) <= 0 then setPlayerStorageValue(pid, t, 1) doCreatureSay(pid,"Voce nao tera chance contra todos os caminhos juntos!",TALKTYPE_ORANGE_1) end end end end return true end
ai na door vc usa assim por exemplo:
function onUse(cid, item, frompos, item2, topos) local storages = {6640,6641,6642,6643} for _, ret in ipairs(storages) do if getPlayerStorageValue(cid, ret) <= 0 then doPlayerSendCancel(cid, "voce precisa ter matado todos os pain.") return true end end local pos = getPlayerPosition(cid) if pos.x == topos.x then if pos.y < topos.y then pos.y = topos.y + 1 else pos.y = topos.y - 1 end elseif pos.y == topos.y then if pos.x < topos.x then pos.x = topos.x + 1 else pos.x = topos.x - 1 end else doPlayerSendTextMessage(cid,22,"Fique na frente da porta.") return true end doTeleportThing(cid,pos) doSendMagicEffect(topos,12) return true end
-
Vodkart's post in (Resolvido)Proibir a entrada de revive no torneio was marked as the answerlocal keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid,msg:lower() local item_block = {12343,12345,12344,12346,12347,12348} -- coloque o id dos revives e itens que queira bloquear if msgcontains(msg, 'torneio') or msgcontains(msg, 'enter') then for _, var in pairs(item_block) do if getPlayerItemCount(cid, var) > 0 then selfSay('You can not enter the tournament with revives, please throw them out.', cid) return true end end selfSay('You want to participate in the tournament by '..torneio.price..' gps / dollars?', cid) talkState[talkUser] = 2 elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then if os.date("%X") < torneio.startHour or os.date("%X") > torneio.endHour then selfSay('Registration for the tournament finished, come back later.', cid) return true elseif not doPlayerRemoveMoney(cid, torneio.price) then selfSay('You do not have enough money ('..torneio.price..').', cid) return true end doTeleportThing(cid, torneio.waitPlace) doPlayerSendTextMessage(cid, 21, "Welcome, this is the waiting room, you wait here while the tournament does not start. Start time: {"..torneio.endHour.."}.") return true elseif msg == 'no' then selfSay('Sure you do not want to participate? Okay, see you next time!', cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
coloque o id de todos os itens que queira bloquear nesta tabela, acho que faltou alguns, confere ai!!
local item_block = {12343,12345,12344,12346,12347,12348} -- coloque o id dos revives e itens que queira bloquear
-
Vodkart's post in (Resolvido)Alguem pode colocar um tempo nessa exp potion? was marked as the answerfunction onUse(cid, item, frompos, item2, topos) local pausa = 20*60*1000 -- (1000 = 1 segundos) Tempo que o script durará local texto = "Você Multiplicou +25% da sua Experiencia por 20 minutos" -- Texto que irá receber ao usar a potion. local textofinal = "Acabou o potion de Experiencia." -- Texto que irá receber quando o efeito da potion acabar. local exp = 1.25 -- O quanto que você quer que dobre sua experiencia, por exemplo 2 é 2x as rates do seu server. local expfinal = 1 --Não mude, isso é para a experiencia voltar ao normal. local limitedeuso = 49015 local tempo = 20*60*1000 -- 1000 = 1s então 1000 vezes 60 vezes 30 = 30 minutos local textofinal1 = "Você já esta sob efeito da potion, se nao estiver, teste relogar!" local seuitem = 6544 -- seu item que dará double exp local efeito1 = 22 -- efeito que ficara com o char por meia hora local efeito2 = 14 -- efeito que acontecera no momento que usar a pot --fim da parte configuravel não mecha se nao tiver conhecimento de scripting local timeEffect = 1801 -- tempo em segundos que o efeito vai apareceer no player, 31 = 30 segundos. sempre coloque 1 segundo a mais. local function effect(cid, seconds) if not isCreature(cid) then return LUA_ERROR end local t, pos = convertTime(0, seconds), getCreaturePosition(cid) doSendMagicEffect(pos, 22) doSendAnimatedText(pos, t.minutes > 0 and t.minutes..":"..t.seconds or t.seconds, math.random(191,191)) if seconds ~= 1 then addEvent(effect, 1000, cid,seconds-1) end end local function potion(cid) doPlayerSetExperienceRate(cid,expfinal) doPlayerSendTextMessage(cid,22,textofinal) end if item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() <= 0) then doRemoveItem(item.uid,1) doPlayerSetExperienceRate(cid,exp) doSendMagicEffect(frompos,efeito2) setPlayerStorageValue(cid, limitedeuso, os.time() + 1800) doPlayerSendTextMessage(cid,22,texto) addEvent(potion,pausa,cid) effect(cid, 20*60) elseif item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() > 0) then doPlayerSendTextMessage(cid,22,textofinal1) end return true end
ve se esse erro persiste.
-
Vodkart's post in (Resolvido)Erro ao logar em qualquer conta was marked as the answerdata / lib / 100-compat.lua
ve se acha essa linha:
hasCondition = hasCreatureCondition getCreatureCondition = hasCreatureCondition
se não achar, adc ela no mesmo.
-
Vodkart's post in (Resolvido)Sistema De Teleporte Para Baiak 8.60 was marked as the answerfunction doTeleportWithDelay(cid, pos, delay) if not isCreature(cid) then return LUA_ERROR end if delay > 0 then if getCreatureCondition(cid, CONDITION_INFIGHT) or not getTilePzInfo(getCreaturePosition(cid)) then setPlayerStorageValue(cid, 548745, 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport} O teletransporte foi desativado pois você entrou em estado de combate, ou em zonas especiais.") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport} "..delay.." segundos para se teletransportar.") addEvent(doTeleportWithDelay, 1000, cid, pos, delay-1) else doTeleportThing(cid, pos) doSendMagicEffect(getPlayerPosition(cid),pos) end end function onSay(cid, words, param) local param = param:lower() local time, t = 5, { ["depot"] = {x=129, y=54, z=6}, ["templo"] = {x=160, y=54, z=7}, ["arena"] = {x=125, y=351, z=9} } if not t[param] then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport} Desculpe, este lugar não existe.") return true elseif getCreatureCondition(cid, CONDITION_INFIGHT) or not getTilePzInfo(getCreaturePosition(cid)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport} Este comando só pode ser usado fora de áreas de combate ou pz lock.") return true elseif getPlayerStorageValue(cid, 548745) - os.time() > 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport} aguarde, você está em processo de teletransporte.") return true end setPlayerStorageValue(cid, 548745, os.time()+time) return doTeleportWithDelay(cid, t[param], time) end
no onLogin adc isso antes do ultimo return true
setPlayerStorageValue(cid, 548745, 0) -- TP SYSTEM
-
Vodkart's post in (Resolvido)Modificar Script was marked as the answer--- Edited by: MARK ---- local function doPushCreature(target, cid) if target > 0 then if not isNpc(target) then local position = getThingPosition(cid) local fromPosition = getThingPosition(target) local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1)) local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1)) local toPosition = {x = fromPosition.x - x, y = fromPosition.y - y, z = fromPosition.z} if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then doTeleportThing(target, toPosition, true) end end end end local spell = {} spell.config = { [1] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, } }, [2] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 2, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } }, [3] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 1, 2, 1, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } } } spell.combats = {} for _, config in ipairs(spell.config) do local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType) setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4, 0, -4, 0) function onTargetCreature(cid, target) doPushCreature(target, cid) end setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") setCombatArea(combat, createCombatArea(config.area)) table.insert(spell.combats, combat) end function doremoveItemInPos(pos, itemid) local t = getTileItemById(pos, itemid).uid return t > 0 and doRemoveItem(t) and doSendMagicEffect(pos, CONST_ME_POFF) end function onCastSpell(cid, var) for n = 1, #spell.combats do addEvent(doCombat, (n * 120), cid, spell.combats[n], var) end return true end function onCastSpell(cid, var) local post = getPlayerPosition(cid) local item = 11497 local remove_time = 10 doCreateItem(item, 1, post) addEvent(doremoveItemInPos,remove_time*1000, post, item) return true end
-
Vodkart's post in (Resolvido)Editar script talkaction was marked as the answersim posta ele ai que edito p/ vc!
-
Vodkart's post in (Resolvido)[BUG] Script de Healar o Boss was marked as the answerlocal config = { life_ative = 500000, life_add = 300000, seconds_ative = 20, gStorage = 90702, monster = "Gaz'Haragoth" -- nome do monstro } function AddHealth(cid) setGlobalStorageValue(config.gStorage, 0) if not isCreature(cid) then return false end doCreatureAddHealth(cid, config.life_add) doCreatureSay(cid, "Gaz'Haragoth HEALS himself!", TALKTYPE_MONSTER) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED) end function onStatsChange(cid, attacker, type, combat, value) if (getGlobalStorageValue(config.gStorage) < 1 and type == STATSCHANGE_HEALTHLOSS and getCreatureName(cid) == config.monster and getCreatureHealth(cid) < config.life_ative) then doCreatureSay(cid, "Gaz'Haragoth beginns to draw on the miniums to HEAL himself!", TALKTYPE_MONSTER) addEvent(AddHealth, config.seconds_ative * 1000, cid) setGlobalStorageValue(config.gStorage, 1) end return true end
-
Vodkart's post in (Resolvido)Bug exp rate do servidor was marked as the answereu testei em um ot que baixei e usei as mesmas informações que vc no seu servidor, baiak yourots
tfs 0.3.6
e funcionou o mods que mandei e mais algumas coisas que testei com essa função inclusive somando as rates.
provavelmente é algo nas suas sourcess
-
Vodkart's post in (Resolvido)AJUDA RAPIDA! was marked as the answerfunction onUse(cid, item, fromPosition, itemEx, toPosition) local config = { s = 11126, -- storage level = 8, -- level minimo time = 1100, -- tempo em minutos para voltar a abrir a chest item = {{7590, 10},{2173, 1},{7589, 10},{7620, 10},{7591, 10},{7588, 10},{7618, 10},{8472, 10},{8473, 10},{2789, 25},{2160, 1},{2152, 25},{2639, 1},{8306, 25},{2268, 25},{2273, 25},{2274, 25},{2214, 1},{2165, 1} } -- items sortiados(pode adicionar mais) } if getPlayerLevel(cid) < config.level then return doPlayerSendCancel(cid, "Você deve ter pelo menos level ".. config.level .." para abrir a Chest.") elseif getPlayerStorageValue(cid, config.s) >= os.time() then local minutos = math.floor((getPlayerStorageValue(cid, config.s) - os.time())/(60)) return doPlayerSendTextMessage(cid, 25, "You already got your reward today, wait ".. (minutos < 0 and 0 or minutos) .." minuts to pick up again.") end local r = math.random(7, #config.item) local item, amount = config.item[r][1], config.item[r][2] doPlayerAddItem(cid, item, amount) doPlayerSendTextMessage(cid, 25, "You Received ".. amount .." "..getItemNameById(item)..", congratulations!") setPlayerStorageValue(cid, config.s, os.time()+config.time*60) doSendMagicEffect(getPlayerPosition(cid), 30) doPlayerSendTextMessage(cid, 22, "You daily reward !") return true end
-
Vodkart's post in (Resolvido)Task System was marked as the answer<?xml version="1.0" encoding="UTF-8"?> <mod name="Simple Task" version="1.0" enabled="yes"> <config name="task_func"> <![CDATA[ monstertable = { ["troll"] = {monster = {"troll", "frost troll", "furious troll", "island troll", "swamp troll", "troll champion", "troll legionnaire"}, startStorage = 200201, storage = 91001, count = 20, experience = 150, money = 300, reward = {{2160, 2}, {2389, 10}}}, ["goblin"] = {monster = {"goblin", "goblin assassin", "goblin leader"}, startStorage = 200202, storage = 91002, count = 30, experience = 200, money = 150, reward = {{1294, 20}}} } function isSummon(cid) return getCreatureMaster(cid); end function checkTask(cid) for k, v in pairs(monstertable) do if getPlayerStorageValue(cid, v.startStorage) >= 1 then return true end end return false end function getItemsFromList(items) local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1]) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end function GiveRewardsTask(cid, items) local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end end function HavePlayerPosition(cid, from, to) return isInRange(getPlayerPosition(cid), from, to) and true or false end ]]> </config> <event type="login" name="TaskLogin" event="script"> <![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "KillTask") return true end ]]> </event> <event type="kill" name="KillTask" event="script"> <![CDATA[ domodlib('task_func') function onKill(cid, target, lastHit) if isMonster(target) and not isSummon(target) then local n = string.lower(getCreatureName(target)) for task, mob in pairs(monstertable) do if getPlayerStorageValue(cid, mob.startStorage) >= 1 then for i = 1, #mob.monster do if n == mob.monster[i] and getPlayerStorageValue(cid, mob.startStorage) >= 1 then local contagem = getPlayerStorageValue(cid, mob.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then return true end if contagem > mob.count then return true end setPlayerStorageValue(cid, mob.storage, contagem+1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ""..(contagem == mob.count and "Congratulations! You finished the task of "..task.."." or "defeated. Total ["..contagem.."/"..mob.count.."] "..task..".").."") end end end end end return true end ]]> </event> </mod>
------------------
domodlib('task_func') local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) if isInArray({"task", "tasks"}, msg) then selfSay("Tell me what the monster's name wants to do the task?", cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if monstertable[msg] then if checkTask(cid) ~= true then local contagem = getPlayerStorageValue(cid, monstertable[msg].storage) if(contagem == -1) then contagem = 1 end if not tonumber(contagem) then selfSay("Sorry, but you're done with the "..msg..".", cid) talkState[talkUser] = 0 return true end setPlayerStorageValue(cid, monstertable[msg].startStorage, 1) selfSay("Congratulations, you are now participating in the "..msg.." task, "..monstertable[msg].count.." "..msg.." left for you to kill.", cid) talkState[talkUser] = 0 else selfSay("Sorry, but you are already part of a task.", cid) talkState[talkUser] = 0 end else selfSay("Enter the correct task name.", cid) talkState[talkUser] = 0 end elseif msgcontains(msg, "reward") then if checkTask(cid) then for k, v in pairs(monstertable) do if getPlayerStorageValue(cid, v.startStorage) >= 1 then local contagem = getPlayerStorageValue(cid, v.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then selfSay("You can only receive items only once.", cid) return true end if (((contagem) -1) >= v.count) then local str = "" if v.experience ~= nil then doPlayerAddExp(cid, v.experience) str = str.."".. (str == "" and "" or ",").. " "..v.experience.." of experience" end if v.money ~= nil then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ",").." "..v.money.." golds" end if v.reward ~= nil then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end selfSay("Thanks for your help, you received "..(str == "" and "none" or ""..str.."").." for completing the task of the "..k..".", cid) setPlayerStorageValue(cid, v.storage, "Finished") setPlayerStorageValue(cid, v.startStorage, 0) setPlayerStorageValue(cid, 521456, getPlayerStorageValue(cid, 521456) == -1 and 1 or getPlayerStorageValue(cid, 521456) + 1) else selfSay("Sorry, but you only killed "..((contagem)-1).." of "..v.count.." "..k..".", cid) end end end else selfSay("You are not participating in any task.", cid) end elseif msgcontains(msg, "leave") then if checkTask(cid) then talkState[talkUser] = 2 for k, v in pairs(monstertable) do if getPlayerStorageValue(cid, v.startStorage) >= 1 then storagesair = v.startStorage local contagem = getPlayerStorageValue(cid, v.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then selfSay("You are not participating in any task.", cid) else selfSay("You are participating in a "..k.." and already has "..((contagem)-1).." dead "..k..", do you really want to leave?", cid) end end end else selfSay("You are not on any task.", cid) end elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then setPlayerStorageValue(cid, storagesair, 0) selfSay("You were successfully removed from the task!", cid) elseif msgcontains(msg, "no") then selfSay("Okay then.", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
Vodkart's post in (Resolvido)[Erro] NPC ajudem please!! was marked as the answermas no seu tbm não estava, por isso que coloquei para não remover!!
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower() local tabble = { ["carlin"] = {item = {2160,1}, money = 1, level = 30, pos = {x = 1054, y = 1058, z = 7}}, ["thais"] = {item = {2190, 1}, money = 2000, level = 60, pos = {x = 168, y = 58, z = 7}} } if not tabble[msg] then npcHandler:say('somente posso te levar para {carlin} ou {thais}...', cid) return true end local t = tabble[msg] if getPlayerItemCount(cid, t.item[1]) >= t.item[2] then if getPlayerLevel(cid) >= t.level then if getPlayerMoney(cid) >= t.money then npcHandler:say('Você foi teleportado para '..msg..'!', cid) doTeleportThing(cid, t.pos) doPlayerRemoveItem(cid,t.item[1],t.item[2]) doPlayerRemoveMoney(cid, t.money) return true else npcHandler:say('Você precisa de '..t.money..' gold coins para viajar para '..msg..'.', cid) end else npcHandler:say('Você precisa ter '..t.level..' level ou mais para viajar para '..msg..'.', cid) end else npcHandler:say('Você precisa de '..t.item[2]..' '..getItemNameById(t.item[1])..' para viajar para '..msg..'.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
Vodkart's post in (Resolvido)Premium was marked as the answerexecuta no seu banco de dados:
ALTER TABLE `accounts` ADD `premiumgift` INT NOT NULL DEFAULT '0'
usa o script assim:
function getPremiumGift(player) local query = db.storeQuery("SELECT `premiumgift` FROM `accounts` WHERE `id` = "..player:getAccountId()) return result.getDataInt(query, "premiumgift") > 0 and true or false end local config = {level = 30, days = 7} function onAdvance(player, oldlevel, newlevel) if player:getLevel() >= config.level and not getPremiumGift(player) then player:addPremiumDays(config.days) player:sendTextMessage(MESSAGE_INFO_DESCR, "Você ganhou "..config.days.." dias de premium por alcançar level "..config.level.." em pelo menos um char de sua account. Você não irá ganhar de novo caso upe level "..config.level.." em outro char para pegar sua premium basta relogar.") db:query("UPDATE `accounts` SET `premiumgift` = 1 WHERE `id` = "..player:getAccountId()) end return true end
caso não der certo troque essa linha:
db:query("UPDATE `accounts` SET `premiumgift` = 1 WHERE `id` = "..player:getAccountId())
por
db.query("UPDATE `accounts` SET `premiumgift` = 1 WHERE `id` = "..player:getAccountId())
ou
db.asyncQuery("UPDATE `accounts` SET `premiumgift` = 1 WHERE `id` = "..player:getAccountId())
-
Vodkart's post in (Resolvido)[DUVIDA] Teleport Falante laranja was marked as the answerlocal positions = { {texto = "CTF" , pos = {x = 180, y = 48, z = 7}}, {texto = "Battle F." , pos = {x = 184, y = 48, z = 7}}, {texto = "DesertWar" , pos = {x = 184, y = 57, z = 7}}, {texto = "Castle24H" , pos = {x = 157, y = 62, z = 7}}, {texto = "Castle48H" , pos = {x = 175, y = 62, z = 7}}, {texto = "TeamBattle" , pos = {x = 176, y = 56, z = 7}}, {texto = "Campo M." , pos = {x = 177, y = 56, z = 7}}, {texto = "FireStorm" , pos = {x = 187, y = 53, z = 7}}, {texto = "IOE" , pos = {x = 175, y = 56, z = 7}}, {texto = "rank" , pos = {x = 60, y = 122, z = 7}}, {texto = "Boss Room" , pos = {x = 187, y = 51, z = 7}}, {texto = "Leia" , pos = {x = 182, y = 51, z = 7}}, {texto = "RushEvent" , pos = {x = 174, y = 56, z = 7}}, {texto = "Leia" , pos = {x = 2959, y = 698, z = 6}}, {texto = "Editados" , pos = {x = 233, y = 2050, z = 4}}, {texto = "Snowball" , pos = {x = 180, y = 57, z = 7}}, {texto = "Dota" , pos = {x = 177, y = 49, z = 7}} } function onThink(cid, interval, lastExecution) for _, pid in pairs(positions) do local t = getSpectators(pid.pos, 7, 5, false) if t then for _, cid in ipairs(t) do if isPlayer(cid) then doCreatureSay(cid, pid.texto, TALKTYPE_ORANGE_1, false, cid, pid.pos) end end end end return true end
-
Vodkart's post in (Resolvido)script de cronometro was marked as the answeradc na sua lib essa função:
function convertTime(minutes,seconds) local hours = 0 repeat if seconds >= 60 then minutes = minutes + 1; seconds = seconds - 60 elseif minutes >= 60 then hours = hours + 1; minutes = minutes - 60 end until seconds < 60 and minutes < 60 return {hours = hours, seconds = seconds, minutes = minutes} end function doTeleportTimer(pos, seconds) local t = convertTime(0, seconds) doSendAnimatedText(pos, t.minutes > 0 and t.minutes..":"..t.seconds or t.seconds, 145) if seconds ~= 1 then addEvent(doTeleportTimer, 1000, pos, seconds-1) end end
e no seu mods usa assim:
<?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Perfect Zombie System" version="8.6" author="Vodkart" contact="tibiaking.com" enabled="yes"> <config name="zombie_config"><![CDATA[ zombie_config = { storages = {172100, 172101, 172102}, -- n edite players = {min = 2, max = 30}, -- min, max players no evento rewards = {items ={{10503,1},{11192,10}}, trophy = 5805}, timeToStartEvent = 30, -- segundos para começar o evento CheckTime = 3, -- tempo que o TP fica aberto para os jogadores adrentarem o evento teleport = {{x=108, y=78, z=7}, {x=144 , y=3161, z=7}}, -- position do tp onde aparece, position para onde o jogador vai ao entrar no tp arena = {{x=109,y=3135,z=7},{x=188,y=3203,z=7}}, -- area positions monster_name = "Zombie Event", timeBetweenSpawns = 10, min_Level = 1000 } zombie_days = { ["Monday"] = {"19:00"}, ["Tuesday"] = {"19:00"}, ["Wednesday"] = {"19:00"}, ["Thursday"] = {"19:00"}, ["Friday"] = {"19:00"}, ["Saturday"] = {"19:00"}, ["Sunday"] = {"19:00"} } function removeZombieTp() local t = getTileItemById(zombie_config.teleport[1], 1387).uid return t > 0 and doRemoveItem(t) and doSendMagicEffect(zombie_config.teleport[1], CONST_ME_POFF) end function ZerarStoragesZombie() for _, stor in pairs(zombie_config.storages) do setGlobalStorageValue(stor, 0) end end function getPlayersInZombieEvent() local t = {} for _, pid in pairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), zombie_config.arena[1], zombie_config.arena[2]) and getPlayerAccess(pid) < 3 then t[#t+1] = pid end end return t end function getZombieRewards(cid, items) local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end end function HaveCreatureZombie(area, remove) for x = area[1].x - 1, area[2].x + 1 do for y = area[1].y - 1, area[2].y + 1 do local pos = {x=x, y=y, z=area[1].z} local m = getTopCreature(pos).uid if remove ~= false and m ~= 0 and isMonster(m) then doRemoveCreature(m) end end end end function spawnZombie() if #getPlayersInZombieEvent() > 1 then local pos = {x=math.random(zombie_config.arena[1].x, zombie_config.arena[2].x), y=math.random(zombie_config.arena[1].y,zombie_config.arena[2].y), z=zombie_config.arena[1].z} doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE) addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE) addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA) doSendMagicEffect(pos, CONST_ME_MORTAREA) doSummonCreature(zombie_config.monster_name, pos, false) setGlobalStorageValue(zombie_config.storages[2], getGlobalStorageValue(zombie_config.storages[2]) <= 0 and 1 or getGlobalStorageValue(zombie_config.storages[2])+1) doBroadcastMessage("A zombie has spawned! There is currently " .. getGlobalStorageValue(zombie_config.storages[2]) .. " zombies in the zombie event!", MESSAGE_STATUS_CONSOLE_RED) addEvent(spawnZombie, zombie_config.timeBetweenSpawns *1000) end end function CheckZombieEvent(delay) if getGlobalStorageValue(zombie_config.storages[1]) ~= (zombie_config.players.max+1) then if delay > 0 and getGlobalStorageValue(zombie_config.storages[1]) < zombie_config.players.max then doBroadcastMessage("Zombie event starting in " .. delay .. " minutes! The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING) elseif delay == 0 and getGlobalStorageValue(zombie_config.storages[1]) < zombie_config.players.min then for _, cid in pairs(getPlayersInZombieEvent()) do doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) end removeZombieTp() doBroadcastMessage("The Zombie event could not start because of to few players participating.\n At least " .. zombie_config.players.min .. " players is needed!", MESSAGE_STATUS_WARNING) ZerarStoragesZombie() elseif delay == 0 and getGlobalStorageValue(zombie_config.storages[1]) >= zombie_config.players.min then removeZombieTp() doBroadcastMessage("The Zombie event is now full [" .. getGlobalStorageValue(zombie_config.storages[1]) .. " players]! The event will soon start.") for _, var in pairs(getPlayersInZombieEvent()) do doPlayerSendTextMessage(var, MESSAGE_EVENT_ADVANCE, "The first zombie will spawn in " .. zombie_config.timeToStartEvent .. " seconds! Good luck!") end addEvent(spawnZombie, zombie_config.timeToStartEvent*1000) end addEvent(CheckZombieEvent, 60000, delay-1) end end]]></config> <event type="statschange" name="ZombieStats" event="script"><![CDATA[ domodlib('zombie_config') if isPlayer(cid) and isMonster(attacker) and getCreatureName(attacker) == zombie_config.monster_name then if isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then if #getPlayersInZombieEvent() > 1 then doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED) local corpse = doCreateItem(getPlayerSex(cid) == 1 and 3058 or 6081, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) if #getPlayersInZombieEvent() == 1 then local winner = getPlayersInZombieEvent()[1] doBroadcastMessage(getCreatureName(winner)..' has survived at zombie event!') local goblet = doPlayerAddItem(winner, zombie_config.rewards.trophy, 1) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(winner) .. " for winning the Zombie event.") getZombieRewards(winner, zombie_config.rewards.items) doTeleportThing(winner, getTownTemplePosition(getPlayerTown(winner)), false) doSendMagicEffect(getPlayerPosition(winner), CONST_ME_TELEPORT) doBroadcastMessage(getPlayerName(winner).." won the Zombie event! Congratulations!") HaveCreatureZombie(zombie_config.arena, true) ZerarStoragesZombie() end else doBroadcastMessage("No one survived in the Zombie Event.", MESSAGE_EVENT_ADVANCE) HaveCreatureZombie(zombie_config.arena, true) ZerarStoragesZombie() end return false end end return true]]></event> <globalevent name="Zombie_Start" interval="60000" event="script"><![CDATA[ domodlib('zombie_config') function onThink(interval, lastExecution) if zombie_days[os.date("%A")] then local hrs = tostring(os.date("%X")):sub(1, 5) if isInArray(zombie_days[os.date("%A")], hrs) and getGlobalStorageValue(zombie_config.storages[3]) <= 0 then local tp = doCreateItem(1387, 1, zombie_config.teleport[1]) doItemSetAttribute(tp, "aid", 45110) CheckZombieEvent(zombie_config.CheckTime) doTeleportTimer(zombie_config.teleport[1], zombie_config.CheckTime*60) setGlobalStorageValue(zombie_config.storages[1], 0) setGlobalStorageValue(zombie_config.storages[2], 0) HaveCreatureZombie(zombie_config.arena, true) end end return true end]]></globalevent> <event type="login" name="Zombie_Login" event="script"><![CDATA[ domodlib('zombie_config') function onLogin(cid) registerCreatureEvent(cid, "ZombieBattle") registerCreatureEvent(cid, "ZombieStats") if isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end return true end]]></event> <event type="combat" name="ZombieBattle" event="script"><![CDATA[ domodlib('zombie_config') if isPlayer(cid) and isPlayer(target) and isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then doPlayerSendCancel(cid, "You may not attack this player.") return false end return true ]]></event> <movevent type="StepIn" actionid ="45110" event="script"><![CDATA[ domodlib('zombie_config') function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true end if getPlayerAccess(cid) > 3 then return doTeleportThing(cid, zombie_config.teleport[2]) end if getPlayerLevel(cid) < zombie_config.min_Level then doTeleportThing(cid, fromPosition, true) doPlayerSendCancel(cid, "You need to be at least level " .. zombie_config.min_Level .. ".") doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) return true end if getGlobalStorageValue(zombie_config.storages[1]) <= zombie_config.players.max then doTeleportThing(cid, zombie_config.teleport[2]) setGlobalStorageValue(zombie_config.storages[1], getGlobalStorageValue(zombie_config.storages[1])+1) doBroadcastMessage(getPlayerName(cid) .. " entered the Zombie event! Currently " .. getGlobalStorageValue(zombie_config.storages[1]) .. " players have joined!", MESSAGE_STATUS_CONSOLE_RED) if getGlobalStorageValue(zombie_config.storages[1]) == zombie_config.players.max then setGlobalStorageValue(zombie_config.storages[1], getGlobalStorageValue(zombie_config.storages[1])+1) removeZombieTp() doBroadcastMessage("The Zombie event is now full [" .. getGlobalStorageValue(zombie_config.storages[1])-1 .. " players]! The event will soon start.") for _, var in pairs(getPlayersInZombieEvent()) do doPlayerSendTextMessage(var, MESSAGE_EVENT_ADVANCE, "The first zombie will spawn in " .. zombie_config.timeToStartEvent .. " seconds! Good luck!") end addEvent(spawnZombie, zombie_config.timeToStartEvent*1000) end end return true end]]></movevent> <talkaction words="/zombiestart;!zombiestart" access="5" event="buffer"><![CDATA[ domodlib('zombie_config') if getGlobalStorageValue(zombie_config.storages[3]) > 0 then doPlayerSendCancel(cid, "The event is already starting.") return true elseif not param or not tonumber(param) then doPlayerSendCancel(cid, "Use only numbers.") return true end local param = tonumber(param) <= 0 and 1 or tonumber(param) local tp = doCreateItem(1387, 1, zombie_config.teleport[1]) doItemSetAttribute(tp, "aid", 45110) CheckZombieEvent(tonumber(param)) doTeleportTimer(zombie_config.teleport[1], tonumber(param)*60) ZerarStoragesZombie() setGlobalStorageValue(zombie_config.storages[3], 1) HaveCreatureZombie(zombie_config.arena, true) ]]></talkaction> <globalevent name="ZombieDebug-Start" type="start" event="buffer"><![CDATA[ domodlib('zombie_config') ZerarStoragesZombie() return true]]></globalevent> </mod>