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

Is this Query in LUA correct?

Tyson12302

New Member
Joined
Aug 6, 2014
Messages
264
Reaction score
4
Code:
local points = 10 -- amount of premium points

function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayer(cid) == TRUE then
local Sql = "UPDATE `znote_accounts` SET `points` = `points` + "..points.." where id="..getPlayerAccountId(cid)
db.executeQuery(Sql)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You Have Received 10 Premium Point")
doRemoveItem(item.uid)
end
return true
end
I'm trying to use this for a Premium Points scroll everything works and it says that i received the points but when i check the website and database it is not there.
 
Code:
local points = 10 -- amount of premium points
function onUse(cid, item, fromPosition, itemEx, toPosition)
    db.executeQuery("UPDATE `znote_accounts` SET `points` = `points` + " .. points .. " where id = " .. getPlayerAccountId(cid) .. ";")
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You Have Received 10 Premium Point")
    doRemoveItem(item.uid)
    return true
end

If it dosen't work then check if the columns name match your database structure.
 
Still doesn't work. I checked and my Shop points come from the column "points" and they are from "znote_accounts. What is the problem?
 
Try this.
Code:
local points = 10 -- amount of premium points

function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayer(cid) == TRUE then
db.executeQuery('UPDATE znote_accounts SET points=points+'.. points ..' WHERE account_id=' .. getPlayerAccountId(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You have received ".. points .." shop points.")
doRemoveItem(item.uid)
end
return true
end
 
Fixed. My Query was wrong i changed it to
Code:
db.executeQuery('UPDATE znote_accounts SET points=points+1 WHERE account_id='.. getPlayerAccountId(cid))
and it started to work.
 
Fixed. My Query was wrong i changed it to
Code:
db.executeQuery('UPDATE znote_accounts SET points=points+1 WHERE account_id='.. getPlayerAccountId(cid))
and it started to work.

In the future remember to actually check the queries, it's very easy that it's something wrong when you download things.

If it dosen't work then check if the columns name match your database structure.
 
Back
Top