• 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++ TFS 1.3 - GetGlobalStorage from C++ source

Morrison

Intermediate OT User
Joined
Mar 15, 2009
Messages
266
Solutions
3
Reaction score
119
Location
Exive me
GitHub
none
Hello my freinds!
I dont see any post for GlobalStorage or some code to help me in tha files so... it's possible?

¿How get | set GlobalStorage in c++ sources?
 
Mark it as solved. If its not solved add this to your global.lua

Code:
globalStorages = {}

function getGlobalStorageValue(key)
     local storage = globalStorages[key]
     if not storage then return -1 end
return storage
end

function setGlobalStorageValue(key, value)
    globalStorages[key] = value
return true
end

Always nice to post the solution for others.
 
Mark it as solved. If its not solved add this to your global.lua

Code:
globalStorages = {}

function getGlobalStorageValue(key)
     local storage = globalStorages[key]
     if not storage then return -1 end
return storage
end

function setGlobalStorageValue(key, value)
    globalStorages[key] = value
return true
end

Always nice to post the solution for others.
Hi,
The storages will disappear when server shutdown, create a new table on DB and use onStartup and onShutdown to save and load the storages values.
 
Always nice to post the solution for others.

That's not the solution. That's already there and not what OP asked for. I will make what OP asked for.


The storages will disappear when server shutdown
That's on purpose, so if you do do this, you need to provide a mechanism to configure retaining ranges that are ephemeral and ones that are persisted.

Otherwise stored ephemeral state becomes lost functionality.
 
and if he want permanent global storage he can use this one by @Znote that works fine for me:

 
Back
Top