kuwalda Posted July 10, 2014 Share Posted July 10, 2014 Hello. I have made GUI which looks something like this: and this is basicly shop GUI, where player can select car from left side and in right upper window it shows information about this car, based on its orginal handling. And my problem is - how to get those values? My solutions, maybe someone can think something out of these: * Problem is this GUI is client sided, but getModelHandling is server sided. Is there resource efficient way to somehow use it? * I store my cars in table (I added that code part below), so maybe I can add those values manualy, like {model,price,handlingProperty,handlingProperty2...}, but how to use them later on? * I could try to use guiGridListGetSelectedItem and then "in chain" put those values from table there, but I only how to make it for individual cars, not every. Like you press on first car and I already putted those values there and setVisibility for other GUI elements. Is there any way to make it work for every car in list? Please help, any advices or suggestions would be appriciated, even if you aren`t 100% about it. I could maybe try to work out something from your idea. local cars = { {579,60000}, {400,60000}, {404,28000}, {489,65000}, {505,65000}, {479,45000}, {442,45000}, {458,45000}, {602,50000}, {496,42500}, {401,41000} } carShop.gridlist[1] = guiCreateGridList(9, 32, 225, 297, false, carShop.window[1]) guiGridListAddColumn(carShop.gridlist[1], "Marka", 0.5) guiGridListAddColumn(carShop.gridlist[1], "Cena", 0.5) for i = 1, 7 do guiGridListAddRow(carShop.gridlist[1]) end for i,v in ipairs (cars) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (carShop.gridlist[1]) guiGridListSetItemText (carShop.gridlist[1], row, 1, carName, false, true) guiGridListSetItemText (carShop.gridlist[1], row, 2, tostring(v[2]), false, true) end Link to comment
xXMADEXx Posted July 10, 2014 Share Posted July 10, 2014 You could create a temporary vehicle, then use the function getVehicleHandling. Link to comment
Dealman Posted July 10, 2014 Share Posted July 10, 2014 You can certainly make use of tables if you so desire, this is how I'd make it. This is purely an example; First you can define the entries into an array like this; local vehicleData = {579, 60000, "AWD", 0.8151, 0.8151, 0.01, 0.1, 952}, {400, 60000, "AWD", 0.8151, 0.8151, 0.01, 0.1, 952} You can then call either of these entries as you please, by using a method like this; outputChatBox("Drivetrain: "..vehicleData[1][3]); outputChatBox("Max Velocity: "..tostring(vehicleData[1][8])); Or you could do as MADE suggested. Whichever you find to be the most convenient to do. 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