• 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 Want this script to NOT reset storage when saying "stop"

Eldora

Banned User
Joined
Oct 19, 2009
Messages
604
Reaction score
26
How can I make this script not reset storage when player say "stop"?

I want it to keep the players different task storage values, not resetting progression every time a player stop a task.
 

Attachments

Problem is that you restart counter every time you resume, I'd do it like that:

Lua:
if player:getStorageValue(monsters[cmsg].storage) == -1 then
    npcHandler:say("Good luck, come back when you killed "..monsters[cmsg].amount.." "..cmsg..".", cid)
    local task = monsters[cmsg]
    local killCount = player:getStorageValue(task.mstorage)
    player:setStorageValue(task.mstorage, killCount or 0)
    player:setStorageValue(task.storage, 1)
    player:setStorageValue(storage, 1)
else
    npcHandler:say("You already did the "..cmsg.." mission.", cid)
end
 
Problem is that you restart counter every time you resume, I'd do it like that:

Lua:
if player:getStorageValue(monsters[cmsg].storage) == -1 then
    npcHandler:say("Good luck, come back when you killed "..monsters[cmsg].amount.." "..cmsg..".", cid)
    local task = monsters[cmsg]
    local killCount = player:getStorageValue(task.mstorage)
    player:setStorageValue(task.mstorage, killCount or 0)
    player:setStorageValue(task.storage, 1)
    player:setStorageValue(storage, 1)
else
    npcHandler:say("You already did the "..cmsg.." mission.", cid)
end

Thank you, worked like a charm.
 
Problem is that you restart counter every time you resume, I'd do it like that:

Lua:
if player:getStorageValue(monsters[cmsg].storage) == -1 then
    npcHandler:say("Good luck, come back when you killed "..monsters[cmsg].amount.." "..cmsg..".", cid)
    local task = monsters[cmsg]
    local killCount = player:getStorageValue(task.mstorage)
    player:setStorageValue(task.mstorage, killCount or 0)
    player:setStorageValue(task.storage, 1)
    player:setStorageValue(storage, 1)
else
    npcHandler:say("You already did the "..cmsg.." mission.", cid)
end
@lursky Are you able to somehow make the tasks repeatable?

Basically, when you deliver a task (and get the reward), that you can later do it again because the storage value gets removed completely after receiving the rewards?
Using same tasks.lua as above :) ??
 
Change 2 to -1 on this line player:setStorageValue(x.storage, 2)
And under that line, add this one player:setStorageValue(x.mstorage, 0)
 
Back
Top