-
Posts
185 -
Joined
-
Last visited
-
Days Won
24
Reputation Activity
-
El Rusher got a reaction from Muvuka in [TFS-0.3.6-8.60] RESET SYSTEM COM 2 STORAGE SÓ PODE RESET SE TIVER VIP E INFINITE VIP
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
-
El Rusher got a reaction from Muvuka in [TFS 0.3.6 - 8.60] Converter Esse Códigos Pra TFS 0.3.6
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
-
El Rusher got a reaction from Nickbhz in Adicionar msg no script
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
-
El Rusher got a reaction from Nickbhz in [Resolvido] função contagem de tempo
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
-
El Rusher got a reaction from Nickbhz in [Resolvido] função contagem de tempo
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
-
El Rusher got a reaction from Nickbhz in [Resolvido] função contagem de tempo
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
-
El Rusher got a reaction from Rodrigo94 in [OTX2] Como fazer os NPCs aceitarem dinheiro do banco no Trade?
No script Lua do NPC que lida com transações comerciais (geralmente dentro da pasta data/npc/scripts/), você deve incluir verificações do saldo bancário do jogador, além de verificar o dinheiro que ele tem em mãos. Usar a função getBankBalance:
Use a função getPlayerBalance(cid) para verificar o saldo bancário do jogador. Se o jogador não tiver dinheiro suficiente em mãos, mas tiver saldo no banco, o NPC pode debitar diretamente do banco. Exemplo de implementação: Aqui está um exemplo básico de como ajustar o código de um NPC para verificar o saldo bancário:
local function playerHasMoney(cid, amount) local money = getPlayerMoney(cid) -- Dinheiro que o jogador tem na mochila local bankBalance = getPlayerBalance(cid) -- Saldo do banco -- Verifica se o jogador tem dinheiro suficiente na mochila ou no banco return (money + bankBalance) >= amount end local function removePlayerMoney(cid, amount) local money = getPlayerMoney(cid) if money >= amount then -- Se o jogador tiver dinheiro suficiente na mochila, remover da mochila doPlayerRemoveMoney(cid, amount) else -- Se não, remover o que tem na mochila e o restante do banco doPlayerRemoveMoney(cid, money) doPlayerSetBalance(cid, getPlayerBalance(cid) - (amount - money)) end end -- Exemplo de função de venda de item local function sellItem(cid, itemId, amount, cost) if not playerHasMoney(cid, cost) then npcHandler:say("Você não tem dinheiro suficiente.", cid) return false end -- Se o jogador tiver dinheiro suficiente, remover o dinheiro e dar o item removePlayerMoney(cid, cost) doPlayerAddItem(cid, itemId, amount) npcHandler:say("Aqui está o seu item!", cid) return true end -- Exemplo de uso no script de NPC local tradeItems = { {name = "sword", id = 2376, price = 100}, -- Exemplo de item para vender } function onCreatureSay(cid, type, msg) if msgcontains(msg, 'trade') then npcHandler:say("Gostaria de comprar algo?", cid) openShopWindow(cid, tradeItems) -- Abre a janela de trade end end Explicação:
playerHasMoney(cid, amount): Verifica se o jogador tem dinheiro suficiente na mochila e/ou no banco. removePlayerMoney(cid, amount): Deduz a quantia necessária primeiro da mochila e depois, se necessário, do banco. Adicionar ao sistema de NPC existente:
Certifique-se de ajustar os nomes das funções e estruturas de diálogo do NPC para o formato usado no seu servidor. Você pode integrar essa lógica com o sistema de eventos de NPCHandler que já está no OTX2. sellItem: Implementa a lógica de venda de um item, removendo o dinheiro do jogador e entregando o item. -
El Rusher got a reaction from IOWeenI in Sala Boss!
Esse script define a dungeon na qual o jogador entrou e armazena essa informação na storage do player. Ele também teleporta o jogador para a posição inicial da dungeon.(Action 17003)
function onUse(player, item, fromPosition, target, toPosition) local dungeonId = 1 -- ID da dungeon, altere conforme a dungeon específica local dungeonEntryPosition = Position(100, 100, 7) -- Defina a posição da entrada da dungeon (x, y, z) -- Armazena o ID da dungeon no storage do player player:setStorageValue(12345, dungeonId) -- 12345 é o storage para a dungeon atual -- Teleporta o player para a posição inicial da dungeon player:teleportTo(dungeonEntryPosition) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Você entrou na Dungeon " .. dungeonId .. ".") return true end
Esse script verifica qual dungeon o jogador entrou, e com base nisso, ele spawna o boss correspondente à dungeon naquela sala, se ela estiver disponível. (Action 14400)
function onUse(player, item, fromPosition, target, toPosition) local dungeonId = player:getStorageValue(12345) -- Recupera o ID da dungeon do player local bossPosition = Position(105, 105, 7) -- Posição onde o boss vai ser spawnado (x, y, z) local playerBossRoomPosition = Position(110, 110, 7) -- Posição para onde o player será teleportado na sala do boss local bossId -- Verifica se o jogador tem um dungeonId válido if dungeonId == -1 then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Você não entrou em nenhuma dungeon.") return false end -- Define o boss de acordo com o ID da dungeon if dungeonId == 1 then bossId = "Boss1" -- Nome do Boss 1 elseif dungeonId == 2 then bossId = "Boss2" -- Nome do Boss 2 elseif dungeonId == 3 then bossId = "Boss3" -- Nome do Boss 3 else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Dungeon inválida.") return false end -- Checa se a sala do boss está disponível (sem criaturas) if not Tile(bossPosition):getTopCreature() then -- Spawna o boss na posição definida Game.createMonster(bossId, bossPosition) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, bossId .. " apareceu!") -- Teleporta o player para a sala do boss player:teleportTo(playerBossRoomPosition) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "A sala do boss já está ocupada.") end return true end
Explicação dos Scripts:
Entrada na Dungeon (17003):
Armazena o ID da dungeon na storage 12345 do player. Teleporta o player para a posição inicial da dungeon. Exibe uma mensagem informando que ele entrou na dungeon. Entrada na sala do Boss (14400):
Verifica qual dungeon o jogador entrou usando o valor armazenado na storage 12345. Com base no ID da dungeon, seleciona o boss correto e tenta spawná-lo na sala do boss. Se a sala estiver disponível (sem criaturas), spawna o boss e teleporta o jogador para a sala. Se a sala estiver ocupada, exibe uma mensagem de erro. Modificações que você pode fazer:
IDs de Dungeon e Boss: Altere os IDs das dungeons e os nomes dos bosses de acordo com o que você quiser. Posições: Ajuste as posições de entrada da dungeon, sala do boss, e local de teleporte para o que for necessário no seu mapa. Cooldown ou reset: Se precisar de um cooldown para respawnar o boss ou resetar a sala, esse sistema pode ser facilmente estendido.
-
El Rusher got a reaction from Muvuka in TO COM PROBLEMA SOUL SYSTEM ELE SÓ CAPTURA SOUL DA CRITURA PRA ATIVA NA ARMA ELE NÃO ATIVA A AURA ESSE É O PROBLEMA QUE ELE NÃO ATIVA AURA!?
Soul System: ok!,
action: ok!,
auras: ok!,
creaturescript: ok!,
soul: ok!
conclusao:
Certifique-se de que o item que você está tentando encantar está listado em L_Soul.enchant.weapons. Cada item deve ter o ID correto correspondente.
Atributos do Item:
Verifique se os atributos como "Soul" estão sendo corretamente definidos no item durante o processo de encantamento. Pode haver um problema de manipulação de atributos.
Tipos de Danos e Efeitos:
Confira se os tipos de danos e efeitos estão definidos corretamente em L_Soul.souls para garantir que o encantamento aplique o efeito esperado.
Garanta que as funções externas, como L_Soul.souls, L_Soul.creatures, L_Soul.lang, e L_Soul.language, estejam devidamente carregadas e acessíveis.
-
El Rusher got a reaction from Smash Tibia 24 in MOVIMENTAÇÃO A CADA ATAQUE
No Tibia, os efeitos gráficos são chamados de projectiles ou magic effects. Para criar o Kamehameha, você precisará usar um projectile que se move em uma direção. Aqui está um exemplo simples de como fazer isso:
function onCastSpell(creature, variant) local position = creature:getPosition() -- Posição inicial do Goku local direction = creature:getDirection() -- Direção do Kamehameha local distance = 7 -- Distância que o ataque vai percorrer local damage = math.random(200, 300) -- Defina o dano do Kamehameha -- Definir o efeito gráfico do Kamehameha local projectileEffect = CONST_ANI_ENERGYBALL -- Escolha um efeito gráfico adequado -- Criação de um loop que movimenta o ataque for i = 1, distance do local newPosition = position:getNextPosition(direction, i) -- Calcula a posição seguinte creature:say("KAMEHAMEHA!", TALKTYPE_MONSTER_SAY) -- Grito de ataque, opcional -- Cria o projectile e o efeito creature:getPosition():sendDistanceEffect(newPosition, projectileEffect) -- Dano no alvo que está na posição do efeito local target = Tile(newPosition):getTopCreature() if target and target:isPlayer() then target:addHealth(-damage) target:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONAREA) -- Efeito de explosão ao atingir end -- Intervalo para a movimentação do projectile addEvent(function() newPosition:sendMagicEffect(CONST_ME_ENERGYHIT) -- Efeito na posição final end, i * 100) -- Ajusta o intervalo da animação end return true end
-
El Rusher got a reaction from Smash Tibia 24 in Mudar o modo de batalha do jogo
até da... mas vai dar um trampo.. geralmente é um arquivo LUA responsavel pela invocação dos pokemons, de modo mais facil era melhor dar um ctrl + f e procurar pela função doSummonCreature() e remover ou comentar ela..
-- doSummonCreature("nome_do_pokemon", pos)
poketibia tambem tem bastante client mod que teria que ser removido..
ai você vai ter que adicionar vocações e sprites
personalizaçao de mapa
e por fim balanceamento..
-
El Rusher got a reaction from Smash Tibia 24 in Sistema SURF ou NAVGAÇÃO
em data/actions/scripts/water_action.lua:
local waterOutfit = {lookType = 134} -- ID da outfit para o navio local originalVoc = 1 -- Vocação original que o player retorna ao sair da água function onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if not player then return true end -- Verifica se o jogador já está na outfit de navio if player:getOutfit().lookType ~= waterOutfit.lookType then player:setStorageValue(12345, player:getVocation():getId()) -- Salva a vocação original do jogador player:setOutfit(waterOutfit) -- Altera para a outfit de navio player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Você entrou na água e agora está em modo de navegação!") end return true end function onStepOut(creature, item, position, fromPosition) local player = creature:getPlayer() if not player then return true end local originalVocationId = player:getStorageValue(12345) if originalVocationId > 0 then player:setVocation(Vocation(originalVocationId)) -- Retorna à vocação original player:setOutfit({lookType = player:getSex() == PLAYERSEX_FEMALE and 136 or 128}) -- Outfit padrão baseado no sexo do jogador player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Você saiu da água e voltou ao modo normal.") end return true end
Adicione o seguinte ao seu arquivo actions.xml que fica em data/actions/actions.xml:
<action actionid="1001" script="water_action.lua"/>
No seu editor de mapas, configure os tiles da área de água que o jogador vai entrar para a ActionID 1001.
Observações
A waterOutfit pode ser alterada para qualquer ID de outfit que você deseja usar para o "modo navio". Lembre-se de ajustar os IDs de acordo com as vocações e outfits que você quer utilizar. Ao pisar na água, a outfit do jogador mudará, e ao sair, ele retornará à sua vocação e outfit originais. Isso deve lhe dar uma base para começar a implementar a funcionalidade de navegação que você deseja!
-
El Rusher got a reaction from Muvuka in -=[TFS - 0.3.6 - 8.60]=- ERRO NPC REVIVE
1. Corrigir o erro do gsub:
O erro de gsub ocorre quando o tipo de dado passado para ele não é válido. No caso do erro que você está recebendo, parece que o sistema está esperando uma string, mas recebeu outro tipo de valor.
2. Verificar o erro Creature not found:
Esse erro sugere que o NPC está tentando interagir com uma criatura (cid) que não existe ou foi removida do jogo. Pode ser resolvido verificando se o cid é uma criatura válida antes de tentar interagir com ele.
Sugestões de ajustes no código:
Função teleportPlayerToPositionReborn:
function teleportPlayerToPositionReborn(cid) if not isCreature(cid) then selfSay('Player not found.', cid) return false end local playerRebornPositionX = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_X) local playerRebornPositionY = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Y) local playerRebornPositionZ = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Z) if playerRebornPositionX == -1 or playerRebornPositionY == -1 or playerRebornPositionZ == -1 then selfSay('You have not died yet.', cid) return false end doTeleportThing(cid, {x = playerRebornPositionX, y = playerRebornPositionY, z = playerRebornPositionZ}) return true end isCreature(cid): Verifica se o cid ainda é uma criatura válida antes de tentar acessá-la. Isso ajuda a evitar o erro Creature not found. Função onThink:
Certifique-se de que o onThink está bem implementado no NPC:
function onThink() if not npcHandler:isFocused() then return false end npcHandler:onThink() return true end
-
El Rusher got a reaction from IOWeenI in Spawn de Poke Aleatorio em uma determinada Area
local config = { [17003] = { nameDz = "Bronze", chave = 2155, count = 1, areas = { {fromx = 1712, fromy = 1211, fromz = 15, tox = 1966, toy = 1303, toz= 15}, {fromx = 1970, fromy = 1319, fromz = 15, tox = 2248, toy = 1303, toz= 15}, {fromx = 1712, fromy = 1211, fromz = 14, tox = 1966, toy = 1303, toz= 14}, {fromx = 1970, fromy = 1319, fromz = 14, tox = 2248, toy = 1303, toz= 14} }, teleport = { {x = 1789, y = 1288, z = 15}, {x = 2062, y = 1288, z = 15}, {x = 1789, y = 1288, z = 14}, {x = 2062, y = 1288, z = 14} }, pokemons = {"Elder Zubat", "Elder Rattata"}, finish = 15 * 60 * 1000, spawnCount = 64, -- Corrigido para 64 }, -- Outros níveis de Dungeon configurados aqui } -- Função para verificar se o local é walkable function isWalkable(pos, creature, proj, pz, water) if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end if isWater(getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and pz then return false, true end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end -- Função para spawnar Pokémons na área correta function spawnPokemons(area, pokemons, spawnCount) local spawnedCount = 0 for i = 1, spawnCount do local posX = math.random(area.fromx, area.tox) local posY = math.random(area.fromy, area.toy) local posZ = area.fromz local position = {x = posX, y = posY, z = posZ} if isWalkable(position) then local chosenPokemon = pokemons[math.random(1, #pokemons)] doCreateMonster(chosenPokemon, position) spawnedCount = spawnedCount + 1 end end return spawnedCount end function onUse(cid, item, fromPosition, itemEx, toPosition) local cfg = config[item.actionid] if not cfg then return true end if isRiderOrFlyOrSurf(cid) then doPlayerSendCancel(cid, "Saia do ride ou fly para acessar a dungeon.") return true end if getPlayerStorageValue(cid, 468703) - os.time() > 0 then doPlayerSendCancel(cid, "Aguarde "..convertTime(getPlayerStorageValue(cid, 468703) - os.time()).." para entrar na Dungeon.") return true end if getPlayerItemCount(cid, cfg.chave) >= cfg.count then for i, area in ipairs(cfg.areas) do if #getPlayersInArea(area) < 1 then -- Remove monstros existentes e inicia os novos spawns removeNpcInArea({x = area.fromx, y = area.fromy, z = area.fromz}, {x = area.tox, y = area.toy, z = area.toz}, true, false) creatureInSurvival({x = area.fromx, y = area.fromy, z = area.fromz}, {x = area.tox, y = area.toy, z = area.toz}, true, false) -- Teleporta o jogador para a área correspondente doTeleportThing(cid, cfg.teleport[i]) setPlayerStorageValue(cid, 2154610, 1) doPlayerRemoveItem(cid, cfg.chave, cfg.count) -- Spawnar os pokémons na área correta local spawnedPokemons = spawnPokemons(area, cfg.pokemons, cfg.spawnCount) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Foram spawnados "..spawnedPokemons.." pokémons na dungeon.") end end return true else doPlayerSendCancel(cid, "Você precisa de "..cfg.count.." "..getItemNameById(cfg.chave).." para entrar.") end return true end
Neste script:
A função spawnPokemons foi ajustada para tentar spawnar um total de 64 pokémons por área (ou o número especificado em spawnCount). Foram feitas correções para garantir que apenas posições "walkable" sejam consideradas para o spawn. O número de pokémons spawnados é mostrado ao jogador após o teleporte. -
El Rusher got a reaction from IOWeenI in Spawn de Poke Aleatorio em uma determinada Area
local function getWalkablePositions(area, maxPositions) local walkablePositions = {} for i = 1, #area do if #walkablePositions >= maxPositions then break -- Limitar o número de posições end local pos = area[i] if isWalkable(pos, true, false, true, true) then table.insert(walkablePositions, pos) end end return walkablePositions end -- Usar a função para obter exatamente 64 posições local positions = getWalkablePositions(area, 64)
-
El Rusher got a reaction from IOWeenI in Spawn de Poke Aleatorio em uma determinada Area
Para evitar a criação de monstros em paredes, você precisa verificar se o local gerado aleatoriamente é um local "walkable" (ou seja, acessível para o monstro andar). O TFS tem uma função chamada isWalkable que pode ser usada para validar as posições antes de gerar um Pokémon.
local config = { [17003] = { nameDz = "Bronze", chave = 2155, count = 1, areas = { -- Criei uma tabela de áreas para simplificar {fromx = 1712, fromy = 1211, fromz = 15, tox = 1966, toy = 1303, toz= 15}, {fromx = 1712, fromy = 1319, fromz = 15, tox = 1966, toy = 1411, toz= 15}, {fromx = 1712, fromy = 1427, fromz = 15, tox = 1966, toy = 1519, toz= 15}, {fromx = 1712, fromy = 1535, fromz = 15, tox = 1966, toy = 1627, toz= 15} }, teleport = { -- Criado teleporte para cada área {x = 1789, y = 1288, z = 15}, {x = 1789, y = 1396, z = 15}, {x = 1789, y = 1504, z = 15}, {x = 1789, y = 1612, z = 15} }, pokemons = {"Elder Zubat", "Elder Rattata", "Shiny Golbat", "Shiny Raticate"}, spawnCount = 64 } } -- Função para verificar se o local é walkable function isPositionWalkable(pos) local tile = Tile(pos) return tile and not tile:hasFlag(TILESTATE_PROTECTIONZONE) and not tile:getCreatureCount() > 0 end -- Função para spawnar Pokémons na área correta function spawnPokemons(area, pokemons, spawnCount) for i = 1, spawnCount do local posX = math.random(area.fromx, area.tox) local posY = math.random(area.fromy, area.toy) local posZ = area.fromz local position = {x = posX, y = posY, z = posZ} -- Verifica se a posição é "walkable" if isPositionWalkable(position) then local chosenPokemon = pokemons[math.random(1, #pokemons)] doCreateMonster(chosenPokemon, position) else i = i - 1 -- Se a posição não for válida, tenta novamente end end end function onUse(cid, item, fromPosition, itemEx, toPosition) local cfg = config[item.actionid] if not cfg then return true end if isRiderOrFlyOrSurf(cid) then doPlayerSendCancel(cid, "Saia do ride ou fly para acessar a dungeon.") return true end if getPlayerStorageValue(cid, 468703) - os.time() > 0 then doPlayerSendCancel(cid, "Aguarde "..convertTime(getPlayerStorageValue(cid, 468703) - os.time()).." para entrar na Dungeon.") return true end if getPlayerItemCount(cid, cfg.chave) >= cfg.count then for i, area in ipairs(cfg.areas) do if #getPlayersInArea(area) < 1 then -- Remove monstros existentes e inicia os novos spawns removeNpcInArea({x = area.fromx, y = area.fromy, z = area.fromz}, {x = area.tox, y = area.toy, z = area.toz}, true, false) creatureInSurvival({x = area.fromx, y = area.fromy, z = area.fromz}, {x = area.tox, y = area.toy, z = area.toz}, true, false) -- Teleporta o jogador para a área correspondente doTeleportThing(cid, cfg.teleport[i]) setPlayerStorageValue(cid, 2154600, 1) doPlayerRemoveItem(cid, cfg.chave, cfg.count) addEvent(doTeleportFinish2, 15 * 60 * 1000, cid) doSendPlayerExtendedOpcode(cid, 133, 899) -- Spawna os Pokémons spawnPokemons(area, cfg.pokemons, cfg.spawnCount) return true end end doPlayerSendCancel(cid, "Nao tem Zonas disponiveis no momento, tente mais tarde!") else doPlayerSendCancel(cid, "Você precisa de uma Bronze Dimensional Key para acessar essa Dungeon.") end return true end
Validação de Local Walkable:
Foi adicionada a função isPositionWalkable para garantir que o Pokémon não seja criado em locais inacessíveis (como paredes). Identificação da Sala:
Cada sala tem uma área e um ponto de teleporte definidos. A função percorre as áreas (cfg.areas) e verifica se há jogadores. Se não houver, o jogador é teleportado e os Pokémons são gerados nessa área. Loop para Encontrar Área Livre:
O script agora percorre todas as áreas da configuração e tenta encontrar uma disponível para o jogador entrar. Novo Teleporte e Spawn para Cada Sala:
Cada área tem seu próprio teleporte, e os Pokémons são gerados na área correspondente. Esse ajuste deve resolver os problemas de criação em áreas incorretas e o erro de geração em paredes.
-
El Rusher got a reaction from IOWeenI in Spawn de Poke Aleatorio em uma determinada Area
você pode seguir essa lógica:
-- Defina a área e a lista de Pokémons local area1 = { fromx = 1712, fromy = 1211, fromz = 15, tox = 1966, toy = 1303, toz = 15 } local pokemons = {"Bulbasaur", "Charmander", "Squirtle", "Torchic", "Treecko", "Mudkip", "Totodile", "Chikorita", "Cyndaquil"} local spawnCount = 64 -- Número de Pokémons a serem gerados function spawnPokemons() for i = 1, spawnCount do -- Gere coordenadas aleatórias dentro da área local posX = math.random(area1.fromx, area1.tox) local posY = math.random(area1.fromy, area1.toy) local posZ = area1.fromz -- Mantenha a mesma altura (z) local position = {x = posX, y = posY, z = posZ} -- Escolha um Pokémon aleatoriamente da lista local chosenPokemon = pokemons[math.random(1, #pokemons)] -- Crie o Pokémon na posição escolhida doCreateMonster(chosenPokemon, position) end end -- Chame a função para spawnar os Pokémons spawnPokemons()
Explicação do Script
Área de Spawn: A área é definida pelas coordenadas fromx, fromy, fromz (canto superior esquerdo) e tox, toy, toz (canto inferior direito).
Lista de Pokémons: A lista pokemons contém os nomes dos Pokémons que podem ser gerados.
Função spawnPokemons:
Gera 64 posições aleatórias dentro da área especificada. Seleciona aleatoriamente um Pokémon da lista para cada posição. Usa a função doCreateMonster para criar o Pokémon na posição especificada. Execução: A função spawnPokemons é chamada para executar o spawn dos Pokémons.
-
El Rusher got a reaction from Muvuka in -=[TFS]=- - 0.3.6 - 8.60 - EU QUERIA QUE QUANDO MATASSE PLAYER APARECESSE HEADSHOT! FICA APARECENDO HEADSHOT! TODA HORA QUE ATACA PLAYER
local chance_percent = 100 -- Chance percentual para headshot local extra_damage_percent = 1000 -- Percentual de dano extra function onLogin(cid) registerCreatureEvent(cid, "HeadshotCritical") return true end function onStatsChange(cid, attacker, type, combat, value) if type ~= STATSCHANGE_HEALTHLOSS then return true end if isPlayer(attacker) and getPlayerStorageValue(cid, 71257) < 1 then if math.random(100) <= chance_percent then local dmg = value * (extra_damage_percent / 100) setPlayerStorageValue(cid, 71257, 1) doTargetCombatHealth(attacker, cid, combat, -dmg, -dmg, 255) setPlayerStorageValue(cid, 71257, -1) -- Verifica se o dano causado é letal if getCreatureHealth(cid) <= dmg then doCreatureSay(cid, "HEADSHOT!", TALKTYPE_MONSTER) end return false end end return true end
Como o script funciona:
Chance de Headshot: O código mantém a chance de "headshot" e o dano adicional, como no script original.
Verificação de Morte: Antes de exibir a mensagem "HEADSHOT!", o script verifica se o dano causado é suficiente para matar o alvo (getCreatureHealth(cid) <= dmg). Se for letal, a mensagem é exibida.
Mensagem de "HEADSHOT!": A mensagem só aparecerá se o jogador morrer pelo ataque que causou o dano crítico.
Como usar:
Adicione o script ao seu servidor.
Registre o evento no creaturescripts.xml:
<event type="statschange" name="HeadshotCritical" script="headshot.lua"/>
Reinicie o servidor para que as alterações entrem em vigor.
Com essas alterações, o efeito "HEADSHOT!" só aparecerá quando um jogador matar outro jogador com um ataque crítico. Isso evita que a mensagem apareça a cada ataque, melhorando a experiência de jogo.
-
El Rusher got a reaction from Dbz in [OTCLIENT] Fixar HealtInfo na barra de texto
Encontre o arquivo de configuração do cliente: Normalmente, isso pode ser um arquivo .cfg, .ini ou um arquivo XML/JSON, dependendo do cliente que você está usando. Abra o arquivo de configuração: Use um editor de texto para abrir o arquivo. Procure por configurações relacionadas à barra de saúde: Algo como healthinfo ou statusbar. Se o seu cliente usa XML para configurações, você pode encontrar algo assim:
<interface> <healthinfo visible="false" /> </interface>
Você precisaria alterar visible="false" para visible="true":
<interface> <healthinfo visible="true" /> </interface>
2. Modificação no Código-Fonte
Se a configuração não estiver diretamente disponível em um arquivo de configuração, você pode precisar modificar o código-fonte do cliente. Aqui está um exemplo de como você pode fazer isso em C++:
Exemplo em C++
Encontre a função de inicialização da interface do cliente: Esta função geralmente é responsável por configurar e renderizar os elementos da interface do usuário quando o cliente é iniciado.
Adicione o código para tornar a barra de saúde visível: Isso pode ser algo assim:
void Interface::initialize() { // Outras inicializações // Certifique-se de que a barra de saúde esteja visível healthInfoBar->setVisible(true); }
-
El Rusher got a reaction from Muvuka in Site [WONRS] não seleciona vocação para criação
1. Verifique o Código JavaScript
O botão de seleção de vocação e o valor do campo pdt_id são definidos pelo JavaScript. Certifique-se de que o JavaScript está funcionando corretamente e que o valor está sendo corretamente atribuído ao campo pdt_id.
Aqui está um exemplo de função JavaScript que deve estar presente para selecionar a vocação:
function selectpdt(id) { document.getElementById('pdt_id').value = id; var buttons = document.getElementsByClassName('pdt_blc'); for (var i = 0; i < buttons.length; i++) { buttons[i].style.border = 'none'; } document.getElementById('b' + id).style.border = '2px solid #f00'; // Ajuste a borda para indicar seleção }
2. Verifique o HTML do Formulário
Assegure-se de que o formulário HTML está configurado corretamente para enviar os dados:
O campo oculto para vocação (pdt_id) deve estar presente e ser atualizado pelo JavaScript quando uma vocação é selecionada. O botão de submit (Criar Personagem) deve estar habilitado quando todos os campos forem preenchidos. No seu código, o botão de submit está desabilitado (disabled), o que pode ser a causa do problema. Verifique se o JavaScript está habilitando o botão após a seleção da vocação e o preenchimento dos campos obrigatórios.
3. Verifique a Função selectpdt
Verifique se a função JavaScript selectpdt está sendo chamada corretamente ao clicar em uma vocação. Você pode adicionar um console.log para depuração:
function selectpdt(id) { console.log('Vocation selected:', id); // Adicione isso para verificar se a função é chamada document.getElementById('pdt_id').value = id; // Resto do código }
4. Verifique o Código PHP para Processamento de Dados
Certifique-se de que o valor de $_POST['pdt_id'] está sendo corretamente verificado e validado no código PHP. Aqui está uma parte relevante do seu código:
// Validate vocation id if (!in_array((int)$_POST['pdt_id'], $config['available_vocations'])) { $errors[] = 'Permissão negada. Vocação errada.'; } Certifique-se de que o $_POST['pdt_id'] está sendo enviado corretamente e contém um ID válido.
atualizando seu código deve ficar mais ou menos assim:
<?php require_once 'engine/init.php'; protect_page(); include 'layout/overall/header.php'; $imagem = 'http://' . $_SERVER['HTTP_HOST'] . '/layout/images/vocstatus'; $statusid = 1; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $required_fields = array('name', 'selected_town', 'pdt_id'); $errors = array(); foreach ($required_fields as $field) { if (empty($_POST[$field])) { $errors[] = 'You need to fill in all fields.'; break; } } if (empty($errors)) { if (!Token::isValid($_POST['token'])) { $errors[] = 'O token é inválido.'; } $_POST['name'] = validate_name($_POST['name']); if ($_POST['name'] === false) { $errors[] = 'Seu nome não pode conter mais de 2 palavras.'; } else { if (user_character_exist($_POST['name']) !== false) { $errors[] = 'Desculpe, esse nome de personagem já existe.'; } if (!preg_match("/^[a-zA-Z_ ]+$/", $_POST['name'])) { $errors[] = 'Seu nome pode conter apenas a-z, A-Z e espaços.'; } if (strlen($_POST['name']) < $config['minL'] || strlen($_POST['name']) > $config['maxL']) { $errors[] = 'O nome do seu personagem deve estar entre ' . $config['minL'] . ' - ' . $config['maxL'] . ' caracteres longos.'; } if (in_array(strtolower($_POST['name']), $config['invalidNames'])) { $errors[] = 'Este nome de usuario esta bloqueado.'; } $resname = explode(" ", $_POST['name']); foreach ($resname as $res) { if (in_array(strtolower($res), $config['invalidNameTags'])) { $errors[] = 'Seu nome de usuário contém uma palavra restrita.'; } else if (strlen($res) == 1) { $errors[] = 'Palavras muito curtas em seu nome.'; } } if (!in_array((int)$_POST['pdt_id'], $config['available_vocations'])) { $errors[] = 'Permissão negada. Vocação errada.'; } $char_count = user_character_list_count($session_user_id); if ($char_count >= $config['max_characters']) { $errors[] = 'Sua conta não tem permissão para ter mais de ' . $config['max_characters'] . ' personagens.'; } if (validate_ip(getIP()) === false && $config['validate_IP'] === true) { $errors[] = 'Falha ao reconhecer o seu endereço IP. (Não é um endereço IPv4 válido).'; } } } } ?> <div id="title"> <div class="name">Criar novo personagem</div> </div> <br> <?php if (isset($_GET['success']) && empty($_GET['success'])) { echo 'Parabéns! Seu personagem foi criado. Te vejo no jogo!'; } else { if ($_SERVER['REQUEST_METHOD'] === 'POST' && empty($errors)) { if ($config['log_ip']) { znote_visitor_insert_detailed_data(2); } // Register $character_data = array( 'name' => format_character_name($_POST['name']), 'elo_points' => 0, 'account_id' => $session_user_id, 'vocation' => $_POST['pdt_id'], 'lastip' => getIPLong(), 'created' => time() ); user_create_character($character_data); header('Location: createcharacter.php?success'); exit(); } else if (!empty($errors)) { echo '<font color="red"><b>'; echo output_errors($errors); echo '</b></font>'; } ?> <br> <link rel="stylesheet" type="text/css" href="layout/css/style.css"> <script type="text/javascript" src="/layout/js/selection.js"></script> <center> <div class="Text"> <br>Selecione o personagem desejado:</div> <div class="caixa" style="width: 600px;height: 300px;overflow: auto;"> <table border="0" cellspacing="10" cellpadding="0"> <?php $y = 0; $i = 0; foreach ($config['available_vocations'] as $id) { if ($i == 0) { echo '<tr>'; } $i++; $y++; ?> <td> <table style="width:115px;" border="0" cellspacing="0" cellpadding="0"> <tr style="height:75px;"> <td> <div id="i<?php echo $id; ?>" class="pdt_cls" style="background-image:url('<?php echo $config['images']['selectVocation']; ?>/<?php echo $id; ?>.png'), url(/layout/images/donate/back.png);"> <div id="b<?php echo $id; ?>" class="pdt_blc" value="<?php echo $id; ?>" onclick="selectpdt(<?php echo $id; ?>);"></div> </div> </td> </tr> <tr> <td> <center> <div class="pdt_nme"><?php echo vocation_id_to_name($id); ?></div> </center> </td> </tr> </table> </td> <td> <div style="width:20px;"></div> </td> <?php if ($i == 3) { echo '</tr>'; $i = 0; } } ?> </table> </div> <br> <form action="" method="post"> <li> <font color="white">Digite o nome para seu personagem:</font> <br> <input type="text" name="name"> </li> <input id="pdt_id" name="pdt_id" type="hidden" value="0" /> <table> <tr> <td> <input id="ckb_obs" name="ckb_obs" onclick="chkbox();" type="checkbox" /> </td> <td> <label class="Text" style="width:100%;" for="ckb_obs"> <center>Estou ciente das <a href="/termos.php" style="font-family:monospace; font-size:13px; font-weight:bold;">observações referentes a criação do personagem.</a></center> </label> </td> </tr> </table> <input type="hidden" name="token" value="<?php echo Token::generate(); ?>" /> <div style="height:20px;"></div> <input id="Button" type="submit" value="Criar Personagem" /> </form> </center> <?php } include 'layout/overall/footer.php'; ?>
-
El Rusher got a reaction from Muvuka in Players ficam "imortal" nao toma dano de outro player ou monstro
pode ser privilegio de GM / ADM
-
El Rusher got a reaction from Muvuka in -=[TFS]=- 0.3.6 - 8.60 - ERRO NA HORA DE USAR UM COMANDO !guildrank
function onSay(cid, words, param) local guilds = {} local guild_rank = {} -- Seleciona o level e a guild de cada jogador com guild e com level maior que 10, ordenados pelo level local query = db.getResult("SELECT level, guild_id FROM players WHERE guild_id > 0 AND level > 10 ORDER BY level DESC") -- Caso nenhum jogador seja selecionado, retorna verdadeiro if query:getID() == -1 then return true end repeat local level = query:getDataInt("level") local guild_id = query:getDataInt("guild_id") -- Cria uma tabela dentro da tabela guilds para cada guilda if not guilds[guild_id] then guilds[guild_id] = {level = level, members = 1} -- Se a tabela já existir e o número de membros for menor que 10, soma o level e +1 ao número de membros elseif guilds[guild_id].members < 10 then guilds[guild_id].level = guilds[guild_id].level + level guilds[guild_id].members = guilds[guild_id].members + 1 end -- Termina se não existirem mais resultados until not query:next() query:free() -- Passa os resultados obtidos para a tabela guild_rank, para ordená-la com table.sort for i, k in pairs(guilds) do table.insert(guild_rank, {id = i, level = k.level}) end -- Ordena a tabela guild_rank de acordo com a soma dos levels table.sort(guild_rank, function(a, b) return a.level > b.level end) local i = 0 local str = ' Guild Rank\n' -- Crie uma string com o nome das guildas em um ranking for _, info in pairs(guild_rank) do i = i + 1 str = str .. i .. ' - '.. getGuildNameById(info.id) .. ' - ' .. info.level .. '\n' if i == 10 then break end end -- Se algum erro ocorrer e o ranking não tiver informações, manda a mensagem "No Guild Information..." local ret = str ~= ' Guild Rank\n' and str or "No guild information to be displayed." doPlayerPopupFYI(cid, ret) return true end
O erro que você está encontrando, SQLITE ERROR: no such column: guild_id, indica que a coluna guild_id não existe na tabela players.
adicione no seu banco de dados:
ALTER TABLE players ADD COLUMN guild_id INTEGER DEFAULT 0;
-
El Rusher got a reaction from Muvuka in -=[TFS]=- 0.3.6 - 8.60 CRITICAL STONE and BOOSTER ATTACK STONE DANDO ERRO [AJUDA]
boa noite
local lvlcrit = 48913 -- armazenamento para críticos normais local lvlcritDanger = 48904 -- armazenamento para críticos perigosos local multiplier = 1.5 -- multiplicador de dano function onCombat(cid, target) print("onCombat chamado com cid: " .. tostring(cid) .. " target: " .. tostring(target)) if isPlayer(cid) and isCreature(target) then local criticalChance = getPlayerStorageValue(cid, lvlcrit) or 0 local criticalDangerChance = getPlayerStorageValue(cid, lvlcritDanger) or 0 local chance = math.random(1, 1000) -- Mantém um intervalo razoável print("Chances de crítico: normal=" .. criticalChance .. " perigo=" .. criticalDangerChance .. " sorteio=" .. chance) -- Verifica se a chance de crítico BOOSTER é atingida if chance <= (criticalChance * 3) then print("Crítico BOOSTER atingido!") local damage = 100 -- Valor do dano crítico BOOSTER (ajuste conforme necessário) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -damage, -damage, 255) doSendAnimatedText(getCreaturePosition(target), "+BOOSTER!", 31) doSendMagicEffect(getCreaturePosition(cid), 54) return true end -- Verifica se a chance de crítico DANGER é atingida if chance <= (criticalDangerChance * 3) then print("Crítico DANGER atingido!") local damage = 100 -- Valor do dano crítico DANGER (ajuste conforme necessário) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -damage, -damage, 255) doSendAnimatedText(getCreaturePosition(target), "DANGER!", 190) doSendMagicEffect(getCreaturePosition(cid), 52) return true end end return true end
-
El Rusher got a reaction from Muvuka in -=[TFS]=- 0.3.6 - 8.60 - [GLOBALEVENTS] - Proibido jogar item em cima do tile
se era pra ser uma imagem esta com erro meu amigo
-
El Rusher got a reaction from Muvuka in -=[TFS]=- 0.3.6 - 8.60 - NPC Reviver Dando erro no console
local MONEY_AMOUNT = 1000000 -- Quantidade de dinheiro (em gold coins) que o player necessitará para reviver local MAGIC_EFFECT_TELEPORT = 65 -- Efeito que aparecerá quando o player for teleportado local PLAYER_REBORN_POSITION_X = 66541 local PLAYER_REBORN_POSITION_Y = 66542 local PLAYER_REBORN_POSITION_Z = 66543 local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'reviver') or msgcontains(msg, 'revive') then selfSay('Você precisa de ' .. MONEY_AMOUNT .. ' gold(s) para ressuscitar no local onde você morreu recentemente', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerMoney(cid) >= MONEY_AMOUNT then doPlayerRemoveMoney(cid, MONEY_AMOUNT) if teleportPlayerToPositionReborn(cid) then doTeleportThing(cid, {x = PLAYER_REBORN_POSITION_X, y = PLAYER_REBORN_POSITION_Y, z = PLAYER_REBORN_POSITION_Z}) doSendMagicEffect(getCreaturePosition(cid), MAGIC_EFFECT_TELEPORT) selfSay('Ok, você foi ressuscitado', cid) end else selfSay('Desculpe, mas você não possui dinheiro suficiente.', cid) end talkState[talkUser] = 0 elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then talkState[talkUser] = 0 selfSay('Ok, até mais.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) function teleportPlayerToPositionReborn(cid) local playerRebornPositionX = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_X) local playerRebornPositionY = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Y) local playerRebornPositionZ = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Z) if playerRebornPositionX == -1 or playerRebornPositionY == -1 or playerRebornPositionZ == -1 then selfSay('Você não morreu nenhuma vez ainda.', cid) return false end doTeleportThing(cid, {x = playerRebornPositionX, y = playerRebornPositionY, z = playerRebornPositionZ}) return true end Correção na Função teleportPlayerToPositionReborn:
Os valores PLAYER_REBORN_POSITION_X, PLAYER_REBORN_POSITION_Y e PLAYER_REBORN_POSITION_Z devem ser usados corretamente para obter a posição armazenada do jogador.
Correção na Lógica de Teleporte:
A função doTeleportThing é chamada uma vez no teleportPlayerToPositionReborn e não precisa ser chamada novamente na função principal.
Adição de Mensage
-
Recently Browsing 0 members
- No registered users viewing this page.
