Ir para conteúdo

El Rusher

Cavaleiro
  • Total de itens

    185
  • Registro em

  • Última visita

  • Dias Ganhos

    24

Tudo que El Rusher postou

  1. function onSay(cid, words, param) --[Configurações de Condição]__ config = { --[[verdadeiro / Falso]] needPa = false, -- Precisa de Premium Account? [true / false] needPz = false, -- Precisa estar em Protection Zone? [true / false] battle = false, -- Precisa estar sem Batlle para Resetar? [true / false] withe = false, -- Players PK Withe pode Resetar? [true / false] red = false, -- Players PK Red pode Resetar? [true / false] tp = false, -- Teleportar para o Templo após o reset? [true / false] look = true, -- Mostrar Resets no Look do Player? [true / false] addLimite = true, -- Abilitar Limite de Resets? [true / false] setClasse = false, -- Mudar Vocação do player quando resetar? [true / false] storage = 54676, -- Storage [valor] --[Configurações do Reset]__ resetStatus = { player = getPlayerGUID(cid), -- Não Mude. lvl = 717217, -- Level Necessário para Resetar. [valor] lvlreset = 1, -- Level que retornará após o Reset. [valor] limite = 100, -- Máximo de resets que um player pode chegar. [valor] newClasse = 0, -- Id da Nova Vocação após o Reset. [valor] tempo = 0 }, } --[Funções]__ function Reseting(cid) resets = getResets(cid) setPlayerStorageValue(cid, config.storage, resets+1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doPlayerSetVocation(cid, config.resetStatus.newClasse) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player) db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player) return TRUE end function noAll(cid) resets = getResets(cid) setPlayerStorageValue(cid, config.storage, resets+1) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player) db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player) return TRUE end function noTeleporting(cid) resets = getResets(cid) setPlayerStorageValue(cid, config.storage, resets+1) doPlayerSetVocation(cid, config.resetStatus.newClasse) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player) db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player) return TRUE end function noLook(cid) resets = getResets(cid) setPlayerStorageValue(cid, config.storage, resets+1) doPlayerSetVocation(cid, config.resetStatus.newClasse) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player) db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player) return TRUE end function noClasse(cid) resets = getResets(cid) setPlayerStorageValue(cid, config.storage, resets+1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player) db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player) return TRUE end function setClasse(cid) resets = getResets(cid) setPlayerStorageValue(cid, config.storage, resets+1) doPlayerSetVocation(cid, config.resetStatus.newClasse) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player) db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player) return TRUE end function look(cid) resets = getResets(cid) setPlayerStorageValue(cid, config.storage, resets+1) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player) db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player) return TRUE end function teleporting(cid) resets = getResets(cid) setPlayerStorageValue(cid, config.storage, resets+1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player) db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player) return TRUE end function getResets(cid) local resets = getPlayerStorageValue(cid, config.storage) -- If the storage value is less than 0 or invalid, set resets to 0 if type(resets) ~= "number" or resets < 0 then resets = 0 end return resets end -- Função para verificar se o jogador tem VIP (normal ou infinito) function hasVipAccess(cid) local vipInfiniteStorage = 13587 local vipNormalStorage = 13545 local currentTime = os.time() -- Verifica VIP infinito (valor máximo de int32) if getPlayerStorageValue(cid, vipInfiniteStorage) == 2^31 - 1 then return true end -- Verifica VIP normal (baseado no tempo) if getPlayerStorageValue(cid, vipNormalStorage) > currentTime then return true end return false end local resets = getResets(cid) local needLvl = "Você precisa de "..config.resetStatus.lvl-getPlayerLevel(cid).." level's para resetar." local msg = "~~[Reset: "..getResets(cid).."]~~ 'Sucesso ao Resetar! Você será deslogado em "..config.resetStatus.tempo.." Segundos." --[Condiçoes]__ -- Verifica se o jogador tem acesso VIP if not hasVipAccess(cid) then doPlayerSendTextMessage(cid, 22, "Você precisa ter VIP (normal ou infinito) para usar o sistema de reset.") return true elseif(config.needPz == true) and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then doPlayerSendTextMessage(cid, 22, "Voce Precisa estar em Protection Zone Para Resetar.") return TRUE elseif(config.addLimite == true) and (getResets(cid) == config.resetStatus.limite) then doPlayerSendTextMessage(cid, 22, "Voce ja atingiu o Limite de Resets.") return TRUE elseif(config.withe == false) and (getCreatureSkullType(cid) == 3) then doPlayerSendTextMessage(cid, 22, "Voce ta PK White, por isso não pode resetar.") return TRUE elseif(config.red == false) and (getCreatureSkullType(cid) == 4) then doPlayerSendTextMessage(cid, 22, "Voce ta PK Red, por isso não pode resetar.") return TRUE elseif(config.needPa == true) and not isPremium(cid) then doPlayerSendTextMessage(cid, 22, "Voce Precisa ser Premium Account para Resetar.") return TRUE elseif(config.battle == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then doPlayerSendTextMessage(cid, 22, "Voce Precisa estar sem Battle para Resetar.") return TRUE elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == true) and (config.setClasse == true) then addEvent(Reseting, config.resetStatus.tempo* 1000, cid) doPlayerSendTextMessage(cid, 22, msg) elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == false) and (config.setClasse == false) then addEvent(noAll, config.resetStatus.tempo* 1000, cid) doPlayerSendTextMessage(cid, 22, msg) elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == true) and (config.setClasse == true) then addEvent(noTeleporting, config.resetStatus.tempo* 1000, cid) doPlayerSendTextMessage(cid, 22, msg) elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == false) and (config.setClasse == true) then addEvent(noLook, config.resetStatus.tempo* 1000, cid) doPlayerSendTextMessage(cid, 22, msg) elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == true) and (config.setClasse == false) then addEvent(noClasse, config.resetStatus.tempo* 1000, cid) doPlayerSendTextMessage(cid, 22, msg) elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == false) and (config.setClasse == true) then addEvent(setClasse, config.resetStatus.tempo* 1000, cid) doPlayerSendTextMessage(cid, 22, msg) elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == true) and (config.setClasse == false) then addEvent(look, config.resetStatus.tempo* 1000, cid) doPlayerSendTextMessage(cid, 22, msg) elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == false) and (config.setClasse == false) then addEvent(teleporting, config.resetStatus.tempo* 1000, cid) doPlayerSendTextMessage(cid, 22, msg) elseif doPlayerSendCancel(cid, needLvl) then doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) return TRUE end return TRUE end
  2. local arrs = { { {0, 1, 0}, {1, 2, 1}, {0, 1, 0} }, { {0, 1, 1, 1, 0}, {1, 1, 0, 1, 1}, {1, 0, 2, 0, 1}, {1, 1, 0, 1, 1}, {0, 1, 1, 1, 0} }, { {0, 0, 1, 0, 1, 0, 0}, {0, 1, 0, 1, 0, 1, 0}, {1, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 2, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 1}, {0, 1, 0, 0, 0, 1, 0}, {0, 0, 1, 1, 1, 0, 0} }, { {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0}, {0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0}, {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1}, {1, 1, 0, 0, 0, 2, 0, 0, 0, 1, 1}, {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1}, {0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0}, {0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0} } } local arr1 = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} } local arr2 = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} } local arr3 = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} } local arr4 = { {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0}, {0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0}, {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1}, {1, 1, 0, 0, 0, 2, 0, 0, 0, 1, 1}, {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1}, {0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0}, {0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0} } local area1 = createCombatArea(arr1) local area2 = createCombatArea(arr2) local area3 = createCombatArea(arr3) local area4 = createCombatArea(arr4) -- Dano do spell - Fase 1 function onGetFormulaValues1(cid, level, maglevel) local min = 1 local max = 1 return -min, -max end -- Dano do spell - Fase 2 function onGetFormulaValues2(cid, level, maglevel) local min = 2 local max = 2 return -min, -max end -- Dano do spell - Fase 3 function onGetFormulaValues3(cid, level, maglevel) local min = 3 local max = 3 return -min, -max end -- Dano do spell - Fase 4 function onGetFormulaValues4(cid, level, maglevel) local min = 4 local max = 4 return -min, -max end -- Efeito visual para o alvo - Fase 1 function onTargetTile1(cid, pos) doSendDistanceShoot(getCreaturePosition(cid), pos, CONST_ANI_HOLY) return true end -- Efeito visual para o alvo - Fase 2 function onTargetTile2(cid, pos) doSendDistanceShoot(getCreaturePosition(cid), pos, CONST_ANI_HOLY) return true end -- Efeito visual para o alvo - Fase 3 function onTargetTile3(cid, pos) doSendDistanceShoot(getCreaturePosition(cid), pos, CONST_ANI_HOLY) return true end -- Efeito visual para o alvo - Fase 4 function onTargetTile4(cid, pos) doSendDistanceShoot(getCreaturePosition(cid), pos, CONST_ANI_HOLY) return true end -- Criação do combate - Fase 1 local combat1 = createCombatObject() setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE) setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA) setCombatArea(combat1, area1) setCombatCallback(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues1") setCombatCallback(combat1, CALLBACK_PARAM_TARGETTILE, "onTargetTile1") -- Criação do combate - Fase 2 local combat2 = createCombatObject() setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE) setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE) setCombatArea(combat2, area2) setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2") setCombatCallback(combat2, CALLBACK_PARAM_TARGETTILE, "onTargetTile2") -- Criação do combate - Fase 3 local combat3 = createCombatObject() setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE) setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE) setCombatArea(combat3, area3) setCombatCallback(combat3, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues3") setCombatCallback(combat3, CALLBACK_PARAM_TARGETTILE, "onTargetTile3") -- Criação do combate - Fase 4 local combat4 = createCombatObject() setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE) setCombatParam(combat4, COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER) setCombatArea(combat4, area4) setCombatCallback(combat4, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues4") setCombatCallback(combat4, CALLBACK_PARAM_TARGETTILE, "onTargetTile4") -- Funções para executar cada fase do spell function castSpell1(parameters) if isCreature(parameters.cid) then doCombat(parameters.cid, combat1, parameters.var) end return true end function castSpell2(parameters) if isCreature(parameters.cid) then doCombat(parameters.cid, combat2, parameters.var) end return true end function castSpell3(parameters) if isCreature(parameters.cid) then doCombat(parameters.cid, combat3, parameters.var) end return true end function castSpell4(parameters) if isCreature(parameters.cid) then doCombat(parameters.cid, combat4, parameters.var) end return true end function onCastSpell(cid, var) -- Executa a primeira fase imediatamente doCombat(cid, combat1, var) -- Agenda as próximas fases com atrasos diferentes local parameters = {cid = cid, var = var} addEvent(castSpell2, 100, parameters) addEvent(castSpell3, 250, parameters) addEvent(castSpell4, 500, parameters) return true end
  3. local config = { {item = 8310, qntd_max = 2, chance = 45, nome = "Gold Ingot"}, {item = 12635, qntd_max = 1, chance = 25, nome = "Mechanic Box"}, {item = 12636, qntd_max = 1, chance = 15, nome = "Surprise Box"}, {item = 9971, qntd_max = 50, chance = 50, nome = "Gold Coin"}, {item = 11390, qntd_max = 1, chance = 20, nome = "Platinum Amulet", raro = true}, } function onUse(cid, item, fromPos, itemEx, toPos) local msgsucesso = "Você abriu uma box e encontrou: " local check = 0 local ganhou = false local itensGanhos = {} for _, var in pairs(config) do if math.random(1, 100) <= var.chance and check < 5 then doPlayerAddItem(cid, var.item, var.qntd_max) check = check + 1 ganhou = true -- Adiciona à lista de itens ganhos table.insert(itensGanhos, var.qntd_max .. "x " .. var.nome) -- Se for um item raro, notifica todo o servidor if var.raro then local playerName = getCreatureName(cid) local msgRaro = playerName .. " encontrou um item raro: " .. var.nome .. "!" doBroadcastMessage(msgRaro, MESSAGE_STATUS_WARNING) end end end if ganhou then -- Cria mensagem com itens ganhos local mensagemFinal = msgsucesso .. table.concat(itensGanhos, ", ") -- Exibe mensagem flutuante acima do jogador doCreatureSay(cid, mensagemFinal, TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), 49) doRemoveItem(item.uid, 1) else -- Caso não ganhe nada doCreatureSay(cid, "Você abriu a box mas não encontrou nada de valor.", TALKTYPE_ORANGE_1) doRemoveItem(item.uid, 1) end return true end
  4. local config = { p_time = 3600 -- Tempo em segundos para receber os pontos (1 hora) } function onSay(cid, words, param, channel) local getP = getPoints(cid) local lastTime = getCreatureStorage(cid, 1219) local currentTime = os.time() -- Usa o tempo de jogo local timeElapsed = currentTime - lastTime local timeRemaining = config.p_time - timeElapsed if timeRemaining < 0 then timeRemaining = 0 end local hours = math.floor(timeRemaining / 3600) local minutes = math.floor((timeRemaining % 3600) / 60) local seconds = timeRemaining % 60 doPlayerPopupFYI(cid, string.format("Você possui %d p-points!\nPróximo ponto em: %02d:%02d:%02d", getP, hours, minutes, seconds)) return true end local config = { p_time = 3600, -- Tempo em segundos para receber os pontos (1 hora) p_points = 1 -- Quantidade de pontos recebida a cada "p_time" } local GLOBAL_TIME_STORAGE = 1220 -- Define um storage global para o tempo de jogo local function givePoints(cid, quant) local currentTime = os.time() -- Usa o tempo de jogo if currentTime - getCreatureStorage(cid, 1219) >= config.p_time then doPlayerSendTextMessage(cid, 19, "Parabéns, você recebeu ".. config.p_points .." p-point. Agora você tem ".. config.p_points + getPoints(cid) .." p-points na sua conta. Seu tempo foi zerado, próximo p-points daqui 1 hora.") doPlayerAddPoints(cid, quant) doCreatureSetStorage(cid, 1219, currentTime) end return true end function onThink(interval) local currentTime = os.time() setGlobalStorageValue(GLOBAL_TIME_STORAGE, currentTime) for i, v in pairs(getPlayersOnline()) do if getCreatureStorage(v, 1219) > 0 then -- Verifica se o storage está inicializado givePoints(v, config.p_points) else doCreatureSetStorage(v, 1219, currentTime) -- Inicializa o storage para novos personagens end end return true end
  5. bom dia talkaction: local config = { p_time = 3600 -- Tempo em segundos para receber os pontos (1 hora) } function onSay(cid, words, param, channel) local getP = getPoints(cid) local lastTime = getCreatureStorage(cid, 1219) local currentTime = getGlobalStorageValue(GLOBAL_TIME_STORAGE) or os.time() -- Usa o tempo de jogo local timeElapsed = currentTime - lastTime local timeRemaining = config.p_time - timeElapsed if timeRemaining < 0 then timeRemaining = 0 end local hours = math.floor(timeRemaining / 3600) local minutes = math.floor((timeRemaining % 3600) / 60) local seconds = timeRemaining % 60 doPlayerPopupFYI(cid, string.format("Você possui %d p-points!\nPróximo ponto em: %02d:%02d:%02d", getP, hours, minutes, seconds)) return true end globalevent: local config = { p_time = 3600, -- Tempo em segundos para receber os pontos (1 hora) p_points = 1 -- Quantidade de pontos recebida a cada "p_time" } local GLOBAL_TIME_STORAGE = 1220 -- Define um storage global para o tempo de jogo local function givePoints(cid, quant) local currentTime = getGlobalStorageValue(GLOBAL_TIME_STORAGE) or os.time() -- Usa o tempo de jogo if currentTime - getCreatureStorage(cid, 1219) >= config.p_time then doPlayerSendTextMessage(cid, 19, "Parabéns, você recebeu ".. config.p_points .." p-point. Agora você tem ".. config.p_points + getPoints(cid) .." p-points na sua conta. Seu tempo foi zerado, próximo p-points daqui 1 hora.") doPlayerAddPoints(cid, quant) doCreatureSetStorage(cid, 1219, currentTime) end return true end function onThink(interval) local currentTime = getGlobalStorageValue(GLOBAL_TIME_STORAGE) or os.time() setGlobalStorageValue(GLOBAL_TIME_STORAGE, currentTime + interval) for i, v in pairs(getPlayersOnline()) do if getCreatureStorage(v, 1219) > 0 then -- Verifica se o storage está inicializado givePoints(v, config.p_points) else doCreatureSetStorage(v, 1219, currentTime) -- Inicializa o storage para novos personagens end end return true end
  6. no points.lua adicione o seguinte no inicio do script: local config = { p_time = 3600 -- Tempo em segundos para receber os pontos (1 hora) } local config = { p_time = 3600 -- Tempo em segundos para receber os pontos (1 hora) } function onSay(cid, words, param, channel) local getP = getPoints(cid) local lastTime = getCreatureStorage(cid, 1219) local currentTime = os.time() local timeElapsed = currentTime - lastTime local timeRemaining = config.p_time - timeElapsed if timeRemaining < 0 then timeRemaining = 0 end local hours = math.floor(timeRemaining / 3600) local minutes = math.floor((timeRemaining % 3600) / 60) local seconds = timeRemaining % 60 doPlayerPopupFYI(cid, string.format("Você possui %d p-points!\nPróximo ponto em: %02d:%02d:%02d", getP, hours, minutes, seconds)) return true end
  7. local waterIds = {493, 4608} -- IDs das tiles de água, adicione aqui os IDs específicos das tiles de água que você está usando. local storageSurf = 1000 -- ID de armazenamento para a surf local storageBike = 1001 -- ID de armazenamento para a bicicleta local storageDive = 1002 -- ID de armazenamento para mergulho local storageRide = 1003 -- ID de armazenamento para montaria local storageFly = 1004 -- ID de armazenamento para voar local condition = Condition(CONDITION_OUTFIT) condition:setTicks(-1) function getEffectIdForPlayer(player) -- Esta função deve retornar o ID do efeito se o jogador estiver com algum efeito ativo -- Exemplo: -- if player:getCondition(CONDITION_INFIGHT) then -- return CONDITION_INFIGHT -- end -- Adicione aqui as verificações de condição que desejar return nil end function hasSummons(player) -- Função para verificar se o jogador tem um summon return #player:getSummons() > 0 end function doRemoveSummon(cid, instant, position, forced) -- Função para remover o summon do jogador local player = Player(cid) if player then local summons = player:getSummons() for _, summon in ipairs(summons) do summon:remove() end end end function doReleaseSummon(cid, position, instant, forced) -- Função para liberar o summon do jogador local player = Player(cid) if player then local summons = player:getSummons() for _, summon in ipairs(summons) do summon:teleportTo(position) end end end function onStepIn(creature, item, position, fromPosition) if not creature:isPlayer() then return false end -- Verificar se o jogador tem algum efeito ativo (não pode usar surf, fly ou ride) local effectId = getEffectIdForPlayer(creature) if effectId then creature:sendCancelMessage("Desculpe, não é possível enquanto estiver com efeito ativo.") creature:teleportTo(fromPosition, false) return false end if creature:getStorageValue(storageBike) > 0 then creature:sendCancelMessage("Desculpe, não é possível enquanto estiver na bicicleta.") creature:teleportTo(fromPosition, false) return false end local outfit = 267 if hasSummons(creature) then local summon = creature:getSummons()[1] local summonName = summon:getName() local summonSpeed = summon:getTotalSpeed() local monsterType = MonsterType(summonName) local surfOutfit = monsterType:isSurfable() if surfOutfit > 0 then if surfOutfit > 1 then outfit = surfOutfit end creature:changeSpeed(summonSpeed) creature:setStorageValue(storageSurf, outfit) condition:setOutfit({lookType = outfit}) creature:addCondition(condition) doRemoveSummon(creature:getId(), false, nil, false) creature:say(summonName .. ", vamos surfar!", TALKTYPE_MONSTER_SAY) else creature:sendCancelMessage("Desculpe, não é possível. Seu Pokémon não pode surfar.") creature:teleportTo(fromPosition, false) return false end else if creature:getStorageValue(storageSurf) == -1 then creature:sendCancelMessage("Desculpe, não é possível. Você precisa de um Pokémon que possa surfar.") creature:teleportTo(fromPosition, false) return false else local surfOutfit = creature:getStorageValue(storageSurf) condition:setOutfit({lookType = surfOutfit}) creature:addCondition(condition) end end return true end function onStepOut(creature, item, position, fromPosition) if not creature:isPlayer() then return false end local tile = Tile(creature:getPosition()) if not tile or not tile:getGround() then return false end local tileId = tile:getGround():getId() if (not isInArray(waterIds, tileId) and position == fromPosition) or (creature:getStorageValue(storageDive) > 0) then creature:changeSpeed(creature:getBaseSpeed()-creature:getSpeed()) creature:setStorageValue(storageSurf, -1) doReleaseSummon(creature:getId(), creature:getPosition(), false, false) local summon = creature:getSummons()[1] if summon then local summonName = summon:getName() creature:say(summonName .. ", obrigado!", TALKTYPE_MONSTER_SAY) else creature:say("Obrigado!", TALKTYPE_MONSTER_SAY) end end if not (creature:getStorageValue(storageRide) > 0 or creature:getStorageValue(storageFly) > 0 or creature:getStorageValue(storageBike) > 0 or creature:getStorageValue(storageDive) > 0) then creature:removeCondition(CONDITION_OUTFIT) end return true end
  8. tankactions: function onSay(cid, words, param, channel) local getP = getPoints(cid) local lastTime = getCreatureStorage(cid, 1219) local currentTime = os.time() local timeElapsed = currentTime - lastTime local timeRemaining = config.p_time - timeElapsed if timeRemaining < 0 then timeRemaining = 0 end local hours = math.floor(timeRemaining / 3600) local minutes = math.floor((timeRemaining % 3600) / 60) local seconds = timeRemaining % 60 doPlayerPopupFYI(cid, string.format("Você possui %d p-points!\nPróximo ponto em: %02d:%02d:%02d", getP, hours, minutes, seconds)) return true end globalevent: --[[ P Points System by LsM. ###### © 2011 Version : v1.0 ]]-- local config = { p_time = 3600, -- Tempo em segundos para receber os pontos( 3600 = 1hora ) p_points = 1 -- Quantidade de pontos recebida a cada "p_time" } local function givePoints(cid, quant) if os.time() - getCreatureStorage(cid, 1219) >= config.p_time then doPlayerSendTextMessage(cid, 19, "Parabéns, você recebeu ".. config.p_points .." p-point. Agora você tem ".. config.p_points + getPoints(cid) .." p-points na sua conta. Seu tempo foi zerado, próximo p-points daqui 1 hora.") doPlayerAddPoints(cid, quant) doCreatureSetStorage(cid, 1219, os.time()) end return true end function onThink(interval) for i, v in pairs(getPlayersOnline()) do givePoints(v, config.p_points) end return true end
  9. ninguem pode ver a url que vc soltou pq esta rodando somente no seu servidor local.. observe que uma das colunas mencionadas no comando DESC players; está sem um sublinhado (skill axe), enquanto no seu comando INSERT ela está com um sublinhado (skill_axe INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `lastlogout`, `blessings`, `blessings1`, `blessings2`, `blessings3`, `blessings4`, `blessings5`, `blessings6`, `blessings7`, `blessings8`, `onlinetime`, `deletion`, `balance`, `offlinetraining_time`, `offlinetraining_skill`, `stamina`, `skill_fist`, `skill_fist_tries`, `skill_club`, `skill_club_tries`, `skill_sword`, `skill_sword_tries`, `skill_axe`, `skill_axe_tries`, `skill_dist`, `skill_dist_tries`, `skill_shielding`, `skill_shielding_tries`, `skill_fishing`, `skill_fishing_tries`, `skill_critical_hit_chance`, `skill_critical_hit_chance_tries`, `skill_critical_hit_damage`, `skill_critical_hit_damage_tries`, `skill_life_leech_chance`, `skill_life_leech_chance_tries`, `skill_life_leech_amount`, `skill_life_leech_amount_tries`, `skill_mana_leech_chance`, `skill_mana_leech_chance_tries`, `skill_mana_leech_amount`, `skill_mana_leech_amount_tries`, `skill_criticalhit_chance`, `skill_criticalhit_damage`, `skill_lifeleech_chance`, `skill_lifeleech_amount`, `skill_manaleech_chance`, `skill_manaleech_amount`, `manashield`, `max_manashield`, `xpboost_stamina`, `xpboost_value`, `marriage_status`, `marriage_spouse`, `bonus_rerolls`, `prey_wildcard`, `task_points`, `quickloot_fallback`, `lookmountbody`, `lookmountfeet`, `lookmounthead`, `lookmountlegs`, `lookfamiliarstype`, `isreward`, `istutorial`, `ismain`, `forge_dusts`, `forge_dust_level`, `randomize_mount`, `boss_points`, `created`, `hidden`, `comment`) VALUES (1, 'Account Manager', 0, 1, 1, 1, 0, 150, 150, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 160, 54, 7, '', 400, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, '', 0, 0, '', 0, 0, ''), (2, 'Rook Sample', 0, 1, 1, 1, 0, 150, 150, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 7, '', 400, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, '', 0, 0, '', 0, 0, ''), (3, 'Sorcerer Sample', 0, 1, 1, 1, 1, 150, 150, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 7, '', 400, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, '', 0, 0, '', 0, 0, ''), (4, 'Druid Sample', 0, 1, 1, 1, 2, 150, 150, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 7, '', 400, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, '', 0, 0, '', 0, 0, ''), (5, 'Paladin Sample', 0, 1, 1, 1, 3, 150, 150, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 7, '', 400, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, '', 0, 0, '', 0, 0, ''), (6, 'Knight Sample', 0, 1, 1, 1, 4, 150, 150, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 7, '', 400, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 201660000, 0, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, '', 0, 0, '', 0, 0, '');
  10. El Rusher

    Ajuda com SCRIPT.

    tenta assim colega local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) if isPlayer(cid) and getPlayerAccess(cid) > 0 then -- Verifica se o jogador ainda é válido. doPlayerAddHealth(cid, 1000) regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Reagendar o evento. else regenEvent[cid] = nil -- Limpa o evento se o jogador não estiver mais online. end end if isPlayer(cid) then -- Certifica-se de que o jogador é válido antes de inicializar o evento. regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Inicializa o evento com o `cid`. end return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end
  11. isso é falha de conexao com o banco de dados, é só inserir o nome dele na linha 'sqlFile = ""'
  12. acho que nao compreendi direito oq vc quer que aconteceça, poderia explicar melhor por gentileza
  13. local BOOSTED_MONSTER = 56404 local boostedMonstersList = {"rat"} local experienceBonus = 8.0 function onDeath(cid, corpse, deathList) local master = getCreatureMaster(cid) if (master and master ~= cid) then return true end local boostedMonster = boostedMonstersList[getGlobalStorageValue(BOOSTED_MONSTER)] if getCreatureName(cid):lower() == boostedMonster then -- Inicializa a mensagem de loot local lootMessage = "Loot of " .. getCreatureName(cid):lower() .. ": " local lootList = getMonsterLootList(getCreatureName(cid)) local firstLoot = true for _, loot in pairs(lootList) do if loot.count > 1 then local numb = math.random(1, loot.count) doAddContainerItem(corpse.uid, loot.id, numb) if firstLoot then lootMessage = lootMessage .. numb .. " " .. getItemNameById(loot.id) firstLoot = false else lootMessage = lootMessage .. ", " .. numb .. " " .. getItemNameById(loot.id) end elseif math.random(1, 100000) <= loot.chance then doAddContainerItem(corpse.uid, loot.id, 1) if firstLoot then lootMessage = lootMessage .. getItemNameById(loot.id) firstLoot = false else lootMessage = lootMessage .. ", " .. getItemNameById(loot.id) end end end -- Adiciona "(boosted loot)" ao final da mensagem lootMessage = lootMessage .. ". (boosted loot)" -- Envia a mensagem de loot para todos os jogadores for i = 1, #deathList do doPlayerSendTextMessage(deathList[i], MESSAGE_INFO_DESCR, lootMessage) end end return true end
  14. local Snowtalk = TalkAction("!snowball") function Snowtalk.onSay(cid, words, param, channel) local k = string.split(param, ",") if k[1] ~= nil then if string.upper(k[1]) == 'INFO' then local score = {} local output = "Você tem " .. getPlayerStorageValue(cid, SBW_SCORE) .. " pontos.\nVocê tem " .. getPlayerStorageValue(cid, SBW_AMMO) .. "x munições.\n------------------\nO maior matador:\n" for _, pid in ipairs(getOnlinePlayers()) do if getPlayerStorageValue(pid, SBW_INEVENT) then table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, SBW_SCORE)}) end end local lx = #score if lx > 3 then lx = 3 end table.sort(score, function(a, b) return a[2] > b[2] end) for i = 1, lx do output = output .. i .. ". " .. score[i][1] .. " [" .. score[i][2] .. "].\n" end doPlayerPopupFYI(cid, output) elseif string.upper(k[1]) == 'ATIRAR' then if getPlayerStorageValue(cid, SBW_INEVENT) == 1 and not getTileInfo(getThingPos(cid)).protection then if getPlayerStorageValue(cid, SBW_EXAUSTHED) <= 1 then if getPlayerStorageValue(cid, SBW_AMMO) > 0 then if SBW_STATUS == 'on' then if not SBW_AMMOINFI then setGlobalStorageValue(cid, SBW_AMMO, getPlayerStorageValue(cid, SBW_AMMO) - 1) end setGlobalStorageValue(cid, SBW_EXAUSTHED, 2) lineAnimation(getCreatureDirection(cid), getCreaturePosition(cid), 13, cid, 1, 1, 1, 1, 1, 1, 1, 1) addEvent(setGlobalStorageValue, SBW_SHOOTEXAUSTHED, cid, SBW_EXAUSTHED, 1) if getPlayerStorageValue(cid, SBW_AMMO) ~= 1 then doPlayerSendTextMessage(cid, 27, "Restam " .. getPlayerStorageValue(cid, SBW_AMMO) .. "x bolas de neve.") else doPlayerSendTextMessage(cid, 27, "Usando sua última bola de neve, recarregue.") end end else doPlayerSendCancel(cid, "Você está sem bolas de neve, recarregue no centro do campo ou mate um inimigo.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) end else doPlayerPopupFYI(cid, "Acalme-se, você deve esperar para atirar novamente.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return false end else doPlayerPopupFYI(cid, "Você precisa estar dentro do evento ou fora da área protegida.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) end end end return true end function lineAnimation(lookDir, playerPos, effect, cid, fvar, fpos, ffound, fposV, fcheck, fvcid, floopCounter, fvpid) local var = fvar local pos = playerPos local found = ffound local posV = fposV local check = fcheck local vcid = fvcid local loopCounter = floopCounter local vpid = fvpid if var < 2 then vcid = cid end pos = playerPos if not isInWallArray(convert(lookDir, pos)) then doSendDistanceShoot(pos, convert(lookDir, pos), effect) pos = convert(lookDir, pos) var = var + 1 posV = convertV(lookDir, playerPos) for _, pid in ipairs(getOnlinePlayers()) do if getCreaturePosition(pid).x == pos.x and getCreaturePosition(pid).y == pos.y and getCreaturePosition(pid).z == pos.z then vpid = pid if vpid ~= vcid then if var > 2 then if getCreaturePosition(pid).x == posV.x and getCreaturePosition(pid).y == posV.y and getCreaturePosition(pid).z == posV.z then killPlayer(pid, pos, vcid) if lookDir == 0 or lookDir == 2 then var = 6 else var = 8 end end end killPlayer(pid, pos, vcid) if lookDir == 0 or lookDir == 2 then var = 6 else var = 8 end end end loopCounter = loopCounter + 1 end if (lookDir == 0 or lookDir == 2) and var ~= 6 then addEvent(lineAnimation, SBW_BALLSPEED, lookDir, pos, effect, nil, var, pos, found, posV, check, vcid, loopCounter, vpid) elseif (lookDir == 1 or lookDir == 3) and var ~= 8 then addEvent(lineAnimation, SBW_BALLSPEED, lookDir, pos, effect, nil, var, pos, found, posV, check, vcid, loopCounter, vpid) else var = 1 end else doSendMagicEffect(convert(lookDir, pos), 2) var = 1 end end function convert(lookDir, pos) local positions = { [0] = {x = pos.x, y = pos.y - 1, z = pos.z}, [1] = {x = pos.x + 1, y = pos.y, z = pos.z}, [2] = {x = pos.x, y = pos.y + 1, z = pos.z}, [3] = {x = pos.x - 1, y = pos.y, z = pos.z}, } return positions[lookDir] end function convertV(lookDir, pos) local positions = { [0] = {x = pos.x, y = pos.y + 1, z = pos.z}, [1] = {x = pos.x - 1, y = pos.y, z = pos.z}, [2] = {x = pos.x, y = pos.y - 1, z = pos.z}, [3] = {x = pos.x + 1, y = pos.y, z = pos.z}, } return positions[lookDir] end function isInWallArray(pos) for _, wallId in ipairs(SBW_WALLSID) do if getTileItemById(pos, wallId).itemid == wallId then return true end end return false end function killPlayer(cid, pos, killer) local tl = SBW_AREA[1] local br = SBW_AREA[2] local posti local isPossibleToTeleportPlayer = false while not isPossibleToTeleportPlayer do posti = Position(math.random(tl.x, br.x), math.random(tl.y, br.y), 7) if not isInWallArray(posti) then isPossibleToTeleportPlayer = true end end doTeleportThing(cid, posti) doSendMagicEffect(pos, 2) doSendMagicEffect(posti, 6) doSendAnimatedText(pos, getCreatureName(killer), 55) doPlayerSendTextMessage(cid, 27, "Você morreu para " .. getCreatureName(killer) .. ".") setGlobalStorageValue(killer, SBW_SCORE, getPlayerStorageValue(killer, SBW_SCORE) + SBW_POINTSKILL) doPlayerSendTextMessage(killer, 27, "Você matou " .. getCreatureName(cid) .. ".") if SBW_LOSTSCORE then setGlobalStorageValue(cid, SBW_SCORE, getPlayerStorageValue(cid, SBW_SCORE) - 1) end if SBW_RESETAMMO then setGlobalStorageValue(cid, SBW_AMMO, SBW_MINAMMO) end end Snowtalk:separator(" ") Snowtalk:register() testa assim colega
  15. El Rusher

    Ajuda com SCRIPT.

    poe cid nesses parenteses ai
  16. El Rusher

    Ajuda com SCRIPT.

    local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) if isPlayer(cid) and getPlayerAccess(cid) > 0 then -- Verifica se o jogador ainda é válido. doPlayerAddHealth(cid, 1000) regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Reagendar o evento. else regenEvent[cid] = nil -- Limpa o evento se o jogador não estiver mais online. end end regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Inicializa o evento com o `cid`. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end "Player not found", sugere que a função luaDoPlayerAddMana está sendo chamada para um jogador que não existe mais no jogo. Isso pode acontecer se um jogador se desconectar enquanto o evento regenVida ainda está rodando. Para corrigir isso, adiciona uma verificação extra se o jogador ainda está conectado antes de executar doPlayerAddHealth:
  17. El Rusher

    Ajuda com SCRIPT.

    opa, bom dia, tenta assim entao por gentileza local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) if isPlayer(cid) then doPlayerAddHealth(cid, 1000) -- Adiciona vida ao jogador. regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Reagendar o evento com o `cid`. end end regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Inicializa o evento com o `cid`. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end
  18. El Rusher

    Ajuda com SCRIPT.

    local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida() if isPlayer(cid) then doPlayerAddHealth(cid, 1000) -- Adiciona vida ao jogador. regenEvent[cid] = addEvent(regenVida, 1 * 1000) -- Reagendar o evento. end end regenEvent[cid] = addEvent(regenVida, 1 * 1000) -- Inicializa o evento. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end
  19. 1.Adicione um comando para escolher o Pokémon: Digamos que você adicione !choosepokemon para configurar o Pokémon que o jogador deseja derrotar. 2.Adapte a função resetDailyKill para usar essa escolha: function choosePokemon(cid, pokemonName) if isPlayer(cid) then local mode = killModes[(getCatchMode(cid))] local pokemons = mode.pokemons if table.contains(pokemons, pokemonName) then local count = math.random(getPlayerLevel(cid) * 2) local day = tostring(""..getNumberDay().."-"..getNumberMonth().."-"..getNumberYear().."") setPlayerStorageValue(cid, killModes.storage, "|"..getCatchMode(cid).."|"..day.."|"..pokemonName.."|false|"..count) setPlayerStorageValue(cid, killModes.storage2, -1) setPlayerStorageValue(cid, 24003, 0) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have chosen: " .. pokemonName .. " as your daily kill target.") else doPlayerSendCancel(cid, "Invalid Pokémon. Choose from the list.") end end end 3.Implementar comando para escolha: function onSay(cid, words, param) if param == "" then doPlayerSendCancel(cid, "Use: !choosepokemon <pokemon_name>") return true end choosePokemon(cid, param:trim()) return true end
  20. Para o comando !sell: function onSay(cid, words, param) local config = { levelNeeded = 8, muteTime = 120, -- tempo em segundos storage = 7896 } if param == "" then doPlayerPopupFYI(cid, "Use: !sell itemName, price in GP") return true end local t = string.explode(param, ",") if not(t[1]) or not(t[2]) then doPlayerSendCancel(cid, "Command requires more than one parameter.") return true end if getPlayerLevel(cid) >= config.levelNeeded then if getPlayerStorageValue(cid, config.storage) == -1 then setPlayerStorageValue(cid, config.storage, os.time()) elseif getPlayerStorageValue(cid, config.storage) > os.time() then doPlayerSendCancel(cid, "You can only place one offer in " .. config.muteTime .. " seconds.") return true else local itemName = t[1]:trim() local price = tonumber(t[2]) if price <= 0 then doPlayerSendCancel(cid, "Invalid price.") return true end local itemId = getItemIdByName(itemName) if getPlayerItemCount(cid, itemId) > 0 then doBroadcastMessage("Player " .. getPlayerName(cid) .. " is selling " .. itemName .. " for " .. price .. " gold coins.") setPlayerStorageValue(cid, config.storage, (os.time() + config.muteTime)) else doPlayerSendCancel(cid, "You don't have the item '" .. itemName .. "' to sell.") end end else doPlayerSendCancel(cid, "Only players with level " .. config.levelNeeded .. " can broadcast an offer.") end return true end Para o comando !buy: function onSay(cid, words, param) local config = { levelNeeded = 8, muteTime = 120, storage = 7896 } if param == "" then doPlayerPopupFYI(cid, "Use: !buy itemName, price in GP") return true end local t = string.explode(param, ",") if not(t[1]) or not(t[2]) then doPlayerSendCancel(cid, "Command requires more than one parameter.") return true end if getPlayerLevel(cid) >= config.levelNeeded then if getPlayerStorageValue(cid, config.storage) == -1 then setPlayerStorageValue(cid, config.storage, os.time()) elseif getPlayerStorageValue(cid, config.storage) > os.time() then doPlayerSendCancel(cid, "You can only place one offer in " .. config.muteTime .. " seconds.") return true else local itemName = t[1]:trim() local price = tonumber(t[2]) if price <= 0 then doPlayerSendCancel(cid, "Invalid price.") return true end -- Logica de compra do item: verificar se algum jogador está vendendo o item -- e o preço condiz com a oferta. Se sim, retirar o item do vendedor e -- transferir para o comprador doBroadcastMessage("Player " .. getPlayerName(cid) .. " is buying " .. itemName .. " for " .. price .. " gold coins.") setPlayerStorageValue(cid, config.storage, (os.time() + config.muteTime)) end else doPlayerSendCancel(cid, "Only players with level " .. config.levelNeeded .. " can broadcast an offer.") end return true end
  21. -- Inicializar as tabelas globais para compras e vendas ativas activeBuys = activeBuys or {} activeSells = activeSells or {} -- Configuração local config = { validCurrencies = {9971, 2160, 2148, 2152, 2157, 2159}, -- Moedas válidas maxPrice = 1000000000, -- Preço máximo permitido } -- Função para verificar se uma moeda é válida local function isValidCurrency(currencyId) for _, validId in ipairs(config.validCurrencies) do if validId == currencyId then return true end end return false end -- Função para listar itens à venda function listItems(cid) if #activeSells == 0 then doPlayerSendCancel(cid, "No items are currently being sold.") return true end local message = "Items available for sale:\n" for i, sell in ipairs(activeSells) do message = message .. i .. ". " .. sell.itemName .. " (" .. sell.quantity .. "x) - Price: " .. sell.price .. " gold coins - Seller: " .. sell.seller .. "\n" end doPlayerPopupFYI(cid, message) return true end -- Função para comprar o item function buyItem(cid, itemName, quantity, price, currencyId, sellerName) -- Verificar se o item está à venda for i, sell in ipairs(activeSells) do if sell.itemName == itemName and sell.seller == sellerName then -- Calcular o preço total pelo número de itens local totalPrice = sell.price * quantity -- Verificar se o jogador tem moeda suficiente if getPlayerItemCount(cid, currencyId) < totalPrice then doPlayerSendCancel(cid, "You don't have enough currency to buy this item.") return true end -- Verificar se há quantidade suficiente do item if sell.quantity < quantity then doPlayerSendCancel(cid, "Not enough items in stock.") return true end -- Realizar a compra -- Remover o dinheiro do comprador doPlayerRemoveItem(cid, currencyId, totalPrice) -- Adicionar o item ao comprador doPlayerAddItem(cid, getItemIdByName(itemName), quantity) -- Atualizar a quantidade do item à venda activeSells[i].quantity = activeSells[i].quantity - quantity -- Informar ao jogador sobre a compra doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have successfully bought " .. quantity .. "x " .. itemName .. " from " .. sellerName .. " for " .. totalPrice .. " currency.") -- Caso o item tenha acabado, remover a venda if activeSells[i].quantity <= 0 then table.remove(activeSells, i) end return true end end doPlayerSendCancel(cid, "Item not found in the market.") return true end -- Função para vender o item function sellItem(cid, itemName, quantity, price, currencyId) -- Verificar se o jogador tem o item suficiente local itemId = getItemIdByName(itemName) if itemId == 0 or getPlayerItemCount(cid, itemId) < quantity then doPlayerSendCancel(cid, "You don't have enough of the item '" .. itemName .. "' to sell.") return true end -- Remover os itens do inventário do vendedor doPlayerRemoveItem(cid, itemId, quantity) -- Registrar a venda table.insert(activeSells, { itemName = itemName, quantity = quantity, price = price, currencyId = currencyId, seller = getPlayerName(cid), }) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your item '" .. itemName .. "' has been listed for sale.") return true end -- Função principal para lidar com os comandos function onSay(cid, words, param) if words == "!sell" then if param == "" then doPlayerSendCancel(cid, "Use: !sell itemName, quantity, price, currencyId") return true end local t = string.explode(param, ",") if #t ~= 4 then doPlayerSendCancel(cid, "Invalid parameters. Use: !sell itemName, quantity, price, currencyId") return true end local itemName = t[1]:trim() local quantity = tonumber(t[2]) local price = tonumber(t[3]) local currencyId = tonumber(t[4]) -- Chama a função para vender o item return sellItem(cid, itemName, quantity, price, currencyId) elseif words == "!buy" then if param == "" then doPlayerSendCancel(cid, "Use: !buy itemName, quantity, price, ID's 9971 - 2160 - 2148 - 2152 - 2157 - 2159, sellerName") return true end -- Separar os parâmetros fornecidos local t = string.explode(param, ",") if #t ~= 5 then doPlayerSendCancel(cid, "Invalid parameters. Use: !buy itemName, quantity, price, ID's 9971 - 2160 - 2148 - 2152 - 2157 - 2159, sellerName") return true end local itemName = t[1]:trim() local quantity = tonumber(t[2]) local price = tonumber(t[3]) local currencyId = tonumber(t[4]) local sellerName = t[5]:trim() -- Chama a função para comprar o item return buyItem(cid, itemName, quantity, price, currencyId, sellerName) elseif words == "!list" then -- Exibe os itens à venda return listItems(cid) end return false end
  22. local UPGRADE_ITEM_ID = 5902 -- Item para ativar leech local LIFE_LEECH_INCREMENT = 1 -- Incremento de Life Leech local MANA_LEECH_INCREMENT = 1 -- Incremento de Mana Leech local MAX_LEECH_PERCENT = 100 -- Máximo de leech permitido function onUse(cid, item, fromPosition, itemEx, toPosition) if not isPlayer(cid) then return false end local weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT) if weapon.itemid == 0 then weapon = getPlayerSlotItem(cid, CONST_SLOT_RIGHT) end if weapon.itemid == 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You need to be holding a weapon to upgrade it.") return false end local currentLifeLeech = tonumber(getItemAttribute(weapon.uid, "lifeLeech")) or 0 local currentManaLeech = tonumber(getItemAttribute(weapon.uid, "manaLeech")) or 0 local newLifeLeech = math.min(currentLifeLeech + LIFE_LEECH_INCREMENT, MAX_LEECH_PERCENT) local newManaLeech = math.min(currentManaLeech + MANA_LEECH_INCREMENT, MAX_LEECH_PERCENT) doItemSetAttribute(weapon.uid, "lifeLeech", newLifeLeech) doItemSetAttribute(weapon.uid, "manaLeech", newManaLeech) local description = "This weapon now has " .. newLifeLeech .. "% Life Leech and " .. newManaLeech .. "% Mana Leech. The maximum is 100%." doItemSetAttribute(weapon.uid, "description", description) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your weapon has been upgraded with " .. newLifeLeech .. "% Life Leech and " .. newManaLeech .. "% Mana Leech.") local position = getCreaturePosition(cid) doSendAnimatedText(position, "+Leech!!!", 35) return true end Agora, configure o dano e o leech para funcionar sempre que a arma equipada atingir uma criatura. Este script pode ser adicionado ao creature scripts do servidor, ativando o leech no evento onAttack. Adicione este código no arquivo de creature scripts: function onAttack(cid, target) if not isPlayer(cid) or not isCreature(target) then return true end local weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT) if weapon.itemid == 0 then weapon = getPlayerSlotItem(cid, CONST_SLOT_RIGHT) end local lifeLeech = tonumber(getItemAttribute(weapon.uid, "lifeLeech")) or 0 local manaLeech = tonumber(getItemAttribute(weapon.uid, "manaLeech")) or 0 if lifeLeech > 0 or manaLeech > 0 then local damage = math.random(50, 150) -- Dano variável para cada ataque (ajuste conforme necessário) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -damage, -damage, CONST_ME_EXPLOSIONHIT) -- Calcula o leech local lifeSteal = math.floor((damage * lifeLeech) / 100) local manaSteal = math.floor((damage * manaLeech) / 100) doCreatureAddHealth(cid, lifeSteal) doPlayerAddMana(cid, manaSteal) -- Mensagem opcional para mostrar o leech doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Life Leech: " .. lifeSteal .. " | Mana Leech: " .. manaSteal) end return true end 2.Atualize o arquivo creaturescripts.xml para adicionar o novo script: <event type="attack" name="WeaponLeech" script="leechAttack.lua"/> 3.No arquivo login.lua, adicione uma linha para registrar o evento onAttack: registerCreatureEvent(cid, "WeaponLeech")
  23. local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) -- Tipo de dano físico para simular spear combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) -- Efeito visual combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SPEAR) -- Animação da spear arremessada -- Configurações de ricochete local bounceCount = 2 -- Número de ricochetes local bounceRange = 5 -- Alcance de cada ricochete function onCastSpell(creature, var) local target = creature:getTarget() -- Obtém o alvo principal if not target or target:getHealth() <= 0 then creature:sendCancelMessage("Você precisa de um alvo válido para essa magia!") return false end -- Confirma que o jogador está usando uma spear local weapon = creature:getSlotItem(CONST_SLOT_LEFT) if not weapon or weapon:getType():getName():lower() ~= "spear" then creature:sendCancelMessage("Você precisa estar usando uma spear para lançar esta magia.") return false end -- Aplica dano no alvo principal combat:execute(creature, var) -- Função para encontrar alvos adicionais para o ricochete local function getNearbyTarget(currentTarget, excludeList) local spectators = Game.getSpectators(currentTarget:getPosition(), false, true, bounceRange, bounceRange, bounceRange, bounceRange) for _, spectator in ipairs(spectators) do if spectator:isMonster() and spectator ~= currentTarget and not excludeList[spectator:getId()] then return spectator end end return nil end -- Aplica ricochete nos alvos próximos local ricochetTarget = target local excludeList = {[target:getId()] = true} for i = 1, bounceCount do ricochetTarget = getNearbyTarget(ricochetTarget, excludeList) if not ricochetTarget then break end -- Para o ricochete se não houver alvo próximo -- Atualiza a variável de alvo para o próximo ricochete local bounceVar = Position(ricochetTarget:getPosition()) combat:execute(creature, Variant(bounceVar)) -- Adiciona o alvo à lista de excluídos para não ser alvo novamente excludeList[ricochetTarget:getId()] = true end return true end
  24. El Rusher

    Canary 3.2.1 13.40

    local portalId, t = 25058, { ["glacius death"] = { message = "You have defeated Glacius Death!", config = { createPos = {}, -- O portal será criado onde o monstro morrer. toPos = {x = 32202, y = 31863, z = 13}, -- Posição onde o portal irá teleportar portalTime = 1, -- Duração do portal em minutos } }, } --------------------------------------------------------------------------------------- -- Fim da Configuração --------------------------------------------------------------------------------------- local function spectatorStartCountdown(time, position) local spectators = Game.getSpectators(position, false, false, 5, 5, 5, 5) if #spectators > 0 then for i = 1, #spectators do if time > 1 then spectators:say("" .. time .. "", TALKTYPE_MONSTER_SAY, false, spectators, position) else spectators:say("Time out!", TALKTYPE_MONSTER_SAY, false, spectators, position) break end end end local portal = Tile(position):getItemById(portalId) if portal then addEvent(spectatorStartCountdown, 1000, time - 1, position) end end local function removePortal(position) local portal = Tile(position):getItemById(portalId) if portal then portal:remove() end end local deathMonsterCreatePortal = CreatureEvent("deathMonsterCreatePortal") function deathMonsterCreatePortal.onDeath(creature, corpse, killer, mostDamageKiller) if not creature:isMonster() or creature:getMaster() then return true end -- Debug para ver se a criatura correta foi detectada print("A criatura morreu: " .. creature:getName()) local k = t[creature:getName():lower()] if not k then print("A criatura " .. creature:getName() .. " não está na lista de criação de portais.") return true end print("Criando portal para a criatura: " .. creature:getName()) local pos = creature:getPosition() local cPos = k.config.createPos if next(cPos) == nil then cPos = pos end if Tile(cPos):getItemById(portalId) then print("Portal já existente na posição: " .. cPos.x .. ", " .. cPos.y .. ", " .. cPos.z) return true end local item = Game.createItem(portalId, 1, cPos) if item:isTeleport() then item:setDestination(k.config.toPos) print("Portal criado com sucesso na posição: " .. cPos.x .. ", " .. cPos.y .. ", " .. cPos.z) else print("Erro ao criar o portal.") end local pt = k.config.portalTime addEvent(spectatorStartCountdown, 500, pt * 60, cPos) addEvent(removePortal, pt * 60 * 1000, cPos) return true end deathMonsterCreatePortal:type("death") deathMonsterCreatePortal:register() --------------------------------------------------------------------------------------- -- Registrar script onLogin --------------------------------------------------------------------------------------- local monsterDeathLogin = CreatureEvent("monsterDeathLogin") function monsterDeathLogin.onLogin(player) player:registerEvent("deathMonsterCreatePortal") return true end monsterDeathLogin:type("login") monsterDeathLogin:register() Ao matar o monstro glacius death, veja no console as mensagens de debug. Elas ajudarão a identificar se o problema está na identificação do monstro ou na criação do portal. Verifique se a posição do portal (onde o monstro morre) é adequada e acessível para criar o item. Certifique-se de que o portalId (25058) corresponde ao item do portal correto.
  25. El Rusher

    Canary 3.2.1 13.40

    local portalId, t = 25058, { ["glacius death"] = { message = "You have defeated Glacius Death!", config = { createPos = {}, -- O portal será criado onde o monstro morrer. toPos = {x = 32202, y = 31863, z = 13}, -- Posição onde o portal irá teleportar portalTime = 1, -- Duração do portal em minutos } }, } --------------------------------------------------------------------------------------- -- Fim da Configuração --------------------------------------------------------------------------------------- local function spectatorStartCountdown(time, position) local spectators = Game.getSpectators(position, false, false, 5, 5, 5, 5) if #spectators > 0 then for i = 1, #spectators do if time > 1 then spectators:say("" .. time .. "", TALKTYPE_MONSTER_SAY, false, spectators, position) else spectators:say("Time out!", TALKTYPE_MONSTER_SAY, false, spectators, position) break end end end local portal = Tile(position):getItemById(portalId) if portal then addEvent(spectatorStartCountdown, 1000, time - 1, position) end end local function removePortal(position) local portal = Tile(position):getItemById(portalId) if portal then portal:remove() end end local deathMonsterCreatePortal = CreatureEvent("deathMonsterCreatePortal") function deathMonsterCreatePortal.onDeath(creature, corpse, killer, mostDamageKiller) if not creature:isMonster() or creature:getMaster() then return true end local k = t[creature:getName():lower()] if not k then return true end local pos = creature:getPosition() local cPos = k.config.createPos if next(cPos) == nil then cPos = pos end if Tile(cPos):getItemById(portalId) then return true end local item = Game.createItem(portalId, 1, cPos) if item:isTeleport() then item:setDestination(k.config.toPos) end local pt = k.config.portalTime addEvent(spectatorStartCountdown, 500, pt * 60, cPos) addEvent(removePortal, pt * 60 * 1000, cPos) return true end deathMonsterCreatePortal:type("death") deathMonsterCreatePortal:register() --------------------------------------------------------------------------------------- -- Registrar script onLogin --------------------------------------------------------------------------------------- local monsterDeathLogin = CreatureEvent("monsterDeathLogin") function monsterDeathLogin.onLogin(player) player:registerEvent("deathMonsterCreatePortal") return true end monsterDeathLogin:type("login") monsterDeathLogin:register()
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...