function getAccountPoints(cid)
local Info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local Points= Info:getDataInt("premium_points")
Info:free()
return Points
end
return LUA_ERROR
end
function doAddPoints(cid, points)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
function doRemovePoints(cid, points)
local Info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
db.executeQuery("UPDATE accounts SET premium_points = premium_points -" .. points .. " WHERE id=" .. getPlayerAccountId(cid) .. ";")
Info:free()
return true
end
end