Ir para conteúdo
  • Cadastre-se

Posts Recomendados

então galera estou querendo que alguem me ajude nesse script de reset pois não está funcionando no meu otserv TFS 1.1 versão 10.76, segue o erro abaixo.

 

5e17300530f8567ce85077b0fe4c4756bacab79d

 

reset.lua

 

--[[ <(Advanced Reset System 2.0)>
                                   Autor: Juniior Cwb ;*. Contato: ([email protected])
                                   Versão: 2.0
                                   Testado em: 8.50 e 8.60
                                   TFS: 0.3.6 and 0.4.0
                                   Atenção , Se Achar Esse Sistema em outro site ou forum favor comunicar Eu ( Juniior Cwb ) [email protected] )
                   -=[Características]=-
                            ~( Versão 2.0 )~
                   - Resets agora Armazenados na DataBase; (Sem Valor de Storage)
                   - Instala o System e cria a Tabela de Resets com o comando "/installreset";
                   - Resets no Look do jogador ex: 22:10 You see Marcello [Reset 2] (Level 8). He is an elder druid.;
                   - [STAGES] para "Premium Account" e "Free Account";  ]]
--=[Functions]=--
-- installReset()'                                                                        [Instala o Sistema.]
-- tableResetInstall()'                             [Verifica Se o Sistema ja foi instaladao.]
-- nowReseting()'                                                                           [Verifica, retorna o erro ou reseta.]
-- getPlayerReset(cid)'                             [Pega numero de resets do player.]
-- checLevelStageReset(cid)'                      [Verifica o Level para Resetar.]
-- newReset(cid)'                                                                           [Verifica todas as Condições de Reset.]
-- addValue(value)'                                                         [Adiciona numero de resets.]
--=[Comandos de Jogadores]=--
--  "!resetar"            -- Para Resetar.
 
local exhaustionMinutes = 1 -- exausted em segundos
local storageUse = 34538 -- storage usado no exausted.
 
function onSay(cid, words, param)
if words =="!resetar" then
if(exhaustion.check(cid, storageUse) == TRUE) then
   if (exhaustion.get(cid, storageUse) >= 5) then
   doPlayerSendCancel(cid, "Voçê só pode usar após [" .. math.floor(exhaustion.get(cid, storageUse) / 5 + 1) .."] Segundos.")
   end
    if (exhaustion.get(cid, storageUse) <= 5) then
    doPlayerSendCancel(cid, "Voçê só pode usar após [" .. exhaustion.get(cid, storageUse).."] segundos.")
    end
return TRUE
end
exhaustion.set(cid, storageUse, exhaustionMinutes*5)
--[ Condições de Reset ] --
local coNdConf = {
needPz = false,                                              -- Precisa estar em Pz pra resetar?                                   [false, false]
needPa = false,                                           -- Precisa ser Premium Account Pra resetar?      [true, false]
withe = false,                                              -- Players com Pk Withe podem resetar?                                          [false, false]
red = true,                                                                      -- Players com Pk Red pode resetar?                                        [false, false]
battle = true,                                           -- Players precisão estar sem battle pra resetar? [true, true]
teleport = false,                                                          -- Teleportar Player para o templo após resetar?  [false, false]
look = true,                                                       -- Aparecer Resets no Look do Player?                                                 [true, true]
pid = getPlayerGUID(cid),                 -- Não Mexer.
 
--[ Configurações do Reset ] --
resetConf = {
Level = 350,                                                                -- Level Necessário para Resetar.                                                                                       [Valor]
backLvl = 25,                                                                -- Level que voltará após o Reset.                                                                                    [Valor]
time = 0,                                                                                 -- Tempo para o Player deslogar ao resetar, em segundos.  [Valor]
  },
}
                                  --[[>> STAGES <<]]--
x=true;X=true -- Não Mexer.
local stage = {Abilitar = {x}, Desabilitar = {},                 --<< Abilitar Stages?? >>--                                [{x};{}]
--          [RESETS]      |  [PREMMY]  |   [FREE]
stage1= {resets= 1,  premmy= 330, free= 330},
stage2= {resets= 5,  premmy= 355, free= 355},    -- EXPLICANDO e Configurando stages. (Se estiver Abilitado [Abilitar = {x}])
stage3= {resets= 10, premmy= 360, free= 360},    -- resets = Número de resets para o Stage;
stage4= {resets= 15, premmy= 365, free= 365},    -- premmy = Level necessário para Premium Accounts;
stage5= {resets= 20, premmy= 380, free= 380},    -- free            = Level necessário para Free Accounts;
stage6= {resets= 25, premmy= 390, free= 390},     -- Coloque em Ordem...
stage7= {resets= 30, premmy= 410, free= 410},    -- [OBS: MARQUE UM "X" PARA ABILITAR OU DESABILITAR OS STAGES]
stage8= {resets= 35, premmy= 430, free= 430},    -- EX: para desabilitar mude: Abilitar = {}, Desabilitar = {x}
stage9= {resets= 40, premmy= 450, free= 450},
stage10={resets= 45, premmy= 480, free= 480},
stage11={resets= 50, premmy= 510, free= 510},
stage12={resets= 55, premmy= 550, free= 550},
stage13={resets= 60, premmy= 610, free= 610},
stage14={resets= 65, premmy= 750, free= 750},
stage15={resets= 70, premmy= 760, free= 760},
stage16={resets= 75, premmy= 900, free= 900},
stage17={resets= 80, premmy= 1000, free= 1000},
stage18={resets= 85, premmy= 1300, free= 1300},
stage19={resets= 90, premmy= 1500, free= 1500},
stage20={resets= 95, premmy= 3000, free= 3000},
stage21={resets= 100, premmy= 2800, free= 2800},
stage22={resets= 105, premmy= 2900, free= 2900},
stage23={resets= 110, premmy= 3200, free= 3200},
stage24={resets= 115, premmy= 3500, free= 3500},
stage25={resets= 120, premmy= 4300, free= 4300},
stage26={resets= 125, premmy= 4500, free= 4500},
stage27={resets= 130, premmy= 99500, free= 99500},
 
}
                            --[[>> FIM STAGES <<]]--
--=[Pega Valor de Resets]=--
function getPlayerReset(cid)
local qr = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..coNdConf.pid..";")
rss = qr:getDataInt("reset", coNdConf.pid)
if rss < 0 then
rss = 0
end
return rss
end
local success = "                                                                 ~~ Sucesso! ~~ \nVocê tem agora "..(getPlayerReset(cid)+1).." resets. \nVocê será deslogado em "..coNdConf.resetConf.time.." segundos." ;err = doPlayerSendTextMessage
local qrt = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..coNdConf.pid..";");rss_db = qrt:getDataInt("reset", coNdConf.pid)
local lvl_query = "UPDATE `players` SET `level` = "..(coNdConf.resetConf.backLvl)..", `experience` = 0 WHERE `id`= " .. coNdConf.pid .. ";"
local reset_query = "UPDATE `players` SET `reset` = "..(getPlayerReset(cid)+(1)).." WHERE `id`= " .. coNdConf.pid .. ";"
local nolook_query = "UPDATE `players` SET `description` = '' WHERE `players`.`id`= " .. coNdConf.pid .. ";"
local look_query = "UPDATE `players` SET `description` = ' [Reset "..(getPlayerReset(cid)+(1)).."]' WHERE `players`.`id`= " .. coNdConf.pid .. ";"
--=[Reseta]=--
function addValue(value)
if coNdConf.look == false then
  doRemoveCreature(cid)
db.executeQuery(lvl_query);db.executeQuery(reset_query);db.executeQuery(nolook_query)
else
  doRemoveCreature(cid)
   db.executeQuery(lvl_query);db.executeQuery(reset_query);db.executeQuery(look_query)
  return LUA_NO_ERROR
end
end
function nowReseting()
if (getPlayerLevel(cid) < coNdConf.resetConf.Level) then
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "- Level Necessário Para o Reset ["..coNdConf.resetConf.Level.."]. Faltam "..coNdConf.resetConf.Level-getPlayerLevel(cid).." level's para você Resetar. -")
  return true
end
if getPlayerLevel(cid) >= coNdConf.resetConf.Level and (coNdConf.teleport == false) then
                  doPlayerPopupFYI(cid, success)
                  addEvent(addValue, coNdConf.resetConf.time*1, value)
            else
                  doPlayerPopupFYI(cid, success)
                  addEvent(doTeleportThing, coNdConf.resetConf.time*900, cid, getTownTemplePosition(getPlayerTown(cid)))
                  addEvent(addValue, coNdConf.resetConf.time*1000, value)
  return true
end
end
--[STAGES Nao mexer em nada.]--
function checkLevelStageReset(cid)
local stages = {
            {resets= stage.stage1.resets, premmy= stage.stage1.premmy, free= stage.stage1.free},
            {resets= stage.stage2.resets, premmy= stage.stage2.premmy, free= stage.stage2.free},
            {resets= stage.stage3.resets, premmy= stage.stage3.premmy, free= stage.stage3.free},
            {resets= stage.stage4.resets, premmy= stage.stage4.premmy, free= stage.stage4.free},
            {resets= stage.stage5.resets, premmy= stage.stage5.premmy, free= stage.stage5.free},
            {resets= stage.stage6.resets, premmy= stage.stage6.premmy, free= stage.stage6.free},
            {resets= stage.stage7.resets, premmy= stage.stage7.premmy, free= stage.stage7.free},
            {resets= stage.stage8.resets, premmy= stage.stage8.premmy, free= stage.stage8.free},
            {resets= stage.stage9.resets, premmy= stage.stage9.premmy, free= stage.stage9.free},
            {resets=stage.stage10.resets, premmy=stage.stage10.premmy, free=stage.stage10.free},
            {resets=stage.stage11.resets, premmy=stage.stage11.premmy, free=stage.stage11.free},
            {resets=stage.stage12.resets, premmy=stage.stage12.premmy, free=stage.stage12.free},
            {resets=stage.stage13.resets, premmy=stage.stage13.premmy, free=stage.stage13.free},
            {resets=stage.stage14.resets, premmy=stage.stage14.premmy, free=stage.stage14.free},
            {resets=stage.stage15.resets, premmy=stage.stage15.premmy, free=stage.stage15.free},
            {resets=stage.stage16.resets, premmy=stage.stage16.premmy, free=stage.stage16.free},
            {resets=stage.stage17.resets, premmy=stage.stage17.premmy, free=stage.stage17.free},
            {resets=stage.stage18.resets, premmy=stage.stage18.premmy, free=stage.stage18.free},
            {resets=stage.stage19.resets, premmy=stage.stage19.premmy, free=stage.stage19.free},
            {resets=stage.stage20.resets, premmy=stage.stage20.premmy, free=stage.stage20.free},
            {resets=stage.stage21.resets, premmy=stage.stage21.premmy, free=stage.stage21.free},
            {resets=stage.stage22.resets, premmy=stage.stage22.premmy, free=stage.stage22.free},
            {resets=stage.stage23.resets, premmy=stage.stage23.premmy, free=stage.stage23.free},
            {resets=stage.stage24.resets, premmy=stage.stage24.premmy, free=stage.stage24.free},
            {resets=stage.stage25.resets, premmy=stage.stage25.premmy, free=stage.stage25.free},
            {resets=stage.stage26.resets, premmy=stage.stage26.premmy, free=stage.stage26.free},
   {resets=stage.stage27.resets, premmy=stage.stage27.premmy, free=stage.stage27.free},
 
}
            local resets = getPlayerReset(cid)
                            for i, tab in ipairs(stages) do
                                            if resets <= tab.resets then
                                                            coNdConf.resetConf.Level = isPremium(cid) and tab.premmy or tab.free
                                                            break
                                            end
                            end
if (getPlayerLevel(cid) < coNdConf.resetConf.Level) then
err(cid, MESSAGE_STATUS_CONSOLE_BLUE, "- Level Necessário Para o Reset ["..coNdConf.resetConf.Level.."]. Faltam "..coNdConf.resetConf.Level-getPlayerLevel(cid).." level's para você Resetar. -")
return TRUE
end
  if getPlayerLevel(cid) >= coNdConf.resetConf.Level and (coNdConf.teleport == false) then
                 doPlayerPopupFYI(cid, success)
                 addEvent(addValue, coNdConf.resetConf.time*1000, value)
   else
   doPlayerPopupFYI(cid, success)
   addEvent(addValue, coNdConf.resetConf.time*1000, value)
   addEvent(doTeleportThing, coNdConf.resetConf.time*900, cid, getTownTemplePosition(getPlayerTown(cid)))
            return true
  end
end
            function newReset(cid)
            if(coNdConf.needPz == true) and (getTilePzInfo(getCreaturePosition(cid)) == LUA_ERROR) then
                 err(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você Precisa estar em Protection Zone Para Resetar. -") return TRUE end
            if(coNdConf.needPa == true) and not isPremium(cid) then
                 err(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você Precisa ser Premium Account para Resetar. -") return TRUE end
            if(coNdConf.withe == false) and (getCreatureSkullType(cid) == 3) then
                 err(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você não pode resetar em condições de PK Withe. -") return TRUE end
            if(coNdConf.red == false) and (getCreatureSkullType(cid) == 4) then
                 err(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você não pode resetar em condições de PK Red. -") return TRUE end
            if(coNdConf.battle == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
                 err(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você Precisa estar sem Battle para Resetar. -") return TRUE end
local xy = {true,false}
table.insert(stage.Abilitar, false)
table.insert(stage.Desabilitar, false)
if stage.Abilitar[1] == xy[1] and stage.Desabilitar[1] == xy[2] then
checkLevelStageReset(cid)
elseif stage.Abilitar[1] == xy[2] and stage.Desabilitar[1] == xy[1] then
nowReseting()
else
doPlayerPopupFYI(cid, "LUA_ERROR; Configure corretamente o Sistema de STAGES!")
end
return true
end
            function tableResetInstall()
                 print(not rss_db  and LUA_ERROR or "Tabela de Resets: Instalada ... [success] ")
                 addEvent(newReset, 1000, cid)
                 return false
                 end
            if tableResetInstall() then
  end
end
            --=[Install System]=--
                   function installReset()
                            if db.executeQuery("ALTER TABLE `players` ADD reset INT(11) NOT NULL DEFAULT 0;") then
                                                            print("[MarcelloMkez] -= Advanced Reset System 2.0 por DataBase =- Instalado com sucesso!")
                                                            return TRUE
                            end
                            print('[Advanced Reset System/MarcelloMkez] Não foi possível instalar o Sistema.')
                            return FALSE
                 end
                            local tt = {
                                   "Preparando Instalação...",
                                   "Instalando: TableReset Db...",
                                   "Instalando: getPlayerReset()...",
                                   "Instalando: addValue()...",
                                   "Instalando: checkLevelStageReset()...",
                                   "Instalando: newReset() and nowReseting()...",
                                   "Finalizando Instalação...",
                                   "...",
                                   success = {
                                   "Iniciando...",
                                   "function: TableReset Db...  [success]",
                                   "function: getPlayerReset()...          [success]",
                                   "function: addValue(value)...                   [success]",
                                   "function: checkLevelStageReset()... [success]",
                                   "function: newReset() and nowReseting()...    [success]",
                                   "Fim da Instalação.  ",
                                   "by: ~~ MarcelloMkez ~~                                          \nContato: [email protected]",
                                   inst = {"MarcelloMkez","Advanced Reset System 2.0 por DataBase"
                                   },
                                 },
                            }
                 if words == "/installresetguiizeera" and getPlayerAccess(cid) >= 3 then
                                            function install()
                                            if installReset() then
                                                            print(""..tt.success[7].."")
                                                                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,""..tt.success[8].."")
                                                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "["..tt.success.inst[1].."] -="..tt.success.inst[2].."=- Instalado com sucesso!")
                                   else
                                                            print("["..tt.success.inst[1].."]  FALHA NA INSTALAÇÃO! [O sistema ja foi instalado].")
                                                                  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "["..tt.success.inst[1].."] FALHA NA INSTALAÇÃO! [O sistema ja foi instalado].")
                                            end
                                            return 1
                            end
                                  function concl(cid)
                                            local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                                                            print(""..tt.success[7].."")
                                                                 print(""..tt[8].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt.success[7].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt[8].."")
                                                            addEvent(install, 1000,cid)
                                            end
                                            function finall(cid)
                                                            local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                                                            print(""..tt.success[6].."")
                                                            print(""..tt[7].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt.success[6].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt[7].."")
                                                            addEvent(concl, 3000,cid)
                                            end
                                                 function installDd(cid)
                                                   local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                                                            print(""..tt.success[5].."")
                                                            print(""..tt[6].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt.success[5].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt[6].."")
                                                            addEvent(finall, 1000,cid)
                                            end
                                            function installCc(cid)
                                                   local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                                                            print(""..tt.success[4].."")
                                                            print(""..tt[5].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt.success[4].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt[5].."")
                                                  addEvent(installDd, 1000,cid)
                                            end
                                            function installBb(cid)
                                                   local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                                                            print(""..tt.success[3].."")
                                                            print(""..tt[4].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt.success[3].."")
                                                  doPlayerSendTextMessage(cid, typetx,""..tt[4].."")
                                            addEvent(installCc, 1000,cid)
                                            end
                                            function installAa(cid)
                                                  local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                                                            print(""..tt.success[2].."")
                                                            print(""..tt[3].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt.success[2].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt[3].."")
                                                            addEvent(installBb, 1000,cid)
                                            end
                                            function toInstall()
                                                  local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                                                            print(""..tt.success[1].."")
                                                            print(""..tt[2].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt.success[1].."")
                                                            doPlayerSendTextMessage(cid, typetx,""..tt[2].."")
                                                   addEvent(installAa, 1000,cid)
                                                  end
                                            function preparation()
                                                  local typetx = MESSAGE_STATUS_CONSOLE_BLUE
                                                   print(""..tt[1].."")
                                                 doPlayerSendTextMessage(cid, typetx,""..tt[1].."")
                                            addEvent(toInstall, 3000,cid)
                            end
                                            if preparation() then
                                            end
                            end
return 1
end
--=[By: Juniior Cwb ;* ]=--

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites
  • Respostas 46
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Consegui testar agora. player.cpp, troque sua função getDescription por essa:

function onSay(cid, words, param)     local player = Player(cid)     local hasAccess = player:getGroup():getAccess()     local players = Game.getPlayers()     local playerCount = Game.getPlayerCount()

tenta ai:

local config = {
    backToLevel = 8,
    redskull = false,
    battle = true,
    pz = false,
    stages = {
        {resets = 4, level = 350, vip = 330},
        {resets = 9, level = 355, vip = 335},
        {resets = 14, level = 360, vip = 340},
        {resets = 19, level = 365, vip = 345},
        {resets = 24, level = 380, vip = 350},
        {resets = 29, level = 390, vip = 355},
        {resets = 34, level = 410, vip = 360},
        {resets = 39, level = 430, vip = 365},
        {resets = 44, level = 450, vip = 370}
    }
}

function onSay(cid, words, param)
    local function getResets(cid)
        local resets = getPlayerStorageValue(cid, 1020)
        return resets < 0 and 0 or resets
    end
    
    local function setResets(cid, count)
        setPlayerStorageValue(cid, getResets(cid) + count)
    end
    
    if config.redskull and getCreatureSkullType(cid) == 4 then
        return doPlayerSendCancel(cid, "Voce precisa estar sem red skull para resetar.")
    elseif config.pz and not getTilePzInfo(getCreaturePosition(cid)) then
        return doPlayerSendCancel(cid, "Voce precisa estar em protection zone para resetar.")
    elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
        return doPlayerSendCancel(cid, "Voce precisa estar sem battle para resetar.")
    end
    
    local resetLevel = 0
    for x, y in ipairs(config.stages) do
        if getResets(cid) <= y.resets then
            resetLevel = isPremium(cid) and y.vip or y.level
            break
        end
    end
    
    if getPlayerLevel(cid) < resetLevel then
        return doPlayerSendCancel(cid, "Voce precisa do level " .. resetLevel .. " ou mais para resetar.")
    end
    
    setResets(cid, 1)
    local guid = getPlayerGUID(cid)
    doRemoveCreature(cid, true)
    db.executeQuery("UPDATE `players` SET `level` = " .. config.backToLevel .. ", `experience` = " .. getExperienceForLevel(config.backToLevel) .. " WHERE `id` = " .. guid)
    return true
end
Editado por fireelement (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

quando fala !resetar ele so desloga e da esse erro

 

2191a9a71a4d3743477ca47cb6816f80f87ccb8f

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites
local config = {
    backToLevel = 8,
    exp = 4200,
    redskull = false,
    battle = true,
    pz = false,
    stages = {
        {resets = 4, level = 350, vip = 330},
        {resets = 9, level = 355, vip = 335},
        {resets = 14, level = 360, vip = 340},
        {resets = 19, level = 365, vip = 345},
        {resets = 24, level = 380, vip = 350},
        {resets = 29, level = 390, vip = 355},
        {resets = 34, level = 410, vip = 360},
        {resets = 39, level = 430, vip = 365},
        {resets = 44, level = 450, vip = 370}
    }
}

function onSay(cid, words, param)
    local function getResets(cid)
        local resets = getPlayerStorageValue(cid, 1020)
        return resets < 0 and 0 or resets
    end
    
    local function setResets(cid, count)
        setPlayerStorageValue(cid, getPlayerStorageValue(cid, 1020) + count)
    end
    
    if config.redskull and getCreatureSkullType(cid) == 4 then
        return doPlayerSendCancel(cid, "Voce precisa estar sem red skull para resetar.")
    elseif config.pz and not getTilePzInfo(getCreaturePosition(cid)) then
        return doPlayerSendCancel(cid, "Voce precisa estar em protection zone para resetar.")
    elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
        return doPlayerSendCancel(cid, "Voce precisa estar sem battle para resetar.")
    end
    
    local resetLevel = 0
    for x, y in ipairs(config.stages) do
        if getResets(cid) <= y.resets then
            resetLevel = isPremium(cid) and y.vip or y.level
            break
        end
    end
    
    if getPlayerLevel(cid) < resetLevel then
        return doPlayerSendCancel(cid, "Voce precisa do level " .. resetLevel .. " ou mais para resetar.")
    end
    
    setResets(cid, 1)
    local guid = getPlayerGUID(cid)
    doRemoveCreature(cid, true)
    db.executeQuery("UPDATE `players` SET `level` = " .. config.backToLevel .. ", `experience` = " .. exp .. " WHERE `id` = " .. guid)
    return true
end   

Editado por fireelement (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

erro meu:

local config = {
    backToLevel = 8,
    exp = 4200,
    redskull = false,
    battle = true,
    pz = false,
    stages = {
        {resets = 4, level = 350, vip = 330},
        {resets = 9, level = 355, vip = 335},
        {resets = 14, level = 360, vip = 340},
        {resets = 19, level = 365, vip = 345},
        {resets = 24, level = 380, vip = 350},
        {resets = 29, level = 390, vip = 355},
        {resets = 34, level = 410, vip = 360},
        {resets = 39, level = 430, vip = 365},
        {resets = 44, level = 450, vip = 370}
    }
}

function onSay(cid, words, param)
    local function getResets(cid)
        local resets = getPlayerStorageValue(cid, 1020)
        return resets < 0 and 0 or resets
    end
    
    local function setResets(cid, count)
        setPlayerStorageValue(cid, getPlayerStorageValue(cid, 1020) + count)
    end
    
    if config.redskull and getCreatureSkullType(cid) == 4 then
        return doPlayerSendCancel(cid, "Voce precisa estar sem red skull para resetar.")
    elseif config.pz and not getTilePzInfo(getCreaturePosition(cid)) then
        return doPlayerSendCancel(cid, "Voce precisa estar em protection zone para resetar.")
    elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
        return doPlayerSendCancel(cid, "Voce precisa estar sem battle para resetar.")
    end
    
    local resetLevel = 0
    for x, y in ipairs(config.stages) do
        if getResets(cid) <= y.resets then
            resetLevel = isPremium(cid) and y.vip or y.level
            break
        end
    end
    
    if getPlayerLevel(cid) < resetLevel then
        return doPlayerSendCancel(cid, "Voce precisa do level " .. resetLevel .. " ou mais para resetar.")
    end
    
    setResets(cid, 1)
    local guid = getPlayerGUID(cid)
    doRemoveCreature(cid, true)
    db.executeQuery("UPDATE `players` SET `level` = " .. config.backToLevel .. ", `experience` = " .. config.exp .. " WHERE `id` = " .. guid)
    return true
end
Link para o post
Compartilhar em outros sites

99fb8bbbf947d2a3a4b95c1b1676b21496469f6a

 

e também com o ADM agente fala !resetar ele so desloga mais não reseta e com o player fala que precisa ta sem batle sendo que tou na pz e sem batle ainda

Editado por JonatasLucasf (veja o histórico de edições)

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites

local config = {
    backToLevel = 8,
    exp = 4200,
    redskull = false,
    battle = false,
    pz = false,
    stages = {
        {resets = 4, level = 350, vip = 330},
        {resets = 9, level = 355, vip = 335},
        {resets = 14, level = 360, vip = 340},
        {resets = 19, level = 365, vip = 345},
        {resets = 24, level = 380, vip = 350},
        {resets = 29, level = 390, vip = 355},
        {resets = 34, level = 410, vip = 360},
        {resets = 39, level = 430, vip = 365},
        {resets = 44, level = 450, vip = 370}
    }
}

function onSay(cid, words, param)
    local function getResets(cid)
        local resets = getPlayerStorageValue(cid, 1020)
        return resets < 0 and 0 or resets
    end
    
    local function setResets(cid, count)
        setPlayerStorageValue(cid, getPlayerStorageValue(cid, 1020) + count)
    end
    
    if config.redskull and getCreatureSkullType(cid) == 4 then
        return doPlayerSendCancel(cid, "Voce precisa estar sem red skull para resetar.")
    elseif config.pz and not getTilePzInfo(getCreaturePosition(cid)) then
        return doPlayerSendCancel(cid, "Voce precisa estar em protection zone para resetar.")
    elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
        return doPlayerSendCancel(cid, "Voce precisa estar sem battle para resetar.")
    end
    
    local resetLevel = 0
    for x, y in ipairs(config.stages) do
        if getResets(cid) <= y.resets then
            resetLevel = isPremium(cid) and y.vip or y.level
            break
        end
    end
    
    if getPlayerLevel(cid) < resetLevel then
        return doPlayerSendCancel(cid, "Voce precisa do level " .. resetLevel .. " ou mais para resetar.")
    end
    
    setResets(cid, 1)
    local guid = getPlayerGUID(cid)
    doRemoveCreature(cid, true)
    db.query("UPDATE `players` SET `level` = " .. config.backToLevel .. ", `experience` = " .. config.exp .. " WHERE `id` = " .. guid)
    return true
end
Link para o post
Compartilhar em outros sites

fireelement 

obrigado funcionou mais tem como quando um player dar look  em  outro personagem mostrar a quantidade de reset do player

Editado por JonatasLucasf (veja o histórico de edições)

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites

data/events/scripts/player.lua, troque a função onLook por isso:

function Player:onLook(thing, position, distance)
    local function getResets(cid)
        local resets = getPlayerStorageValue(cid, 1020)
        return resets < 0 and 0 or resets
    end

    local description = "You see " .. thing:getDescription(distance) .. ". Resets: " .. getResets(cid)
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end

            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
        elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end

        local position = thing:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )

        if thing:isCreature() then
            if thing:isPlayer() then
                description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
            end
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
Link para o post
Compartilhar em outros sites

fire eu não conseguir meu player.lua

 

function Player:onBrowseField(position)
return true
end
 
function Player:onLook(thing, position, distance)
local description = "You see " .. thing:getDescription(distance)
if self:getGroup():getAccess() then
if thing:isItem() then
description = string.format("%s\nItem ID: %d", description, thing:getId())
 
local actionId = thing:getActionId()
if actionId ~= 0 then
description = string.format("%s, Action ID: %d", description, actionId)
end
 
local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
if uniqueId > 0 and uniqueId < 65536 then
description = string.format("%s, Unique ID: %d", description, uniqueId)
end
 
local itemType = thing:getType()
 
local transformEquipId = itemType:getTransformEquipId()
local transformDeEquipId = itemType:getTransformDeEquipId()
if transformEquipId ~= 0 then
description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
elseif transformDeEquipId ~= 0 then
description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
end
 
local decayId = itemType:getDecayId()
if decayId ~= -1 then
description = string.format("%s\nDecays to: %d", description, decayId)
end
elseif thing:isCreature() then
local str = "%s\nHealth: %d / %d"
if thing:getMaxMana() > 0 then
str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
end
description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
end
 
local position = thing:getPosition()
description = string.format(
"%s\nPosition: %d, %d, %d",
description, position.x, position.y, position.z
)
 
if thing:isCreature() then
if thing:isPlayer() then
description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
end
end
end
self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
function Player:onLookInBattleList(creature, distance)
local description = "You see " .. creature:getDescription(distance)
if self:getGroup():getAccess() then
local str = "%s\nHealth: %d / %d"
if creature:getMaxMana() > 0 then
str = string.format("%s, Mana: %d / %d", str, creature:getMana(), creature:getMaxMana())
end
description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. "."
 
local position = creature:getPosition()
description = string.format(
"%s\nPosition: %d, %d, %d",
description, position.x, position.y, position.z
)
 
if creature:isPlayer() then
description = string.format("%s\nIP: %s", description, Game.convertIpToString(creature:getIp()))
end
end
self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
function Player:onLookInTrade(partner, item, distance)
self:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. item:getDescription(distance))
end
 
function Player:onLookInShop(itemType, count)
return true
end
 
function Player:onMoveItem(item, count, fromPosition, toPosition)
return true
end
 
function Player:onMoveCreature(creature, fromPosition, toPosition)
return true
end
 
function Player:onTurn(direction)
return true
end
 
function Player:onTradeRequest(target, item)
return true
end
 
function Player:onTradeAccept(target, item, targetItem)
return true
end
 
local soulCondition = Condition(CONDITION_SOUL, CONDITIONID_DEFAULT)
soulCondition:setTicks(4 * 60 * 1000)
soulCondition:setParameter(CONDITION_PARAM_SOULGAIN, 1)
 
local function useStamina(player)
local staminaMinutes = player:getStamina()
if staminaMinutes == 0 then
return
end
 
local playerId = player:getId()
local currentTime = os.time()
local timePassed = currentTime - nextUseStaminaTime[playerId]
if timePassed <= 0 then
return
end
 
if timePassed > 60 then
if staminaMinutes > 2 then
staminaMinutes = staminaMinutes - 2
else
staminaMinutes = 0
end
nextUseStaminaTime[playerId] = currentTime + 120
else
staminaMinutes = staminaMinutes - 1
nextUseStaminaTime[playerId] = currentTime + 60
end
player:setStamina(staminaMinutes)
end
 
function Player:onGainExperience(source, exp, rawExp)
if not source or source:isPlayer() then
return exp
end
 
-- Soul regeneration
local vocation = self:getVocation()
if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
self:addCondition(soulCondition)
end
 
-- Apply experience stage multiplier
exp = exp * Game.getExperienceStage(self:getLevel())
 
-- Stamina modifier
if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
useStamina(self)
 
local staminaMinutes = self:getStamina()
if staminaMinutes > 2400 and self:isPremium() then
exp = exp * 1.5
elseif staminaMinutes <= 840 then
exp = exp * 0.5
end
end
 
return exp
end
 
function Player:onLoseExperience(exp)
return exp
end
 
function Player:onGainSkillTries(skill, tries)
if APPLY_SKILL_MULTIPLIER == false then
return tries
end
 
if skill == SKILL_MAGLEVEL then
return tries * configManager.getNumber(configKeys.RATE_MAGIC)
end
return tries * configManager.getNumber(configKeys.RATE_SKILL)
end

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites

function Player:onBrowseField(position)
    return true
end

function Player:onLook(thing, position, distance)
    local function getResets(cid)
        local resets = getPlayerStorageValue(cid, 1020)
        return resets < 0 and 0 or resets
    end

    local description = "You see " .. thing:getDescription(distance) .. ". Resets: " .. getResets(cid)
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())
            
            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end
            
            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end
            
            local itemType = thing:getType()
            
            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
                elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end
            
            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
            elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end
        
        local position = thing:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )
        
        if thing:isCreature() then
            if thing:isPlayer() then
                description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
            end
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end

function Player:onLookInBattleList(creature, distance)
    local description = "You see " .. creature:getDescription(distance)
    if self:getGroup():getAccess() then
        local str = "%s\nHealth: %d / %d"
        if creature:getMaxMana() > 0 then
            str = string.format("%s, Mana: %d / %d", str, creature:getMana(), creature:getMaxMana())
        end
        description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. "."
        
        local position = creature:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )
        
        if creature:isPlayer() then
            description = string.format("%s\nIP: %s", description, Game.convertIpToString(creature:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end

function Player:onLookInTrade(partner, item, distance)
    self:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. item:getDescription(distance))
end

function Player:onLookInShop(itemType, count)
    return true
end

function Player:onMoveItem(item, count, fromPosition, toPosition)
    return true
end

function Player:onMoveCreature(creature, fromPosition, toPosition)
    return true
end

function Player:onTurn(direction)
    return true
end

function Player:onTradeRequest(target, item)
    return true
end

function Player:onTradeAccept(target, item, targetItem)
    return true
end

local soulCondition = Condition(CONDITION_SOUL, CONDITIONID_DEFAULT)
soulCondition:setTicks(4 * 60 * 1000)
soulCondition:setParameter(CONDITION_PARAM_SOULGAIN, 1)

local function useStamina(player)
    local staminaMinutes = player:getStamina()
    if staminaMinutes == 0 then
        return
    end
    
    local playerId = player:getId()
    local currentTime = os.time()
    local timePassed = currentTime - nextUseStaminaTime[playerId]
    if timePassed <= 0 then
        return
    end
    
    if timePassed > 60 then
        if staminaMinutes > 2 then
            staminaMinutes = staminaMinutes - 2
            else
            staminaMinutes = 0
        end
        nextUseStaminaTime[playerId] = currentTime + 120
        else
        staminaMinutes = staminaMinutes - 1
        nextUseStaminaTime[playerId] = currentTime + 60
    end
    player:setStamina(staminaMinutes)
end

function Player:onGainExperience(source, exp, rawExp)
    if not source or source:isPlayer() then
        return exp
    end
    
    -- Soul regeneration
    local vocation = self:getVocation()
    if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
        soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
        self:addCondition(soulCondition)
    end
    
    -- Apply experience stage multiplier
    exp = exp * Game.getExperienceStage(self:getLevel())
    
    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)
        
        local staminaMinutes = self:getStamina()
        if staminaMinutes > 2400 and self:isPremium() then
            exp = exp * 1.5
            elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end
    
    return exp
end

function Player:onLoseExperience(exp)
    return exp
end

function Player:onGainSkillTries(skill, tries)
    if APPLY_SKILL_MULTIPLIER == false then
        return tries
    end
    
    if skill == SKILL_MAGLEVEL then
        return tries * configManager.getNumber(configKeys.RATE_MAGIC)
    end
    return tries * configManager.getNumber(configKeys.RATE_SKILL)
end

Link para o post
Compartilhar em outros sites

function Player:onBrowseField(position)
    return true
end

function Player:onLook(thing, position, distance)
    local function getResets()
        local resets = thing:getStorageValue(1020)
        return resets < 0 and 0 or resets
    end

    local description = "You see " .. thing:getDescription(distance) .. ". Resets: " .. getResets()
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())
            
            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end
            
            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end
            
            local itemType = thing:getType()
            
            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
                elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end
            
            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
            elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end
        
        local position = thing:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )
        
        if thing:isCreature() then
            if thing:isPlayer() then
                description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
            end
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end

function Player:onLookInBattleList(creature, distance)
    local description = "You see " .. creature:getDescription(distance)
    if self:getGroup():getAccess() then
        local str = "%s\nHealth: %d / %d"
        if creature:getMaxMana() > 0 then
            str = string.format("%s, Mana: %d / %d", str, creature:getMana(), creature:getMaxMana())
        end
        description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. "."
        
        local position = creature:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )
        
        if creature:isPlayer() then
            description = string.format("%s\nIP: %s", description, Game.convertIpToString(creature:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end

function Player:onLookInTrade(partner, item, distance)
    self:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. item:getDescription(distance))
end

function Player:onLookInShop(itemType, count)
    return true
end

function Player:onMoveItem(item, count, fromPosition, toPosition)
    return true
end

function Player:onMoveCreature(creature, fromPosition, toPosition)
    return true
end

function Player:onTurn(direction)
    return true
end

function Player:onTradeRequest(target, item)
    return true
end

function Player:onTradeAccept(target, item, targetItem)
    return true
end

local soulCondition = Condition(CONDITION_SOUL, CONDITIONID_DEFAULT)
soulCondition:setTicks(4 * 60 * 1000)
soulCondition:setParameter(CONDITION_PARAM_SOULGAIN, 1)

local function useStamina(player)
    local staminaMinutes = player:getStamina()
    if staminaMinutes == 0 then
        return
    end
    
    local playerId = player:getId()
    local currentTime = os.time()
    local timePassed = currentTime - nextUseStaminaTime[playerId]
    if timePassed <= 0 then
        return
    end
    
    if timePassed > 60 then
        if staminaMinutes > 2 then
            staminaMinutes = staminaMinutes - 2
            else
            staminaMinutes = 0
        end
        nextUseStaminaTime[playerId] = currentTime + 120
        else
        staminaMinutes = staminaMinutes - 1
        nextUseStaminaTime[playerId] = currentTime + 60
    end
    player:setStamina(staminaMinutes)
end

function Player:onGainExperience(source, exp, rawExp)
    if not source or source:isPlayer() then
        return exp
    end
    
    -- Soul regeneration
    local vocation = self:getVocation()
    if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
        soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
        self:addCondition(soulCondition)
    end
    
    -- Apply experience stage multiplier
    exp = exp * Game.getExperienceStage(self:getLevel())
    
    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)
        
        local staminaMinutes = self:getStamina()
        if staminaMinutes > 2400 and self:isPremium() then
            exp = exp * 1.5
            elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end
    
    return exp
end

function Player:onLoseExperience(exp)
    return exp
end

function Player:onGainSkillTries(skill, tries)
    if APPLY_SKILL_MULTIPLIER == false then
        return tries
    end
    
    if skill == SKILL_MAGLEVEL then
        return tries * configManager.getNumber(configKeys.RATE_MAGIC)
    end
    return tries * configManager.getNumber(configKeys.RATE_SKILL)
end

Link para o post
Compartilhar em outros sites

muito obrigado fire.

 

@ se não for pedir muito poderia me ajudar em outro script kk

Editado por JonatasLucasf (veja o histórico de edições)

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites

Diz ai, se possível me envie uma MP pra eu ver seu post.

 

@edit

 

Tinha um bug no sistema de reset, usa esse:

local config = {
    backToLevel = 8,
    exp = 4200,
    redskull = false,
    battle = false,
    pz = false,
    stages = {
        {resets = 4, level = 350, vip = 330},
        {resets = 9, level = 355, vip = 335},
        {resets = 14, level = 360, vip = 340},
        {resets = 19, level = 365, vip = 345},
        {resets = 24, level = 380, vip = 350},
        {resets = 29, level = 390, vip = 355},
        {resets = 34, level = 410, vip = 360},
        {resets = 39, level = 430, vip = 365},
        {resets = 44, level = 450, vip = 370}
    }
}

function onSay(cid, words, param)
    local function getResets(cid)
        local resets = getPlayerStorageValue(cid, 1020)
        return resets < 0 and 0 or resets
    end
    
    local function setResets(cid, count)
        setPlayerStorageValue(cid, 1020, getResets(cid) + count)
    end
    
    if config.redskull and getCreatureSkullType(cid) == 4 then
        return doPlayerSendCancel(cid, "Voce precisa estar sem red skull para resetar.")
    elseif config.pz and not getTilePzInfo(getCreaturePosition(cid)) then
        return doPlayerSendCancel(cid, "Voce precisa estar em protection zone para resetar.")
    elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
        return doPlayerSendCancel(cid, "Voce precisa estar sem battle para resetar.")
    end
    
    local resetLevel = 0
    for x, y in ipairs(config.stages) do
        if getResets(cid) <= y.resets then
            resetLevel = isPremium(cid) and y.vip or y.level
            break
        end
    end
    
    if getPlayerLevel(cid) < resetLevel then
        return doPlayerSendCancel(cid, "Voce precisa do level " .. resetLevel .. " ou mais para resetar.")
    end
    
    setResets(cid, 1)
    local guid = getPlayerGUID(cid)
    doRemoveCreature(cid, true)
    db.query("UPDATE `players` SET `level` = " .. config.backToLevel .. ", `experience` = " .. config.exp .. " WHERE `id` = " .. guid)
    return true
end
Editado por fireelement (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Fire quando estou dando look em items está dando esse erro

 

59e34f0af06718897b400c2891b611a52c76da0f

 

player.lua

function Player:onBrowseField(position)
    return true
end
 
function Player:onLook(thing, position, distance)
    local function getResets()
        local resets = thing:getStorageValue(1020)
        return resets < 0 and 0 or resets
    end
 
    local description = "You see " .. thing:getDescription(distance) .. ". Resets: " .. getResets()
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())
            
            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end
            
            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end
            
            local itemType = thing:getType()
            
            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
                elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end
            
            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
            elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end
        
        local position = thing:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )
        
        if thing:isCreature() then
            if thing:isPlayer() then
                description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
            end
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
function Player:onLookInBattleList(creature, distance)
    local description = "You see " .. creature:getDescription(distance)
    if self:getGroup():getAccess() then
        local str = "%s\nHealth: %d / %d"
        if creature:getMaxMana() > 0 then
            str = string.format("%s, Mana: %d / %d", str, creature:getMana(), creature:getMaxMana())
        end
        description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. "."
        
        local position = creature:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )
        
        if creature:isPlayer() then
            description = string.format("%s\nIP: %s", description, Game.convertIpToString(creature:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
function Player:onLookInTrade(partner, item, distance)
    self:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. item:getDescription(distance))
end
 
function Player:onLookInShop(itemType, count)
    return true
end
 
function Player:onMoveItem(item, count, fromPosition, toPosition)
    return true
end
 
function Player:onMoveCreature(creature, fromPosition, toPosition)
    return true
end
 
function Player:onTurn(direction)
    return true
end
 
function Player:onTradeRequest(target, item)
    return true
end
 
function Player:onTradeAccept(target, item, targetItem)
    return true
end
 
local soulCondition = Condition(CONDITION_SOUL, CONDITIONID_DEFAULT)
soulCondition:setTicks(4 * 60 * 1000)
soulCondition:setParameter(CONDITION_PARAM_SOULGAIN, 1)
 
local function useStamina(player)
    local staminaMinutes = player:getStamina()
    if staminaMinutes == 0 then
        return
    end
    
    local playerId = player:getId()
    local currentTime = os.time()
    local timePassed = currentTime - nextUseStaminaTime[playerId]
    if timePassed <= 0 then
        return
    end
    
    if timePassed > 60 then
        if staminaMinutes > 2 then
            staminaMinutes = staminaMinutes - 2
            else
            staminaMinutes = 0
        end
        nextUseStaminaTime[playerId] = currentTime + 120
        else
        staminaMinutes = staminaMinutes - 1
        nextUseStaminaTime[playerId] = currentTime + 60
    end
    player:setStamina(staminaMinutes)
end
 
function Player:onGainExperience(source, exp, rawExp)
    if not source or source:isPlayer() then
        return exp
    end
    
    -- Soul regeneration
    local vocation = self:getVocation()
    if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
        soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
        self:addCondition(soulCondition)
    end
    
    -- Apply experience stage multiplier
    exp = exp * Game.getExperienceStage(self:getLevel())
    
    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)
        
        local staminaMinutes = self:getStamina()
        if staminaMinutes > 2400 and self:isPremium() then
            exp = exp * 1.5
            elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end
    
    return exp
end
 
function Player:onLoseExperience(exp)
    return exp
end
 
function Player:onGainSkillTries(skill, tries)
    if APPLY_SKILL_MULTIPLIER == false then
        return tries
    end
    
    if skill == SKILL_MAGLEVEL then
        return tries * configManager.getNumber(configKeys.RATE_MAGIC)
    end
    return tries * configManager.getNumber(configKeys.RATE_SKILL)
end

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites

player.cpp, troque:

        s << "yourself.";

por:

        int32_t value;
        getStorageValue(1020, value);
        if(value < 0)
            value = 0;

        s << "yourself [Resets: " << value << "].";

Se funcionar, me avise que faço o resto.

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.




×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo