Caduceus
Unknown Member
- Joined
- May 10, 2010
- Messages
- 321
- Solutions
- 2
- Reaction score
- 24
I know that their are several Account storage functions floating around. None of which work. When I try to use this function as player:getAccountStorage() I am getting an error in console as player is a nil value on line "local playerAccount = player:getAccountId()". Player is defined above, I thought. Maybe I'm wrong.
Also, when I try to log in. My character logs in & back out. not allowing me to enter game. All I have is a creaturescript to test onLogin, which storage will return.
Lua:
function Player.getAccountStorage(accountId, key)
local player = Player(cid)
if player == nil then
return false
end
local playerAccount = player:getAccountId()
local resultId = db.getResult("SELECT `value` FROM `account_storage` WHERE `account_id` = " .. playerAccount .. " and `key` = " .. db.escapeString(key))
if resultId ~= false then
local value = result.getDataInt(resultId, "value")
result.free(resultId)
return value
end
return -1
end
Also, when I try to log in. My character logs in & back out. not allowing me to enter game. All I have is a creaturescript to test onLogin, which storage will return.
Code:
function onLogin(player)
local accountId = player:getAccountId()
print(player:getAccountStorage(accountId, xxx))
end