• 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!

Lua Error command (talkaction) with error in executable

Status
Not open for further replies.

Nuckles

New Member
Joined
Mar 19, 2010
Messages
39
Reaction score
0
This script:
Code:
function getPlayerNameByGUID2(n)

local c = db.getResult("SELECT `name` FROM `players` WHERE `id` = "..n..";")

if c:getID() == -1 then
   return "SQL_ERROR["..n.."]"
end
return c:getDataString("name")
end

function onSay(cid, words, param)

if (param == "") then
   doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"Você possui "..getPlayerStorageValue(cid, 102086).." pontos de Natal.")
   return TRUE
end

if (param == "rank") then

local max = 50
local letters_to_next = 50

local name_now
local name = "Highscore de Pontos de Natal\n"
local rkn = 0
local no_break = 0

name = name.."\n"
name = name.."Rank. Pontos | Nome do Jogador\n"
local v = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = 102086 ORDER BY cast(value as SIGNED) DESC;")
local kk = 0

repeat
   if kk == max or v:getID() == -1 then
break
end

kk = kk+1
name_now, l = getPlayerNameByGUID2(v:getDataInt("player_id")), string.len(getPlayerNameByGUID2(v:getDataInt("player_id")))
space = ""

for i=1, letters_to_next-l do
space = space.." "
end

if name_now == nil then
   name_now = 'sql error['..v:getDataInt("player_id")..']'
end

name = name..kk..". "..v:getDataInt("value").." | "..name_now..space.." \n"
until v:next() == false

if name ~= "Highscore\n" then
   doPlayerPopupFYI(cid, name)
end

return TRUE

else

doPlayerSendCancel(cid, "Command valid: !natal rank.")
return TRUE
end

end

Appears this error in executable:
[2:4:02.827] [Warning - ProtocolGame::sendFYIBox] Trying to send an empty or too huge message.

This Line:
Code:
local v = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = 102086 ORDER BY cast(value as SIGNED) DESC;")

It was this:
Code:
local v = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = 102086 ORDER BY cast(value as INTEGER) DESC;")

But was giving mysql errorl:
Code:
mysql_real_query(): SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = 102086 ORDER BY cast(value as INTEGER) DESC; - MYSQL ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTEGER) DESC' at line 1 (1064)

So I switched! Now the error is appearing in the executable and the command does not appear.

Anyone can help me? plx, Thank! :]


Version 8.6 TFS rev3926.
 
Status
Not open for further replies.
Back
Top