• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Storages Login

nefinoo

Carnage.flv
Joined
Sep 11, 2010
Messages
549
Solutions
1
Reaction score
58
Location
Lo Mochis, Sinaloa
How can make the storages at login just do 1 time, and no in every reset and login the questlog, misions and access reset itself.
 
Solution
No, the script has a storage that checks if the player has already acquired his quests.

CHECK:
Lua:
if player:getStorageValue(123123) == 1 then

If the player doesn't already have this storage, the script will set all the established quests. And if the script verifies that the player already has this "check storage", it won't execute the script.

Only pay attention to changing the check storage (123123), if you're going to create other scripts like this.
As TFS wasn't mentioned, I passed the script based on TFS 1.3, but it is very easy to adapt it.

In creaturescripts:

The first script has a check that occurs only at the first login of the character. If there are already registered players, you can use the second option.

Use lastLogin:
Lua:
local freeQuests = {
-- {storage = XXXXX, value = YYY},
}

function onLogin(player)
    if player:getLastLoginSaved() ~= 0 then
        return true
    end
    for i = 1, #freeQuests do
        if player:getStorageValue(freeQuests[i].storage) ~= freeQuests[i].value then
            player:setStorageValue(freeQuests[i].storage, freeQuests[i].value)
        end
    end
    return true
end

Use a storage to check and give another storages. (123123,1)
Lua:
local freeQuests = {
-- {storage = XXXXX, value = YYY},
}

function onLogin(player)
    if player:getStorageValue(123123) == 1 then
        return true
    end
    for i = 1, #freeQuests do
        if player:getStorageValue(freeQuests[i].storage) ~= freeQuests[i].value then
            player:setStorageValue(freeQuests[i].storage, freeQuests[i].value)
            player:setStorageValue(123123,1)
        end
    end
    return true
end
 
As TFS wasn't mentioned, I passed the script based on TFS 1.3, but it is very easy to adapt it.

In creaturescripts:

The first script has a check that occurs only at the first login of the character. If there are already registered players, you can use the second option.

Use lastLogin:
Lua:
local freeQuests = {
-- {storage = XXXXX, value = YYY},
}

function onLogin(player)
    if player:getLastLoginSaved() ~= 0 then
        return true
    end
    for i = 1, #freeQuests do
        if player:getStorageValue(freeQuests[i].storage) ~= freeQuests[i].value then
            player:setStorageValue(freeQuests[i].storage, freeQuests[i].value)
        end
    end
    return true
end

Use a storage to check and give another storages. (123123,1)
Lua:
local freeQuests = {
-- {storage = XXXXX, value = YYY},
}

function onLogin(player)
    if player:getStorageValue(123123) == 1 then
        return true
    end
    for i = 1, #freeQuests do
        if player:getStorageValue(freeQuests[i].storage) ~= freeQuests[i].value then
            player:setStorageValue(freeQuests[i].storage, freeQuests[i].value)
            player:setStorageValue(123123,1)
        end
    end
    return true
end
I am using tfs 1.3, but i dont understand how enter all my storages.
 
Here:
Code:
local freeQuests
EXAMPLE:
Storage 123 value 4 and storage 124 value 6.


Lua:
local freeQuests = {
    {storage = 123, value = 4},
    {storage = 124, value = 6},
}

function onLogin(player)
    if player:getStorageValue(123123) == 1 then
        return true
    end
    for i = 1, #freeQuests do
        if player:getStorageValue(freeQuests[i].storage) ~= freeQuests[i].value then
            player:setStorageValue(freeQuests[i].storage, freeQuests[i].value)
            player:setStorageValue(123123,1)
        end
    end
    return true
end
 
No, the script has a storage that checks if the player has already acquired his quests.

CHECK:
Lua:
if player:getStorageValue(123123) == 1 then

If the player doesn't already have this storage, the script will set all the established quests. And if the script verifies that the player already has this "check storage", it won't execute the script.

Only pay attention to changing the check storage (123123), if you're going to create other scripts like this.
 
Solution
No, the script has a storage that checks if the player has already acquired his quests.

CHECK:
Lua:
if player:getStorageValue(123123) == 1 then

If the player doesn't already have this storage, the script will set all the established quests. And if the script verifies that the player already has this "check storage", it won't execute the script.

Only pay attention to changing the check storage (123123), if you're going to create other scripts like this.
Ohh i see now
 
Back
Top