
Solutions
-
Wise's post in (Resolvido)Tile Mute was marked as the answersilencertile.lua (data/movements/scripts):
local time = 5 -- time in minutes local condition_muted = createConditionObject(CONDITION_MUTED) setConditionParam(condition_muted, CONDITION_PARAM_TICKS, time*60000) function onStepIn(cid) if isPlayer(cid) then doAddCondition(cid, condition_muted) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have been muted for '..time..' minutes.') end return true end
Tag - movements.xml (data/movements):
<movevent type="StepIn" actionid="ACTIONID" event="script" value="silencertile.lua"/> -
Wise's post in (Resolvido)[PEDIDO] Evento Sala de Summon was marked as the answerEsqueci um parâmetro..
function onUse(cid, fromPos, toPos) local monster = 'Demon' doCreateMonster(monster, getClosestFreeTile(cid, toPos)) doSendMagicEffect(toPos, CONST_ME_MAGIC_GREEN) return true end -
Wise's post in (Resolvido)preciso de um comando de gerar items was marked as the answerHahah sem problemas.
Se seu pedido foi atendido, por favor clique no botão que está localizado abaixo do post de quem te ajudou. Automaticamente ele irá ficar destacado como a melhor resposta e o tópico ficará com o prefixo "Resolvido" no início do título.
-
Wise's post in (Resolvido)Ajuda ae :) was marked as the answerA checagem serve, o resto não.
Basta adicioná-la ao script do baú:
local voc = {1, 2, 5, 6} -- {vocationID, vocationID, vocationID..} if not isInArray(voc, getPlayerVocation(cid)) then return doPlayerSendCancel(cid, 'Your vocation is not allowed to open the chest.') end Mas é apenas isso mesmo, só faltam detalhes. Sempre que fizer um pedido, lembre-se de não poupar detalhes.
Sobre as portas, basta configurar a tabela voc do script anterior, com os IDs das vocações que você deseja.
O baú ficaria:
vchest.lua (data/actions/scripts):
function onUse(cid, fromPos) local item = {5432, 1} -- {itemID, amount} local voc = {1, 2, 5, 6} -- {vocationID, vocationID, vocationID..} if not isInArray(voc, getPlayerVocation(cid)) then return doPlayerSendCancel(cid, 'Your vocation is not allowed to open the chest.') end doPlayerAddItem(cid, item[1], item[2]) doSendMagicEffect(fromPos, CONST_ME_MAGIC_BLUE) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You found '..item[2]..' '..getItemNameById(item[1])) return true end
Tag - actions.xml (data/actions):
<action actionid="ACTIONID" event="script" value="vchest.lua"/>
Crie o arquivo e nomeie ele; adicione a tag com o mesmo nome do arquivo e decida um ID para a action.
Edite a tabela voc com os IDs das vocações que você deseja que possa abrir a porta:
local voc = {1, 2, 5, 6} -- {vocationID, vocationID, vocationID..} Você pode ver os IDs delas em vocations.xml (data/XML).
Adicione a actionID à porta/baú pelo RME (Remere's Map Editor) e fim.
-
Wise's post in (Resolvido)[Pedido] Spell was marked as the answerlocal t = {time = 3, stor = 30303, stats = {30, 30}} -- time in minutes to cast again / storage / {health%, mana%} local hm = {} local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, t.time*60000) setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, hm[1]) setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANA, hm[2]) setCombatCondition(combat, condition) function onCastSpell(cid, var) if getPlayerStorageValue(cid, t.stor) - os.time() > 0 then doPlayerSendCancel(cid, 'This spell can only be cast every '..t.time..' minutes.') return false end table.insert(hm, t.stats[1]*(getCreatureMaxHealth(cid)/100)) table.insert(hm, t.stats[2]*(getCreatureMaxMana(cid)/100)) return doCombat(cid, combat, var) and setPlayerStorageValue(cid, t.stor, os.time() + t.time*60) end
-
Wise's post in (Resolvido)[PEDIDO] Alguem tem esse scrpit ? was marked as the answerNão é porque ele se nomeia um scripter que ele não pode fazer um pedido de um script. E se ele for um iniciante?
function onStepIn(cid) if not isPlayer(cid) then return false end return true end -
Wise's post in (Resolvido)[Ajuda Urgente] Itens que fazer as skills was marked as the answerVocê cria um movement script que atribui ao player determinado valor de uma storage ao equipar/remover o item de determinado slot.
local stor = 12345 -- storage function onEquip(cid, item, slot) setPlayerStorageValue(cid, stor, 1) -- já que é no callback de equipar, ele recebe o valor de ID 1 (como sendo positivo para a checagem do uso da spell) return true end function onDeEquip(cid, item, slot) setPlayerStorageValue(cid, stor, -1) -- ao remover o item, ele recebe o valor de ID -1 (como sendo negativo para a checagem do uso da spell) return true end
Configure as tags como movevents Equip / DeEquip.
Ex:
<movevent type="Equip" itemid="ITEMID" slot="ring" event="script" value="filename.lua"/> <movevent type="DeEquip" itemid="ITEMID" slot="ring" event="script" value="filename.lua"/>
local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) setHealingFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1.5, 2) function onCastSpell(cid, var) local stor = 12345 -- storage if getPlayerStorageValue(cid, stor) < 1 then -- checa se o valor da storage no player é menor que 1 (sendo que 1 seria o necessário) doPlayerSendCancel(cid, "You can't cast the spell without using the item that allows it.") -- a informação de que ele nao pode conjurar a spell é dada return false -- retorna false ao callback, resultando em não conjurar a spell end return doCombat(cid, combat, var) -- se a checagem acima for false, ou seja, maior ou igual a 1 (valor necessário), então significa que o player está com o item necessário equipado e a conjuração da spell é feita end
Qualquer dúvida ou problema, é só relatar por aqui.
-
Wise's post in (Resolvido)Regeneração de Soul Points was marked as the answerfunction onThink(interval, lastExecution) local soul = 15 if getWorldCreatures(0) > 0 then for _, all in ipairs(getPlayersOnline()) do doPlayerAddSoul(all, soul) end end return true end
-
Wise's post in (Resolvido)Sistema de Presente was marked as the answerA estrutura de controle que você usou pra checar o valor do itemID, não precisa ser feita já que a própria tag o determina (por ser apenas um itemID usado na action, isso se torna inútil). E de qualquer forma, não justifica os demais erros.
Mas tudo bem, não leve isso para o lado pessoal.
Obrigado por contribuir.
presentbox.lua
function onUse(cid, item, fromPos, toPos) local coins = {1, 30} -- {quantia mínima, quantia máxima} local items = {2160, 2472, 2470} -- {items} local mr = items[math.random(1, #items)] if mr == 2160 then doPlayerAddItem(cid, 2160, math.random(coins[1], #coins)) doSendMagicEffect(fromPos, CONST_ME_GIFT_WRAPS) doCreatureSay(cid, 'Congratulations!', TALKTYPE_ORANGE_1) doRemoveItem(item.uid, 1) else doPlayerAddItem(cid, mr, 1) doSendMagicEffect(fromPos, CONST_ME_GIFT_WRAPS) doCreatureSay(cid, 'Congratulations!', TALKTYPE_ORANGE_1) doRemoveItem(item.uid, 1) end return true end
<action itemid="8110" script="presentbox.lua"/>
@TsplayerT
Não havia lido sua mensagem. É sim, amigo
-
Wise's post in (Resolvido)[AJUDA] Food was marked as the answernewfood.lua (data/actions/scripts):
function onUse(cid, item) local percent = 0.1 -- 10% if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return doPlayerSendCancel(cid, 'Your life is full.') end doCreatureAddHealth(cid, (getCreatureMaxHealth(cid) * percent)) doCreatureSay(cid, 'Mmmm.', TALKTYPE_ORANGE_1) doRemoveItem(item.uid, 1) return true end
Tag - actions.xml (data/actions):
<action itemid="ITEMID" script="newfood.lua"/> Ops! Corrigi um erro de desatenção minha.
-
Wise's post in (Resolvido)FLECHA DE GELO was marked as the answerUse uma munição que contenha esse efeito de shoot type (CONST_ANI_SHIVERARROW).
Se você no caso não tiver o item com esse efeito, basta adicionar então em items.xml, como os membros disseram.
Exemplo do uso no infernal bolt: <item id="6529" article="an" name="infernal bolt" plural="infernal bolts"> <attribute key="weight" value="90" /> <attribute key="slotType" value="ammo" /> <attribute key="attack" value="43" /> <attribute key="maxHitChance" value="90" /> <attribute key="weaponType" value="ammunition" /> <attribute key="ammoType" value="bolt" /> <attribute key="shootType" value="shivearrow" /> <attribute key="ammoAction" value="removecount" /> </item> -
Wise's post in (Resolvido)[PEDIDO] Talkaction was marked as the answerdonateaccess.lua (data/talkactions/scripts):
function onSay(cid, words, param, channel) local stor = 12345 -- storage local p = string.explode(param, ",") local pid, ts, tn = getPlayerByNameWildcard(p[1]), tostring(p[1]), tonumber(p[2]) if (param == '') then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Enter the name of the player and the number of days you want to give access to it. Thus: /donate Player, 30') end if (not ts or not tn or p[3]) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Invalid parameter specified.') end if (tn < 1) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You need to assign to the player at least one day of access.') end if (not pid) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Player '..ts..' not found.') end setPlayerStorageValue(pid, stor, os.time() + (tn * 86400)) doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Were assigned '..tn..' day(s) of donate access to your account.') doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have assigned '..tn..' day(s) of donate access to the player '..ts) return true end
Tag - talkactions.xml (data/talkactions):
<talkaction log="yes" words="/donate" access="5" event="script" value="donateaccess.lua"/> -
Wise's post in (Resolvido)Outfit e addon quest was marked as the answeroutfits.xml (data/XML):
Altere os parâmetros do outfit assassin (geralmente sendo o outfit ID 13) para como sendo:
<outfit id="13" quest="31013"> <list gender="0" lookType="156" name="Assassin"/> <list gender="1" lookType="152" name="Assassin"/> </outfit>
ou
<outfit id="13" storageId="31013" storageValue="1"> <list gender="0" lookType="156" name="Assassin"/> <list gender="1" lookType="152" name="Assassin"/> </outfit>
assassinquest.lua (data/actions/scripts):
function onUse(cid, item, fromPos, item2, toPos) local stor = 31013 -- storage if getPlayerStorageValue(cid, stor) < 1 then setPlayerStorageValue(cid, stor, 1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Now you can wear your new outfit.") else doPlayerSendCancel(cid, "You already have picked up your outfit, it's empty.") end return true end
Tag - actions.xml (data/actions):
<action actionid="ACTIONID" script="assassinquest.lua"/>
Basta fazer o mesmo processo com os outros outfits.
-
Wise's post in (Resolvido)Remover Pz Locked Ajudaa pf was marked as the answerpzlocked.lua (data/movements/scripts):
function onStepIn(cid, item, pos, fromPos) if isPlayer(cid) and isPlayerPzLocked(cid) then doPlayerSetPzLocked(cid, false) end return true end
Tag - movements.xml (data/movements):
<movevent type="StepIn" actionid="ACTIONID" event="script" value="pzlocked.lua"/> -
Wise's post in (Resolvido)Npc que da vocação diferente was marked as the answerBom, nesse caso nem precisaria usar storages.. local tab = { voc = {5}, -- newVocationID dctime = 5, -- segundos para desconectar o player stats = {1, 150, 5} -- {newLevel, newHealth, newMana} novo level/hp/mana ao trocar a voc } 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 function changeVoc(cid) local playerid, mh, mm = getPlayerGUID(cid), getCreatureMaxHealth(cid), getCreatureMaxMana(cid) if(npcHandler:isFocused(cid)) then npcHandler:releaseFocus(cid) end setCreatureMaxHealth(cid, tab.stats[2]) doCreatureAddHealth(cid, -(tab.stats[2] - mh)) setCreatureMaxMana(cid, tab.stats[3]) doCreatureAddMana(cid, -(tab.stats[3] - mm)) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `level`="..tab.stats[1]..",`experience`= 0 WHERE `players`.`id`= "..playerid.."") return true end if (msgcontains(msg, 'change')) then if not (tab.voc[getPlayerVocation(cid)]) then talkState[talkUser] = 1 selfSay('If you choose to change your vocation, your level, health and mana will return as a level '..tab.stats[1]..'..', cid) selfSay('Are you sure you want this?', cid) else talkState[talkUser] = 0 npcHandler:releaseFocus(cid) selfSay('I can not change your vocation.', cid) end elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then doPlayerSetVocation(cid, tab.voc[1]) doSendMagicEffect(getThingPos(cid), CONST_ME_STUN) addEvent(function() if isPlayer(cid) then changeVoc(cid) end end, tab.dctime * 1000) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) selfSay('Okay, now you will pass out and I will send you to the temple of your town in '..tab.dctime..' seconds.', cid) elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then talkState[talkUser] = 0 npcHandler:releaseFocus(cid) selfSay('Sure, goodbye!', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
Wise's post in (Resolvido)Como fazer a bless n perder tão pouco level? was marked as the answerVocê pode atribuir uma porcentagem de perca de experiência no creature event de blessings do seu servidor, através da função:
doPlayerSetLossPercent(cid, lossType, newPercent)
Valores do segundo parâmetro:
-lossTypes: PLAYERLOSS_EXPERIENCE = 0 PLAYERLOSS_MANA = 1 PLAYERLOSS_SKILLS = 2 PLAYERLOSS_CONTAINERS = 3 PLAYERLOSS_ITEMS = 4
No terceiro parâmetro da função, determine a porcentagem em números inteiros ou decimais (como preferir) da perda do player.
Exemplo do uso no tipo de perda de experiência:
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 5) -
Wise's post in (Resolvido)[Creaturescript] DEBUGANDO was marked as the answerdoPlayerPopupFYI(cid, "Parabéns, você atingiu o level "..newLevel.."! Agora você está prestes a iniciar sua jornada no Global Legalize!\nNavegue pelos Guias de Hunts através deste NPC. Mas primeiramente você terá que atingir o level necessário para isso.\nSe você se considera um jogador já experiente, você pode conhecer a biblioteca do nosso site, assim não precisará de ter o level recomendado pelos NPCs para ir a qualquer lugar.\nLembre-se! Os NPCs guias somente servem para lhe guiar a algumas hunts.\nMas você pode acessa-las a qualquer level, caso se considere um explorador competente.\nBoa sorte!")
-
Wise's post in (Resolvido)Sistema de look was marked as the answerSem problemas, estou aqui para contribuir.
Testei o script, sem bugs: function onLook(cid, thing, position, lookDistance) if thing.uid ~= cid and isPlayer(thing.uid) then string = 'You see '..getCreatureName(thing.uid)..'. '..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is a '..getPlayerVocationName(thing.uid)..'.\nInformação do jogador ('..getCreatureName(thing.uid)..')\nHealth: ['..getCreatureHealth(thing.uid)..'/'..getCreatureMaxHealth(thing.uid)..']\nMana: ['..getCreatureMana(thing.uid)..'/'..getCreatureMaxMana(thing.uid)..']' doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, string) elseif thing.uid == cid then string = 'You see yourself. You are '..getPlayerVocationName(cid)..'.\nInformação sua ('..getCreatureName(cid)..')\nHealth: ['..getCreatureHealth(cid)..'/'..getCreatureMaxHealth(cid)..']\nMana: ['..getCreatureMana(cid)..'/'..getCreatureMaxMana(cid)..']' doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, string) end return true end -
Wise's post in (Resolvido)[Creaturescript] Teleport at level X was marked as the answerfunction onAdvance(cid, skill, oldLevel, newLevel) local pos = {x=32288, y=32337, z=15} if skill == SKILL__LEVEL and newLevel == 100 then doTeleportThing(cid, pos) end return true end
-
Wise's post in (Resolvido)Alavanca com storage - Usar apenas 1x was marked as the answerleverpos.lua (data/actions/scripts):
local tab = { time = 24, -- tempo em horas, para usar a alavanca novamente storages = {22001, 22002}, -- {globalstorage, storage} pos = {x=697, y=486, z=7, stackpos=253} -- pos x, y, z } function onUse(cid, item, fromPos, item2, toPos) if getGlobalStorageValue(tab.storages[1]) - os.time() < 1 then if getPlayerStorageValue(cid, tab.storages[2]) < 1 then setGlobalStorageValue(tab.storages[1], os.time() + (tab.time * 3600)) setPlayerStorageValue(cid, tab.storages[2], 1) doTeleportThing(cid, tab.pos) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Look for Loki and kill him!') else doSendMagicEffect(fromPos, CONST_ME_POFF) doPlayerSendCancel(cid, 'You already have used the lever.') end else doSendMagicEffect(fromPos, CONST_ME_POFF) doPlayerSendCancel(cid, 'The lever can only be used once a day.') end return true end
Tag - actions.xml (data/actions):
<action actionid="ACTIONID" event="script" value="leverpos.lua"/> -
Wise's post in (Resolvido)Ao equipar um item X no meu slot serta vocartion mudara a outfit was marked as the answerDesatenção minha, estou um tanto quanto ocupado:
local tab = { [1] = {outfit = 123}, -- [vocID] = {outfit = lookTypeNumber} [300] = {outfit = 456} } local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, -1) setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, 50) function onEquip(cid, item, slot) doSetCreatureOutfit(cid, {lookType = tab[getPlayerVocation(cid)].outfit}, -1) doChangeSpeed(cid, getCreatureSpeed(cid) + 50) doAddCondition(cid, condition) return true end function onDeEquip(cid, item, slot) doChangeSpeed(cid, getCreatureSpeed(cid) - 50) doRemoveCondition(cid, CONDITION_ATTRIBUTES) doRemoveCondition(cid, CONDITION_OUTFIT) return true end -
Wise's post in (Resolvido)Usar esse script para dar item ao upar was marked as the answerFaltou encerrar o for e o callback. E creio que poderá bugar a mensagem já que está dentro do for.
Talvez assim dê como você quer (retirei a mensagem pra evitar bugs), eu não testei:
local level = { {level = {50, 99}, item = {5432, 1}, stor = 54321}, -- {level = {levelMin, levelMax}, item = {itemID, count}, stor = storage} {level = {100, 149}, item = {5432, 1}, stor = 54321}, {level = {150, 199}, item = {5432, 1}, stor = 54321}, {level = {200}, item = {5432, 100}, stor = 54321} -- {level = {lastLevel}, item = {itemID, count}, stor = storage} } function onAdvance(cid, skill, oldLevel, newLevel) for i = 1, #level do if skill == 8 and getPlayerStorageValue(cid, level[i].stor) < 1 and getPlayerStorageValue(cid, level[#level].stor) < 1 then if newLevel >= level[i].level[1] and newLevel <= level[i].level[2] then setPlayerStorageValue(cid, level[i].stor, 1) doPlayerAddItem(cid, level[i].item[1], level[i].item[2]) elseif newLevel >= level[#level].level[1] then setPlayerStorageValue(cid, level[#level].stor, 1) doPlayerAddItem(cid, level[#level].item[1], level[#level].item[2]) end end end return true end -
Wise's post in (Resolvido)[PEDIDO] NPC que teleporta Player por itens was marked as the answerOps, acabei me esquecendo de aplicar a função pra essa parte. Obrigado por adicionar, Nogard.
Só um detalhe:
Não precisa adicionar outra função de remoção do dinheiro, já que a própria checagem já remove (retornando true, caso tenha).
Já editei o meu script.
Adicione os códigos ao arquivo xml do npc:
<npc name="Teleporter Man" script="data/npc/scripts/teleporterman.lua" walkinterval="0" floorchange="0"> <health now="150" max="150"/> <look typeex="1448"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I can {teleport} you to an area." /> </parameters> </npc> Substitua o ID 1448 em look typeex pelo ID do item que você deseja (no caso, 1448, é a estátua do Oracle).
-
Wise's post in (Resolvido)Script para Sqm was marked as the answeritemtile.lua (data/movements/scripts): local item = {5432, 1} -- {itemID, count} function onStepIn(cid, item, pos, fromPos) if isPlayer(cid) and getPlayerItemCount(cid, item[1]) < item[2] then doTeleportThing(cid, frompos) doSendMagicEffect(frompos, CONST_ME_POFF) doPlayerSendCancel(cid, "You can't enter without "..item[2].." "..getItemNameById(item[1]).." in your backpack.") end doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) return true end
Tag - movements.xml (data/movements):
<movevent type="StepIn" actionid="ACTIONID" event="script" value="itemtile.lua"/> -
Wise's post in (Resolvido)Arena Que Só Pode Haver Um Player Por Vez. Ajude-me e Torne Meu Projeto Mais Perto De Ser Inaugurado was marked as the answer@maiconmnt
Substitua o action script por esse:
-- Coded by Suicide local tab = { boss = "Infernatil", -- "Monster Name" storages = {27771, 27772}, -- {globalstorage, storage} apos = {x=1882, y=2080, z=14}, -- pos x, y, z que o player será teleportado ao puxar a alavanca rangex = {x=123, y=456, z=7}, -- pos x, y, z do sqm do canto superior da área (total) rangey = {x=321, y=654, z=7}, -- pos x, y, z do sqm do canto inferior da área (total) atime = 10 -- tempo máximo de permanência na arena, em minutos } -- xWhiteWolfs functions \/ function isOnSameFloor(fromPos, toPos) return fromPos.z == toPos.z and true or false end function isEven(arg) return arg % 2 == 0 and true or false end function getMiddlePos(fromPos, toPos) if not isOnSameFloor(fromPos, toPos) then return false end local middle = {x = 0, y = 0, z = 0} middle.x = isEven(fromPos.x + toPos.x) and (fromPos.x + toPos.x)/2 or math.floor((fromPos.x + toPos.x)/2) + 1 middle.y = isEven(fromPos.y + toPos.y) and (fromPos.y + toPos.y)/2 or math.floor((fromPos.y + toPos.y)/2) + 1 middle.z = fromPos.z or toPos.z return middle end function clearArea(middlePos, rangex, rangey, mob, player) for i = -rangex, rangex do for j = -rangey, rangey do pos = {x = middlePos.x + i, y = middlePos.y + j, z = middlePos.z} creature = getTopCreature(pos).uid if isMonster(creature) and mob then doSendMagicEffect(getThingPos(creature), 14) addEvent(doCreateMonster, 1000, tab.boss, pos) doRemoveCreature(creature) end if isPlayer(creature) and player then doSendMagicEffect(getThingPos(creature), 14) doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature))) end end end return true end function getDistanceRadius(fromPos, toPos) if not isOnSameFloor(fromPos, toPos) then return false end local distance = getDistanceBetween(fromPos, toPos) return isEven(distance) and (distance/2) or math.floor(distance/2) + 1 end -- xWhiteWolfs functions /\ function onUse(cid, item, frompos, item2, topos) if getGlobalStorageValue(tab.storage[1]) - os.time() < 1 then setGlobalStorageValue(tab.storages[1], os.time() + (tab.atime * 60)) setPlayerStorageValue(cid, tab.storages[2], 1) local rx = getDistanceRadius(tab.rangex, tab.rangey) addEvent(clearArea, 1000, getMiddlePos(tab.rangex, tab.rangey), rx, rx, true, false) doTeleportThing(cid, tab.apos) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "E que comece o desafio!!") else doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Há alguém fazendo a Quest.") end return true end E obrigado, xWhiteWolf.