Implemented starting balance, closes #537

This commit is contained in:
ElPumpo
2020-03-04 13:01:46 +01:00
parent 4e4ebfff7b
commit a2308dec59
3 changed files with 12 additions and 10 deletions
+5 -4
View File
@@ -164,7 +164,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
end
if not found then
table.insert(missingAccounts, account)
missingAccounts[account] = Config.StartingAccountMoney[account] or 0
end
end
@@ -172,10 +172,11 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
end
self.createMissingAccounts = function(missingAccounts, cb)
for k,v in ipairs(missingAccounts) do
MySQL.Async.execute('INSERT INTO user_accounts (identifier, name) VALUES (@identifier, @name)', {
for name,money in pairs(missingAccounts) do
MySQL.Async.execute('INSERT INTO user_accounts (identifier, name, money) VALUES (@identifier, @name, @money)', {
['@identifier'] = self.identifier,
['@name'] = v
['@name'] = name,
['@money'] = money
}, function(rowsChanged)
if cb then
cb()