Ir para conteúdo
  • 0

-=[TFS]=- 0.4 8.60 Reset [Talkactions] ta dando pal nesse script


Muvuka

Pergunta

<talkaction words="!reset" script="reset.lua"/>

 

[16/08/2023 14:23:21] [VIP] [Vip21] Capoto has logged out.

[16/08/2023 14:23:22] [Error - TalkAction Interface]
[16/08/2023 14:23:22] In a timer event called from:
[16/08/2023 14:23:22] data/talkactions/scripts/reset.lua:onSay
[16/08/2023 14:23:22] Description:
[16/08/2023 14:23:22] (luaGetCreatureStorage) Creature not found

[16/08/2023 14:23:23] [Error - TalkAction Interface]
[16/08/2023 14:23:23] In a timer event called from:
[16/08/2023 14:23:23] data/talkactions/scripts/reset.lua:onSay
[16/08/2023 14:23:23] Description:
[16/08/2023 14:23:23] data/talkactions/scripts/reset.lua:117: attempt to compare boolean with number
[16/08/2023 14:23:23] stack traceback:
[16/08/2023 14:23:23]     data/talkactions/scripts/reset.lua:117: in function 'getResets'
[16/08/2023 14:23:23]     data/talkactions/scripts/reset.lua:96: in function <data/talkactions/scripts/reset.lua:95>

[16/08/2023 14:23:24] [Error - TalkAction Interface]
[16/08/2023 14:23:24] In a timer event called from:
[16/08/2023 14:23:24] data/talkactions/scripts/reset.lua:onSay
[16/08/2023 14:23:24] Description:
[16/08/2023 14:23:24] (luaGetCreatureStorage) Creature not found

[16/08/2023 14:23:25] [Error - TalkAction Interface]
[16/08/2023 14:23:25] In a timer event called from:
[16/08/2023 14:23:25] data/talkactions/scripts/reset.lua:onSay
[16/08/2023 14:23:25] Description:
[16/08/2023 14:23:25] data/talkactions/scripts/reset.lua:117: attempt to compare boolean with number
[16/08/2023 14:23:25] stack traceback:
[16/08/2023 14:23:25]     data/talkactions/scripts/reset.lua:117: in function 'getResets'
[16/08/2023 14:23:26]     data/talkactions/scripts/reset.lua:96: in function <data/talkactions/scripts/reset.lua:95>

[16/08/2023 14:23:26] [Error - TalkAction Interface]
[16/08/2023 14:23:26] In a timer event called from:
[16/08/2023 14:23:26] data/talkactions/scripts/reset.lua:onSay
[16/08/2023 14:23:26] Description:
[16/08/2023 14:23:26] (luaGetCreatureStorage) Creature not found

[16/08/2023 14:23:27] [Error - TalkAction Interface]
[16/08/2023 14:23:27] In a timer event called from:
[16/08/2023 14:23:27] data/talkactions/scripts/reset.lua:onSay
[16/08/2023 14:23:27] Description:
[16/08/2023 14:23:27] data/talkactions/scripts/reset.lua:117: attempt to compare boolean with number
[16/08/2023 14:23:27] stack traceback:
[16/08/2023 14:23:28]     data/talkactions/scripts/reset.lua:117: in function 'getResets'
[16/08/2023 14:23:28]     data/talkactions/scripts/reset.lua:96: in function <data/talkactions/scripts/reset.lua:95>
[16/08/2023 14:23:28] [VIP] [Vip21] Capoto has logged in.

 

function onSay(cid, words, param)
 
--[Configurações de Condição]__
 
config = { --[[verdadeiro / Falso]]
 
needPa = true, -- Precisa de Premium Account? [true / false]
needPz = true, -- Precisa estar em Protection Zone? [true / false]
battle = true, -- 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 = 101, -- 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)
resets = getPlayerStorageValue(cid,config.storage)
 
if resets < 0 then
resets = 0
end
return resets
 
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]__

local storageKey = 13545

if getCreatureStorage(cid, storageKey) < os.time() then
doPlayerPopupFYI(cid, "Somente Player VIP Account.")
return true
 
elseif(config.needPz == true) and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
doPlayerSendTextMessage(cid,22,"Você Precisa estar em Protection Zone Para Resetar.")
return TRUE
 
elseif(config.addLimite == true) and (getResets(cid) == config.resetStatus.limite) then
doPlayerSendTextMessage(cid, 22, "Você ja atingiu o Limite de Resets.")
return TRUE
 
elseif(config.withe == false) and (getCreatureSkullType(cid) == 3) then
doPlayerSendTextMessage(cid,22,"Você ta PK White, por isso não pode resetar.")
return TRUE
 
elseif(config.red == false) and (getCreatureSkullType(cid) == 4) then
doPlayerSendTextMessage(cid,22,"Você ta PK Red, por isso não pode resetar.")
return TRUE
 
elseif(config.needPa == true) and not isPremium(cid) then
doPlayerSendTextMessage(cid,22,"Você Precisa ser Premium Account para Resetar.")
return TRUE
 
elseif(config.battle == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
doPlayerSendTextMessage(cid,22,"Você 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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
elseif doPlayerSendCancel(cid, needLvl) then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return TRUE
end
 
if doPlayerPopupFYI(cid, msg) then
 
end
return TRUE
 
end
 
--[By: Linnux]__

 

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0

Boa tarde,

 

Parece que na hora que ele tenta buscar o valor de resets para comparar, está dando erro. (Variável cid), tomei a liberdade de organizar o código da linha 95 a 123:

 

function resetPlayer(cid, description)
    local resets = getResets(cid)
    local newResets = resets + 1

    if newResets < 0 then
        newResets = 0
    end

    setPlayerStorageValue(cid, config.storage, newResets)

    if description then
        db.executeQuery("UPDATE `players` SET `description` = ' [Reset " .. newResets .. "]' WHERE `id` = " .. config.resetStatus.player)
    else
        db.executeQuery("UPDATE `players` SET `description` = '' WHERE `id` = " .. config.resetStatus.player)
    end

    doRemoveCreature(cid)

    -- Reset player's level and experience to initial values
    db.executeQuery("UPDATE `players` SET `level` = " .. config.resetStatus.lvlreset .. ", `experience` = 0 WHERE `id` = " .. config.resetStatus.player)
end

function teleportAndReset(cid)
    resetPlayer(cid, true) -- true indicates to update the player's description
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    return TRUE
end

function resetAndKeepLook(cid)
    resetPlayer(cid, false) -- false indicates not to update the player's description
    return TRUE
end

function getResets(cid)
    local resets = getPlayerStorageValue(cid, config.storage)
    return math.max(0, resets)
end


Nesse código revisado, as funções resetPlayer, teleportAndReset, e resetAndKeepLook foram criadas para realizar as operações de reset de forma mais organizada. A função resetPlayer realiza a atualização dos resets no armazenamento, a atualização da descrição do jogador e o teletransporte para o templo. As outras duas funções chamam resetPlayer com diferentes configurações. Certifique-se de chamar a função apropriada com base nas condições do jogo.

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

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