
Tudo que Wise postou
-
Colocar doCreatureSay a cada transformação!
Substitua a tabela por esta: local config = { --[vocation id] = { {lvl inicial, lvl maximo}, looktype, efeito, msg ao transformar} [1] = { --Naruto {lvl = {25, 49}, look = 66, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {50, 74}, look = 91, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {75, 99}, look = 18, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {100, 124}, look = 31, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {125, 149}, look = 92, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {150, 174}, look = 40, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {175, 199}, look = 49, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {200, 224}, look = 25, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {225, 249}, look = 179, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {250, 274}, look = 31, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {275, 299}, look = 291, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {300, 324}, look = 302, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {325, 374}, look = 54, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {375, 399}, look = 743, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {400, 449}, look = 1000, eff = 208, msg = 'Transformei carai sou foda'}, {lvl = {450, 499}, look = 1001, eff = 208, msg = 'Transformei carai sou foda'}, }, } E após: doSendMagicEffect(getCreaturePosition(cid), voc[i].eff) Adicione: doCreatureSay(cid, voc[i].msg, TALKTYPE_ORANGE_1)
-
modificar esse script de bless
blessed300.lua (data\creaturescripts\scripts): function onPrepareDeath(cid) local level, perc = 300, 20 for b = 1, 5 do if isPlayer(cid) and getPlayerBlessing(cid, b) and getPlayerLevel(cid) >= level then doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, perc) end end return true end creaturescripts.xml (data\creaturescripts): <event type="preparedeath" name="Blessed300" event="script" value="blessed300.lua"/> Registre o creature event em login.lua (data\creaturescripts\scripts): registerCreatureEvent(cid, "Blessed300")
-
Procurar players por letra (!searchplayers)
@Global Atualizei o código, só pra constar @Vodkart Bem simplesinho..hehe obrigado, brother! @elton123 Não, você não soube interpretar o código. Olha, brother: if n:sub(1, 1):lower() == param:lower() then -- aqui eu checo se o primeiro caractere da string da tabela pnames, que está sendo rodada no for, é igual a string do parâmetro determinado pelo cid (comparar as duas strings em minúsculo é uma forma de simplificar a checagem) if list ~= '' then -- verifico se há caracteres na string list = list..', '..n -- caso haja, a string atual será adicionada junto ao valor já existente em list, vindo após uma vírgula (formato de listagem) else list = n -- caso não haja, list receberá o valor da string atual end Por isso, não há necessidade de usar table.sort Abç!
- Procurar players por letra (!searchplayers)
-
Seu gostooso
Nossa, só agora que eu vi isso aqui '~' Tava ausente pq tinha que fazer meu nick ter sentido aí eu me suicidei minino lobo
-
Procurar players por letra (!searchplayers)
Como o título do tópico já diz, o script a seguir serve como uma ferramenta para auxiliar o player a fazer uma busca por outro player. A partir de uma letra, é gerada uma lista dos players online cujo o nome começa com a inicial escolhida. searchplayers.lua (data\talkactions\scripts): function onSay(cid, words, param) -- Developed by Wise ~ TibiaKing.com local pnames, list = {}, '' for _, pid in ipairs(getPlayersOnline()) do table.insert(pnames, getCreatureName(pid)) end if not tostring(param) or param:len() > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Type the first letter of the name of online players you want to view on the list.\nEx: !searchplayers K') end for _, n in pairs(pnames) do if n:sub(1, 1):lower() == param:lower() then if list ~= '' then list = list..', '..n else list = n end end end return list ~= '' and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Players whose first name begins with '..param..': '..list) or doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'There are no players whose first name begins with '..param) end talkactions.xml (data\talkactions): <talkaction words="!searchplayers" event="script" value="searchplayers.lua"/> Uso da talkaction: !searchplayers letra ~ !searchplayers k > Players whose first name begins with k: Kharsek, Krohm, Kawaka Espero que gostem (;
-
forceSetStorageValue(name, key, value)
Serei breve enquanto a explicação. Esta função serve para "forçar" o value de uma storage key a mudar, independentemente do player estar on ou offline. Adicione o seguinte script à lib do seu servidor (data\lib): forceSetStorageValue = function (name, key, value) if not tostring(name) or not tonumber(key) then return nil end local p = getPlayerByName(name) if p then setPlayerStorageValue(p, key, value) else local have = db.storeQuery("SELECT `key` FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." and `key` = ".. key) if have then db.query("UPDATE `player_storage` SET `value` = '".. value .."' WHERE `player_id` = '".. getPlayerGUIDByName(name) .."' AND `key` = ".. key) else db.query("INSERT INTO `player_storage` (`player_id` ,`key` ,`value`) VALUES ('".. getPlayerGUIDByName(name) .."', '".. key .."', '".. value .."');") end end return true end A seguir, preparei uma talkaction para o uso da função. fstorage.lua (data\talkactions\scripts): function onSay(cid, words, param) local w = string.explode(param, ",") if param == '' then return doPlayerSendCancel(cid, 'Enter the player name, the storage key and the storage value (number or string). Ex: /forcestorage Player, 1234, 5') elseif not tostring(w[1]) or not tonumber(w[2]) or not w[3] or w[4] then return doPlayerSendCancel(cid, 'Invalid parameter specified.') end forceSetStorageValue(w[1], w[2], w[3]) return true end talkactions.xml (data\talkactions): <talkaction log="yes" words="/forcestorage" access="5" event="script" value="fstorage.lua"/> (o formato da tag varia de acordo com a versão do servidor utilizado) Uso da talkaction: /forcestorage Player, key, value ~ /forcestorage Wise, 1234, 5 Enfim, na minha mente ela me parece bem eficaz. Espero que gostem.
-
Ajuda com Script Galera
Ah, ok. Apenas altere o callback do script por este: function onKill(cid, target) E a tag, por esta: <event type="kill" name="teamattack" event="script" value="teamattack.lua"/>
- [Ajuda] Bless
-
[Ajuda] Bless
blessedplayer.lua (data\creaturescripts\scripts): function onDeath(cid) for b = 1, 5 do if isPlayer(cid) and getPlayerBlessing(cid, b) and getCreatureSkullType(cid) < 4 then doCreatureSetDropLoot(cid, false) end end return true end creaturescripts.xml (data\creaturescripts): <event type="death" name="BlessedPlayer" event="script" value="blessedplayer.lua"/> Registre o creature event em login.lua (data\creaturescripts\scripts): registerCreatureEvent(cid, "BlessedPlayer")
- problema com as potions mastermind potion, berserk potion e bullseye potion
-
help comando em talkactions!
(: function onSay(cid, words, param) local femaleOutfits = { ["citizen"]={136}, ["hunter"]={137}, ["mage"]={138}, ["knight"]={139}, ["noblewoman"]={140}, ["summoner"]={141}, ["warrior"]={142}, ["barbarian"]={147}, ["druid"]={148}, ["wizard"]={149}, ["oriental"]={150}, ["pirate"]={155}, ["assassin"]={156}, ["beggar"]={157}, ["shaman"]={158}, ["norsewoman"]={252}, ["nightmare"]={269}, ["jester"]={270}, ["brotherhood"]={279}, ["demonhunter"]={288}, ["yalaharian"]={324}, ["warmaster"]={336} } local maleOutfits = { ["citizen"]={128}, ["hunter"]={129}, ["mage"]={130}, ["knight"]={131}, ["nobleman"]={132},["summoner"]={133}, ["warrior"]={134}, ["barbarian"]={143}, ["druid"]={144}, ["wizard"]={145}, ["oriental"]={146}, ["pirate"]={151}, ["assassin"]={152}, ["beggar"]={153}, ["shaman"]={154}, ["norsewoman"]={251}, ["nightmare"]={268}, ["jester"]={273}, ["brotherhood"]={278}, ["demonhunter"]={289}, ["yalaharian"]={325}, ["warmaster"]={335}, ["wayfarer"]={366} } local msg = {"Command requires GOOD param!", "You dont have Addon Doll!", "Bad param!", "Full Addon Set sucesfully added!"} local x = string.explode(param, " ") if getPlayerItemCount(cid, 9693) > 0 then if param ~= "" then if maleOutfits[x[2]:lower()] and femaleOutfits[x[2]:lower()] then if (x[1] == 'first' or x[1] == 'second') then doPlayerRemoveItem(cid, 9693, 1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[4]) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) if getPlayerSex(cid) == 0 then doPlayerAddOutfit(cid, femaleOutfits[x[2]:lower()][1], x[1] == 'first' and 1 or 2) else doPlayerAddOutfit(cid, maleOutfits[x[2]:lower()][1], x[1] == 'first' and 1 or 2) end else doPlayerSendTextMessage(cid, 27, msg[3]) end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[3]) end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[1]) end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[2]) end return true end
-
(Resolvido)[PEDIDO] Redbull
Substitua o conteúdo da linha 23 por: addEvent(function() if isCreature(cid) then doChangeSpeed(cid, speed) end end, speedCfg[2]*1000)
-
Evento do Bolo
Primeiramente, você já tem as sprites do bolo em mãos? E o que ocorre quando um pedaço é comido? Ele se transforma em um outro menor ou simplesmente desaparece? Informe como ocorre esse processo de gordo.
-
Ajuda com Script Galera
Então no caso, a tag seria: <event type="attack" name="teamattack" event="script" value="teamattack.lua"/>
-
Ajuda com Script Galera
Tenta aí: function onAttack(cid, target) local n = {'[Alliance]', '[Horda]'} if not isPlayer(target) then return true end if getCreatureName(cid):find(n[1]) or getCreatureName(cid):find(n[2]) then if getCreatureName(cid):find(n[1]) and getCreatureName(target):find(n[1]) or getCreatureName(cid):find(n[2]) and getCreatureName(target):find(n[2]) then doCreatureSetSkullType(cid, SKULL_RED) else doCreatureSetSkullType(cid, SKULL_NONE) end end return true end Não se esqueça de registrar o creature event em login.lua e de adicionar a tag do mesmo (data\creaturescripts).
-
(Resolvido)Monsters que Empurra
Ô caralho..fiz tão rápido que nem notei. Enfim, na verdade seria: <script> <event name="MonsterPusher"/> </script>
-
(Resolvido)Monsters que Empurra
Me interessei pelo seu pedido, fiz aqui rapidinho.. monsterpusher.lua (data\creaturescripts\scripts): function doPush(uid) if not isCreature(uid) then return false end local pos = getCreaturePosition(uid) local pushp = { [0] = {x = pos.x, y = pos.y + 1, z = pos.z, stackpos = 0}, [1] = {x = pos.x - 1, y = pos.y, z = pos.z, stackpos = 0}, [2] = {x = pos.x, y = pos.y - 1, z = pos.z, stackpos = 0}, [3] = {x = pos.x + 1, y = pos.y, z = pos.z, stackpos = 0}, [4] = {x = pos.x + 1, y = pos.y - 1, z = pos.z, stackpos = 0}, [5] = {x = pos.x - 1, y = pos.y - 1, z = pos.z, stackpos = 0}, [6] = {x = pos.x + 1, y = pos.y + 1, z = pos.z, stackpos = 0}, [7] = {x = pos.x - 1, y = pos.y - 1, z = pos.z, stackpos = 0} } local rn = math.random(0, 7) if getTopCreature(pushp[rn]).uid > 0 or getTileThingByPos(pushp[rn]).itemid == 0 then return doPush(uid) else doTeleportThing(uid, pushp[rn], true) end return true end function onAttack(cid, target) doPush(target) doMonsterChangeTarget(cid) return true end creaturescripts.xml (data\creaturescripts): <event type="attack" name="MonsterPusher" script="monsterpusher.lua"/> Registre o creature event adicionando a seguinte tag ao arquivo XML do monstro desejado: <script> <event name="MonsterPusher"/> </script>
-
[PEDIDO]Sistema para PokeTibia
O tópico foi movido para a área correta, preste mais atenção da próxima vez! Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680 Este tópico foi movido: De: "OTServ → Suporte OTServ → Suporte de Scripts" Para: "OTServ → Suporte OTServ → Suporte de Servidores Derivados"
-
Capturar pokequest
O tópico foi movido para a área correta, preste mais atenção da próxima vez! Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680 Este tópico foi movido: De: "OTServ → Suporte OTServ → Suporte de Scripts" Para: "OTServ → Suporte OTServ → Suporte de Servidores Derivados"
-
[PEDIDO] Scriptes tipo da PxG
O tópico foi movido para a área correta, preste mais atenção da próxima vez! Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680 Este tópico foi movido: De: "OTServ → Scripting → Geral" Para: "OTServ → Suporte OTServ → Suporte de Servidores Derivados"
-
Função para arredondar...
Que eu me lembre, nem cheguei a mostrar os meus códigos, como pôde concluir que só fiz arredondando pra cima? Terminei-a, caso queira ver como ficou: math.round(n) Fiz apenas para resultar no arredondamento de inteiros não-negativos e não-nulos, ao meu ver, há mais utilidade desse modo. PS: as funções que o Garou propôs são muito mais úteis em Lua no geral, eu fiz para se adequar ao Open Tibia mesmo.
- Nolis Show Off
- math.round(n)
-
math.round(n)
Pensei em fazer esta função há um tempo. Alguns membros, que também programam, tentaram desenvolve-la quando comentei sobre ela em um grupo do skype. math.round reconhece, automaticamente, se o número é um inteiro ou decimal e o arredonda para cima ou para baixo, seguindo a condição >= ou < do que 5, respectivamente. Eu preferi fazer para que o arredondamento sempre resulte em um inteiro não-negativo e não-nulo. Ao meu ver, a função tem mais utilidade desse modo e, já que o resultado de n segue essa regra, não é possível utilizar números negativos ou nulos. Se utilizados, nil é retornado. Sem mais delongas, adicione a qualquer arquivo com extensão Lua da library do seu servidor (data\lib): math.round = function (n) -- Developed by Wise ~ TibiaKing.com if not tonumber(n) or n < 1 then return nil end n = tostring(n) local d = string.format('%.1f', n) if n:find('%.') then n = tonumber(string.explode(d, '.')[2]) > 4 and math.round(math.ceil(tonumber(d))) or math.round(math.floor(tonumber(d))) else local r = tonumber(n:sub(n:len())) n = tonumber(n) n = n > 10 and (r > 4 and n + (10 - r) or n - r) or (n > 4 and 10 or 1) end return n end Mas, quando e como ela seria útil? t = {10, 30, 50, 70, 90} if isInArray(t, math.round(getPlayerStorageValue(cid, storage))) then block end Por exemplo, temos uma tabela com n elementos. Os n elementos são números inteiros não-negativos e não-nulos, e um creatureid recebe values em quantidades decimais ou simplesmente aleatórios, dos quais serão arredondados pela função, formando um value "final". Se esse value estiver incluso na tabela, então executará um bloco..etc. Há inúmeras possibilidades, use a sua criatividade..mentalize. Saiba também que, para executar a função de arredondamento, é necessário ter a função string.explode: string.explode = function (str, separator) local ret = {} str = tostring(str) .. separator local sep for a = 1, #str do if not sep then sep = a end for b = a, #str do if a ~= 1 and str:sub(a, b) == separator then table.insert(ret, str:sub(sep, b - 1)) sep = nil end end end return ret end No caso, essa função acima não é a própria para o Open Tibia, portanto, pode ser utilizada em qualquer ambiente que tenha Lua como linguagem. Abraços.