Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Create Table if not exist
- GLife.DB.db:Query("CREATE TABLE IF NOT EXISTS "..GLife.Config.BankName.."(id INTEGER PRIMARY KEY, steamid BIGINT, amount INT)")
- --Create Info
- local function createInfo( ply )
- GLife.DB.db:Query("SELECT * FROM "..GLife.Config.BankName.." WHERE steamid = "..ply:SteamID64(), _, function(data)
- print("Trying To Create Bank Balance: "..ply:Nick())
- if(data != nil)then
- print("Creating Bank Balance: "..ply:Nick())
- GLife.DB.db:Insert(GLife.Config.BankName, {
- steamid = ply:SteamID64(),
- amount = GLife.Config.BankStarting
- }, function(affectedRowCount, insertedId)
- -- Print the AUTOINCREMENTed row id
- print("Added row with id ", insertedId)
- end)
- GLife.DB.updateInfoToClient ( ply )
- else
- print("Bank Balance Exists For: "..ply:Nick())
- end
- end)
- end
- hook.Add( "PlayerInitialSpawn", "CreateInfo", createInfo )
- if(SERVER)then
- print("# SQL Bank Loaded #")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement