Solutions
-
zipter98's post in (Resolvido)[PEDIDO] Máquina de helds was marked as the answerFoi mal pela demora, fiquei sem internet quase o dia todo.
Em data/XML/channels.xml, você deverá criar canais relativos a cada opção de troca, seguindo o modelo:
<channel id="ID_do_canal" name="Nome_do_canal"> <vocation id="10"/> </channel> Exemplos:
<channel id="22" name="20 Devoted Token (Tier 1-2)"> <vocation id="10"/> </channel> <channel id="23" name="70 Mighty Token (Tier 1-3)"> <vocation id="10"/> </channel> Depois, na mesma pasta, vocations.xml:
<vocation id="10" name="Held Machine" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="15" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1"> <formula meleeDamage="0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="1.0" club="1.0" sword="1.0" axe="1.0" distance="1.0" shielding="1.0" fishing="3.0" experience="1.0"/> </vocation> data/actions/scripts, código da máquina de troca:
function onUse(cid) doPlayerSetVocation(cid, 10) openChannelDialog(cid) return true end data/creaturescripts/scripts:
local trade_options = { --[channel_id] = {token = {token_itemid, amount}, results = {held_itemid, held_itemid, held_itemid, ...}}, } function onJoinChannel(cid, channelId, users, isTv) local option = trade_options[channelId] if not option then return false end doPlayerSetVocation(cid, 1) if doPlayerRemoveItem(cid, option.token[1], option.token[2]) then local result = option.results[math.random(#option.results)] doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "In trade of "..option.token[2].."x "..getItemNameById(option.token[1])..", you received: "..getItemNameById(result)..".") doPlayerAddItem(cid, result, 1) else doPlayerSendTextMessage(cid, 27, "You do not have "..option.token[2].."x "..getItemNameById(option.token[1])..".") end return false end Configure na tabela trade_options as opções de troca, seguindo o modelo:
[ID_do_canal] = {token = {ID_do_token, quantidade}, results = {IDs_dos_helds}}, Tag:
<event type="joinchannel" name="Held_Machine" event="script" value="nome_do_arquivo.lua"/> Em login.lua:
registerCreatureEvent(cid, "Held_Machine")
-
zipter98's post in (Resolvido)Talkactions Addpoints was marked as the answerTroque: db.query por: db.executeQuery
-
zipter98's post in (Resolvido)Doble xp a x guild. was marked as the answerNão testei, mas w/e.
Em algum arquivo da lib, coloque essas funções:
function setGuildExperience(guildId, exp) for _, pid in pairs(getPlayersOnline()) do if getPlayerGuildId(pid) == guildId then doPlayerSetExperienceRate(pid, exp) end end end function getGuildExpRate(guildId) for _, pid in pairs(getPlayersOnline()) do local playerRate = getPlayerRates(pid)[8] if getPlayerGuildId(pid) == guildId and playerRate > 1 then return playerRate end end return 1.0 end data/actions/scripts: local config = { exp_rate = 2.0, --Rate de experiência (2x). time = 60, --Tempo, em minutos, para a double experience da guild acabar (em minutos). g_storage = 4790, guild_events = {} } function onUse(cid) local owner_guild, player_guild = getGlobalStorageValue(config.g_storage), getPlayerGuildId(cid) if player_guild < 1 then return doPlayerSendCancel(cid, "You do not have a guild.") elseif player_guild == owner_guild then return doPlayerSendCancel(cid, "Your guild is already owner of this lever.") end broadcastMessage("The guild "..getPlayerGuildName(cid).." is now owner of the lever and has "..config.exp_rate.."x experience rate for "..config.time.." minutes!") setGuildExperience(player_guild, config.exp_rate) setGlobalStorageValue(config.g_storage, player_guild) if owner_guild ~= -1 then setGuildExperience(owner_guild, 1.0) stopEvent(config.guild_events[owner_guild]) end config.guild_events[player_guild] = addEvent(function() setGuildExperience(player_guild, 1.0) setGlobalStorageValue(config.g_storage, -1) end, config.time * 60 * 1000) return true end data/creaturescripts/scripts: function onLogin(cid) if getPlayerGuildId(cid) < 1 then return true end local guild_exp = getGuildExpRate(getPlayerGuildId(cid)) if guild_exp > 1 then doPlayerSetExperienceRate(cid, guild_exp) end return true end Logicamente, não precisa registrar nada em login.lua. -
zipter98's post in (Resolvido)Globalevents que dá item para player em X posição e em X horário! was marked as the answerTag:
<globalevent name="prize_event" time="20:00" event="script" value="nome_do_arquivo.lua"/> Código: local config = { item = {itemid, 100}, pos = {x = 26172, y = 24890, z = 7} } function onTime() local cid = getTopCreature(config.pos).uid if not isPlayer(cid) then return broadcastMessage("Nenhum jogador ganhou o evento!") end broadcastMessage("Parabéns, "..getCreatureName(cid).." ganhou o evento!") doPlayerAddItem(cid, config.item[1], config.item[2]) return true end -
zipter98's post in (Resolvido)BUG EM SCRIPT DE AURA SYSTEM was marked as the answerlocal config = { [9] = 35; -- [VOCATION] = CORES; [10] = 66; [11] = 144; [12] = 205; } function effectText(cid) local texts, eff = "´ . ," for vocation, color in pairs(config) do if getPlayerVocation(cid) == vocation then eff = color break end end if eff then doSendAnimatedText(getThingPos(cid), texts, eff) addEvent(function() if isPlayer(cid) then effectText(cid) end end, 1000) end end function onLogin(cid) effectText(cid) return true end
-
zipter98's post in (Resolvido)[PEDIDO] Desert quest (10 reps) was marked as the answerlocal config = { items = { {position = {x = x, y = y, z = z}, itemid = xxx}, --{position = posição_do_item, itemid = id_do_item}, {position = {x = x, y = y, z = z}, itemid = xxx}, {position = {x = x, y = y, z = z}, itemid = xxx}, --etc }, players = { {position = {x = x, y = y, z = z}, toPos = {x = x, y = y, z = z}, vocation = {xxx, xxx, ...}}, --{position = posição_do_jogador, toPos = posição_final, vocation = ID_das_vocações}, {position = {x = x, y = y, z = z}, toPos = {x = x, y = y, z = z}, vocation = {xxx, xxx, ...}}, {position = {x = x, y = y, z = z}, toPos = {x = x, y = y, z = z}, vocation = {xxx, xxx, ...}}, --etc } } function onUse(cid) local items, quest_players = {}, {} for _, item in pairs(config.items) do local position_item = getTileItemById(item.position, item.itemid).uid if position_item > 0 then table.insert(items, position_item) else return doPlayerSendCancel(cid, "There's missing some item(s).") end end for _, player in pairs(config.players) do local pid = getTopCreature(player.position).uid if isPlayer(pid) and isInArray(player.vocation, getPlayerVocation(pid)) then table.insert(quest_players, pid) else return doPlayerSendCancel(cid, "There's some player(s) missing or there's some wrong vocation(s).") end end for i = 1, #items do doRemoveItem(items[i]) end for i = 1, #quest_players do doPlayerSendTextMessage(quest_players[i], MESSAGE_INFO_DESCR, "Good luck at the quest!") doTeleportThing(quest_players[i], config.players[i].toPos) end return true end
-
zipter98's post in (Resolvido)[NPC] Function Error (HELP!) was marked as the answerNo código do NPC, você está usando como objeto dos metamétodos getStorageValue e setStorageValue uma variável inexistente (player).
Confesso não programar nas novas versões do TFS, mas tente:
local choose = {} 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) local player = Player(cid) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid if isInArray({"task", "tasks"}, msg:lower()) then selfSay("Here.", cid) taskNPCuid = getNpcCid() if player:getStorageValue(cid, 32150) < 0 then player:setStorageValue(cid, 32150, 0) end return taskWindow:sendToPlayer(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) -
zipter98's post in (Resolvido)Script de alavanca was marked as the answerlocal config = { rockid = 1304, --ID da pedra. time = xxx, --Tempo, em minutos, para a pedra voltar. pos = {x = x, y = y, z = z} --Posição da pedra. } function onUse(cid) local rock = getTileItemById(config.pos, config.rockid).uid if rock < 1 then return doPlayerSendCancel(cid, "The stone was already removed.") end doRemoveItem(rock) addEvent(doCreateItem, config.time * 60 * 1000, config.rockid, 1, config.pos) return true end
-
zipter98's post in (Resolvido)Ataques dos pokemons was marked as the answerTroque: doSendAnimatedText(getThingPos(cid), value, combats[combat].cor) por: doSendAnimatedText(getThingPos(cid), "-"..value, combats[combat].cor) troque: doSendAnimatedText(getThingPos(cid), valor, races[getMonsterInfo(getCreatureName(cid)).race].cor) por: doSendAnimatedText(getThingPos(cid), "-"..valor, races[getMonsterInfo(getCreatureName(cid)).race].cor) troque: doSendAnimatedText(getThingPos(cid), valor, combats[damageCombat].cor) por: doSendAnimatedText(getThingPos(cid), "-"..valor, combats[damageCombat].cor)
-
zipter98's post in (Resolvido)Item que ao usar em outro, da reflect. was marked as the answerAction:
local config = { reflectBonus = 2, --Bônus de reflect, em %. failChance = 50, --Chance de falhar, em porcentagem. types = {"armor", "legs", "helmet", "boots"}, noReflect = {1, 2, 3, 5, 6} --Tipos de armamento bloqueados (valores podem ser conferidos em 000-constant.lua, data/lib) } function onUse(cid, item, fromPos, itemEx, toPos) if itemEx.itemid < 100 then return doPlayerSendCancel(cid, "Use this in valid itens.") elseif isInArray(config.noReflect, getItemWeaponType(itemEx.uid)) then return doPlayerSendCancel(cid, "Use this in valid itens.") elseif getItemAttribute(itemEx.uid, "reflect") then return doPlayerSendCancel(cid, "This item has already a reflect bonus.") elseif math.random(1, 100) > config.failChance then return doPlayerSendTextMessage(cid, 27, "Sorry, your item didn't get a reflect bonus. Good luck at the next try! =]"), doRemoveItem(item.uid, 1) end local checkItemName for i = 1, #config.types do if getItemNameById(itemEx.itemid):find(config.types[i]) then checkItemName = true break end end if not checkItemName then return doPlayerSendCancel(cid, "Use this in valid itens.") end doPlayerSendTextMessage(cid, 27, "Congratulations, now your item has a reflect bonus of "..config.reflectBonus.."%!") doItemSetAttribute(itemEx.uid, "reflect", config.reflectBonus) doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).." ref "..config.reflectBonus.."%") doRemoveItem(item.uid, 1) return true end Creaturescript (não se esqueça de registrar o evento em login.lua):
function onStatsChange(cid, attacker, type, combat, value) if isPlayer(cid) and isCreature(attacker) and type == STATSCHANGE_HEALTHLOSS then local bonusReflect = 0 for i = 1, 10 do local item = getPlayerSlotItem(cid, i).uid if item > 0 and getItemAttribute(item, "reflect") then bonusReflect = bonusReflect + getItemAttribute(item, "reflect") end end if bonusReflect > 0 then local damage = value * bonusReflect / 100 doSendAnimatedText(getThingPos(attacker), -damage, COLOR_RED) doCreatureAddHealth(attacker, -damage) end end return true end -
zipter98's post in (Resolvido)Ganhar skull ao atacar determinado monstro was marked as the answerTags:
<event type="logout" name="skullLogin" event="script" value="nome_do_arquivo.lua"/> <event type="statschange" name="skullStatsChange" event="script" value="nome_do_arquivo.lua"/> <event type="target" name="skullTarget" event="script" value="nome_do_arquivo.lua"/> Código (data/creaturescripts/scripts): local monsterName = "nome_do_monstro" function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and getCreatureSkullType(attacker) ~= SKULL_WHITE and isMonster(cid) and getCreatureName(cid) == monsterName and type == STATSCHANGE_HEALTHLOSS then doCreatureSetSkullType(attacker, SKULL_WHITE) end return true end function onTarget(cid, target) if isPlayer(cid) and getCreatureSkullType(cid) ~= SKULL_WHITE and isMonster(target) and getCreatureName(target) == monsterName then doCreatureSetSkullType(cid, SKULL_WHITE) end return true end function onLogin(cid) registerCreatureEvent(cid, "skullStatsChange") registerCreatureEvent(cid, "skullTarget") return true end -
zipter98's post in (Resolvido)Monster morre aparece efeito was marked as the answerNão se esqueça de registrar o evento no arquivo .XML dos monstros.
local config = { --["monster_name"] = effect, ["Dragon"] = 28, ["Orc"] = 13, --etc } function onDeath(cid) local effect = config[getCreatureName(cid)] if effect then doSendMagicEffect(getThingPos(cid), effect) end return true end -
zipter98's post in (Resolvido)Comando para dar Storage para todos os player online. was marked as the answerfunction onSay(cid, words, param) local t = param:explode(",") for _, pid in pairs(getPlayersOnline()) do setPlayerStorageValue(pid, tonumber(t[1]) or 1, tonumber(t[2]) or 1) end return true end
-
zipter98's post in (Resolvido)Effect was marked as the answerTabela effectiveness, configuration.lua. Já o multiplicador de dano, exp2.0.lua.
-
zipter98's post in (Resolvido)Storage resetar todo dia 07:00h was marked as the answerVocê pode colocar, como valor da storage, a diferença de segundos entre o horário atual e o horário designado (7h, nesse caso). Assim, não haveriam problemas como este.
Exemplo:
function timeDiff(from, to) local ret = {} local t1 = from:explode(":") local t2 = to:explode(":") for i = 3, 1, -1 do t1[i] = tonumber(t1[i]) t2[i] = tonumber(t2[i]) if t2[i] > t1[i] then ret[i] = t2[i] - t1[i] - (ret[i] and 1 or 0) elseif t1[i] > t2[i] then local value = i ~= 1 and 60 or 24 ret[i] = value - t1[i] + t2[i] - (ret[i] and 1 or 0) ret[i - 1] = true else ret[i] = ret[i] and 1 or 0 end end return ret end local diff = timeDiff(os.date("%X"), "07:00:00") setPlayerStorageValue(cid, 9292, os.time() + diff[1] * 60 * 60 + diff[2] * 60 + diff[3]) Para checagens: if getPlayerStorageValue(cid, 9292) > os.time() then --não deu 7h ainda end -
zipter98's post in (Resolvido)Pedido de anunciar was marked as the answerfunction onKill(cid, target) if isPlayer(cid) and isPlayer(target) then broadcastMessage(getCreatureName(cid).." killed "..getCreatureName(target)) end return true end function onLogin(cid) registerCreatureEvent(cid, "killPlayer") return true end Tags: <event type="kill" name="killPlayer" script="nome_do_arquivo.lua"/> <event type="login" name="killPlayerLogin" event="script" value="nome_do_arquivo.lua"/>
-
zipter98's post in (Resolvido)[Pedido] boss da storage ao morrer was marked as the answerNão se esqueça de registrar o evento no arquivo .XML do monstro.
local config = { pos = {{x = x, y = y, z = z}, {x = x, y = y, z = z}}, --{{fromPos}, {toPos}} storage = {9281, 1}, --{key, value}, } function onDeath(cid) for x = config.pos[1].x, config.pos[2].x do for y = config.pos[1].y, config.pos[2].y do local pid = getTopCreature({x = x, y = y, z = config.pos[1].z}).uid if pid > 0 and isPlayer(pid) then setPlayerStorageValue(pid, config.storage[1], config.storage[2]) end end end return true end -
zipter98's post in (Resolvido)[PEDIDO] Editar meu !online was marked as the answerlocal config = { showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand')), showLevel = "yes", showVocations = "yes" } config.showLevel, config.showVocations = getBooleanFromString(config.showLevel), getBooleanFromString(config.showVocations) function onSay(cid, words, param, channel) local i, position, vocations, vocStr = 0, 1, {}, "" for _, pid in ipairs(getPlayersOnline()) do i = i + 1 if(vocations[getPlayerVocation(pid)] ~= nil) then vocations[getPlayerVocation(pid)] = vocations[getPlayerVocation(pid)] + 1 else vocations[getPlayerVocation(pid)] = 1 end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i * 2) .. " player" .. ((i * 2) and "s" or "") .. " online:") if(config.showVocations) then for vocId, quant in pairs(vocations) do vocStr = vocStr .. ""..getVocationInfo(vocId).name.." ["..(quant * 2).."], " end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Vocations: "..vocStr:gsub(", $", ".")) end return true end
-
zipter98's post in (Resolvido)TILE QUE MOSTRE MENSSAGEM was marked as the answerlocal time, storage = 3, 9471 function onStepIn(cid, item, position, fromPosition) if getPlayerStorageValue(cid, storage) > os.time() then doPlayerSendCancel(cid, "Wait "..getPlayerStorageValue(cid, storage) - os.time().." second(s) to pass here again.") doTeleportThing(cid, fromPosition) else local message = getCreatureName(cid).." esta invadindo o castelo." if getPlayerGuildId(cid) > 0 then message = getCreatureName(cid)..", da guild "..getPlayerGuildName(cid)..", esta invadindo o castelo." end for _, pid in pairs(getPlayersOnline()) do if pid ~= cid then doPlayerSendTextMessage(pid, 27, message) end end setPlayerStorageValue(cid, storage, os.time() + time) end return true end
-
zipter98's post in (Resolvido)Quest was marked as the answerlocal config = { storage = 9721, time = 5, --Tempo para fazer a quest, em minutos. interval = 15, --Tempo para poder usar a alavanca novamente, em minutos. timerPos = {x = x, y = y, z = z}, --Posição onde o tempo restante aparecerá. monster = { name = "monster_name", --Nome do monstro. pos = { {x = x, y = y, z = z}, --Posições onde ele vai nascer. {x = x, y = y, z = z}, {x = x, y = y, z = z}, --etc }, }, player = { {{x = x, y = y, z = z}, {x = x, y = y, z = z}}, --{{posição onde o player deve ficar}, {para onde será teleportado}}, {{x = x, y = y, z = z}, {x = x, y = y, z = z}}, {{x = x, y = y, z = z}, {x = x, y = y, z = z}}, --etc }, area = {{x = x, y = y, z = z}, {x = x, y = y, z = z}}, --{{posição superior esquerda da área}, {posição inferior direita da área}}, } local cidPos = {} function clearArea() for x = config.area[1].x, config.area[2].x do for y = config.area[1].y, config.area[2].y do local pos = {x = x, y = y, z = config.area[1].z} local pid = getTopCreature(pos).uid if pid > 0 then if isPlayer(pid) then doTeleportThing(pid, config.player[cidPos[pid]][1] or getTownTemplePosition(getPlayerTown(pid))) doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_RED, "You didn't get to the reward room in time.") else doRemoveCreature(pid) end end end end setGlobalStorageValue(config.storage, os.time() + config.interval * 60) end function checkPlayer() for x = config.area[1].x, config.area[2].x do for y = config.area[1].y, config.area[2].y do local pos = {x = x, y = y, z = config.area[1].z} local pid = getTopCreature(pos).uid if isPlayer(pid) then return true end end end return false end function convert(time) return {minutes = math.floor(time / 60), seconds = time - math.floor(time / 60) * 60} end function timer(time) if time < 0 or not checkPlayer() then return true end doSendAnimatedText(config.timerPos, convert(time).minutes..":"..convert(time).seconds, 215) addEvent(timer, 1000, time - 1) end function onUse(cid) if getGlobalStorageValue(config.storage) > os.time() then return doPlayerSendCancel(cid, "Wait "..convert(getGlobalStorageValue(config.storage) - os.time()).minutes.."min and "..convert(getGlobalStorageValue(config.storage) - os.time()).seconds.."secs.") elseif checkPlayer() then return doPlayerSendCancel(cid, "There's player(s) doing the quest right now.") end local p = {} for _, pos in pairs(config.player) do local pid = getTopCreature(pos[1]).uid if isPlayer(pid) then p[#p + 1] = pid cidPos[pid] = _ end end if #p < #config.player then return doPlayerSendCancel(cid, "There's some player(s) missing.") end for i = 1, #p do doTeleportThing(p[i], config.player[cidPos[p[i]]][2]) doPlayerSendTextMessage(p[i], 27, "Good luck!") end for _, pos in pairs(config.monster.pos) do doCreateMonster(config.monster.name, pos) end timer(config.time) addEvent(function() clearArea() end, config.time * 60 * 1000) return true end
-
zipter98's post in (Resolvido)Mensagem automatica uma dps da outra was marked as the answer1º pedido:
-- [( Script created by Matheus for TibiaKing.com )] -- local MENSAGEM = { "FRASE 1", "FRASE 2", "FRASE 3", "FRASE 4", "FRASE 5", } local t = 0 function onThink(interval, lastExecution) if not MENSAGEM[t] then t = 1 end doBroadcastMessage(MENSAGEM[t], 22) t = t + 1 return true end -
zipter98's post in (Resolvido)[PEDIDO] Sistema de colheita was marked as the answerlocal cfg = { soul = 0, time = 3600, level = 1 } local t = { [{11419}] = {fruit = 2675, NFTree = 4008, fName = "Orange"}, [{5094}] = {fruit = 2676, NFTree = 5092, fName = "Banana"}, [{5096}] = {fruit = 2678, NFTree = 2726, fName = "Coconut"}, [{5157}] = {fruit = 5097, NFTree = 5156, fName = "Mango"} } function onUse(cid, item, frompos, item2, topos) local S = getPlayerSoul(cid) local L = getPlayerLevel(cid) for i, k in pairs(t) do if (isInArray(i, item.itemid) == true) and (S >= cfg.soul) and (L >= cfg.level) then local info = {fromId = k.NFTree, toId = item.itemid, pos = topos} addEvent(function() local i = getTileItemById(info.pos, info.fromId).uid if i > 0 then doTransformItem(i, info.toId) end end, cfg.time * 1000) doTransformItem(item.uid, k.NFTree) doPlayerAddItem(cid, k.fruit, math.random(1, 10)) doPlayerAddSoul(cid, -cfg.soul) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some "..k.fName..".") elseif (S < cfg.soul) then doPlayerSendCancel(cid, "You do not have soul to harvest the plant.") elseif (L < cfg.level) then doPLayerSendCancel(cid, "You are not in the requiered level to harvest.") end end return true end
-
zipter98's post in (Resolvido)Adicionando Wild Na Frente? was marked as the answerTroque o código da função ShinyName por este:
local function ShinyName(cid) if isCreature(cid) then local newName = "Wild "..getCreatureName(cid) if string.find(tostring(getCreatureName(cid)), "Shiny") then newName = newName:gsub("Shiny ", "") end doCreatureSetNick(cid, newName) if isMonster(cid) then doSetCreatureDropLoot(cid, false) end end end -
zipter98's post in (Resolvido)Remover pedra, alavanca+iten was marked as the answerlocal config = { wall = { time = 5, --Tempo, em minutos, para a parede reaparecer. id = xxx, --ID da wall. pos = {x = x, y = y, z = z}, --Posição da wall. }, items = { {{x = x, y = y, z = z}, itemid}, --{{posição que o item deve estar}, itemid}, {{x = x, y = y, z = z}, itemid}, {{x = x, y = y, z = z}, itemid}, {{x = x, y = y, z = z}, itemid}, {{x = x, y = y, z = z}, itemid}, }, } function onUse(cid) local wall = getTileItemById(config.wall.pos, config.wall.id).uid if wall < 1 then return doPlayerSendCancel(cid, "The wall is already openned.") end for _, item in pairs(config.items) do if getTileItemById(item[1], item[2]).uid < 1 then return doPlayerSendCancel(cid, "One or more items are missing or aren't in the correct position.") end end doRemoveItem(wall) addEvent(function() doCreateItem(config.wall.id, 1, config.wall.pos) end, config.wall.time * 60 * 1000) return true end
-
zipter98's post in (Resolvido)Anunciar quando nascer o monstro ! was marked as the answerlocal shinys = { "Venusaur", "Charizard", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Zubat", "Golbat", "Paras", "Parasect", "Venonat", "Venomoth", "Growlithe", "Arcanine", "Abra", "Alakazam", "Tentacool", "Tentacruel", "Farfetch'd", "Grimer", "Muk", "Gengar", "Onix", "Krabby", "Kingler", "Voltorb", "Electrode", "Cubone", "Marowak", "Hitmonlee", "Hitmonchan", "Tangela", "Horsea", "Seadra", "Scyther", "Jynx", "Electabuzz", "Pinsir", "Magikarp", "Gyarados", "Snorlax", "Dragonair", "Dratini"} local raros = {"Dragonite"} local mName = "name" --Nome do monstro que será anunciado ao nascer. local function ShinyName(cid) if isCreature(cid) then if string.find(tostring(getCreatureName(cid)), "Shiny") then local newName = tostring(getCreatureName(cid)):match("Shiny (.*)") doCreatureSetNick(cid, newName) if isMonster(cid) then doSetCreatureDropLoot(cid, false) end end end end local function doSetRandomGender(cid) if not isCreature(cid) then return true end if isSummon(cid) then return true end local gender = 0 local name = getCreatureName(cid) if not newpokedex[name] then return true end local rate = newpokedex[name].gender if rate == 0 then gender = 3 elseif rate == 1000 then gender = 4 elseif rate == -1 then gender = 0 elseif math.random(1, 1000) <= rate then gender = 4 else gender = 3 end doCreatureSetSkullType(cid, gender) end local function doShiny(cid) if isCreature(cid) then if isSummon(cid) then return true end if getPlayerStorageValue(cid, 74469) >= 1 then return true end if getPlayerStorageValue(cid, 22546) >= 1 then return true end if isNpcSummon(cid) then return true end if getPlayerStorageValue(cid, 637500) >= 1 then return true end --alterado v1.9 if isInArray(shinys, getCreatureName(cid)) then --alterado v1.9 \/ chance = 6 --1% chance elseif isInArray(raros, getCreatureName(cid)) then --n coloquem valores menores que 0.1 !! chance = 6 --1% chance else return true end if math.random(1, 1000) <= chance*10 then doSendMagicEffect(getThingPos(cid), 18) local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid) doRemoveCreature(cid) local shi = doCreateMonster(name, pos, false) setPlayerStorageValue(shi, 74469, 1) else setPlayerStorageValue(cid, 74469, 1) end --/\ else return true end end function onSpawn(cid) registerCreatureEvent(cid, "Experience") registerCreatureEvent(cid, "GeneralConfiguration") registerCreatureEvent(cid, "DirectionSystem") registerCreatureEvent(cid, "CastSystem") if isSummon(cid) then registerCreatureEvent(cid, "SummonDeath") return true end if getCreatureName(cid) == mName then broadcastMessage(mName.." spawned!") end addEvent(doSetRandomGender, 5, cid) addEvent(doShiny, 10, cid) addEvent(ShinyName, 15, cid) addEvent(adjustWildPoke, 5, cid) return true end