kewizzle Posted April 7, 2017 Share Posted April 7, 2017 i opened registry.db and found this how would i get the model id column and insert it into a gridlist ? I tried a few things but all failed. heres the server side createsql function executeSQLQuery("CREATE TABLE IF NOT EXISTS carslot1 (PlayerName TEXT, Model NUMERIC, Cost NUMERIC, Paintjob NUMERIC, Color TEXT, Upgrade0 NUMERIC, Upgrade1 NUMERIC, Upgrade2 NUMERIC, Upgrade3 NUMERIC, Upgrade4 NUMERIC, Upgrade5 NUMERIC, Upgrade6 NUMERIC, Upgrade7 NUMERIC, Upgrade8 NUMERIC, Upgrade9 NUMERIC, Upgrade10 NUMERIC, Upgrade11 NUMERIC, Upgrade12 NUMERIC, Upgrade13 NUMERIC, Upgrade14 NUMERIC, Upgrade15 NUMERIC, Upgrade16 NUMERIC)") here is my gridlist in client ownedVehicles = guiCreateGridList(633, 257, 333, 254, false) Link to comment
_DrXenon Posted April 7, 2017 Share Posted April 7, 2017 (edited) executeSQLQuery("SELECT Model FROM carslot1 WHERE PlayerName=?",playerName) Edited April 7, 2017 by SuperCroz Link to comment
kewizzle Posted April 7, 2017 Author Share Posted April 7, 2017 client for _, veh in ipairs ( ownedCars ) do row = guiGridListAddRow ( ownedVehicles ) guiGridListSetItemText ( ownedVehicles, row, column, tostring(veh), false, false ) end server ownedCars = {executeSQLQuery("SELECT Model FROM carslot1 WHERE PlayerName=?",playerName)} im not to sure if this is how you do it on the server side. Probably not since i never worked with sql and im just now learning.. but i dont know how i would go about getting the server side table in my client side function either. Link to comment
_DrXenon Posted April 7, 2017 Share Posted April 7, 2017 I can help if you tell me more about this; Can more than one Model be saved for the same player? or each player can have one car only? Link to comment
kewizzle Posted April 7, 2017 Author Share Posted April 7, 2017 1 hour ago, SuperCroz said: I can help if you tell me more about this; Can more than one Model be saved for the same player? or each player can have one car only? each can have 2 cars Link to comment
_DrXenon Posted April 7, 2017 Share Posted April 7, 2017 local s = { q = executeSQLQuery } ... local all = s.q( "SELECT * FROM carslot1" ) ... for i = 1, #all do if all[i].PlayerName == playername then table.insert(ownedcars, all[i].Model) end end ... it should be something like this, Just make it fit in your script. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now