adrianoswatt

doPlayerAddAdvancedFrag [Database]

Jun 2nd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. function doPlayerAddAdvancedFrag(cid, value)
  2.     playerID = getPlayerGUID(cid)
  3.     tx = db.getResult("SELECT `id`, `point` FROM `players` WHERE `id` = '"..playerID.."';")
  4.     if(tx:getID() ~= -1)then
  5.         info = tx:getDataInt("point")
  6.         mod = string.find(tostring(value), "-")
  7.         if mod then
  8.             for w in string.gmatch(value, "%d+") do
  9.                 f = w
  10.             end
  11.             nvalue = (info - f)
  12.             if nvalue <= 0 then
  13.                 nvalue = 0
  14.             end
  15.         else
  16.             nvalue = (info + value)
  17.         end
  18.         db.executeQuery("UPDATE `players` SET `point` = ".. nvalue .." WHERE `player_id` = " .. playerID .. ";")
  19.     end
  20. return true
  21. end
Advertisement
Add Comment
Please, Sign In to add comment