Advertisement
LuckOake

RadBr Banishment System Lib

Nov 4th, 2012
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. function getPlayerAccountStorageValue(name, key)
  2.     local result, ret = db.getResult("SELECT `value` FROM `account_storage` WHERE `acc_id` = '".. getAccountIdByName(name) .."' AND `key` = ".. key ..";")
  3.     if result:getID() == -1 then
  4.         return nil
  5.     end
  6.     ret = result:getDataInt("value")
  7.     result:free()
  8.     return ret
  9. end
  10.  
  11. function setPlayerAccountStorageValue(name, key, value)
  12.     local result = db.getResult("SELECT * FROM `account_storage` WHERE `acc_id` = ".. getAccountIdByName(name) .." AND `key` = ".. key ..";")
  13.     if result:getID() == -1 then
  14.         return db.executeQuery("INSERT INTO `account_storage` (`acc_id`, `key`, `value`) VALUES (".. getAccountIdByName(name) ..", ".. key ..", ".. value ..");")
  15.     else
  16.         result:free()
  17.         return db.executeQuery("UPDATE `account_storage` SET `value` = ".. value .." WHERE `acc_id` = ".. getAccountIdByName(name) .." AND `key` = ".. key ..";")
  18.     end
  19. end
  20.  
  21. function getWarnings(name)
  22.     return getPlayerAccountStorageValue(name, 21798)
  23. end
  24.  
  25. function setWarnings(name, count)
  26.     return setPlayerAccountStorageValue(name, 21798, count)
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement