Jump to content

get players owned vehicles in gridlist


kewizzle

Recommended Posts

i opened registry.db and found this

80fde7aea19d78a5f8d29ab7c7cb7419.jpg

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

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...