[lua]if (!sql.TableExists("player_loadout")) then sql.Query("CREATE TABLE IF NOT EXISTS player_loadout(id VARCHAR(255) PRIMARY KEY, primary VARCHAR(255), secondary VARCHAR(255), grenade VARCHAR(255))")
sql.Query( "INSERT INTO player_loadout (`id`, `primary`, `secondary`, `grenade`)VALUES ('"..LocalPlayer():UniqueID().."', '"..primary.."', '"..secondary.."', '"..grenade.."')")
else
sql.Query("UPDATE player_loadout SET id = "..LocalPlayer():UniqueID()..", primary = "..primary..", secondary = "..secondary..", grenade = "..grenade.."")
end
chat.AddText(Color(255,0,0), "Loadout updated!")
if (!sql.TableExists("player_loadout")) then
print("No table exists!")
end[/lua]
Trying to figure out how to get my data to save clientside in the cl.db file and no matter what I do I can't seem to get it to create the table.
[editline]18th July 2013[/editline]
Didn't realize primary was a keyword :L
Sorry, you need to Log In to post a reply to this thread.