Solutions
-
zipter98's post in (Resolvido)Sistema de Cofre was marked as the answerfunction onUse(cid, item) local money = getItemAttribute(item.uid, "money") or 0 if money > 0 then doPlayerAddMoney(cid, money) doItemSetAttribute(item.uid, "money", 0) doItemSetAttribute(item.uid, "description", "It doesn't has money.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have withdrawn "..money.." gold.") else if getPlayerMoney(cid) > 0 then money = getPlayerMoney(cid) doPlayerRemoveMoney(cid, money) doItemSetAttribute(item.uid, "money", money) doItemSetAttribute(item.uid, "description", "It has "..money.." gold.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have deposited "..money.." gold.") else return doPlayerSendCancel(cid, "You do not have money.") end end return true end
-
zipter98's post in (Resolvido)Item que não faz trade e não possa jogar. was marked as the answerPrimeiramente, você deverá ter este callback instalado no seu servidor.
data/creaturescripts/scripts:
function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot = 0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i = 0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end local itemId = 19473 --ID do item. local depot = xxx --ID do depot. function onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos) if getTileItemById(toPos, depot).uid < 1 then if toPos.x ~= 65535 or toPos.y ~= 64 then return doPlayerSendCancel(cid, "You can't move this item.") and false end end return true end function onTradeRequest(cid, target, item) if item.itemid == itemId then return doPlayerSendCancel(cid, "You can't trade this item.") and false elseif isContainer(item.uid) then if #getItemsInContainerById(item.uid, itemId) > 0 then return doPlayerSendCancel(cid, "You can't trade this item.") and false end end return true end function onTradeAccept(cid, target, item, targetItem) if item.itemid == itemId then return doPlayerSendCancel(cid, "You can't trade this item.") and false elseif isContainer(item.uid) then if #getItemsInContainerById(item.uid, itemId) > 0 then return doPlayerSendCancel(cid, "You can't trade this item.") and false end end return true end function onLogin(cid) local events = {"moveItem", "tradeItem", "accItem"} for i = 1, #events do registerCreatureEvent(cid, events[i]) end return true end Tags: <event type="traderequest" name="tradeItem" event="script" value="nome_do_arquivo.lua"/> <event type="moveitem" name="moveItem" event="script" value="nome_do_arquivo.lua"/> <event type="tradeaccept" name="accItem" event="script" value="nome_do_arquivo.lua"/> <event type="login" name="itemLogin" event="script" value="nome_do_arquivo.lua"/> Caso você não possua as sources do seu servidor, avise.
-
zipter98's post in (Resolvido)[Pedido]Algum scripter para min ajuda nesse script was marked as the answerSupondo que a tabela movestable estivesse assim:
local movestable = { ["Bulbasaur"] = { move1 = {name = "Razor Leaf", level = 20, cd = 7, target = 1}, }, } refiz sua função da seguinte maneira: function getMoveDexDescr(pokemon, number) if not pokemon then return "" elseif not movestable[pokemon] then return print(pokemon.." doesn't exist on movestable.") end local moves = { [1] = movestable[pokemon].move1, [2] = movestable[pokemon].move2, [3] = movestable[pokemon].move3, [4] = movestable[pokemon].move4, [5] = movestable[pokemon].move5, [6] = movestable[pokemon].move6, [7] = movestable[pokemon].move7, [8] = movestable[pokemon].move8, [9] = movestable[pokemon].move9, [10] = movestable[pokemon].move10, } if not moves[number] then return print("move"..number.." isn't a valid move on "..pokemon..".") end local movement = moves[number] local name, level, cooldown, target = movement.name, movement.level, movement.cd, movement.target if target == 1 then target = "Sim" else target = "Não" end return "\n Nome:"..name.."\n Level:"..level.."\n Tempo:"..cooldown.."\n Alvo:"..target.."." end -
zipter98's post in (Resolvido)Dado premiado was marked as the answeritemid -> ID do item.
chance -> Chance, em porcentagem, de sair o item.
count -> Quantidade do item.
local items = { --[itemid] = {chance, count}, [2160] = {50, 100}, [2158] = {70, 50}, } function onUse(cid, item) local number = math.random(1, 100) local _item = 0 for itemid, chance in pairs(items) do if _item == 0 then _item = itemid else local new_chance = (chance[1] - number) > 0 and chance[1] - number or number - chance[1] local old_chance = (items[_item][1] - number) > 0 and items[_item][1] - number or number - items[_item][1] if new_chance < old_chance then _item = itemid end end end if _item ~= 0 then local count = items[_item][2] if not isItemStackable(_item) then if count > 1 then for i = 1, count do doPlayerAddItem(cid, _item, 1) end else doPlayerAddItem(cid, _item, 1) end else doPlayerAddItem(cid, _item, count) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received: "..count.."x "..getItemNameById(_item)..(count > 1 and "s" or "")..".") doRemoveItem(item.uid, 1) end return true end -
zipter98's post in (Resolvido)[PEDIDO] Broadcast was marked as the answerTag:
<globalevent name="dayBroadcast" time="18:55" event="script" value="nome_do_arquivo.lua"/> Código:
local open = 5 --Tempo para abrir o evento (minutos). function onTime() local days = {"Monday", "Tuesday"} local messages = {"O evento foi aberto!!", "%d minutos para o evento abrir."} if isInArray(days, os.date("%A")) then broadcastMessage(messages[2]:format(open)) for i = 1, open do addEvent(function() local time = open - i if time <= 0 then broadcastMessage(messages[1]) else broadcastMessage(messages[2]:format(time)) end end, i * 60 * 1000) end end return true end -
zipter98's post in (Resolvido)[Pedido/Ajuda] Arquivo look.lua mostrando Gods com descrição de player was marked as the answerEm configuration.lua, altere a tabela youAre para a seguinte:
youAre = { [3] = "a Senior Tutor", } -
zipter98's post in (Resolvido)Comando para evento. was marked as the answerTalkaction:
Tag:
<talkaction words="/eventbag;/bag;/enceventbag" event="script" value="nome_do_arquivo.lua"/> Código:
local config = { tp = { pos = {x = x, y = y, z = z}, --Onde o teleporte será criado. toPos = {x = x, y = y, z = z}, --Para onde jogador será teleportado ao usar o comando /bag. tpId = 1328, --Id do teleporte. aid = 91801, }, storages = { event_storage = 8591, storage = 9591, }, groupId = 6, --Group ID mínimo para abrir o evento. } function onSay(cid, words) if words == "/eventbag" then if getPlayerGroupId(cid) < config.groupId then return false elseif getGlobalStorageValue(config.storages.event_storage) > -1 then return doPlayerSendCancel(cid, "The event is already openned.") end setGlobalStorageValue(config.storages.event_storage, 1) local item = doCreateItem(config.tp.tpId, 1, config.tp.pos) doItemSetAttribute(item, "aid", config.tp.aid) broadcastMessage("The bag event is open! You can enter only 1 time, then good luck!") elseif words == "/bag" then if getPlayerStorageValue(cid, config.storages.storage) > -1 then return doPlayerSendCancel(cid, "You already got into the event.") elseif getGlobalStorageValue(config.storages.event_storage) < 1 then return doPlayerSendCancel(cid, "The event isn't open.") end doPlayerSendTextMessage(cid, 27, "You were teleported to the event.") doTeleportThing(cid, config.tp.toPos) setPlayerStorageValue(cid, config.storages.storage, 1) elseif words == "/enceventbag" then if getPlayerGroupId(cid) < config.groupId then return false elseif getGlobalStorageValue(config.storages.event_storage) < 1 then return doPlayerSendCancel(cid, "The event isn't open.") end local teleport = getTileItemById(config.tp.pos, config.tp.tpId).uid if teleport and teleport > 0 then doRemoveItem(teleport) end for _, pid in pairs(getPlayersOnline()) do if getPlayerStorageValue(pid, config.storages.storage) > -1 then setPlayerStorageValue(pid, config.storages.storage, -1) end end db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..config.storages.storage.." AND value > -1") setGlobalStorageValue(config.storages.event_storage, -1) broadcastMessage("The bag event is closed!") end return true end Movement: Tag: <movevent type="StepIn" actionid="91801" event="script" value="nome_do_arquivo.lua"/> Código: local config = { toPos = {x = x, y = y, z = z}, --Para onde o teleporte levará. event_storage = 8591, storage = 9591, } function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true elseif getGlobalStorageValue(config.event_storage) < 1 then return doPlayerSendCancel(cid, "The event is closed.") and doTeleportThing(cid, fromPosition) elseif getPlayerStorageValue(cid, config.storage) > -1 then return doPlayerSendCancel(cid, "You can't go to the event.") and doTeleportThing(cid, fromPosition) end doTeleportThing(cid, config.toPos) doPlayerSendTextMessage(cid, 27, "You were teleported to the event.") setPlayerStorageValue(cid, config.storage, 1) return true end -
zipter98's post in (Resolvido)Erro e bug Comando !rankclan (clan system) was marked as the answerCalma aí, se o jogador for Volcanic e digitar o comando, aparece a mensagem [Clan] Você nao tem Clan!?
Se for isso, basta mudar:
if getPlayerStorageValue(cid, 86228) == 1 then return doPlayerSendTextMessage(cid, 27, "[Clan] Você nao tem Clan!") end para:
if getPlayerStorageValue(cid, 86228) < 1 then return doPlayerSendTextMessage(cid, 27, "[Clan] Você nao tem Clan!") end Já que o valor da storage 86228 referente ao clan Volcanic é 1, a checagem de o jogador ter ou não clan está sendo feita de maneira errada. -
zipter98's post in (Resolvido)Duvida CreatureScripts was marked as the answer^
function onDeath(cid, corpse, deathList) if not isPlayer(cid) then return true end local killer = deathList[1] if isMonster(killer) then doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid).."] foi morto pelo monstro "..getCreatureName(killer).."." , MESSAGE_STATUS_CONSOLE_RED) elseif isPlayer(killer) then doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid).."] foi morto por "..getCreatureName(killer).." [Level: "..getPlayerLevel(killer).."].", MESSAGE_STATUS_CONSOLE_RED) end return true end -
zipter98's post in (Resolvido)[AJUDA] teleport evento was marked as the answerlocal configuration = { day = "Saturday", to_pos = {x = x, y = y, z = z}, --Para onde o teleport levará. pos = {x = x, y = y, z = z}, --Onde o teleport será criado. teleport_id = 1387, --ID do teleport. aid = 3434, --Action ID do teleport. } function onTime() if os.date("%A") == configuration.day then local item = getTileItemById(configuration.pos, configuration.teleport_id).uid if item < 1 then local tp = doCreateTeleport(configuration.teleport_id, configuration.to_pos, configuration.pos) doItemSetAttribute(tp, "aid", configuration.aid) broadcastMessage("Castle War foi aberto.", MESSAGE_STATUS_WARNING) end end return true end
-
zipter98's post in (Resolvido)[AJUDA]Evento Automatico was marked as the answerNa verdade, eu refiz o código e o simplifiquei. Porém, a funcionalidade é a mesma.
Quando digo erros no console, quero dizer erros que aparecem no executável (aquele responsável por ligar o servidor). Geralmente, quando um script dá erro, são relatados erros neste executável.
E obrigado.
PS: Teste esta versão do script (talvez o erro esteja no callback):
local day = "Saturday" --Mude o dia que o evento será executado aqui. EM INGLÊS. local id = 1547 local posis = { {x = 71, y = 620, z = 6}, -- posição da barreira {x = 72, y = 620, z = 6}, -- posição da barreira {x = 73, y = 620, z = 6}, -- posição da barreira {x = 74, y = 620, z = 6}, -- posição da barreira {x = 75, y = 620, z = 6}, -- posição da barreira {x = 71, y = 618, z = 6}, -- posição da barreira {x = 72, y = 618, z = 6}, -- posição da barreira {x = 73, y = 618, z = 6}, -- posição da barreira {x = 74, y = 618, z = 6}, -- posição da barreira {x = 75, y = 618, z = 6}, -- posição da barreira } function onTime() if os.date("%A") == day then for i = 1, #posis do local item = getTileItemById(posis[i], id).uid if item > 0 then doRemoveItem(item, 1) else doCreateItem(id, 1, posis[i]) end end end return true end -
zipter98's post in (Resolvido)[AJUDA] Editar Script Montaria 8.6 was marked as the answerTroque seu código por esse:
-- [( Mount System 1.4 created by Matheus for TibiaKing.com )] -- function onUse(cid, item) local outfit = 342 -- Outfit da montaria! local exhaust = 30 -- Tempo para player poder usar o item novamente! (tempo em segundos) local time = 60 -- Tempo para ficar na montaria! (tempo em segundos) local speed = 500 -- Velocidade adicionada ao player após usar o item! (300 = velocidade, quanto maior mais rapido...) local mana = 0 -- Quantidade de mana que o player necessita para usar o sistema! local premium = true -- Apenas players premium accounts true (sim) ou false (não)!? local storage, storage_time = 9393, 9394 --Não mexa aqui! if premium and not isPremium(cid) then return doPlayerSendTextMessage(cid, 23, "Sorry, only premium players.") elseif getCreatureMana(cid) < mana then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA) elseif getPlayerStorageValue(cid, storage) > os.time() then return doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.") else doCreatureSay(cid, "Yeeeah!!!\nYou went up on his ride.", 19) doSetCreatureOutfit(cid, {lookType = outfit}, -1) doChangeSpeed(cid, speed) doSendMagicEffect(getCreaturePosition(cid), 34) setPlayerStorageValue(cid, storage, os.time() + exhaust) setPlayerStorageValue(cid, storage_time, os.time() + time) doPlayerAddMana(cid, -mana) addEvent(function() if isPlayer(cid) then doChangeSpeed(cid, -speed) doPlayerSendTextMessage(cid, 23, "Mount System is time out!") doSendMagicEffect(getCreaturePosition(cid), 2) doRemoveCondition(cid, CONDITION_OUTFIT) end end, time * 1000) end return true end Em data/creaturescripts/scripts, crie um arquivo com extensão .lua e adicione o seguinte conteúdo: local cfg = { storage = 9394, speed = 500, --Velocidade adicionada ao player após usar o item! (300 = velocidade, quanto maior mais rapido...) outfit = 342, --Outfit da montaria! } function onLogin(cid) if getPlayerStorageValue(cid, cfg.storage) > os.time() then doSetCreatureOutfit(cid, {lookType = cfg.outfit}, -1) doChangeSpeed(cid, cfg.speed) end return true end Sabe fazer a tag? PS: Não precisa registrar nada em login.lua. -
zipter98's post in (Resolvido)[ERRO] Problema com Montaria Script was marked as the answerPara não remover 1 unidade do item ao usá-lo, basta retirar esta linha:
doRemoveItem(item.uid, 1) -
zipter98's post in (Resolvido)[PEDIDO] ANUNCIAR MORTE DE TAL MONSTRO was marked as the answerDesculpe, pensei que você sabia configurar.
data/creaturescripts/scripts, crie um arquivo com extensão .lua, nomeie-o avisar, e coloque o código que passei em meu comentário anterior.
Depois, em data/creaturescripts, abra o arquivo creaturescripts.xml e coloque a seguinte tag, abaixo de semelhantes (porém antes de </creaturescripts>):
<event type="death" name="avisarServer" event="script" value="avisar.lua"/> Depois, em data/monster, abra o arquivo XML do monstro e coloque, antes do </monster>, isso:
<script> <event name="avisarServer"/> </script> -
zipter98's post in (Resolvido)[Exp.lua] Error was marked as the answerNão é exatamente uma correção, mas sim uma proteção.
Na linha 635, troque:
doCreatureAddHealth(cid, -valor, 3,combats[damageCombat].cor) por:
if damageCombat and combats[damageCombat] then doCreatureAddHealth(cid, -valor, 3, combats[damageCombat].cor) end -
zipter98's post in (Resolvido)[AJUDA] teleport Rep++ was marked as the answerQualquer coisa, talkaction:
local teleport = { tpId = 1328, --ID do teleporte. tpPos = {x = x, y = y, z = z}, --Onde o teleporte será criado. tpToPos = {x = x, y = y, z = z}, --Para onde ele levará. } function onSay(cid, words) local tp = doCreateTeleport(teleport.tpId, teleport.tpToPos, teleport.tpPos) doPlayerSendTextMessage(cid, 27, "You created the teleport.") doItemSetAttribute(tp, "aid", 3434) return true end Movement: local tpId = 1328 --ID do teleporte. function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true end addEvent(function() if getTileItemById(position, tpId).uid > 0 then doRemoveItem(getTileItemById(position, tpId).uid, 1) end end, 5) return true end Mesmas tags que o Caronte passou. -
zipter98's post in (Resolvido)[AJUDA] Action spawn mosnter was marked as the answerlocal pokemons = {"monster_name", "monster_name", "monster_name"} --Aqui você configura os monstros que serão invocados aleatoriamente. function onUse(cid, item, fromPosition, item2, toPosition) local poke = pokemons[math.random(1, #pokemons)] doSummonCreature(poke, getThingPos(cid)) doSendMagicEffect(getCreaturePosition(cid), 29) doRemoveItem(item.uid, 1) doCreatureSay(cid, "Cuidado! Pokemons Muito Perigosos apareceram do Nada OMG.", TALKTYPE_ORANGE_1) return true end
-
zipter98's post in (Resolvido)Scanner Área was marked as the answerlocal toPosition = {x = x, y = y, z = z} --Para onde o jogador será teleportado. function onStepIn(cid, item, position, fromPosition) for posx = 494, 497 do -- checar posição X, começo e final da sala for posy = 499, 502 do -- checar posicao Y, começo e final da sala local pos = {x = posx, y = posy, z = 5, stackpos = 253} -- posição que ira verificar se existe creatures (stackpos = 253) local creature = getThingfromPos(pos) -- pega informações da creature da posição if isMonster(creature.uid) then -- verifica se é um monster return doTeleportThing(cid, fromPosition) and doSendMagicEffect(getPlayerPosition(cid), 2) end end end doTeleportThing(cid, toPosition) return true end Ou:
local fromPos = {x = 494, y = 499} local toPos = {x = 497, y = 502} local toPosition = {x = x, y = y, z = z} --Para onde o jogador será teleportado. local function isThereSomeMonster() for x = fromPos.x, toPos.x do for y = fromPos.y, toPos.y do local area = {x = x, y = y, z = 5} local creature = getTopCreature(area).uid if isMonster(creature) then return true end end end return false end function onStepIn(cid, item, position, fromPosition) if isThereSomeMonster() then return doTeleportThing(cid, fromPosition) and doSendMagicEffect(getPlayerPosition(cid), 2) end doTeleportThing(cid, toPosition) return true end -
zipter98's post in (Resolvido)getItem was marked as the answerÉ como tivesse vários itens empilhados?
while getTileItemById(position, itemid).uid > 0 do doRemoveItem(getTileItemById(position, itemid).uid) end -
zipter98's post in (Resolvido)Drop por chance was marked as the answerdata/creaturescripts/scripts, crie um arquivo com extensão .lua, nomeie-o bonusloot.lua e adicione o seguinte conteúdo:
local monsters = { ["Demon"] = {90181, 100, {item_id, count}}, --["nome_do_monstro"] = {storage, quantidade_para_matar, {item_id, quantidade}}, } function onDeath(cid, corpse, deathList) local killer = deathList[1] if #deathList > 1 then killer = deathList[2] end if isMonster(cid) and isPlayer(killer) and monsters[getCreatureName(cid)] then local monster = monsters[getCreatureName(cid)] local storage = monster[1] local value = getPlayerStorageValue(killer, storage) < 1 and 1 or getPlayerStorageValue(killer, storage) + 1 if value >= monster[2] then local id = monster[3][1] local count = monster[3][2] setPlayerStorageValue(killer, storage, -1) if isItemStackable(id) then doAddContainerItem(corpse.uid, id, count) else for i = 1, count do doAddContainerItem(corpse.uid, id, 1) end end else local left = monster[2] - value setPlayerStorageValue(killer, storage, value) doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_ORANGE, left.." "..getCreatureName(cid)..(left > 1 and "s" or "").." left to kill.") end end return true end Tag: <event type="death" name="bonusLoot" event="script" value="bonusloot.lua"/> No arquivo XML dos monstros configurados na tabela monsters (ou seja, aqueles que droparão um item bônus após matar quantia x deles), você adicione, antes de </monster>, isso: <script> <event name="bonusLoot"/> </script> -
zipter98's post in (Resolvido)[Pedido] Sistema de Arena. was marked as the answerOK. Eu fiz bem rapidamente o sistema aqui, talvez haja algum(s) erro(s).
data/lib, crie um arquivo com extensão .lua e coloque o seguinte conteúdo:
ARENA = { WAVES = { [1] = {"monster_name", {x = x, y = y, z = z}}, --{nome_do_monstro, {posição_que_vai_nascer}}, [2] = {"monster_name", {x = x, y = y, z = z}}, [3] = {"monster_name", {x = x, y = y, z = z}}, [4] = {"monster_name", {x = x, y = y, z = z}}, [5] = {"monster_name", {x = x, y = y, z = z}}, [6] = {"monster_name", {x = x, y = y, z = z}}, [7] = {"monster_name", {x = x, y = y, z = z}}, [8] = {"monster_name", {x = x, y = y, z = z}}, }, NPC = { price = 2000, --Preço para entrar na arena. position = {x = x, y = y, z = z}, --Para onde o jogador será teleportado ao falar com o NPC. }, TELEPORT = { tpId = 1387, --ID do teleporte. tpPos = {x = x, y = y, z = z}, --Onde o teleporte será criado, ao matar o último boss. tpToPos = {x = x, y = y, z = z}, --Para onde o teleporte levará. aid = 1307, }, STORAGES = { storage = 90181, wave_sto = 90182, }, fromPos = {x = x, y = y, z = z}, --Coordenadas da posição superior esquerda da arena. toPos = {x = x, y = y, z = z}, --Coordenadas da posição inferior direita da arena. delay = 15, --Segundos para o boss aparecer. level = 100, --Level mínimo. } function doWave(cid, wave) if not isPlayer(cid) then return true elseif not ARENA.WAVES[wave] then return true elseif getPlayerStorageValue(cid, ARENA.STORAGES.storage) > -1 then return true end local monster = ARENA.WAVES[wave][1] local pos = ARENA.WAVES[wave][2] doPlayerSendTextMessage(cid, 27, "In "..ARENA.delay.." seconds, a boss will spawn. [Wave: "..wave.."]") addEvent(function() doCreateMonster(monster, pos) end, ARENA.delay * 1000) end function clearArena() for x = ARENA.fromPos.x, ARENA.toPos.x do for y = ARENA.fromPos.y, ARENA.toPos.y do for z = ARENA.fromPos.z, ARENA.toPos.z do local area = {x = x, y = y, z = z} local creature = getTopCreature(area).uid if isCreature(creature) then doRemoveCreature(creature) end end end end end Código do NPC: 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 if msgcontains(msg:lower(), "arena") or msgcontains(msg:lower(), "enter") then if getPlayerLevel(cid) < ARENA.level then selfSay("You do not have enough level ["..ARENA.level.."].", cid) talkState[talkUser] = 0 return true elseif getGlobalStorageValue(1000) > -1 then selfSay("Someone is at the arena right now, please wait.", cid) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, ARENA.STORAGES.storage) > -1 then selfSay("You already completed the arena.", cid) talkState[talkUser] = 0 return true else selfSay("You really want enter in the arena? It will cost you {"..ARENA.NPC.price.."}.", cid) talkState[talkUser] = 1 return true end elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 1 then if doPlayerRemoveMoney(cid, ARENA.NPC.price) then selfSay("Good luck! ^.^", cid) doTeleportThing(cid, ARENA.NPC.position) setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, 1) setGlobalStorageValue(1000, 1) doWave(cid, 1) talkState[talkUser] = 0 return true else selfSay("You do not have enough money.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 1 then selfSay("Ok, then...", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) data/creaturescripts/scripts, crie um arquivo com extensão .lua, nomeie-o killboss.lua, e coloque o seguinte conteúdo: function onKill(cid, target) if isPlayer(cid) and getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then local new_wave = getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) + 1 if ARENA.WAVES[new_wave] then setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, new_wave) doWave(cid, new_wave) else local tp = doCreateTeleport(ARENA.TELEPORT.tpId, ARENA.TELEPORT.tpToPos, ARENA.TELEPORT.tpPos) doItemSetAttribute(tp, "aid", ARENA.TELEPORT.aid) end end return true end function onLogout(cid) if getTileInfo(getThingPos(cid)).protection and getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then return setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, -1) end if getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then doPlayerSendCancel(cid, "You can't logout now.") return false end return true end function onPrepareDeath(cid) if getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, -1) setGlobalStorageValue(1000, -1) clearArena() end return true end Tags: <event type="kill" name="killBoss" script="killboss.lua"/> <event type="logout" name="arenaLogout" event="script" value="killboss.lua"/> <event type="preparedeath" name="deathBoss" event="script" value="killboss.lua"/> Não se esqueça de registrar o evento em login.lua:
registerCreatureEvent(cid, "killBoss") registerCreatureEvent(cid, "deathBoss") Já em data/movements/scripts, você novamente cria um arquivo com extensão .lua (nome do arquivo: tpremove.lua) e coloca o seguinte código: function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true end setPlayerStorageValue(cid, ARENA.STORAGES.storage, 1) setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, -1) setGlobalStorageValue(1000, -1) addEvent(function() if getTileItemById(position, ARENA.TELEPORT.tpId).uid > 0 then doRemoveItem(getTileItemById(position, ARENA.TELEPORT.tpId).uid, 1) end end, 50) return true end Tag: <movevent type="StepIn" actionid="1307" event="script" value="tpremove.lua"/> -
zipter98's post in (Resolvido)SetGlobalStorage was marked as the answerVocê está configurando a topos do teleporte no RME, certo? Ao invés de fazer isso, apenas crie o teleporte e configure o actionid. Depois, substitua seu movement por esse:
local pos = {x = x, y = y, z = z} --Para onde o jogador vai ser teleportado. function onStepIn(cid, item, position, fromPosition) if getGlobalStorageValue(1400) == 1 then return doTeleportThing(cid, fromPosition) and doPlayerSendCancel(cid, "Sorry, The quest was beginned.") end doTeleportThing(cid, pos) return true end -
zipter98's post in (Resolvido)Movement a partir de um MOD was marked as the answerColoquei fora do mod, my bad.
Troca:
<action actionid="84005" event="script"><![CDATA[ domodlib('guild_func') function onUse(cid, item, frompos, item2, topos) local MyGuild = getPlayerGuildName(cid) if not HaveGuild(cid) then return doPlayerSendTextMessage(cid,22,"Sorry, you're not in a guild.") elseif not HaveAcess(MyGuild) then return doPlayerSendTextMessage(cid,22,"Your guild no has access to this area.") end doTransformItem(item.uid, item.itemid + 1) doTeleportThing(cid, topos, TRUE) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Welcome,The access of your guild in this area ends in "..getAcessDate(getGuildWinnerName())) return true end]]></action> por: <movevent type="StepIn" actionid="9089" event="script"><![CDATA[ domodlib("guild_func") function onStepIn(cid, item, position, fromPosition) local guild = getPlayerGuildName(cid) if not isPlayer(cid) then return true elseif not HaveGuild(cid) then return doPlayerSendCancel(cid, "Sorry, you're not in a guild.") and doTeleportThing(cid, fromPosition) elseif not HaveAcess(guild) then return doPlayerSendCancel(cid, "Your guild no has access to this area.") and doTeleportThing(cid, fromPosition) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Welcome, the access of your guild in this area ends in "..getAcessDate(getGuildWinnerName())) return true end]]></movement> PS: Não mexo com MODs, então não é certeza que vai funcionar. Mas não custa tentar. -
zipter98's post in (Resolvido)Script Look Bonus Level PDA was marked as the answerNa função da lib, abaixo de:
local status = getPokemonStatus(pokemon) você coloca:
local bonus_level = getItemAttribute(item, "b_level") or 0 Depois, abaixo de:
doItemSetAttribute(item, "level", newlevel) você coloca:
doItemSetAttribute(item, "b_level", bonus_level + 1) No código do look, você troca:
table.insert(str, "\nIt contains "..getArticle(pokename).." "..pokename.." [level "..getItemAttribute(thing.uid, "level").."].\n [Bonus level: "..(getItemAttribute(thing.uid, "level")).."].\n") por:
local bonus_level = getItemAttribute(thing.uid, "b_level") or 0 table.insert(str, "\nIt contains "..getArticle(pokename).." "..pokename.." [level "..getItemAttribute(thing.uid, "level").."].\n [Bonus level: +"..bonus_level.."].\n") PS: Isso só vai funcionar com pokémons criados/capturados após a atualização acima.
-
zipter98's post in (Resolvido)Avisar quem é o top was marked as the answerdata/creaturescripts/scripts, crie um arquivo com extensão .lua chamado newtoplv e coloque o seguinte conteúdo:
function onAdvance(cid, skill, oldLevel, newLevel) if skill == SKILL__LEVEL then local query = db.getResult("SELECT name, level FROM players WHERE group_id < 2 ORDER BY level DESC LIMIT 1") if query:getID() ~= -1 then local topLv = query:getDataInt("level") local topName = query:getDataString("name") if newLevel > topLv and topName ~= getCreatureName(cid) then broadcastMessage("O jogador "..getCreatureName(cid).." se tornou o novo TOP LEVEL do servidor.") end end end return true end function onLogin(cid) registerCreatureEvent(cid, "newTopLv") return true end Tags:
<event type="advance" name="newTopLv" event="script" value="newtoplv.lua"/> <event type="login" name="newTopLogin" event="script" value="newtoplv.lua"/>