Ir para conteúdo

L3K0T

Membro
  • Registro em

  • Última visita

Tudo que L3K0T postou

  1. local playerPos = getCreaturePosition(cid) -- Obter a posição do jogador local playersOnScreen = getSpectators(playerPos, 7, 5, false, true) -- Obter os jogadores na área de 7x5 tiles em torno do jogador for _, player in ipairs(playersOnScreen) do doPlayerSendChannelMessage(player, TALKTYPE_CHANNEL_O, CHANNEL_TESTE, "Teste", MESSAGE_STATUS_CONSOLE_YELLOW) end Esse é por distância, ele obtém a posição do jogador (getPlayerPosition(cid)) e, em seguida, busca os jogadores na área ao redor usando getPlayersInArea(playerPos, 7, 5). Em seguida, um loop é usado para enviar a mensagem para cada jogador encontrado na área.
  2. Segue que eu disse amigo, first atack é o primeiro dano do player, se ele não foi configurado corretamente, todos os outros danos vão buga quando o player estiver sem arma.
  3. Se puder poste a solução para ajudar as outras pessoas
  4. "if pontos then" considera qualquer valor diferente de "false" ou "nil" como verdadeiro. "if pontos ~= nil" verifica explicitamente se pontos não é igual a "nil".
  5. Procure por esse " int32_t Player::getFistDamage() const" deve ter ja no seu codigo, resumindo... o código desse mesmo modelo já existe dentro do arquivo, ache ele e remova e deixando o código novo
  6. Só reverter o processo... Em protocolgame.cpp procure por: msg->put<uint16_t>(player->getHealth()); msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH)); Substitua : if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0) { msg->put<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH))); msg->put<uint16_t>(100); } else { msg->put<uint16_t>(0); msg->put<uint16_t>(0); } Mude Para: if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0) { msg->put<uint16_t>(player->getHealth()); msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH)); } else { msg->put<uint16_t>(0); msg->put<uint16_t>(0); } Depois procure por: msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA)); msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA)); Substitua: if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0) { msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA)); msg->put<uint16_t>(100); } else { msg->put<uint16_t>(0); msg->put<uint16_t>(0); } Muda Para: if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0) { msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA)); msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA)); } else { msg->put<uint16_t>(0); msg->put<uint16_t>(0); } Agora é só compilar sua sourcer
  7. A parte que o Luciano disse, fiz alteração local pontos = getPlayerStorageValue(players[i], boss.storage) if pontos ~= nil then if i == 1 then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) addLoot(boss.sempre, tabela_reward, true) elseif i >= 2 and pontos >= math.ceil((porcentagem * 0.8)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) addLoot(boss.muito_raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.8)) and pontos >= math.ceil((porcentagem * 0.6)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.6)) and pontos >= math.ceil((porcentagem * 0.4)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.4)) and pontos >= math.ceil((porcentagem * 0.1)) then addLoot(boss.comum, tabela_reward, false) end addRewardLoot(players[i], bossName, tabela_reward) end Esse erro que vc citou é porque alguém ficou desconectado durante a batalha e deslogo causando o erro, vc disse que de vez enquando aparece, então é isso foi adicionado no script if pontos ~= nil then
  8. Source uint32_t Player::getAttackSpeed() const { int32_t SpeedAttack; SpeedAttack = vocation->getAttackSpeed() - (getSkill(SKILL_FIST, SKILL_LEVEL) * 9); if (SpeedAttack < 350) { return 350; } else { return (uint32_t)SpeedAttack; } } int32_t Player::getFistDamage() const { int32_t FistDamage; FistDamage = vocation->getFistDamage() - (getSkill(SKILL_FIST, SKILL_LEVEL) * 2); if (FistDamage < 1) { return 1; } else { return FistDamage; } }
  9. Na verdade pra ele ser kikado vc deverá por no login.lua pra verificar se o playeré Premium ou não, se ele logar e não for vip seja lá aonde ele estiver, ele vai pro templo da cidade principal <event type="login" name="LoginScriptVip" script="loginVip.lua"/> local TEMPLE_POSITION = {x = 100, y = 200, z = 7} -- Coordenadas do templo function onLogin(cid) local vip = getPlayerPremiumDays(cid) if vip == 0 then -- Teleporta o jogador para o templo doTeleportThing(cid, TEMPLE_POSITION, false) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Seu VIP acabou. Você foi teleportado para o templo.") setPlayerStorageValue(cid, 18956, -1) -- Define a storage 18956 como -1 return false -- Evita que o jogador execute outras ações após o login end return true end *configure pra onde o player vai quando o vip acabar Vc mandou um Use item e mandou aonde o player entra pra acessar a área vip, mais pra mandar o player pra área free depois que acabar o vip é outro script, mandei um exemplo acima, testa ai
  10. <event type="death" name="onDeath" script="avoidSameIPKill.lua"/> function onDeath(cid, corpse, killer) local playerIp = getPlayerIp(cid) local killerIp = getPlayerIp(killer) -- Verifica se o jogador morto e o jogador que matou têm o mesmo IP if playerIp == killerIp then return false -- Evita registrar a kill end -- Resto da lógica para contabilizar as kills normalmente return true end
  11. function onUse(cid, item, fromPosition, itemEx, toPosition) local ITEM_ID = 12780 -- ID do item Senzu Bean local STORAGE_ID = 50000 -- ID de armazenamento para controle de cooldown local COOLDOWN_TIME = 60 -- Tempo de recarga em segundos local HEAL_PERCENTAGE = 20 -- Porcentagem de vida e mana a ser curada local EFFECT_ID = 80 -- ID do efeito visual ao usar a Senzu Bean local pos = getPlayerPosition(cid) local newPos = {x = pos.x + 1, y = pos.y, z = pos.z} -- Verifica se o item usado é uma Senzu Bean if item.itemid ~= ITEM_ID then doPlayerSendCancel(cid, "You must use a Senzu Bean.") return TRUE end -- Verifica se o jogador está em cooldown if exhaustion.get(cid, STORAGE_ID) == TRUE then local cooldownTime = exhaustion.get(cid, STORAGE_ID) / 1000 doPlayerSendCancel(cid, "You are still in cooldown for " .. cooldownTime .. " seconds.") return TRUE end -- Calcula a quantidade de vida e mana a ser curada com base na porcentagem local maxHealth = getCreatureMaxHealth(cid) local maxMana = getCreatureMaxMana(cid) local healAmount = math.floor(maxHealth * HEAL_PERCENTAGE / 100) local manaAmount = math.floor(maxMana * HEAL_PERCENTAGE / 100) -- Cura o jogador doPlayerAddMana(cid, manaAmount) doCreatureAddHealth(cid, healAmount) -- Exibe a mensagem e o efeito visual doCreatureSay(cid, "Aaahhh! Bem melhor!", TALKTYPE_ORANGE_1) doSendMagicEffect(newPos, EFFECT_ID) -- Remove a Senzu Bean do inventário doRemoveItem(item.uid, 1) -- Define o tempo de cooldown exhaustion.set(cid, STORAGE_ID, COOLDOWN_TIME * 1000) return TRUE end
  12. Curando 20% mana e vida function onUse(cid, item, fromPosition, itemEx, toPosition) local ITEM_ID = 12780 -- ID do item Senzu Bean local STORAGE_ID = 50000 -- ID de armazenamento para controle de cooldown local COOLDOWN_TIME = 60 -- Tempo de recarga em segundos local HEAL_PERCENTAGE = 20 -- Porcentagem de vida e mana a ser curada local EFFECT_ID = 80 -- ID do efeito visual ao usar a Senzu Bean local pos = getPlayerPosition(cid) local newPos = {x = pos.x + 1, y = pos.y, z = pos.z} -- Verifica se o item usado é uma Senzu Bean if item.itemid ~= ITEM_ID then doPlayerSendCancel(cid, "You must use a Senzu Bean.") return TRUE end -- Verifica se o jogador está em cooldown if exhaustion.get(cid, STORAGE_ID) == TRUE then local cooldownTime = exhaustion.get(cid, STORAGE_ID) / 1000 doPlayerSendCancel(cid, "You are still in cooldown for " .. cooldownTime .. " seconds.") return TRUE end -- Calcula a quantidade de vida e mana a ser curada com base na porcentagem local maxHealth = getPlayerMaxHealth(cid) local maxMana = getPlayerMaxMana(cid) local healAmount = math.floor(maxHealth * HEAL_PERCENTAGE / 100) local manaAmount = math.floor(maxMana * HEAL_PERCENTAGE / 100) -- Cura o jogador doPlayerAddMana(cid, manaAmount) doCreatureAddHealth(cid, healAmount) -- Exibe a mensagem e o efeito visual doCreatureSay(cid, "Aaahhh! Bem melhor!", TALKTYPE_ORANGE_1) doSendMagicEffect(newPos, EFFECT_ID) -- Remove a Senzu Bean do inventário doRemoveItem(item.uid, 1) -- Define o tempo de cooldown exhaustion.set(cid, STORAGE_ID, COOLDOWN_TIME * 1000) return TRUE end
  13. Te ajuda? function onUse(cid, item, fromPosition, itemEx, toPosition) local ITEM_ID = 12780 -- ID do item Senzu Bean local STORAGE_ID = 50000 -- ID de armazenamento para controle de cooldown local COOLDOWN_TIME = 60 -- Tempo de recarga em segundos local HEAL_AMOUNT = 200000 -- Quantidade de vida e mana a ser curada local EFFECT_ID = 80 -- ID do efeito visual ao usar a Senzu Bean local pos = getPlayerPosition(cid) local newPos = {x = pos.x + 1, y = pos.y, z = pos.z} -- Verifica se o item usado é uma Senzu Bean if item.itemid ~= ITEM_ID then doPlayerSendCancel(cid, "You must use a Senzu Bean.") return TRUE end -- Verifica se o jogador está em cooldown if exhaustion.get(cid, STORAGE_ID) == TRUE then local cooldownTime = exhaustion.get(cid, STORAGE_ID) / 1000 doPlayerSendCancel(cid, "You are still in cooldown for " .. cooldownTime .. " seconds.") return TRUE end -- Cura o jogador doPlayerAddMana(cid, HEAL_AMOUNT) doCreatureAddHealth(cid, HEAL_AMOUNT) -- Exibe a mensagem e o efeito visual doCreatureSay(cid, "Aaahhh! Bem melhor!", TALKTYPE_ORANGE_1) doSendMagicEffect(newPos, EFFECT_ID) -- Remove a Senzu Bean do inventário doRemoveItem(item.uid, 1) -- Define o tempo de cooldown exhaustion.set(cid, STORAGE_ID, COOLDOWN_TIME * 1000) return TRUE end
  14. local storages = {13002} local message = [[ ( Guia Nto Hard ) Desça no subsolo de Konoha e procure por criaturas para batalhar! 1. Utilize Jutsus para Curar (Regeneration) e Atacar (Throw Kunai). 2. Utilize a palavra (skip) para subir e sair do calabouço! ]] local signature = "L3K0T" function onStepIn(cid, item, position, fromPosition) if isPlayer(cid) then for _, v in ipairs(storages) do if getPlayerStorageValue(cid, v) <= 0 then doPlayerPopupFYI(cid, message) setPlayerStorageValue(cid, 13002, 1) return doTeleportThing(cid, fromPosition) end end end local script = tostring(onStepIn) if not string.find(script, signature) then print("A assinatura foi removida do script!") -- Tome a ação adequada aqui, por exemplo, enviar uma mensagem para o administrador. end end
  15. Tenta isso rateStaminaLoss = 5 rateStaminaGain = 2 rateStaminaThresholdGain = 12 staminaRatingLimitTop = 42 * 60 staminaRatingLimitBottom = 6 * 60 rateStaminaAboveNormal = 1.5 rateStaminaUnderNormal = 0.5 staminaThresholdOnlyPremium = true
  16. function Player.canAttack(cid, target) -- Verifica se o jogador e o alvo são jogadores reais (não NPCs ou criaturas) if not isPlayer(cid) or not isPlayer(target) then return true end -- Verifica se o jogador está usando MC e tem o mesmo endereço IP que o alvo if getPlayerClient(cid).isMC and getPlayerIp(cid) == getPlayerIp(target) then -- Se as condições acima forem verdadeiras, envia uma mensagem de cancelamento para o jogador e impede o ataque doPlayerSendCancel(cid, "Você não pode atacar outro jogador enquanto estiver usando MC com o mesmo endereço IP.") return false end -- Se as condições acima não forem verdadeiras, permite que o ataque ocorra normalmente return true end function onPrepareDeath(cid, killer) -- Se o jogador morreu para outro jogador, atualiza a lista de frags if isPlayer(killer) and killer ~= cid then doPlayerAddFrags(killer, 1) doPlayerAddKill(cid, 1) end return true end function onLogin(cid) -- Ao entrar no jogo, exibe a mensagem de boas-vindas e atualiza a lista de frags doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Bem-vindo ao servidor de PvP!") doPlayerUpdateFrags(cid) return true end function onLogout(cid) -- Ao sair do jogo, atualiza a lista de frags doPlayerUpdateFrags(cid) return true end function onKill(cid, target) -- Exibe a mensagem de morte para o jogador e atualiza a lista de frags doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você matou " .. getCreatureName(target) .. ".") doPlayerUpdateFrags(cid) return true end function onDeath(cid, killer) -- Exibe a mensagem de morte para o jogador e atualiza a lista de frags doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você foi morto por " .. getCreatureName(killer) .. ".") doPlayerUpdateFrags(cid) return true end <event type="login" name="PvpOnLogin" event="script" value="pvp.lua"/> <event type="logout" name="PvpOnLogout" event="script" value="pvp.lua"/> <event type="preparedeath" name="PvpOnPrepareDeath" event="script" value="pvp.lua"/> <event type="kill" name="PvpOnKill" event="script" value="pvp.lua"/> <event type="death" name="PvpOnDeath" event="script" value="pvp.lua"/> <event type="attack" name="PvpOnAttack" event="script" value="pvp.lua"/> <event type="advance" name="PvpOnAdvance" event="script" value="pvp.lua"/> <event type="login" name="PvpFragsOnLogin" event="script" value="frags.lua"/> <event type="logout" name="PvpFragsOnLogout" event="script" value="frags.lua"/> <event type="preparedeath" name="PvpFragsOnPrepareDeath" event="script" value="frags.lua"/> <event type="kill" name="PvpFragsOnKill" event="script" value="frags.lua"/> <event type="death" name="PvpFragsOnDeath" event="script" value="frags.lua"/> <event type="advance" name="PvpFragsOnAdvance" event="script" value="frags.lua"/>
  17. Remove todos os espaços, comentários e verifique se o mysql esta configurado correto com o seu banco de dados
  18. L3K0T postou uma resposta no tópico em Suporte Tibia OTServer
    Este tópico foi movido para a seção de Suporte Otserv.
  19. Tenta local STAMINA_GAIN = 2 -- Quantidade de stamina recuperada por minuto local STAMINA_INTERVAL = 60 * 1000 -- Intervalo de tempo entre cada aumento de stamina (em milissegundos) function onLogin(cid) checkStamina(cid) -- Verifica se o jogador já está dormindo ao entrar no jogo end function onLogout(cid) stopStaminaGain(cid) -- Remove o evento de aumento de stamina ao sair do jogo end function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) stopStaminaGain(cid) -- Remove o evento de aumento de stamina ao mudar de posição end function checkStamina(cid) if getPlayerSoul(cid) == SOUL_SLEEPING then startStaminaGain(cid) end end function startStaminaGain(cid) addEvent(function() if getPlayerSoul(cid) ~= SOUL_SLEEPING then stopStaminaGain(cid) return end doPlayerAddStamina(cid, STAMINA_GAIN) startStaminaGain(cid) end, STAMINA_INTERVAL) end function stopStaminaGain(cid) stopEvent("stamina_gain_" .. cid) -- Remove o evento de aumento de stamina end function onUse(cid, item, fromPosition, itemEx, toPosition) if item.itemid == ID DA CAMA AQUI then -- ID do item que permite dormir doChangeSoulState(cid, SOUL_SLEEPING) checkStamina(cid) end return true end <event type="login" name="StaminaRegenLogin" script="staminaregen_login.lua"/> <event type="logout" name="StaminaRegenLogout" script="staminaregen_logout.lua"/> <event type="death" name="StaminaRegenDeath" script="staminaregen_death.lua"/> <event type="advance" name="StaminaRegenAdvance" script="staminaregen_advance.lua"/> <event type="minute" name="StaminaRegenMinute" script="staminaregen_minute.lua"/> <event type="startup" name="StaminaRegenStartup" script="staminaregen_startup.lua"/>
  20. Ve se te ajuda data/creturescript/creaturescript.xnml. <event type="advance" name="AntiBotAdvance" script="antibot_advance.lua"/> data/creturescript/antibot_advance.lua. local creaturesToKill = math.random(300, 1000) local antiBotStorage = 25631 -- armazena quantas criaturas o jogador matou local antiBotTime = 30 -- tempo em segundos para o jogador matar o número de criaturas necessárias function onKill(cid, target, lastHit) if isPlayer(cid) and isCreature(target) then local storageValue = getPlayerStorageValue(cid, antiBotStorage) if storageValue < creaturesToKill then setPlayerStorageValue(cid, antiBotStorage, storageValue + 1) if storageValue + 1 == creaturesToKill then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. creaturesToKill .. " criaturas! Por favor, resolva o anti-bot para continuar jogando.") setPlayerStorageValue(cid, antiBotStorage, -antiBotTime) -- inicia o tempo para o jogador resolver o anti-bot end end end end function onThink(interval, lastExecution) for _, playerId in ipairs(getPlayersOnline()) do local storageValue = getPlayerStorageValue(playerId, antiBotStorage) if storageValue > 0 then if storageValue < creaturesToKill then doPlayerSendTextMessage(playerId, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. storageValue .. " criaturas. Continue matando para resolver o anti-bot.") elseif storageValue == creaturesToKill then local timeLeft = getPlayerStorageValue(playerId, antiBotStorage) + antiBotTime - os.time() if timeLeft <= 0 then doPlayerSendTextMessage(playerId, MESSAGE_STATUS_CONSOLE_ORANGE, "Tempo esgotado para resolver o anti-bot. Você será desconectado em breve.") doRemoveCreature(playerId) else doPlayerSendTextMessage(playerId, MESSAGE_STATUS_CONSOLE_ORANGE, "Por favor, resolva o anti-bot em " .. timeLeft .. " segundos para continuar jogando.") end end end end return true end data/creturescript/creaturescript.xnml. <event type="login" name="AntiBotLogin" script="antibot_login.lua"/> data/creturescript/antibot_login.lua. function onLogin(cid) local storageValue = getPlayerStorageValue(cid, antiBotStorage) if storageValue > 0 then if storageValue < creaturesToKill then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. storageValue .. " criaturas. Continue matando para resolver o anti-bot.") elseif storageValue == creaturesToKill then local timeLeft = getPlayerStorageValue(cid, antiBotStorage) + antiBotTime - os.time() if timeLeft <= 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Tempo esgotado para resolver o anti-bot. Você será desconectado em breve.") doRemoveCreature(cid) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Por favor, resolva o anti-bot em " .. timeLeft .. " segundos para continuar jogando.") end end end return true end data/creturescript/creaturescript.xnml. <event type="logout" name="AntiBotLogout" script="antibot_logout.lua"/> data/creturescript/antibot_logout.lua function onLogout(cid) setPlayerStorageValue(cid, antiBotStorage, 0) return true end
  21. L3K0T postou uma resposta no tópico em Suporte Tibia OTServer
    Cade o script?
  22. Voce pode tantar essa formula 0.9 * 1000 ficando local config = { lifeGain = 5.5, lifeGainMax = 8, manaGain = 5.5, manaGainMax = 8, exhaustionSeconds = 0.9 * 1000, effectChar = 212 } function onUse(cid, item, fromPosition, itemEx, toPosition) if exhaustion.check(cid, item.itemid) then local timeLeft = exhaustion.get(cid, item.itemid) if timeLeft > 0 then doPlayerSendCancel(cid, "You are exhausted. You need to wait " .. timeLeft .. " seconds before using this item again.") return true end end doRemoveItem(item.uid, 1) local health = getCreatureMaxHealth(cid) * (config.lifeGain/100) local mana = getCreatureMaxMana(cid) * (config.manaGain/100) local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100) local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100) doCreatureAddHealth(cid, math.random(health, healthmax)) doCreatureAddMana(cid, math.random(mana, manamax)) doSendMagicEffect(getPlayerPosition(cid), config.effectChar) exhaustion.set(cid, item.itemid, config.exhaustionSeconds) return true end

Informação Importante

Confirmação de Termo