Ir para conteúdo

Reset Door ( Porta )


Neo Sonny

Posts Recomendados

Preciso Ajuda com 1 Script do ----- Porta ------ que precise Reset ------ Exemplo : 5 reset Ja que tenho 1 script ------ fazer Reset mais nao podo achar 1 bom script reset door ( Tibia - 8.54 )

+ REP 

 

Spoiler

local config = {
minlevel = 1000,
price = 0,
newlevel = 1000,
priceByReset = 0,
percent = 5,
maxresets = 50,
levelbyreset = 0,
}
--- end config

function getResets(uid)
resets = getPlayerStorageValue(uid, 2300)
  if resets < 0 then
            resets = 0
          end
return resets
end

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


 function addReset(cid)
    if(npcHandler:isFocused(cid)) then
        npcHandler:releaseFocus(cid)
    end        
    talkState[talkUser] = 0
    resets = getResets(cid)
    setPlayerStorageValue(cid, 2300, resets+1) 
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    doPlayerAddItem(cid, 2150, 35)
    local hp = getCreatureMaxHealth(cid)
    local resethp = hp*(config.percent/100)
    setCreatureMaxHealth(cid, resethp)
    local differencehp = (hp - resethp)
    doCreatureAddHealth(cid, -differencehp)
    local mana = getCreatureMaxMana(cid)
    local resetmana = mana*(config.percent/100)
    setCreatureMaxMana(cid, resetmana)
    local differencemana = (mana - resetmana)
    doCreatureAddMana(cid, -differencemana)
    doRemoveCreature(cid)        
    local description = resets+1
    db.executeQuery("UPDATE `players` SET `description` = ' [Reset: "..description.."]' WHERE `players`.`id`= ".. playerid .."")
    db.executeQuery("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
    return true
end


local newPrice = config.price + (getResets(cid) * config.priceByReset)
local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)

if msgcontains(msg, 'reset') then
    if getResets(cid) < config.maxresets then
        selfSay('You want to reset your character? It will cost '..newPrice..' gp\'s!', cid)
        talkState[talkUser] = 1
    else
        selfSay('You already reached the maximum reset level!', cid)
    end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
    if getPlayerMoney(cid) < newPrice then
        selfSay('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
    elseif getPlayerLevel(cid) < newminlevel then
        selfSay('The minimum level for reseting is '..newminlevel..'!', cid)
    else
        doPlayerRemoveMoney(cid,newPrice)
        playerid = getPlayerGUID(cid)
        addEvent(function()
            if isPlayer(cid) then
                addReset(cid)
            end
        end, 3000)
        local number = getResets(cid)+1
        local msg ="---[Reset: "..number.."]-- You have reseted!  You'll be disconnected in 3 seconds."
        doPlayerPopupFYI(cid, msg) 
        talkState[talkUser] = 0
        npcHandler:releaseFocus(cid)
    end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
    talkState[talkUser] = 0
    npcHandler:releaseFocus(cid)
    selfSay('Ok.', cid)
elseif msgcontains(msg, 'quantity') then
    selfSay('You have a total of '..getResets(cid)..' reset(s).', cid)
    talkState[talkUser] = 0
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Link para o comentário
Compartilhar em outros sites

'------------'

Como que nao vai sabe qual Sistema ussa meu Reset? sim tenho ele Script ae ...... -.-!! nao precisa muto so --- XML e LUA , com isso basta tem ele 


resets = getPlayerStorageValue(uid, 2300)

Nao responda, n tem idea que fazer... ( OBG )

Link para o comentário
Compartilhar em outros sites

  • 2 months later...
function onUse(cid, item, fromPosition, itemEx, toPosition)local resets = 1 --- aqui define a quantidade de resetsif getPlayerStorageValue(cid,2300) >= resets thenpos = getPlayerPosition(cid)			if pos.x == topos.x then				if pos.y < topos.y then					pos.y = topos.y + 1				else					pos.y = topos.y - 1				end			elseif pos.y == topos.y then				if pos.x < topos.x then					pos.x = topos.x + 1				else					pos.x = topos.x - 1				end			else				doPlayerSendTextMessage(cid,22,'Fique na frente da porta.')				return 1			end			doTeleportThing(cid,pos)			doSendMagicEffect(topos,3)else			doPlayerSendTextMessage(cid,22,'Voce nao tem resets suficiente para passar por essa porta.')endreturn trueend

Basta ir em actions.xml e adicionar a tag definindo o id da porta ou actionid/uniqueid

Editado por Fjinst
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...