darkshin
New old member
- Joined
- Dec 14, 2010
- Messages
- 231
- Reaction score
- 22
Hey Guys!!
I have the following function and I am trying to update a character balance at MySql, but it only updates if the characters is online, logs out and then logs in. How can I make it update rightaway via MySql?
I have the following function and I am trying to update a character balance at MySql, but it only updates if the characters is online, logs out and then logs in. How can I make it update rightaway via MySql?
Code:
function setBalanceByGuid(guid, money)
local oldBalance = getBalanceByGuid(guid)
local newBalance = oldBalance + money
print(oldBalance, newBalance)
db.query("UPDATE`players` SET `balance` = "..newBalance.." WHERE `id` = "..guid..";")
end