Postado Dezembro 13, 2017 7 anos Achei o comando /info com informações bem limitadas sobre o jogador e acabei decidindo fazer um melhor, dessa vez com uma janela exibindo todas as informações. Demonstração Spoiler Caso você tenha gostado do script e deseja implementá-lo em seu servidor, você pode substituir o comando /info já existente. Para isso é só ir na pasta data/talkactions/scripts, abrir o arquivo info.lua e substituir todo o conteúdo pelo código abaixo. data/talkactions/scripts/info.lua Spoiler function onSay(player, words, param) if not player:getGroup():getAccess() then return true end local target = Player(param) if not target then player:sendCancelMessage("Player not found.") return false end if target:getAccountType() > player:getAccountType() then player:sendCancelMessage("You can not get info about this player.") return false end local modal = ModalWindow(3478, 'Player Info', '') local message local targetIp = target:getIp() message = "-------------INFO--------------" .. "\nName: " .. target:getName() .. "\nType: " .. (target:getGroup():getAccess() and "God" or "Player") .. "\nPremium Days: " .. target:getPremiumDays() .. "\nXP: " .. target:getExperience() .. "\nLevel: " .. target:getLevel() .. "\nHP: [" .. target:getHealth() .. '/' .. target:getMaxHealth() .. ']' .. "\nMP: [" .. target:getMana() .. '/' .. target:getMaxMana() .. ']' .. "\nMoney: " .. target:getMoney() + target:getBankBalance() .. "\nFree Cap: " .. target:getFreeCapacity() .. "\nStamina: " .. target:getStamina() .. "\nSoul Points: " .. target:getSoul() .. "\nSpeed: " .. target:getSpeed() .. "\nGuild: " .. (target:getGuildNick() and target:getGuildNick() or '-') .. "\nIP: " .. Game.convertIpToString(targetIp) .. "\n\n--------------SET--------------" .. "\nAmulet: " .. (target:getSlotItem(CONST_SLOT_NECKLACE) and capitalize(target:getSlotItem(CONST_SLOT_NECKLACE):getName()) or '-') .. "\nBackpak: " .. (target:getSlotItem(CONST_SLOT_BACKPACK) and capitalize(target:getSlotItem(CONST_SLOT_BACKPACK):getName()) or '-') .. "\nHead: " .. (target:getSlotItem(CONST_SLOT_HEAD) and capitalize(target:getSlotItem(CONST_SLOT_HEAD):getName()) or '-') .. "\nArmor: " .. (target:getSlotItem(CONST_SLOT_ARMOR) and capitalize(target:getSlotItem(CONST_SLOT_ARMOR):getName()) or '-') .. "\nLegs: " .. (target:getSlotItem(CONST_SLOT_LEGS) and capitalize(target:getSlotItem(CONST_SLOT_LEGS):getName()) or '-') .. "\nBoots: " .. (target:getSlotItem(CONST_SLOT_FEET) and capitalize(target:getSlotItem(CONST_SLOT_FEET):getName()) or '-') .. "\nWeapon: " .. (target:getSlotItem(CONST_SLOT_LEFT) and capitalize(target:getSlotItem(CONST_SLOT_LEFT):getName()) or '-') .. "\nShield: " .. (target:getSlotItem(CONST_SLOT_RIGHT) and capitalize(target:getSlotItem(CONST_SLOT_RIGHT):getName()) or '-') .. "\nRing: " .. (target:getSlotItem(CONST_SLOT_RING) and capitalize(target:getSlotItem(CONST_SLOT_RING):getName()) or '-') .. "\nAmmo: " .. (target:getSlotItem(CONST_SLOT_AMMO) and capitalize(target:getSlotItem(CONST_SLOT_AMMO):getName()) or '-') .. "\n\n------------SKILLS-------------" .. "\nML: " .. target:getMagicLevel() .. "\nFist: " .. target:getSkillLevel(SKILL_FIST) .. "\nClub: " .. target:getSkillLevel(SKILL_CLUB) .. "\nSword: " .. target:getSkillLevel(SKILL_SWORD) .. "\nAxe: " .. target:getSkillLevel(SKILL_AXE) .. "\nDistance: " .. target:getSkillLevel(SKILL_DISTANCE) .. "\nShielding: " .. target:getSkillLevel(SKILL_SHIELDING) .. "\nFishing: " .. target:getSkillLevel(SKILL_FISHING) .. "\n\n-----------POSITION----------" .. "\nX: " .. target:getPosition().x .. " | Y: " .. target:getPosition().y .. " | Z: " .. target:getPosition().z modal:setMessage(message) modal:addButton(8738, 'OK') modal:setDefaultEnterButton(8738) modal:sendToPlayer(player) local players = {} for _, targetPlayer in ipairs(Game.getPlayers()) do if targetPlayer:getIp() == targetIp and targetPlayer ~= target then players[#players + 1] = targetPlayer:getName() .. " [" .. targetPlayer:getLevel() .. "]" end end if #players > 0 then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Other players on same IP: " .. table.concat(players, ", ") .. ".") end return false end Agora você vai precisar adicionar uma nova função a biblioteca do seu servidor, para isso vá até a pasta data/lib e abra o arquivo lib.lua e adicione o seguinte código ao fim do arquivo sem substituir nada. data/lib/lib.lua Spoiler function capitalize(str) return string.gsub(" " .. str, "%W%l", string.upper):sub(2) end Com isso você já poderá ser capaz de digitar o comando /info nomeDoJogador e visualizar todas as suas informações (somente se ele estiver online). Caso você queira apenas adicionar este novo comando sem substituir o atual, simplesmente crie um arquivo chamando playerinfo.lua na mesma pasta do info.lua e adicione o seguinte código ao talkactions.xml antes do </talkactions> Spoiler <talkaction words="/playerinfo" separator=" " script="playerinfo.lua" hidden="yes" /> Não se esqueça de adicionar a função a biblioteca de seu servidor. Agora é só digitar /playerinfo nomeDoJogador para ver as suas informações. Bom é isso ai
Postado Dezembro 13, 2017 7 anos @Leohige Especifique que é somente para servidores com client 10.10+ ou que contém otclient devido ao modal! Obrigado por trazer o conteúdo para o TibiaKing! @Tópico aprovado, o tibiaking agradece sua contribuição!
Postado Abril 7, 2018 7 anos o meu é tfs 1.3 e no libs.lua só tem isso: -- Miscellaneous library dofile('data/lib/miscellaneous/miscellaneous.lua') -- Core API functions implemented in Lua dofile('data/lib/core/core.lua') -- Compatibility library for our old Lua API dofile('data/lib/compat/compat.lua') dofile('data/lib/rewardboss.lua') dofile('data/lib/modalwindow.lua') dofile('data/lib/citywars.lua') dofile('data/lib/lionrock.lua') dofile('data/lib/tasksystem.lua') Acredito que se eu add esse teu script ele vai bugar onde add certinho para não bugar?
Postado Abril 7, 2018 7 anos Autor Simplesmente siga como está no tutorial e adicione ao final do arquivo sem substituir nada...
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.