Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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!
function onSay(cid, words, param)
local result = db.getResult("SELECT `id` FROM `accounts` WHERE `key` != '0' and name='"..getAccountName(cid).."' LIMIT 1")
if(result:getID() > 0)then
db.executeQuery("UPDATE `accounts` SET `key` = '0' WHERE `id` = ".. result:getDataInt("id"))
doPlayerSendTextMessage(cid, 19, "Your rec key have been deleted.")
else
doPlayerSendCancel(cid, "Your account have not registered rec key.")
end
return TRUE
end
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/reckey.lua:onSay
data/talkactions/scripts/reckey.lua:2: attempt to call global 'getAccountName' (a nil value)
stack traceback:
data/talkactions/scripts/reckey.lua:2: in function <data/talkactions/scripts/reckey.lua:1>
function setAccountRecoveryKey(accountId, newKey)
return db.executeQuery("UPDATE `accounts` SET `key` = " .. db.escapeString(newKey) .. " WHERE `id` = " .. accountId .. ";")
end
function getAccountRecoveryKey(accountId)
local recRes = db.getResult("SELECT `key` FROM `accounts` WHERE `id` = " .. accountId .. ";")
if(recRes:getID() == -1) then
error('Account not found.')
return LUA_ERROR
end
return tonumber(recRes:getDataInt("key"))
end
So, for example:
Code:
function onSay(cid, words, param)
local playerAccount = getPlayerAccoundId(cid)
if(getAccountRecoveryKey(playerAccount) == "") then
doPlayerSendCancel(cid, "Your account have not registered recovery key.")
return TRUE
end
doAccountSetRecoveryKey(playerAccount, "")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your recovery key has been deleted.")
return TRUE
end
function getAccountRecoveryKey(accountId)
local recRes = db.getResult("SELECT `key` FROM `accounts` WHERE `id` = " .. accountId .. ";")
if(recRes:getID() == -1) then
error('Account not found.')
return LUA_ERROR
end
return tonumber(recRes:getDataInt("key"))
end
function onSay(cid, word)
doPlayerSendTextMessage(cid, 19, "Your RK is [" ..getAccountRecoveryKey(getPlayerAccountId(cid)).. "].")
return TRUE
end
The problem that i can see is that you're trying to turn a string with dashes and letters into a number, which ain't gonna work unless your recovery key is something like... "1234123412341234"
Try this:
PHP:
function getAccountRecoveryKey(accountId)
local recRes = db.getResult("SELECT `key` FROM `accounts` WHERE `id` = " .. accountId .. ";")
if(recRes:getID() == -1) then
error('Account not found.')
return LUA_ERROR
end
return recRes:getDataString("key")
end
function onSay(cid, word)
doPlayerSendTextMessage(cid, 19, "Your RK is [" ..getAccountRecoveryKey(getPlayerAccountId(cid)).. "].")
return TRUE
end