Ir para conteúdo

Featured Replies

Postado

Alguem pode criar uma script que se tiver x storage não pode deslogar???

 

 

 

///// To com um problema numa script o servidor não tem uma função GetPokeOut(cid) ,como daria pra arrumar a script

 -- if getPlayerStorageValue(cid, 61207) >= 1 then

	       -- local item = getPokeOutLive(cid)[1]

	      --  doTransformItem(item, pokein)

	      --  doRemoveCondition(cid, CONDITION_OUTFIT)

	      --  doItemSetAttribute(item, "poke", getItemAttribute(item, "poke"):sub(#getItemAttribute(item, "poke")) ~= "]" and getItemAttribute(item, "poke") .. " HP = ["..getPlayerStorageValue(cid, 61205).."/"..getPlayerStorageValue(cid, 61206).."]" or getItemAttribute(item, "poke"))

	      --  setPlayerStorageValue(cid, 61207, 0)

	   -- end


 

Script Completa:

 



function onLogout(cid)
local health,maxhealth = getSummonLifes(cid)
    if getPlayerStorageValue(cid, 61204) >= 1 and getPlayerStorageValue(cid, 63215) <= 0 and getPlayerStorageValue(cid, 62314) <= 0 and getPlayerStorageValue(cid, 59987) <= 0 then
        setPlayerStorageValue(cid, 61205, health)
        setPlayerStorageValue(cid, 61206, maxhealth)
        setPlayerStorageValue(cid, 61204, 0)
        setPlayerStorageValue(cid, 61207, 1)
    end
    
    if getPlayerStorageValue(cid, 62314) >= 1 then
        pos = getCreaturePosition(cid)
        for i = 1,8 do
            doRemoveTile(getPosDirs(getCreaturePosition(cid), i))
        end
        doRemoveTile(getCreaturePosition(cid))
        setPlayerStorageValue(cid, 61941, pos.x)
        setPlayerStorageValue(cid, 61942, pos.y)
        setPlayerStorageValue(cid, 61943, pos.z) 
    end
return TRUE
end

function onLogin(cid)
    local pokes = {
    --["Dragon"] = {lookType=267, speed = 1500},
    
    }

    local pokesfly = {
    ---["Dragon"] = {lookType = 216, speed = 500},
    }

    local pokesride = {
    ---["Dragon Lord"] = {lookType=4, speed = 3000},
    
    }
    
    if getPlayerStorageValue(cid, 62314) >= 1 then
        doCreateTile(460, {x=getPlayerStorageValue(cid, 61941), y=getPlayerStorageValue(cid, 61942), z=getPlayerStorageValue(cid, 61943)})
        doTeleportThing(cid, {x=getPlayerStorageValue(cid, 61941), y=getPlayerStorageValue(cid, 61942), z=getPlayerStorageValue(cid, 61943)}) 
        for i = 1,8 do
            doItem(getPosDirs(getCreaturePosition(cid), i), 65119+i)
        end
        local item = getPokeOutLive(cid)[1]
        local a = getItemAttribute(item, "poke"):match("This is (.-)'s pokeball.")
        doSetCreatureOutfit(cid, pokesfly[tostring(a)], -1)
        doChangeSpeed(cid, pokesfly[tostring(a)].speed)
        registerCreatureEvent(cid, "PlayerPokeDeath")  
    end

    if getPlayerStorageValue(cid, 63215) >= 1 then
        local item = getPokeOutLive(cid)[1]
        local a = getItemAttribute(item, "poke"):match("This is (.-)'s pokeball.")
        doSetCreatureOutfit(cid, pokes[tostring(a)], -1)
        doChangeSpeed(cid, pokes[tostring(a)].speed)
        registerCreatureEvent(cid, "PlayerPokeDeath")
    end

    if getPlayerStorageValue(cid, 59987) >= 1 then
        local item = getPokeOutLive(cid)[1]
        local a = getItemAttribute(item, "poke"):match("This is (.-)'s pokeball.")
        doSetCreatureOutfit(cid, pokesride[tostring(a)], -1)
        doChangeSpeed(cid, pokesride[tostring(a)].speed)
        registerCreatureEvent(cid, "PlayerPokeDeath")
    end

   -- if getPlayerStorageValue(cid, 61207) >= 1 then
       -- local item = getPokeOutLive(cid)[1]
      --  doTransformItem(item, pokein)
      --  doRemoveCondition(cid, CONDITION_OUTFIT)
      --  doItemSetAttribute(item, "poke", getItemAttribute(item, "poke"):sub(#getItemAttribute(item, "poke")) ~= "]" and getItemAttribute(item, "poke") .. " HP = ["..getPlayerStorageValue(cid, 61205).."/"..getPlayerStorageValue(cid, 61206).."]" or getItemAttribute(item, "poke"))
      --  setPlayerStorageValue(cid, 61207, 0)
   -- end

return TRUE
end

function onDeath(cid, deathList)
    local owner = getCreatureMaster(cid)
    doPlayerSendTextMessage(owner, 22, "Sua alma morreu!")
    
    for slot = CONST_SLOT_FIRST, CONST_SLOT_LAST do
        local item = getPlayerSlotItem(owner, slot)
        if isContainer(item.uid) then
            local items = getItemsInContainerById(item.uid, pokeout)
            for _, ui in pairs(items) do
                if getItemAttribute(ui, "poke"):sub(#getItemAttribute(ui, "poke")) == "." then
                    local maxh = tonumber(getItemAttribute(ui, "poke"):match("/(.+)]"))
                    doItemSetAttribute(ui, "poke", getItemAttribute(ui, "poke"):sub(1, findLetter(getItemAttribute(ui, "poke"), ".")) .. " HP = [0/"..getCreatureMaxHealth(cid).."]")
                end
            end
       end
       
       if item.itemid == pokeout then
            if getItemAttribute(item.uid, "poke"):sub(#getItemAttribute(item.uid, "poke")) == "." then
                local maxh = tonumber(getItemAttribute(item.uid, "poke"):match("/(.+)]"))
                doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = [0/"..getCreatureMaxHealth(cid).."]")
            end
       end
    end
    doRemoveCreature(cid)
    setPlayerStorageValue(owner, 61207, 0)
    setPlayerStorageValue(owner, 61204, 0)
return FALSE
end

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

Resolvido por Noob II

Ir para solução
Postado
  • Solução

Pasta data/creaturescripts/scripts cria um arquivo logout.lua

function onLogout(cid)
    if getPlayerStorageValue(cid, 12121) > -1 then
        doPlayerSendTextMessage(cid, 27, "You can't logout.")
        return false
    end
    return true
end

 

no creaturevents.xml adiciona essa tag

<event type="logout" name="PlayerLogout" event="script" value="logout.lua"/>

 

12121 é a storage 

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

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo