Advertisement
Guest User

ASDAS

a guest
Dec 6th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. --Create Table if not exist
  2. GLife.DB.db:Query("CREATE TABLE IF NOT EXISTS "..GLife.Config.BankName.."(id INTEGER PRIMARY KEY, steamid BIGINT, amount INT)")
  3.  
  4. --Create Info
  5. local function createInfo( ply )
  6.    
  7.  
  8.     GLife.DB.db:Query("SELECT * FROM "..GLife.Config.BankName.." WHERE steamid = "..ply:SteamID64(), _, function(data)
  9.         print("Trying To Create Bank Balance: "..ply:Nick())
  10.  
  11.         if(data != nil)then
  12.  
  13.             print("Creating Bank Balance: "..ply:Nick())
  14.  
  15.                 GLife.DB.db:Insert(GLife.Config.BankName, {
  16.                     steamid = ply:SteamID64(),
  17.                     amount = GLife.Config.BankStarting
  18.                 }, function(affectedRowCount, insertedId)
  19.                     -- Print the AUTOINCREMENTed row id
  20.                     print("Added row with id ", insertedId)
  21.                 end)
  22.                 GLife.DB.updateInfoToClient ( ply )
  23.         else
  24.  
  25.             print("Bank Balance Exists For: "..ply:Nick())
  26.  
  27.         end
  28.  
  29.        
  30.  
  31.  
  32.  
  33.     end)
  34.  
  35. end
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. hook.Add( "PlayerInitialSpawn", "CreateInfo", createInfo )
  43.  
  44.  
  45.  
  46.  
  47.  
  48. if(SERVER)then
  49.     print("#        SQL Bank Loaded        #")
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement