Ir para conteúdo
  • 0

-=[TFS]=- 0.3.6 - 8.60 - PET SYSTEM PRECISA DE STORAGE MAIS NAO TA PEGANDO RECONHECENDO AS STORAGE


Muvuka

Pergunta

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local petName = "[PET] NIVEL MAXIMO"
    local requiredStorage1 = 91811
    local requiredStorage2 = 13546
    local storageValue = 83712
    local playerPets = getCreatureSummons(cid)

    -- Check if the player has the required immortality storages
    if getPlayerStorageValue(cid, requiredStorage1) == 1 and getPlayerStorageValue(cid, requiredStorage2) == 1 then
        -- Check if the player already has a summoned pet
        if #playerPets <= 0 then
            -- If no pet is summoned, summon a new one
            local newPet = doSummonMonster(cid, petName)
            if newPet then
                setPlayerStorageValue(cid, storageValue, 1)
            end
        else
            -- If a pet is summoned, check if it's the correct one and remove it
            for _, pet in ipairs(playerPets) do
                if getCreatureName(pet) == petName then
                    doRemoveCreature(pet)
                end
            end
        end
    else
        -- If the player doesn't have the required storages, send a message
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need the immortality storage to use this item.")
    end
    return true
end

 

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local petName = "[PET] NIVEL MAXIMO"
    local requiredStorage1 = 91811
    local requiredStorage2 = 13546
    local storageValue = 83712
    local playerPets = getCreatureSummons(cid)

    -- Verificar se o jogador possui as storages necessárias
    if getPlayerStorageValue(cid, requiredStorage1) == 1 and getPlayerStorageValue(cid, requiredStorage2) == 1 then
        -- Verificar se o jogador já possui um pet invocado
        if #playerPets <= 0 then
            -- Se nenhum pet estiver invocado, invocar um novo
            local newPet = doSummonMonster(cid, petName)
            if newPet then
                setPlayerStorageValue(cid, storageValue, 1)
            end
        else
            -- Se um pet estiver invocado, verificar se é o pet correto e removê-lo
            for _, pet in ipairs(playerPets) do
                if getCreatureName(pet) == petName then
                    doRemoveCreature(pet)
                end
            end
        end
    else
        -- Se o jogador não possuir as storages necessárias, enviar uma mensagem de erro
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need both immortality storages to use this item.")
    end
    return true
end

 

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...