harryh Posted April 21, 2014 Posted April 21, 2014 Well I need it to get the selected item from the gridlist then look at a table and get the certain ID. It must then add use that ID as addVehicleUpgrade ID for the vehicle the player is it. I need some guidance on how I am to do this. GUI: Vehicle Mods Table: Here is what I have so far. However, it doesn't work. function buymod() local bSelect = guiGridListGetSelectedItem(bodygrid) outputChatBox(bSelect) local iData = guiGridListGetItemData(bodygrid, bSelect, bSelect) outputChatBox(iData) end
Castillo Posted April 21, 2014 Posted April 21, 2014 function buymod ( ) local row, col = guiGridListGetSelectedItem ( bodygrid ) -- Get the selected item. if ( row and col and row ~= -1 and col ~= -1 ) then -- If there is a selected item.. local iData = guiGridListGetItemText ( bodygrid, row, 1 ) -- Get the text from the first column. outputChatBox ( iData ) for _, upg in ipairs ( vehicleupgrades ) do -- Loop the "vehicleupgrades" table. if ( upg [ 1 ] == iData ) then -- If the upgrade name matches the one selected.. outputChatBox ( "Cost: ".. tostring ( upg [ 2 ] ) ..": UPG ID: ".. tostring ( upg [ 3 ] ) ) -- Output the cost and upgrade ID. break -- Stop the loop. end end end end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted April 23, 2014 Posted April 23, 2014 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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