Basically, I’m storing the players SteamID and Rank to a database with this code:
function FirstJoinMysql( ply )
local query1 = databaseObject:query(“SELECT * FROM Players WHERE SteamID = '” … ply:SteamID() … “’”)
query1.onSuccess = function(q)
if not checkQuery(q) then
local query2 = databaseObject:query(“INSERT INTO Players(SteamID, Rank) VALUES (’” … ply:SteamID() … "’, " … 0 … “)”) // else create the bugger
query2.onSuccess = function(q) print(“Created you!”) end
query2.onError = function(q,e) print(“something went wrong”) end
print(“You are already created!”)
query1.onError = function(q,e) print(“something went wrong when checking”) end
hook.Add( “PlayerInitialSpawn”, “PlayerInitialSpawn”, FirstJoinMysql )
This was taken from the wiki (Which is horrible and he explains jack shit). I’m basically needing to know how to check the database and how to check individual rows in the table.
Ill be doing:
function Firstspawn( ply )
//MYSQL code to read from the rank row to check there rank, and if it’s 1 then pl:Addmoney(100) or something like that.
hook.Add( “PlayerSpawn”, “PlayerSpawn”, Firstspawn )
Any help is appreciated.