beeki

Points function

May 29th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. function getAccountPoints(cid)
  2.         local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'')
  3.         if(res:getID() == -1) then
  4.            return false
  5.         end
  6.         local ret = res:getDataInt("premium_points")
  7.         res:free()
  8.         return tonumber(ret)
  9. end
  10.  
  11. function doAccountAddPoints(cid, count)
  12.         return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) + count .."' WHERE `name` ='"..getPlayerAccount(cid).."'")
  13. end
  14.  
  15. function doAccountRemovePoints(cid, count)
  16.         return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) - count .."' WHERE `name` ='"..getPlayerAccount(cid).."'")
  17. end
Advertisement
Add Comment
Please, Sign In to add comment