• 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!

C++ By getting 4 storages you get another storage

Aldo Axel

New Member
Joined
Jul 14, 2014
Messages
70
Reaction score
4
Greetings, my request now is when a player get 4 storages,
Storage 1: 9000
Storage 2: 9001
Storage 3: 9002
Storage 4: 9003
Automatically get another storage
New Storage: 9004
I mean when they have those 4 storages, give him another new storage.
Please, thank ya.
 
ve those 4 storages, give him another new storage.

Use whichever you like the most :)
Btw, I just wrote all of them, none of them are tested but they should work fine :)

TFS 1.*
Lua:
if player:getStorageValue(9000) > 0 and player:getStorageValue(9001) > 0 and player:getStorageValue(9002) > 0 and player:getStorageValue(9003) > 0 then
    player:setStorageValue(9004, 1)
end

Other:
Lua:
if getPlayerStorageValue(cid, 9000) > 0 and getPlayerStorageValue(cid, 9001) > 0 and getPlayerStorageValue(cid, 9002) > 0 and getPlayerStorageValue(cid, 9003) > 0 then
   setPlayerStorageValue(cid, 9004, 1)
end

Fancy TFS 1.*
Lua:
local config = {
   storages = {9000, 9001, 9002, 9003},   --Storages
   amount_needed = 4,                 --How many must be completed
   extra_storage = 9004               --The storage you get if you meet the requirements.
}
local amount_done = 0 --Don't touch, this will keep track of how many you've done

for i, storage in pairs(config.storages) do
   if player:getStorageValue(storage) > 0 then
       amount_done = amount_done+1
   end
   if amount_done >= amount_needed then
       player:setStorageValue(config.extra_storage, 1)
   end
end

Fancy Other:
Lua:
local config = {
   storages = {9000, 9001, 9002, 9003},  --Storages
   amount_needed = 4,                   --How many must be completed
   extra_storage = 9004,              --The storage you get if you meet the requirements.
}
local amount_done = 0 --Don't touch, this will keep track of how many you've done

for i, storage in pairs(config.storages) do
   if getPlayerStorageValue(cid, storage) > 0 then
       amount_done = amount_done+1
   end
   if amount_done >= amount_needed then
       setPlayerStorageValue(cid, config.extra_storage, 1)
   end
end
 
Last edited:
Error Console:
[Error - LuaInterface::loadFile] data/creaturescripts/scripts/TOTE Storages.lua:3: '}' expected (to close '{' at line 1) near 'amount_needed'
[23:22:51.381] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/TOTE Storages.lua)
[23:22:51.389] data/creaturescripts/scripts/TOTE Storages.lua:3: '}' expected (to close '{' at line 1) near 'amount_needed'
TFS 0.4 8.6 Cast
Can this be easier? Apparently this is entangled, you could do something better, make a moveevent, with a teleport requests those 4 storages, if you do not have or you lack some, will not let you pass, if you have those 4 will take you to X position, maybe complicate me too much, I have Faith in you & thx anyways for those scripts :D.
 
Error Console:
[Error - LuaInterface::loadFile] data/creaturescripts/scripts/TOTE Storages.lua:3: '}' expected (to close '{' at line 1) near 'amount_needed'
[23:22:51.381] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/TOTE Storages.lua)
[23:22:51.389] data/creaturescripts/scripts/TOTE Storages.lua:3: '}' expected (to close '{' at line 1) near 'amount_needed'
TFS 0.4 8.6 Cast
Can this be easier? Apparently this is entangled, you could do something better, make a moveevent, with a teleport requests those 4 storages, if you do not have or you lack some, will not let you pass, if you have those 4 will take you to X position, maybe complicate me too much, I have Faith in you & thx anyways for those scripts :D.

Sorry, I forgot some comas in my code but corrected them, try it out again :)
The teleport is possible as well if you want a code for it :p
 
Ye I saw :)
I'm just waiting for him to confirm if he really wants a brand new code or if my corrected previous one will do :)
you need to replace the code for 0.x versions because you aren't using cid at all to identify a creature to use with getStorageValue
all you have is getStorageValue(storage)
 
you need to replace the code for 0.x versions because you aren't using cid at all to identify a creature to use with getStorageValue
all you have is getStorageValue(storage)
Oh shit xD
Thanks, corrected them, was bit tired last night when I wrote all codes :p
 
Back
Top