Postado Fevereiro 25, 2018 7 anos Fala Galera Do Tk Estou procurando um Script q quando o player mata o top level do servidor apareça uma menssagem em vermelhor para o server dizendo que o jogador X matou o top Level Do servidor e Recebeu 5 evet coins se estiver na seçao errada mude por favor moderadors mais rep pra quem ajudar uso sistema de efect top level --[[ Script by Bruno Minervino para o Tibia King Caso for postar, colocar os créditos ]] local config = { tempo = 10, --tempo em segundos mensagem = { texto = "[TOP]", --não use mais de 9 caracteres efeito = TEXTCOLOR_LIGHTBLUE --efeito para a função doSendAnimatedText }, efeito = 30, --efeito da função doSendMagicEffect globalstr = 5687 -- uma global storage qualquer q esteje vazia } --[[ Não mexa em nada abaixo ]] local topPlayer = getGlobalStorageValue(config.globalstr) > 0 and getGlobalStorageValue(config.globalstr) or 0 function onLogin(cid) local query = db.getResult("SELECT `id`, `name`, `level` FROM `players` WHERE `group_id` < 2 ORDER BY `level` DESC LIMIT 1") if (query:getID() ~= -1) then local pid = query:getDataString("id") local name = query:getDataString("name") if getPlayerName(cid) == name then if topPlayer ~= getPlayerID(cid) then topPlayer = getPlayerID(cid) end setGlobalStorageValue(config.globalstr, pid) TopEffect(cid) end end registerCreatureEvent(cid, "CheckTop") return true end function onAdvance(cid, skill, oldlevel, newlevel) if skill == 8 then local query = db.getResult("SELECT `id`, `name`, `level` FROM `players` WHERE `group_id` < 2 ORDER BY `level` DESC LIMIT 1") if (query:getID() ~= -1) then local level = tonumber(query:getDataString("level")) if level < newlevel and topPlayer ~= getPlayerID(cid) then doBroadcastMessage("O jogador " .. getPlayerName(cid) .. " tornou-se o novo Top Level. Parabens!", 22) topPlayer = getPlayerID(cid) doSaveServer() setGlobalStorageValue(config.globalstr, getPlayerID(cid)) TopEffect(cid) end end end return true end function TopEffect(cid) if not isPlayer(cid) then return true end if topPlayer == getPlayerID(cid) then doSendAnimatedText(getCreaturePosition(cid), config.mensagem.texto, config.mensagem.efeito) doSendMagicEffect(getCreaturePosition(cid), config.efeito) addEvent(TopEffect, config.tempo * 1000, cid) end end function getPlayerNameById(id) local query = db.getResult("SELECT `name` FROM `players` WHERE `id` = " .. db.escapeString(id)) if query:getID() ~= -1 then return query:getDataString("name") end return 0 end function getPlayerIdByName(name) local query = db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(name)) if query:getID() ~= -1 then return tonumber(query:getDataString("id")) end return 0 end function getPlayerID(cid) return getPlayerIdByName(getPlayerName(cid)) end Agora, mullino disse: @KotZletY ajuda ae amigo
Postado Fevereiro 25, 2018 7 anos Este tópico foi movido para a área correta. Esta é uma mensagem automática!Pedimos que leia as regras do fórum! Spoiler This topic has been moved to the correct area. This is an automated message!Please read the forum rules. Script: Spoiler na pasta lib crie lib/050-functions.lua function triggerHuntFor(cid) if getGlobalStorageValue(31314) ~= cid then setGlobalStorageValue(31314, cid) setGlobalStorageValue(31313, getPlayerLevel(cid)) - doBroadcastMessage("[The Hunt is On!]\nPlayer " ..getCreatureName(cid).. " is the highest level online and thus hunted.\nKilling him/her will reward a bounty!") end end function getHighestOnlineLevel(self,skipself) local highest = {id = 0, level = 0} for _, name in ipairs(getOnlinePlayers()) do local cid = getPlayerByName(name) if cid == self and skipself == true then else if getPlayerLevel(cid) > highest.level then highest.level = getPlayerLevel(cid) highest.id = cid end end end return highest.id end em creaurescripts/scripts function onLogout(cid) if getGlobalStorageValue(31314) == cid then local person = getHighestOnlineLevel(cid, true) doBroadcastMessage("[The Hunt is On!]\nPlayer " ..getPlayerName(cid).. " has logged out as the highest level on the server.\nA new player has been marked for the bounty: " ..getCreatureName(person).. "!\nGet him/her!") triggerHuntFor(cid) end return true end e function onKill(cid, target) if isPlayer(cid) and isPlayer(target) then if getGlobalStorageValue(31314) == target then doBroadcastMessage("[The Hunt is On!]\nPlayer " ..getCreatureName(cid).. " killed the hunter player " ..getCreatureName(target).. " and claimed the bounty!") doPlayerAddItem(cid, rewardID, stacks) -- no rewardID coloque o premio copie e cole essa linha caso queira mais premios end end return true end agora abra o login.lua que existe em creaturescript e adiciona registerCreatureEvent(cid, "LogoutBH") registerCreatureEvent(cid, "KillBH") if getPlayerLevel(cid) > getGlobalStorageValue(31313) then triggerHuntFor(cid) doBroadcastMessage("[The Hunt is On!]\nPlayer " ..getPlayerName(cid).. " has logged in as the highest level on the server.\nThe bounty is on his/her head!") end e por fim no creaturescripts.xml adicione <event type="kill" name="KillBH" event="script" value="killbh.lua"/> <event type="logout" name="LogoutBH" event="script" value="logoutbh.lua"/> Créditos shadowsong Talvez você queira ver: BestBaiak [FAQ]Remere's Map Editor - Dúvidas e soluções de bugs Contato: Discord:
Postado Fevereiro 26, 2018 7 anos @mullino vá em data/creaturescripts/scripts e crie um arquivo chamado KillTOPLevel.lua ou o nome que desejar e nesse arquivo adicione o código abaixo: Spoiler local function getTopLevelName() local name = "" local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `group_id` < 2 ORDER BY `level` DESC LIMIT 1") if query:getID() == -1 then return name end name = query:getDataString("name") query:free() return name end local coin_id = 2160 -- Id do coin que o player vai ganhar! local coins_count = 4 -- Quantidade de coins que vai ganhar! function onKill(cid, target, lastHit) if isPlayer(target) then local top_player = getTopLevelName() if getCreatureName(target) == top_player then doBroadcastMessage("O player "..getCreatureName(cid).." matou o(a) "..top_player.." que atualmente é o TOP Level do jogo, e por isso ganhou "..coins_count.."x Coins!!", class) doPlayerAddItem(cid, coin_id, coins_count) end end return true end Vá em data/creaturescripts e abra o arquivo chamado creaturescripts.xml e adicione a seguinte tag: <event type="kill" name="KillTOPLevel" event="script" value="KillTOPLevel.lua"/> Caso criou o arquivo com outro nome em vez de KillTOPLevel.lua em value=" mude para o nome que você escolheu. Por fim em data/creaturescripts/scripts abra o arquivo login.lua e antes do último return true adicione: registerCreatureEvent(cid, "KillTOPLevel") Bom uso!!
Postado Fevereiro 26, 2018 7 anos Autor 12 horas atrás, KotZletY disse: @mullino vá em data/creaturescripts/scripts e crie um arquivo chamado KillTOPLevel.lua ou o nome que desejar e nesse arquivo adicione o código abaixo: Mostrar conteúdo oculto local function getTopLevelName() local name = "" local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `group_id` < 2 ORDER BY `level` DESC LIMIT 1") if query:getID() == -1 then return name end name = query:getDataString("name") query:free() return name end local coin_id = 2160 -- Id do coin que o player vai ganhar! local coins_count = 4 -- Quantidade de coins que vai ganhar! function onKill(cid, target, lastHit) if isPlayer(target) then local top_player = getTopLevelName() if getCreatureName(target) == top_player then doBroadcastMessage("O player "..getCreatureName(cid).." matou o(a) "..top_player.." que atualmente é o TOP Level do jogo, e por isso ganhou "..coins_count.."x Coins!!", class) doPlayerAddItem(cid, coin_id, coins_count) end end return true end Vá em data/creaturescripts e abra o arquivo chamado creaturescripts.xml e adicione a seguinte tag: <event type="kill" name="KillTOPLevel" event="script" value="KillTOPLevel.lua"/> Caso criou o arquivo com outro nome em vez de KillTOPLevel.lua em value=" mude para o nome que você escolheu. Por fim em data/creaturescripts/scripts abra o arquivo login.lua e antes do último return true adicione: registerCreatureEvent(cid, "KillTOPLevel") Bom uso!! obrigado funcionou perfeitamente podem fexar o topico te love mano
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.