Ir para conteúdo
  • Cadastre-se

Snowsz

Héroi
  • Total de itens

    1213
  • Registro em

  • Última visita

  • Dias Ganhos

    8

Histórico de Curtidas

  1. Gostei
    Snowsz recebeu reputação de Scorpiondaniel em (Resolvido)[Pedido] Dar dano em determinaria área   
    local areas = { {leftUpPoint = {x = 1, y = 2, z = 3}, rightDownPoint = {x = 6, y = 7, z = 8}, minHit = 100, maxHit = 500, effect = 30}, } function onThink(interval, lastExecution, thinkInterval) for id, arr in pairs(areas) do for x = arr.leftUpPoint.x, arr.rightDownPoint.x do for y = arr.leftUpPoint.y, arr.rightDownPoint.y do for z = arr.leftUpPoint.z, arr.rightDownPoint.z do local pos = {x = x, y = y, z = z} local uid = getTopCreature(pos).uid doSendMagicEffect(pos, arr.effect) if isCreature(uid) then local random = math.random(arr.minHit, arr.maxHit) doCreatureAddHealth(uid, -random) doSendAnimatedText(pos,"-"..random, 180) end end end end end return true end
  2. Gostei
    Snowsz recebeu reputação de Scorpiondaniel em (Resolvido)[Pedido] Dar dano em determinaria área   
    Tenta isso, crie um arquivo em data/globalevents/scripts com o nome de areahit.lua e ponha isso dentro:
     
    local areas = { {leftUpPoint = {x = 1, y = 2, z = 3}, rightDownPoint = {x = 6, y = 7, z = 8}, minHit = 100, maxHit = 500, effect = 30}, } function onThink(interval, lastExecution, thinkInterval) for id, arr in pairs(areas) do for x = arr.leftUpPoint.x, arr.rightDownPoint.x do for y = arr.leftUpPoint.y, arr.rightDownPoint.y do for z = arr.leftUpPoint.z, arr.rightDownPoint.z do local pos = {x = x, y = y, z = z} local uid = getTopCreature(pos).uid doSendMagicEffect(pos, arr.effect) if isCreature(uid) then doCreatureAddHealth(uid, -(math.random(arr.minHit, arr.maxHit))) end end end end end return true end Em globalevents.xml adicione isso:
     
    <globalevent name="think" interval="30000" event="script" value="areahit.lua"/> Modifique o intervalo a seu gosto.
     
     
    Configuração do script:
    Modifique primeiro essa linha:
     
    {leftUpPoint = {x = 1, y = 2, z = 3}, rightDownPoint = {x = 6, y = 7, z = 8}, minHit = 100, maxHit = 500, effect = 30}, • leftUpPoint coloque as coordenadas do ponto superior esquerdo da área que você quer que de os danos.
    • rightDownPoint coloque as posições do canto inferior direito.
    • minHit coloque o dano mínimo.
    • maxHit coloque o dano máximo.
    • effect coloque o id do efeito que você quer.
     
     
    Após isso, é só copiar essa linha inteira e ir colocando e configurando mais áreas a seu gosto, exemplo:
     
    local areas = { {leftUpPoint = {x = 1, y = 2, z = 3}, rightDownPoint = {x = 6, y = 7, z = 8}, minHit = 100, maxHit = 500, effect = 30}, {leftUpPoint = {x = 178978, y = 213, z = 5}, rightDownPoint = {x = 612321312, y = 789890, z = 8}, minHit = 17800, maxHit = 4569000, effect = 20}, {leftUpPoint = {x = 567856, y = 123123, z = 6}, rightDownPoint = {x = 6567778, y = 7798, z = 10}, minHit = 19500, maxHit = 7890000, effect = 4}, }
  3. Gostei
    Snowsz recebeu reputação de Standard em Creature Information Offset   
    Faz tempo que não posto nada, então deu vontade, tava brincando um pouco ai fiz esse sisteminha básico.
     
    • Gifs
     
    Nesse primeiro Gif, ao trocar a direção da Outfit, o nome e as barras de informações como Health, Mana, mudam de posição, isso é bom para ajustar as Outfits de acordo com o seu tamanho, como o Demon, ficar com as informações logo em cima da cabeça, ou Hydra, todos estão com o local padrão.

     
    Aqui era como as informações ficavam com essa Outfit originalmente, no padrão de sempre dos clients.

     
     
    Comparativo em imagem estática:
     
    Tibia Outfit antes e depois:

     
    Aqui estão algumas outfits que meu primo @Fae1z fez, apliquei o sistema de offset nelas, uma do Graves, uma do Ekko, ambos são personagens do game League of Legends, e uma baseada Uganda Knuckle:
     
    Ekko antes:

     
    Ekko depois:

     
    Graves antes e depois:

     
    Uganda Knuckle antes e depois:

     
    Aqui eu estava brincando de por as informações da Outfit de anão de modo drogado kkk.

     
     
    • Código
     
    Em Creature.h modifique nesta linha:
    void Creature::drawInformation(const Point& point, bool useGray, const Rect& parentRect, int drawFlags) Mude "const Point& point" para "Point& point".
    Ficando:
    void Creature::drawInformation(Point& point, bool useGray, const Rect& parentRect, int drawFlags)  
    Embaixo de:
     
    std::string getName() { return m_name; } Adicione:
     
    Point getInformationOffset() { return m_informationOffset; } void setInformationOffset(int x, int y) { m_informationOffset.x = x; m_informationOffset.y = y; }  
    Embaixo de:
    Position m_oldPosition; Adicione:
     
    Point m_informationOffset;  
     
    Agora, em Creature.cpp procure por:
    void Creature::drawInformation(const Point& point, bool useGray, const Rect& parentRect, int drawFlags) Mude "const Point& point" para "Point& point".
    Ficando:
    void Creature::drawInformation(Point& point, bool useGray, const Rect& parentRect, int drawFlags) Sim, isso está repetido, é assim mesmo, o processo é necessário em Creature.h e Creature.cpp, nessa função a variável point tem seu tipo alterado de Const para normal.
     
    Ainda em Creature.cpp procure por:
    if(!useGray) fillColor = m_informationColor; Pule duas linhas e adicione:
    point.x += m_informationOffset.x; point.y += m_informationOffset.y;  
    Agora, em Luafunctions.cpp procure por:
    g_lua.bindClassMemberFunction<Creature>("jump", &Creature::jump); Embaixo adicione:
    g_lua.bindClassMemberFunction<Creature>("setInformationOffset", &Creature::setInformationOffset); g_lua.bindClassMemberFunction<Creature>("getInformationOffset", &Creature::getInformationOffset);  
    A parte da source é só isso.
     
    Foi criada uma variável do tipo Point na classe Creature, que pode armazenar dois valores do tipo Int, sendo eles X & Y, assim detendo uma posição de offset, para ajustar a posição das informações(Health Bar, Mana Bar e Name) da criatura, essa variável é usada na função Creature::drawInformation, onde ocorre todo o desenho de informações das criaturas, lá o offset criado altera a posição de um Point usado como posição base das informações, alterando esse Point todo o resto segue aquela posição,  você pode setar o offset diretamente na criatura, as funções podem ser usadas tanto na source usando C++ quanto nos scripts usando Lua, em Lua o uso das funções é o seguinte:
     
    Essa função retorna uma tabela com X & Y, algo como "table = {x = 10, y = 20}", são as posições do offset.
    Creature:getInformationOffset() Exemplo de uso:
     
    local Offset = Creature:getInformationOffset() print(Offset.x) print(Offset.y) Isso vai printar no client_terminal do OTClient os valores de X & Y.
     
    Enquanto esta altera as posições usando os valores X & Y.
    Creature:setInformationOffset(x, y) Exemplo:
    Creature:setInformationOffset(10, -5)  
    Essa configuração de offset vai aumentar X em 10 Pixels e diminuir Y em 5 Pixels, no meu primeiro gif, na direção Sul do Char, eu usei X diminuindo 13 Pixels e Y diminuindo 8 Pixels, algo como isso:
    Creature:setInformationOffset(-13, -8)  
     
    Para tudo isso funcionar igual os gifs acima eu fiz um módulo especial, onde dependendo da Outfit e da direção que a criatura está olhando, ele vai alterar o offset de acordo.
     
    Para criar o módulo, siga estes passos:
     
    Na pasta do OTClient em modules/ crie uma pasta chamada game_creatureinformation, dentro crie um arquivo com o mesmo nome e a extensão .otmod, algo como "game_creatureinformation.otmod", o conteúdo do arquivo é este:
    Module name: game_creatureinformation description: Changes the position of the informations point to correctly draw names and creature bars. author: Snowsz website: tibiaking.com autoload: true reloadable: true sandboxed: true version: 1.0 scripts: [ game_creatureinformation ] @onLoad: init() @onUnload: terminate()  
    Crie um arquivo com o mesmo nome e a extensão .lua, algo como "game_creatureinformation.lua", o conteúdo do arquivo é este:
    --[[ Directions: North /\ East > South \/ West < Structure: [OutfitID] = { [Direction] = {x = OFFSETX, y = OFFSETY}, } ]] --Lista de offsets para cada Outfit. local OutfitOffsets = { [143] = { --Outfit do primeiro gif [North] = {x = -13, y = -8}, [East] = {x = -17, y = -8}, [South] = {x = -13, y = -8}, [West] = {x = -15, y = -8}, }, [160] = { --Outfit de anão com o nome full drogado. [North] = {x = 0, y = 0}, [East] = {x = 0, y = 0}, [South] = {x = -13, y = -80}, [West] = {x = 0, y = 0}, } } local function translateDir(dir) if dir == NorthEast or dir == SouthEast then return East elseif dir == NorthWest or dir == SouthWest then return West end return dir end local function getOutfitInformationOffset(outfit, dir) if OutfitOffsets[outfit] then return OutfitOffsets[outfit][translateDir(dir)] end return {x = 0, y = 0} end local function onCreatureAppear(creature) local Offset = getOutfitInformationOffset(creature:getOutfit().type, creature:getDirection()) creature:setInformationOffset(Offset.x, Offset.y) end local function onCreatureDirectionChange(creature, oldDirection, newDirection) local Offset = getOutfitInformationOffset(creature:getOutfit().type, newDirection) creature:setInformationOffset(Offset.x, Offset.y) end local function onCreatureOutfitChange(creature, newOutfit, oldOutfit) local Offset = getOutfitInformationOffset(newOutfit.type, creature:getDirection()) creature:setInformationOffset(Offset.x, Offset.y) end function init() connect(LocalPlayer, {onOutfitChange = onCreatureOutfitChange}) connect(Creature, { onAppear = onCreatureAppear, onDirectionChange = onCreatureDirectionChange, onOutfitChange = onCreatureOutfitChange }) end function terminate() disconnect(LocalPlayer, {onOutfitChange = onCreatureOutfitChange}) disconnect(Creature, { onAppear = onCreatureAppear, onDirectionChange = onCreatureDirectionChange, onOutfitChange = onCreatureOutfitChange }) end  
    A parte do módulo está finalizada, o que resta agora é configurar as Outfits na tabela com seus determinados Offsets, e não se preocupe, se a outfit não estiver configurada, ela vai seguir o padrão normal, o módulo só altera algo quando determinada Outfit está configurada.
     
    Para configurar o módulo é simples, basta seguir o padrão:
    [ID DA OUTFIT AQUI] = { [North] = {x = 0, y = 0}, [East] = {x = 0, y = 0}, [South] = {x = 0, y = 0}, [West] = {x = -0, y = 0}, }, Nos primeiros colchetes coloque o ID da sua Outfit para ter o offset modificado, os colchetes restantes são as direções, não é necessário mexer neles, dentro de cada índice da tabela tem os offsets X & Y, basta modificar o valor de acordo, sendo ele positivo ou negativo. NÃO SE ESQUEÇA DA VÍRGULA NO FINAL "},".
  4. Obrigado
    Snowsz recebeu reputação de Cat em [OTC] MOD que deixa o OTC exclusivo para seu servidor.   
    Testado em:
    TFS 0.4 8.60.
    Otclient 0.6.3.
     
    Descrição: O player só poderá entrar no seu otserver com este mod, caso contrário, levará um kick bonito
     
    Bom galera, criei este mod para ajudar um membro do fórum que, quer que seu server só seja acessado com um otclient dele, então, vamos ao mod.

    Vá na pasta do seu otclient e entre na pasta mods, lá, crie outra pasta, chamada exclusiveclient, nesta pasta, crie um arquivo com o nome exclusiveclient.lua e coloque isso dentro:
    function init() connect(g_game, 'onTextMessage', serverComunication) connect(g_game, { onGameEnd = hide } ) end function terminate() disconnect(g_game, { onGameEnd = hide }) disconnect(g_game, 'onTextMessage', serverComunication) end function serverComunication(mode, text) if not g_game.isOnline() then return end if mode == MessageModes.Failure then if text:find("$@$ExclusiveClient") then g_game.talk("/$@$exclusive$@$") end end end Feche e salve o arquivo.
    Ainda na mesma pasta, crie um novo arquivo chamado, exclusiveclient.otmod (lembrem-se da extensão sempre, exemplo: login>.lua<)
    No exclusiveclient.otmod coloque isto dentro:
    Module name: Exclusive Client description: author: Snowsz website: autoload: true autoload-priority: 1000 scripts: - exclusiveclient.lua @onLoad: init() @onUnload: terminate() Após isso, feche e salve o arquivo, não é só isso, agora iremos mexer no seu servidor, vá na pasta data/creaturescripts/scripts e abra o login.lua, coloque isso antes do ultimo return true.
    addEvent(doPlayerSendCancel, 100, cid, "$@$ExclusiveClient$@$") addEvent(doPlayerSendCancel, 200, cid, " ") addEvent(function() if getPlayerStorageValue(cid, "exclusive") <= 0 then doRemoveCreature(cid) end end, 500) Após isso, feche e salve o arquivo, agora, crie um novo arquivo nesta mesma pasta, chamado exclusivelogout.lua, nele coloque isto dentro:
    function onLogout(cid) setPlayerStorageValue(cid, "exclusive", -1) return true end Feche e salve o arquivo, agora, vá em data/creaturescripts/creaturescripts.xml e coloque esta tag:
    <event type="logout" name="ExlusiveLogout" event="script" value="exclusivelogout.lua"/> Após isso, vá em data/talkactions/scripts e crie um arquivo chamado exclusive.lua, coloque isso dentro:
     
    function onSay(cid, words, param) setPlayerStorageValue(cid, "exclusive", 1) return true end Feche e salve o arquivo, vá em data/talkactions/talkactions.xml e coloque esta tag:
    <talkaction log="no" access="0" words="/$@$exclusive$@$" event="script" value="exclusive.lua"/> Feche e salve o arquivo, pronto, sistema instalado, espero que gostem
     
    Créditos: Snowsz
  5. Obrigado
    Snowsz recebeu reputação de Jeff Delay em [OTC] MOD que deixa o OTC exclusivo para seu servidor.   
    Testado em:
    TFS 0.4 8.60.
    Otclient 0.6.3.
     
    Descrição: O player só poderá entrar no seu otserver com este mod, caso contrário, levará um kick bonito
     
    Bom galera, criei este mod para ajudar um membro do fórum que, quer que seu server só seja acessado com um otclient dele, então, vamos ao mod.

    Vá na pasta do seu otclient e entre na pasta mods, lá, crie outra pasta, chamada exclusiveclient, nesta pasta, crie um arquivo com o nome exclusiveclient.lua e coloque isso dentro:
    function init() connect(g_game, 'onTextMessage', serverComunication) connect(g_game, { onGameEnd = hide } ) end function terminate() disconnect(g_game, { onGameEnd = hide }) disconnect(g_game, 'onTextMessage', serverComunication) end function serverComunication(mode, text) if not g_game.isOnline() then return end if mode == MessageModes.Failure then if text:find("$@$ExclusiveClient") then g_game.talk("/$@$exclusive$@$") end end end Feche e salve o arquivo.
    Ainda na mesma pasta, crie um novo arquivo chamado, exclusiveclient.otmod (lembrem-se da extensão sempre, exemplo: login>.lua<)
    No exclusiveclient.otmod coloque isto dentro:
    Module name: Exclusive Client description: author: Snowsz website: autoload: true autoload-priority: 1000 scripts: - exclusiveclient.lua @onLoad: init() @onUnload: terminate() Após isso, feche e salve o arquivo, não é só isso, agora iremos mexer no seu servidor, vá na pasta data/creaturescripts/scripts e abra o login.lua, coloque isso antes do ultimo return true.
    addEvent(doPlayerSendCancel, 100, cid, "$@$ExclusiveClient$@$") addEvent(doPlayerSendCancel, 200, cid, " ") addEvent(function() if getPlayerStorageValue(cid, "exclusive") <= 0 then doRemoveCreature(cid) end end, 500) Após isso, feche e salve o arquivo, agora, crie um novo arquivo nesta mesma pasta, chamado exclusivelogout.lua, nele coloque isto dentro:
    function onLogout(cid) setPlayerStorageValue(cid, "exclusive", -1) return true end Feche e salve o arquivo, agora, vá em data/creaturescripts/creaturescripts.xml e coloque esta tag:
    <event type="logout" name="ExlusiveLogout" event="script" value="exclusivelogout.lua"/> Após isso, vá em data/talkactions/scripts e crie um arquivo chamado exclusive.lua, coloque isso dentro:
     
    function onSay(cid, words, param) setPlayerStorageValue(cid, "exclusive", 1) return true end Feche e salve o arquivo, vá em data/talkactions/talkactions.xml e coloque esta tag:
    <talkaction log="no" access="0" words="/$@$exclusive$@$" event="script" value="exclusive.lua"/> Feche e salve o arquivo, pronto, sistema instalado, espero que gostem
     
    Créditos: Snowsz
  6. Haha
    Snowsz deu reputação a Cjaker em Extrair arquivo .cab   
    Heyo, desenvolvi essa ferramenta com o intuito de poder extrair o .dat/.spr de um arquivo .cab protegido.
    Vale lembrar que essa ferramenta foi desenvolvida com a intenção de recuperar suas sprites em um .cab protegido e não ser usado com intuições maliciosas!
    OBS: Não dou suporte em cima de outras proteções, essa é 100% funcional em cima da proteção padrão DISPONIBILIZADA no fórum.
     
    Tutorial: baixe os dois arquivos desse tópico, jogue na mesma pasta do cliente que queira abrir, arraste o executável do cliente em cima do 'CabExtractor.exe', selecione se o cliente é Extended ou não. (o .dat e .spr vão aparecer dentro de uma pasta chamada 'extracted'. Se caso não aparecer o .dat, tente mais algumas vezes)
     
    Enjoy
     
    [Downloads]
    CabExtractor.exe
    datextractor.dll

    [Scans]
    Caso esteja com dúvidas sobre os vírus 'falso-positivo' use uma máquina virtual.
    Software: https://www.virustotal.com/gui/file/9eee27a8260abe604f34bc070368913115acf93a64f0e82dfed3a59de1484ff9/detection
    DLL: https://www.virustotal.com/gui/file/b1b7e44a367b81c9d2c5dfd22d574b6baec6c01ea8a9e55ea6074a42746c0f1b/detection
  7. Curtir
    Snowsz recebeu reputação de Ackerzin em SCRIPT EM TILE   
    local config = {day = 1, minHour = "17:00", maxHour = "18:00", depotPos = {x = x, y = y, z =z}, message = "mensagem que abre sei la quando"} function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if tonumber(os.date("%w"))+1 == config.day and os.date("%H:%M") >= config.minHour and os.date("%H:%M") <= config.maxHour then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.message) return true end doTeleportThing(cid, depotPos) return true end Configuração:
    Day = dia da semana por números, 1 = domingo, 7 = sábado, logo 2 = segunda... etc...
    minHour = hora mínima para subir no tile.
    maxHour = hora máxima para subir no tile.
    depotPos = já sabe.
  8. Gostei
    Snowsz recebeu reputação de GeanRs em /commands para TFS 1.1   
    Bom, eu estou começando a usar o TFS 1.1 e percebi que, ele não contém o comando /commands, que me ajuda bastante, então, resolvi criá-lo, como no TFS 1.1, não é definido "tutor, gm, god" pelo talkactions.xml e sim em todos os arquivos Lua, esse comando vai mostrar tudo para qualquer grupo de acesso:

    Em talkactions.xml adicione:

     
    <talkaction words="/commands" script="commands.lua" /> Em talkactions/scripts crie um arquivo chamado commands.lua e adicione:

     
    function onSay(cid, words, param) local p = Player(cid) local file = io.open("data/talkactions/talkactions.xml", "r+") local str = "" local text = "" for line in (file:lines()) do str = str.."\n"..line end file:close() for a in string.gmatch(str, '<talkaction words="(.-)"') do text = text..'\n'..a end p:showTextDialog(2160, text) return true end Agora é só usar
     
    Print: ↓↓↓

  9. Curtir
    Snowsz recebeu reputação de Pedro. em (Resolvido)Talkaction Deathlist [TFS1.X]   
    Execute isso no MySQL:
    ALTER TABLE player_deaths ADD player_killers TEXT NOT NULL  
    Talkaction:
    local function getArticle(str) return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a" end local function getMonthDayEnding(day) if day == "01" or day == "21" or day == "31" then return "st" elseif day == "02" or day == "22" then return "nd" elseif day == "03" or day == "23" then return "rd" else return "th" end end local function getMonthString(m) return os.date("%B", os.time{year = 1970, month = m, day = 1}) end function onSay(player, words, param) local resultId = db.storeQuery("SELECT `id`, `name` FROM `players` WHERE `name` = " .. db.escapeString(param)) if resultId ~= false then local targetGUID = result.getNumber(resultId, "id") local targetName = result.getString(resultId, "name") result.free(resultId) local str = "" local breakline = "" local resultId = db.storeQuery("SELECT `time`, `level`, `killed_by`, `is_player`, `player_killers` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC") if resultId ~= false then repeat if str ~= "" then breakline = "\n" end local date = os.date("*t", result.getNumber(resultId, "time")) local article = "" local killed_by = result.getString(resultId, "killed_by") if result.getNumber(resultId, "is_player") == 0 then article = getArticle(killed_by) .. " " killed_by = killed_by:lower() end local killers = (result.getString(resultId, "player_killers") or ""):gsub(";", ", ") killers = killers:sub(1, #killers-2) if date.day < 10 then date.day = "0" .. date.day end if date.hour < 10 then date.hour = "0" .. date.hour end if date.min < 10 then date.min = "0" .. date.min end if date.sec < 10 then date.sec = "0" .. date.sec end str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. " Morto no Level " .. result.getNumber(resultId, "level") .. " por " .. killers .. "." until not result.next(resultId) result.free(resultId) end if str == "" then str = "Sem mortes." end player:popupFYI("Mortes do personagem, " .. targetName .. ".\n\n" .. str) else player:sendCancelMessage("O jogador com esse nome não existe.") end return false end  
    Creaturescript:
    local deathListEnabled = true local maxDeathRecords = 5 function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local playerId = player:getId() if nextUseStaminaTime[playerId] ~= nil then nextUseStaminaTime[playerId] = nil end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Você morreu') player:removeBlessing(6) player:removeBlessing(7) if not deathListEnabled then return end local byPlayer = 0 local killerName local killerid if killer ~= nil then if killer:isPlayer() then killerid = killer:getGuid() byPlayer = 1 else local master = killer:getMaster() if master and master ~= killer and master:isPlayer() then killer = master killerid = killer:getGuid() byPlayer = 1 end end killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName() else killerName = 'field item' end local byPlayerMostDamage = 0 local mostDamageKillerName if mostDamageKiller ~= nil then if mostDamageKiller:isPlayer() then byPlayerMostDamage = 1 else local master = mostDamageKiller:getMaster() if master and master ~= mostDamageKiller and master:isPlayer() then mostDamageKiller = master byPlayerMostDamage = 1 end end mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName() else mostDamageName = 'field item' end local KillersArray = {} for k, v in pairs(player:getDamageMap()) do local CreatureMT = Creature(k) if CreatureMT and CreatureMT:isPlayer() then table.insert(KillersArray, v:getName()) end end local playerGuid = player:getGuid() db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `player_killers`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ', ' .. table.concat(KillersArray, ";") .. ')') local resultId = db.storeQuery('SELECT `player_id` FROM `player_deaths` WHERE `player_id` = ' .. playerGuid) local deathRecords = 0 local tmpResultId = resultId while tmpResultId ~= false do tmpResultId = result.next(resultId) deathRecords = deathRecords + 1 end if resultId ~= false then result.free(resultId) end local limit = deathRecords - maxDeathRecords if limit > 0 then db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit) end if byPlayer == 1 then local targetGuild = player:getGuild() targetGuild = targetGuild and targetGuild:getId() or 0 if targetGuild ~= 0 then local killerGuild = killer:getGuild() killerGuild = killerGuild and killerGuild:getId() or 0 if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then local warId = false resultId = db.storeQuery('SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = ' .. killerGuild .. ' AND `guild2` = ' .. targetGuild .. ') OR (`guild1` = ' .. targetGuild .. ' AND `guild2` = ' .. killerGuild .. '))') if resultId ~= false then warId = result.getNumber(resultId, 'id') result.free(resultId) end if warId ~= false then db.asyncQuery('INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', ' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')') end end end end end  
     
    Não testei então tenta aí.
    A identação saiu meio bugada umas partes mas não importa.
  10. Curtir
    Snowsz recebeu reputação de bpm91 em (Resolvido)Talkaction Deathlist [TFS1.X]   
    Isso é assunto pra outro tópico kk
  11. Curtir
    Snowsz recebeu reputação de bpm91 em (Resolvido)Talkaction Deathlist [TFS1.X]   
    local deathListEnabled = true local maxDeathRecords = 5 function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local playerId = player:getId() if nextUseStaminaTime[playerId] ~= nil then nextUseStaminaTime[playerId] = nil end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Você morreu') player:removeBlessing(6) player:removeBlessing(7) if not deathListEnabled then return end local byPlayer = 0 local killerName local killerid if killer ~= nil then if killer:isPlayer() then killerid = killer:getGuid() byPlayer = 1 else local master = killer:getMaster() if master and master ~= killer and master:isPlayer() then killer = master killerid = killer:getGuid() byPlayer = 1 end end killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName() else killerName = 'field item' end local byPlayerMostDamage = 0 local mostDamageKillerName if mostDamageKiller ~= nil then if mostDamageKiller:isPlayer() then byPlayerMostDamage = 1 else local master = mostDamageKiller:getMaster() if master and master ~= mostDamageKiller and master:isPlayer() then mostDamageKiller = master byPlayerMostDamage = 1 end end mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName() else mostDamageName = 'field item' end local KillersArray = {} for k, v in pairs(player:getDamageMap()) do local CreatureMT = Creature(k) if CreatureMT and not isInArray(KillersArray, CreatureMT:getName()) then table.insert(KillersArray, CreatureMT:getName()) end end local playerGuid = player:getGuid() db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `player_killers`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ', \"' .. table.concat(KillersArray, ";") .. '\")') local resultId = db.storeQuery('SELECT `player_id` FROM `player_deaths` WHERE `player_id` = ' .. playerGuid) local deathRecords = 0 local tmpResultId = resultId while tmpResultId ~= false do tmpResultId = result.next(resultId) deathRecords = deathRecords + 1 end if resultId ~= false then result.free(resultId) end local limit = deathRecords - maxDeathRecords if limit > 0 then db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit) end if byPlayer == 1 then local targetGuild = player:getGuild() targetGuild = targetGuild and targetGuild:getId() or 0 if targetGuild ~= 0 then local killerGuild = killer:getGuild() killerGuild = killerGuild and killerGuild:getId() or 0 if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then local warId = false resultId = db.storeQuery('SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = ' .. killerGuild .. ' AND `guild2` = ' .. targetGuild .. ') OR (`guild1` = ' .. targetGuild .. ' AND `guild2` = ' .. killerGuild .. '))') if resultId ~= false then warId = result.getNumber(resultId, 'id') result.free(resultId) end if warId ~= false then db.asyncQuery('INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', ' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')') end end end end end Isso deve resolver ↑.
     
    Sobre o site eu não entendo muito bem, mas posso até tentar.
  12. Curtir
    Snowsz recebeu reputação de bpm91 em (Resolvido)Talkaction Deathlist [TFS1.X]   
    Pensei que só queria de player kkk, sobre cortar 2 letras, é falta de prática minha, mesmo mexendo com isso todo dia, me sinto enferrujado sempre, isso deve resolver:
     
    local deathListEnabled = true local maxDeathRecords = 5 function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local playerId = player:getId() if nextUseStaminaTime[playerId] ~= nil then nextUseStaminaTime[playerId] = nil end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Você morreu') player:removeBlessing(6) player:removeBlessing(7) if not deathListEnabled then return end local byPlayer = 0 local killerName local killerid if killer ~= nil then if killer:isPlayer() then killerid = killer:getGuid() byPlayer = 1 else local master = killer:getMaster() if master and master ~= killer and master:isPlayer() then killer = master killerid = killer:getGuid() byPlayer = 1 end end killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName() else killerName = 'field item' end local byPlayerMostDamage = 0 local mostDamageKillerName if mostDamageKiller ~= nil then if mostDamageKiller:isPlayer() then byPlayerMostDamage = 1 else local master = mostDamageKiller:getMaster() if master and master ~= mostDamageKiller and master:isPlayer() then mostDamageKiller = master byPlayerMostDamage = 1 end end mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName() else mostDamageName = 'field item' end local KillersArray = {} for k, v in pairs(player:getDamageMap()) do local CreatureMT = Creature(k) if CreatureMT then table.insert(KillersArray, CreatureMT:getName()) end end local playerGuid = player:getGuid() db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `player_killers`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ', \"' .. table.concat(KillersArray, ";") .. '\")') local resultId = db.storeQuery('SELECT `player_id` FROM `player_deaths` WHERE `player_id` = ' .. playerGuid) local deathRecords = 0 local tmpResultId = resultId while tmpResultId ~= false do tmpResultId = result.next(resultId) deathRecords = deathRecords + 1 end if resultId ~= false then result.free(resultId) end local limit = deathRecords - maxDeathRecords if limit > 0 then db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit) end if byPlayer == 1 then local targetGuild = player:getGuild() targetGuild = targetGuild and targetGuild:getId() or 0 if targetGuild ~= 0 then local killerGuild = killer:getGuild() killerGuild = killerGuild and killerGuild:getId() or 0 if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then local warId = false resultId = db.storeQuery('SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = ' .. killerGuild .. ' AND `guild2` = ' .. targetGuild .. ') OR (`guild1` = ' .. targetGuild .. ' AND `guild2` = ' .. killerGuild .. '))') if resultId ~= false then warId = result.getNumber(resultId, 'id') result.free(resultId) end if warId ~= false then db.asyncQuery('INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', ' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')') end end end end end Talk:
    local function getArticle(str) return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a" end local function getMonthDayEnding(day) if day == "01" or day == "21" or day == "31" then return "st" elseif day == "02" or day == "22" then return "nd" elseif day == "03" or day == "23" then return "rd" else return "th" end end local function getMonthString(m) return os.date("%B", os.time{year = 1970, month = m, day = 1}) end function onSay(player, words, param) local resultId = db.storeQuery("SELECT `id`, `name` FROM `players` WHERE `name` = " .. db.escapeString(param)) if resultId ~= false then local targetGUID = result.getNumber(resultId, "id") local targetName = result.getString(resultId, "name") result.free(resultId) local str = "" local breakline = "" local resultId = db.storeQuery("SELECT `time`, `level`, `killed_by`, `is_player`, `player_killers` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC") if resultId ~= false then repeat if str ~= "" then breakline = "\n" end local date = os.date("*t", result.getNumber(resultId, "time")) local article = "" local killed_by = result.getString(resultId, "killed_by") if result.getNumber(resultId, "is_player") == 0 then article = getArticle(killed_by) .. " " killed_by = killed_by:lower() end local killers = (result.getString(resultId, "player_killers") or ""):gsub(";", ", ") if date.day < 10 then date.day = "0" .. date.day end if date.hour < 10 then date.hour = "0" .. date.hour end if date.min < 10 then date.min = "0" .. date.min end if date.sec < 10 then date.sec = "0" .. date.sec end str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. " Morto no Level " .. result.getNumber(resultId, "level") .. " por " .. killers .. "." until not result.next(resultId) result.free(resultId) end if str == "" then str = "Sem mortes." end player:popupFYI("Mortes do personagem, " .. targetName .. ".\n\n" .. str) else player:sendCancelMessage("O jogador com esse nome não existe.") end return false end  
  13. Curtir
    Snowsz recebeu reputação de bpm91 em (Resolvido)Talkaction Deathlist [TFS1.X]   
    Erro meu kkk, fez bem em mudar lá, tenta agora:
    local deathListEnabled = true local maxDeathRecords = 5 function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local playerId = player:getId() if nextUseStaminaTime[playerId] ~= nil then nextUseStaminaTime[playerId] = nil end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Você morreu') player:removeBlessing(6) player:removeBlessing(7) if not deathListEnabled then return end local byPlayer = 0 local killerName local killerid if killer ~= nil then if killer:isPlayer() then killerid = killer:getGuid() byPlayer = 1 else local master = killer:getMaster() if master and master ~= killer and master:isPlayer() then killer = master killerid = killer:getGuid() byPlayer = 1 end end killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName() else killerName = 'field item' end local byPlayerMostDamage = 0 local mostDamageKillerName if mostDamageKiller ~= nil then if mostDamageKiller:isPlayer() then byPlayerMostDamage = 1 else local master = mostDamageKiller:getMaster() if master and master ~= mostDamageKiller and master:isPlayer() then mostDamageKiller = master byPlayerMostDamage = 1 end end mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName() else mostDamageName = 'field item' end local KillersArray = {} for k, v in pairs(player:getDamageMap()) do local CreatureMT = Creature(k) if CreatureMT and CreatureMT:isPlayer() then table.insert(KillersArray, CreatureMT:getName()) end end local playerGuid = player:getGuid() db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `player_killers`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ', \"' .. table.concat(KillersArray, ";") .. '\")') local resultId = db.storeQuery('SELECT `player_id` FROM `player_deaths` WHERE `player_id` = ' .. playerGuid) local deathRecords = 0 local tmpResultId = resultId while tmpResultId ~= false do tmpResultId = result.next(resultId) deathRecords = deathRecords + 1 end if resultId ~= false then result.free(resultId) end local limit = deathRecords - maxDeathRecords if limit > 0 then db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit) end if byPlayer == 1 then local targetGuild = player:getGuild() targetGuild = targetGuild and targetGuild:getId() or 0 if targetGuild ~= 0 then local killerGuild = killer:getGuild() killerGuild = killerGuild and killerGuild:getId() or 0 if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then local warId = false resultId = db.storeQuery('SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = ' .. killerGuild .. ' AND `guild2` = ' .. targetGuild .. ') OR (`guild1` = ' .. targetGuild .. ' AND `guild2` = ' .. killerGuild .. '))') if resultId ~= false then warId = result.getNumber(resultId, 'id') result.free(resultId) end if warId ~= false then db.asyncQuery('INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', ' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')') end end end end end  
  14. Curtir
    Snowsz recebeu reputação de bpm91 em (Resolvido)Talkaction Deathlist [TFS1.X]   
    Execute isso no MySQL:
    ALTER TABLE player_deaths ADD player_killers TEXT NOT NULL  
    Talkaction:
    local function getArticle(str) return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a" end local function getMonthDayEnding(day) if day == "01" or day == "21" or day == "31" then return "st" elseif day == "02" or day == "22" then return "nd" elseif day == "03" or day == "23" then return "rd" else return "th" end end local function getMonthString(m) return os.date("%B", os.time{year = 1970, month = m, day = 1}) end function onSay(player, words, param) local resultId = db.storeQuery("SELECT `id`, `name` FROM `players` WHERE `name` = " .. db.escapeString(param)) if resultId ~= false then local targetGUID = result.getNumber(resultId, "id") local targetName = result.getString(resultId, "name") result.free(resultId) local str = "" local breakline = "" local resultId = db.storeQuery("SELECT `time`, `level`, `killed_by`, `is_player`, `player_killers` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC") if resultId ~= false then repeat if str ~= "" then breakline = "\n" end local date = os.date("*t", result.getNumber(resultId, "time")) local article = "" local killed_by = result.getString(resultId, "killed_by") if result.getNumber(resultId, "is_player") == 0 then article = getArticle(killed_by) .. " " killed_by = killed_by:lower() end local killers = (result.getString(resultId, "player_killers") or ""):gsub(";", ", ") killers = killers:sub(1, #killers-2) if date.day < 10 then date.day = "0" .. date.day end if date.hour < 10 then date.hour = "0" .. date.hour end if date.min < 10 then date.min = "0" .. date.min end if date.sec < 10 then date.sec = "0" .. date.sec end str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. " Morto no Level " .. result.getNumber(resultId, "level") .. " por " .. killers .. "." until not result.next(resultId) result.free(resultId) end if str == "" then str = "Sem mortes." end player:popupFYI("Mortes do personagem, " .. targetName .. ".\n\n" .. str) else player:sendCancelMessage("O jogador com esse nome não existe.") end return false end  
    Creaturescript:
    local deathListEnabled = true local maxDeathRecords = 5 function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local playerId = player:getId() if nextUseStaminaTime[playerId] ~= nil then nextUseStaminaTime[playerId] = nil end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Você morreu') player:removeBlessing(6) player:removeBlessing(7) if not deathListEnabled then return end local byPlayer = 0 local killerName local killerid if killer ~= nil then if killer:isPlayer() then killerid = killer:getGuid() byPlayer = 1 else local master = killer:getMaster() if master and master ~= killer and master:isPlayer() then killer = master killerid = killer:getGuid() byPlayer = 1 end end killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName() else killerName = 'field item' end local byPlayerMostDamage = 0 local mostDamageKillerName if mostDamageKiller ~= nil then if mostDamageKiller:isPlayer() then byPlayerMostDamage = 1 else local master = mostDamageKiller:getMaster() if master and master ~= mostDamageKiller and master:isPlayer() then mostDamageKiller = master byPlayerMostDamage = 1 end end mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName() else mostDamageName = 'field item' end local KillersArray = {} for k, v in pairs(player:getDamageMap()) do local CreatureMT = Creature(k) if CreatureMT and CreatureMT:isPlayer() then table.insert(KillersArray, v:getName()) end end local playerGuid = player:getGuid() db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `player_killers`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ', ' .. table.concat(KillersArray, ";") .. ')') local resultId = db.storeQuery('SELECT `player_id` FROM `player_deaths` WHERE `player_id` = ' .. playerGuid) local deathRecords = 0 local tmpResultId = resultId while tmpResultId ~= false do tmpResultId = result.next(resultId) deathRecords = deathRecords + 1 end if resultId ~= false then result.free(resultId) end local limit = deathRecords - maxDeathRecords if limit > 0 then db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit) end if byPlayer == 1 then local targetGuild = player:getGuild() targetGuild = targetGuild and targetGuild:getId() or 0 if targetGuild ~= 0 then local killerGuild = killer:getGuild() killerGuild = killerGuild and killerGuild:getId() or 0 if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then local warId = false resultId = db.storeQuery('SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = ' .. killerGuild .. ' AND `guild2` = ' .. targetGuild .. ') OR (`guild1` = ' .. targetGuild .. ' AND `guild2` = ' .. killerGuild .. '))') if resultId ~= false then warId = result.getNumber(resultId, 'id') result.free(resultId) end if warId ~= false then db.asyncQuery('INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', ' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')') end end end end end  
     
    Não testei então tenta aí.
    A identação saiu meio bugada umas partes mas não importa.
  15. Curtir
    Snowsz recebeu reputação de bpm91 em item que fala   
    Caso seja TFS 1.X:
    local Messages = { [Id do item] = "Msg", [Id do item2] = "Msg2 etccc" } function onUse(player, item, fromPosition, itemEx, toPosition) player:say(Messages[item:getId()]) return true end  
    Isso não vai funcionar, o correto seria:
    local Messages = { [ID] = {Text = "Msg", Color = 21}, [ID] = {Text = "Msg", Color = 21} } function onUse(cid, item, fromPosition, itemEx, toPosition) doSendAnimatedText(getCreaturePosition(cid), Messages[item.itemid].Text, Messages[item.itemid].Color) return true end  
  16. Curtir
    Snowsz recebeu reputação de MatCollier em (Resolvido)Talkaction Deathlist [TFS1.X]   
    local deathListEnabled = true local maxDeathRecords = 5 function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local playerId = player:getId() if nextUseStaminaTime[playerId] ~= nil then nextUseStaminaTime[playerId] = nil end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Você morreu') player:removeBlessing(6) player:removeBlessing(7) if not deathListEnabled then return end local byPlayer = 0 local killerName local killerid if killer ~= nil then if killer:isPlayer() then killerid = killer:getGuid() byPlayer = 1 else local master = killer:getMaster() if master and master ~= killer and master:isPlayer() then killer = master killerid = killer:getGuid() byPlayer = 1 end end killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName() else killerName = 'field item' end local byPlayerMostDamage = 0 local mostDamageKillerName if mostDamageKiller ~= nil then if mostDamageKiller:isPlayer() then byPlayerMostDamage = 1 else local master = mostDamageKiller:getMaster() if master and master ~= mostDamageKiller and master:isPlayer() then mostDamageKiller = master byPlayerMostDamage = 1 end end mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName() else mostDamageName = 'field item' end local KillersArray = {} for k, v in pairs(player:getDamageMap()) do local CreatureMT = Creature(k) if CreatureMT and not isInArray(KillersArray, CreatureMT:getName()) then table.insert(KillersArray, CreatureMT:getName()) end end local playerGuid = player:getGuid() db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `player_killers`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ', \"' .. table.concat(KillersArray, ";") .. '\")') local resultId = db.storeQuery('SELECT `player_id` FROM `player_deaths` WHERE `player_id` = ' .. playerGuid) local deathRecords = 0 local tmpResultId = resultId while tmpResultId ~= false do tmpResultId = result.next(resultId) deathRecords = deathRecords + 1 end if resultId ~= false then result.free(resultId) end local limit = deathRecords - maxDeathRecords if limit > 0 then db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit) end if byPlayer == 1 then local targetGuild = player:getGuild() targetGuild = targetGuild and targetGuild:getId() or 0 if targetGuild ~= 0 then local killerGuild = killer:getGuild() killerGuild = killerGuild and killerGuild:getId() or 0 if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then local warId = false resultId = db.storeQuery('SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = ' .. killerGuild .. ' AND `guild2` = ' .. targetGuild .. ') OR (`guild1` = ' .. targetGuild .. ' AND `guild2` = ' .. killerGuild .. '))') if resultId ~= false then warId = result.getNumber(resultId, 'id') result.free(resultId) end if warId ~= false then db.asyncQuery('INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', ' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')') end end end end end Isso deve resolver ↑.
     
    Sobre o site eu não entendo muito bem, mas posso até tentar.
  17. Curtir
    Snowsz recebeu reputação de MatCollier em (Resolvido)Talkaction Deathlist [TFS1.X]   
    Pensei que só queria de player kkk, sobre cortar 2 letras, é falta de prática minha, mesmo mexendo com isso todo dia, me sinto enferrujado sempre, isso deve resolver:
     
    local deathListEnabled = true local maxDeathRecords = 5 function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local playerId = player:getId() if nextUseStaminaTime[playerId] ~= nil then nextUseStaminaTime[playerId] = nil end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Você morreu') player:removeBlessing(6) player:removeBlessing(7) if not deathListEnabled then return end local byPlayer = 0 local killerName local killerid if killer ~= nil then if killer:isPlayer() then killerid = killer:getGuid() byPlayer = 1 else local master = killer:getMaster() if master and master ~= killer and master:isPlayer() then killer = master killerid = killer:getGuid() byPlayer = 1 end end killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName() else killerName = 'field item' end local byPlayerMostDamage = 0 local mostDamageKillerName if mostDamageKiller ~= nil then if mostDamageKiller:isPlayer() then byPlayerMostDamage = 1 else local master = mostDamageKiller:getMaster() if master and master ~= mostDamageKiller and master:isPlayer() then mostDamageKiller = master byPlayerMostDamage = 1 end end mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName() else mostDamageName = 'field item' end local KillersArray = {} for k, v in pairs(player:getDamageMap()) do local CreatureMT = Creature(k) if CreatureMT then table.insert(KillersArray, CreatureMT:getName()) end end local playerGuid = player:getGuid() db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `player_killers`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ', \"' .. table.concat(KillersArray, ";") .. '\")') local resultId = db.storeQuery('SELECT `player_id` FROM `player_deaths` WHERE `player_id` = ' .. playerGuid) local deathRecords = 0 local tmpResultId = resultId while tmpResultId ~= false do tmpResultId = result.next(resultId) deathRecords = deathRecords + 1 end if resultId ~= false then result.free(resultId) end local limit = deathRecords - maxDeathRecords if limit > 0 then db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit) end if byPlayer == 1 then local targetGuild = player:getGuild() targetGuild = targetGuild and targetGuild:getId() or 0 if targetGuild ~= 0 then local killerGuild = killer:getGuild() killerGuild = killerGuild and killerGuild:getId() or 0 if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then local warId = false resultId = db.storeQuery('SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = ' .. killerGuild .. ' AND `guild2` = ' .. targetGuild .. ') OR (`guild1` = ' .. targetGuild .. ' AND `guild2` = ' .. killerGuild .. '))') if resultId ~= false then warId = result.getNumber(resultId, 'id') result.free(resultId) end if warId ~= false then db.asyncQuery('INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', ' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')') end end end end end Talk:
    local function getArticle(str) return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a" end local function getMonthDayEnding(day) if day == "01" or day == "21" or day == "31" then return "st" elseif day == "02" or day == "22" then return "nd" elseif day == "03" or day == "23" then return "rd" else return "th" end end local function getMonthString(m) return os.date("%B", os.time{year = 1970, month = m, day = 1}) end function onSay(player, words, param) local resultId = db.storeQuery("SELECT `id`, `name` FROM `players` WHERE `name` = " .. db.escapeString(param)) if resultId ~= false then local targetGUID = result.getNumber(resultId, "id") local targetName = result.getString(resultId, "name") result.free(resultId) local str = "" local breakline = "" local resultId = db.storeQuery("SELECT `time`, `level`, `killed_by`, `is_player`, `player_killers` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC") if resultId ~= false then repeat if str ~= "" then breakline = "\n" end local date = os.date("*t", result.getNumber(resultId, "time")) local article = "" local killed_by = result.getString(resultId, "killed_by") if result.getNumber(resultId, "is_player") == 0 then article = getArticle(killed_by) .. " " killed_by = killed_by:lower() end local killers = (result.getString(resultId, "player_killers") or ""):gsub(";", ", ") if date.day < 10 then date.day = "0" .. date.day end if date.hour < 10 then date.hour = "0" .. date.hour end if date.min < 10 then date.min = "0" .. date.min end if date.sec < 10 then date.sec = "0" .. date.sec end str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. " Morto no Level " .. result.getNumber(resultId, "level") .. " por " .. killers .. "." until not result.next(resultId) result.free(resultId) end if str == "" then str = "Sem mortes." end player:popupFYI("Mortes do personagem, " .. targetName .. ".\n\n" .. str) else player:sendCancelMessage("O jogador com esse nome não existe.") end return false end  
  18. Curtir
    Snowsz recebeu reputação de MatCollier em (Resolvido)Talkaction Deathlist [TFS1.X]   
    Execute isso no MySQL:
    ALTER TABLE player_deaths ADD player_killers TEXT NOT NULL  
    Talkaction:
    local function getArticle(str) return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a" end local function getMonthDayEnding(day) if day == "01" or day == "21" or day == "31" then return "st" elseif day == "02" or day == "22" then return "nd" elseif day == "03" or day == "23" then return "rd" else return "th" end end local function getMonthString(m) return os.date("%B", os.time{year = 1970, month = m, day = 1}) end function onSay(player, words, param) local resultId = db.storeQuery("SELECT `id`, `name` FROM `players` WHERE `name` = " .. db.escapeString(param)) if resultId ~= false then local targetGUID = result.getNumber(resultId, "id") local targetName = result.getString(resultId, "name") result.free(resultId) local str = "" local breakline = "" local resultId = db.storeQuery("SELECT `time`, `level`, `killed_by`, `is_player`, `player_killers` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC") if resultId ~= false then repeat if str ~= "" then breakline = "\n" end local date = os.date("*t", result.getNumber(resultId, "time")) local article = "" local killed_by = result.getString(resultId, "killed_by") if result.getNumber(resultId, "is_player") == 0 then article = getArticle(killed_by) .. " " killed_by = killed_by:lower() end local killers = (result.getString(resultId, "player_killers") or ""):gsub(";", ", ") killers = killers:sub(1, #killers-2) if date.day < 10 then date.day = "0" .. date.day end if date.hour < 10 then date.hour = "0" .. date.hour end if date.min < 10 then date.min = "0" .. date.min end if date.sec < 10 then date.sec = "0" .. date.sec end str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. " Morto no Level " .. result.getNumber(resultId, "level") .. " por " .. killers .. "." until not result.next(resultId) result.free(resultId) end if str == "" then str = "Sem mortes." end player:popupFYI("Mortes do personagem, " .. targetName .. ".\n\n" .. str) else player:sendCancelMessage("O jogador com esse nome não existe.") end return false end  
    Creaturescript:
    local deathListEnabled = true local maxDeathRecords = 5 function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local playerId = player:getId() if nextUseStaminaTime[playerId] ~= nil then nextUseStaminaTime[playerId] = nil end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Você morreu') player:removeBlessing(6) player:removeBlessing(7) if not deathListEnabled then return end local byPlayer = 0 local killerName local killerid if killer ~= nil then if killer:isPlayer() then killerid = killer:getGuid() byPlayer = 1 else local master = killer:getMaster() if master and master ~= killer and master:isPlayer() then killer = master killerid = killer:getGuid() byPlayer = 1 end end killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName() else killerName = 'field item' end local byPlayerMostDamage = 0 local mostDamageKillerName if mostDamageKiller ~= nil then if mostDamageKiller:isPlayer() then byPlayerMostDamage = 1 else local master = mostDamageKiller:getMaster() if master and master ~= mostDamageKiller and master:isPlayer() then mostDamageKiller = master byPlayerMostDamage = 1 end end mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName() else mostDamageName = 'field item' end local KillersArray = {} for k, v in pairs(player:getDamageMap()) do local CreatureMT = Creature(k) if CreatureMT and CreatureMT:isPlayer() then table.insert(KillersArray, v:getName()) end end local playerGuid = player:getGuid() db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `player_killers`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ', ' .. table.concat(KillersArray, ";") .. ')') local resultId = db.storeQuery('SELECT `player_id` FROM `player_deaths` WHERE `player_id` = ' .. playerGuid) local deathRecords = 0 local tmpResultId = resultId while tmpResultId ~= false do tmpResultId = result.next(resultId) deathRecords = deathRecords + 1 end if resultId ~= false then result.free(resultId) end local limit = deathRecords - maxDeathRecords if limit > 0 then db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit) end if byPlayer == 1 then local targetGuild = player:getGuild() targetGuild = targetGuild and targetGuild:getId() or 0 if targetGuild ~= 0 then local killerGuild = killer:getGuild() killerGuild = killerGuild and killerGuild:getId() or 0 if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then local warId = false resultId = db.storeQuery('SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = ' .. killerGuild .. ' AND `guild2` = ' .. targetGuild .. ') OR (`guild1` = ' .. targetGuild .. ' AND `guild2` = ' .. killerGuild .. '))') if resultId ~= false then warId = result.getNumber(resultId, 'id') result.free(resultId) end if warId ~= false then db.asyncQuery('INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', ' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')') end end end end end  
     
    Não testei então tenta aí.
    A identação saiu meio bugada umas partes mas não importa.
  19. Curtir
    Snowsz recebeu reputação de MatCollier em (Resolvido)Talkaction Deathlist [TFS1.X]   
    Erro meu kkk, fez bem em mudar lá, tenta agora:
    local deathListEnabled = true local maxDeathRecords = 5 function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local playerId = player:getId() if nextUseStaminaTime[playerId] ~= nil then nextUseStaminaTime[playerId] = nil end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Você morreu') player:removeBlessing(6) player:removeBlessing(7) if not deathListEnabled then return end local byPlayer = 0 local killerName local killerid if killer ~= nil then if killer:isPlayer() then killerid = killer:getGuid() byPlayer = 1 else local master = killer:getMaster() if master and master ~= killer and master:isPlayer() then killer = master killerid = killer:getGuid() byPlayer = 1 end end killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName() else killerName = 'field item' end local byPlayerMostDamage = 0 local mostDamageKillerName if mostDamageKiller ~= nil then if mostDamageKiller:isPlayer() then byPlayerMostDamage = 1 else local master = mostDamageKiller:getMaster() if master and master ~= mostDamageKiller and master:isPlayer() then mostDamageKiller = master byPlayerMostDamage = 1 end end mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName() else mostDamageName = 'field item' end local KillersArray = {} for k, v in pairs(player:getDamageMap()) do local CreatureMT = Creature(k) if CreatureMT and CreatureMT:isPlayer() then table.insert(KillersArray, CreatureMT:getName()) end end local playerGuid = player:getGuid() db.query('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `player_killers`) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ', \"' .. table.concat(KillersArray, ";") .. '\")') local resultId = db.storeQuery('SELECT `player_id` FROM `player_deaths` WHERE `player_id` = ' .. playerGuid) local deathRecords = 0 local tmpResultId = resultId while tmpResultId ~= false do tmpResultId = result.next(resultId) deathRecords = deathRecords + 1 end if resultId ~= false then result.free(resultId) end local limit = deathRecords - maxDeathRecords if limit > 0 then db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit) end if byPlayer == 1 then local targetGuild = player:getGuild() targetGuild = targetGuild and targetGuild:getId() or 0 if targetGuild ~= 0 then local killerGuild = killer:getGuild() killerGuild = killerGuild and killerGuild:getId() or 0 if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then local warId = false resultId = db.storeQuery('SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = ' .. killerGuild .. ' AND `guild2` = ' .. targetGuild .. ') OR (`guild1` = ' .. targetGuild .. ' AND `guild2` = ' .. killerGuild .. '))') if resultId ~= false then warId = result.getNumber(resultId, 'id') result.free(resultId) end if warId ~= false then db.asyncQuery('INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', ' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')') end end end end end  
  20. Gostei
    Snowsz deu reputação a ZoR em item que fala   
    Valeu mano! eu estava tentando por o text mas não saberia se iria funcionar então deixei daquela forma.
    mas valeu mano! aprendi algo novo !  

    @Snowsz
  21. Curtir
    Snowsz recebeu reputação de ZoR em item que fala   
    Caso seja TFS 1.X:
    local Messages = { [Id do item] = "Msg", [Id do item2] = "Msg2 etccc" } function onUse(player, item, fromPosition, itemEx, toPosition) player:say(Messages[item:getId()]) return true end  
    Isso não vai funcionar, o correto seria:
    local Messages = { [ID] = {Text = "Msg", Color = 21}, [ID] = {Text = "Msg", Color = 21} } function onUse(cid, item, fromPosition, itemEx, toPosition) doSendAnimatedText(getCreaturePosition(cid), Messages[item.itemid].Text, Messages[item.itemid].Color) return true end  
  22. Gostei
    Snowsz recebeu reputação de gmstrikker em Criando um mod simples   
    Neste tutorial espero ensina-los a criar um mod simples, composto por uma janela e um botão, para ativa-la e desativá-la.
     
    O mod deve ficar mais ou menos assim:
     

     
     

    • Entre na pasta mods do seu otclient, e crie um arquivo com um nome quaisquer, como por exemplo, o nome que quer para seu mod,  o meu, vou chamar de "tutorial".
     
    • Dentro da pasta criada, crie um novo arquivo com extensão "otmod", coloque o nome do seu mod nele, eu vou colocar o nome de "tutorial", ficando "tutorial.otmod": 
     
    • Dentro do seu arquivo de extensão "otmod" adicione o seguinte código:
     
    Module name: description: author: website: version: autoload: autoload-priority: scripts: [ ] @onLoad: @onUnload:  
    • Explicando
     
    Dai você me pergunta por que isso está identado dessa forma?
    Module name: Com dois espaços antes de "name:"?
    Porque "Module" é uma declaração do tipo de arquivo que está sendo utilizado, já o "name:", é um componente do "Module", por isso, ele deve estar dentro de "Module", caso contrário, poderá ocorrer erros.
     
    Nesta linha:
    Module Ele está declarando que este arquivo é um modulo, uma modificação para seu client.
     
     
     
    Nesta linha:
    name: Aqui, estará sendo declarado o nome do seu módulo, eu vou colocar o nome "Tutorial":
    name: Tutorial Ao clicar no gerenciador de módulos, ele irá mostrar o seu mod com o nome escolhido:
     
     

    Nesta linha:
    description: Aqui, entrará a descrição do seu mod, por exemplo:
    description: Um mod simples. Irá mostrar mais ou menos assim:

     
     
     
    Nesta linha:
    author: Entrará o seu nome, ou seja, o nome de quem criou o mod(autor óbvio), por exemplo:
     
    author: Snowsz Ficaria mais ou menos assim:

     
     
     
    Nesta linha:
    website: Você pode declarar o seu site, por exemplo:
     
    website: tibiaking.com Ficaria mais ou menos assim:

     
     
     
    Nesta linha:
    version: Você pode colocar a versão do seu mod, por exemplo:
    version: 1.0 Ficaria mais ou menos assim:

     
     
    A parte com explicação gráfica terminou  !
     
     
     
    Nesta linha:
    autoload: Será determinado se o seu mod irá ser carregado automaticamente, por exemplo:
     
    Exemplo 1:
    autoload: false Assim, seu mod só irá ser carregado manualmente, você terá que ir no gerenciador de módulos e clicar em carregar para inciar seu mod.
     
    Exemplo 2:
     
    autoload: true  Assim, seu mod só irá ser carregado automaticamente, sem a necessidade de clicar para ser carregado.
     
     
     
    Nesta linha:
    autoload-priority: Será determinada a prioridade de carregamento do seu mod, "Como assim?", é simples, ele irá carregar antes ou depois de outro mod, isso determina em que posição de carregamento seu mod deve estar, como por exemplo, em primeiro lugar  , um exemplo de prioridade:
    autoload-priority: 1000 Acho que não tem nenhum mod com essa prioridade? Hehe, será um dos primeiros a carregar!
     
     
     
    Nesta linha:
    scripts: [ ] Será determinado os scripts carregados pelo seu módulo, os scripts usado por ele, por exemplo:
    scripts: [ tutorial ] Ele irá busca um arquivo com o nome tutorial.lua na mesma pasta que ele estiver, e carregará tudo que tem dentro daquele arquivo.
     
     
     
    Nesta linha:
    @onLoad: Será determinado que função o seu mod irá chamar ao iniciar, por exemplo:
     
    @onLoad: print("Hello World!") Irá mostrar uma mensagem no seu terminal do otclient.
     
     
     
    Por fim, nesta linha:
    @onUnload: Será determinado que função o seu mod irá chamar ao ser descarregado, ao se desligar, por exemplo:
    @onUnload: print("Bye World! ;(") Irá mostrar uma mensagem no seu terminal do otclient.
     
    Bom, a configuração que usaremos no nosso mod simples será essa:
     
    Module   name: Tutorial   description: Um mod simples.   author: Snowsz   website: tibiaking.com   version: 1.0     autoload: true   autoload-priority: 1000     scripts: [ tutorial ]     @onLoad: init()   @onUnload: terminate()  
    Mexa apenas no que souber
     
     

     
    Na pasta do seu mod, crie um novo arquivo, com o nome "tutorial", ele deverá conter a extensão "lua", ficando "tutorial.lua", que é o arquivo de script setado no nosso "tutorial.otmod":
    scripts: [ tutorial ] Dentro dele, coloque o seguinte código:
    function init() tutorialWindow = g_ui.displayUI('tutorial.otui') tutorialWindow:hide() tutorialButton = modules.client_topmenu.addRightButton('tutorialButton', tr('Exemplo'), 'icone', onoff, true) end function terminate() tutorialWindow:hide() end function onoff() if tutorialWindow:isVisible() then tutorialWindow:hide() else tutorialWindow:show() end end A função "init()" é a função chamada pelo seu mod, ao iniciar, a função "terminate()", é chamada pelo seu mod, ao ser desligado.
    Na função "init()", em uma de suas linhas podemos encontrar isso:
    tutorialWindow = g_ui.displayUI('tutorial.otui') Onde tem "tutorialWindow", está sendo declarado uma variável global, um iniciante em lua deve saber o que é, então não vou explicar.
    Dentro de tal variável, há uma função, "O que essa função faz?", ela executa os elementos contidos em um arquivo, que seria os arquivos de extensão "otui", nela, estaremos executando o "tutorial.otui".
     
     
    Nesta linha:
    tutorialWindow:hide() Ele executa uma função na variável "tutorialWindow", que seria uma função para esconder a janela, pois, o que estava contido no "tutorial.otui" seria uma janela que criaremos logo logo.
     
    Nesta linha:
    tutorialButton = modules.client_topmenu.addRightButton('tutorialButton', tr('Exemplo'), 'icone', onoff, true) Está sendo declarado uma variável global, nela, está contido a referencia de uma função, que seria um botão adicionado ao lado direito do menu, exemplo:
    Utilizei a imagem de ícone do otclient para demonstração.
     
    Explicando a função:
    Sua base é essa:
    modules.client_topmenu.addRightButton(id, description, icon, callback, front) • Id: Será o id dado ao botão, para melhorar o acesso.
    • Description: É a descrição do botão, ao passar o mouse em cima, aparecerá um texto.
    • Icon: É a imagem do botão, como a que eu utilizei no exemplo, usei o ícone do otclient.
    • Callback: É uma função chamada ao clicar nele.
    • Front: Define se o botão será adicionado na frente ou atrás dos demais botões do seu menu.
     
     
    Explicando a função "terminate()", na sua única linha podemos encontrar isso:
    tutorialWindow:hide() É o seguinte, ao seu mod descarregar, ele irá esconder sua janela criada.
     
     
    Explicando a função "onoff()", nas suas linhas podemos encontrar isso:
    if tutorialWindow:isVisible() then tutorialWindow:hide() else tutorialWindow:show() end Mas bem, o que isso faz? Simples, "tutorialWindow:isVisible()", ele checa se a janela está visível, se estiver, ele irá esconde-la "tutorialWindow:hide()", caso a janela não esteja visível, ele irá mostra-la "tutorialWindow:show()", essa é a utilidade da função utilizada no botão do menu.
     
     
     
    Agora, na pasta do seu mod, crie um novo arquivo, com o nome de "tutorial", a extensão dele deve ser "otui", ficando "tutorial.otui", dentro desse arquivo, adicione isso:
    MainWindow id: tutorialwindow height: 255 width: 438 !text: tr("Mod simples") Explicando:
     
    • "MainWindow", seria o objeto que irá ser utilizado pelo arquivo, no caso, uma janela.
    • "id", o id, estaria setando um id para a sua janela.
    • "height", seria a altura da sua janela, do "MainWindow".
    • "width", seria a largura da sua janela, do "MainWindow".
    • "!text", seria o texto inserido como título de sua janela, a função chamada nele "tr()", chama uma tradução para aquela frase, caso não tenha ficaria aquilo mesmo, caso tenha, iria mudar para outro texto traduzido.
     
     
     
     
    Bom gente, espero que tenham gostado do tutorial, eu não sou bom com tutoriais... Se tiver me perdido peço desculpas, qualquer erro podem postar aqui que irei corrigir, se eu tiver me enrolado em algo, me desculpem, dei várias pausas enquanto fazia isso kk', espero que tenham entendido tudo.
     
    Créditos: Snowsz
  23. Curtir
    Snowsz recebeu reputação de bpm91 em [New Cast System] OTX3 8.60   
    Parabéns, seu tópico de conteúdo foi aprovado!
    Muito obrigado pela sua contribuição, nós do Tibia King agradecemos.
    Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.
     
  24. Curtir
    Snowsz recebeu reputação de bpm91 em [Base DxP]This editor needs an updated items.otb version   
    Na pasta 854 no RME, troca o item otb de lá pra o seu item otb, 8.54 ou 8.60, não sei qual a versão de pokémon.
  25. Curtir
    Snowsz recebeu reputação de bpm91 em [Base DxP]This editor needs an updated items.otb version   
    Nah, n sou de usar pokémon. Já que isso não resolveu não tenho ideia, talvez o @Nolis saiba.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo