-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36b3c89
commit caf195f
Showing
6 changed files
with
106 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-- load accounts storages | ||
local load = GlobalEvent("LoadAccountStorage") | ||
|
||
function load.onStartup() | ||
local resultId = db.storeQuery("SELECT `account_id`, `key`, `value` FROM `account_storage`") | ||
if not resultId then | ||
return true | ||
end | ||
|
||
repeat | ||
local accountId = result.getNumber(resultId, "account_id") | ||
local key = result.getNumber(resultId, "key") | ||
local value = result.getNumber(resultId, "value") | ||
Game.setAccountStorageValue(accountId, key, value) | ||
until not result.next(resultId) | ||
result.free(resultId) | ||
|
||
return true | ||
end | ||
|
||
load:register() | ||
|
||
-- save accounts storages | ||
local save = GlobalEvent("SaveAccountStorage") | ||
|
||
function save.onSave() | ||
local success = Game.saveAccountsStorage() | ||
if not success then | ||
print("Failed to save account-level storage values.") | ||
end | ||
return true | ||
end | ||
|
||
save:register() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters