..:D&G:.. Posted December 28, 2015 Share Posted December 28, 2015 Hello, I am making a mechanic job, and instead of making tons of topics when I need help with this system, I will just make 1 topic. So, I want to make a gridlist with all the vehicles in a colshape, but I don't really know how to get the vehicles within the colshape... Thanks. Link to comment
aka Blue Posted December 29, 2015 Share Posted December 29, 2015 You use a table for that and table.insert, table.remove. Easy Link to comment
Revolt Posted December 29, 2015 Share Posted December 29, 2015 local vehicleTable = getElementsWithinColShape(colShapeObjectVar, "vehicle") Link to comment
..:D&G:.. Posted December 29, 2015 Author Share Posted December 29, 2015 local vehicleTable = getElementsWithinColShape(colShapeObjectVar, "vehicle") That works thanks. Now, I created the gridlist and it shows the vehicles within the colshape, but how do I get the vehicle itself (theVehicle) when the mechanic selects one of the vehicles from the gridlist and then click on the button "Show Tunables"? I know how to get the name, id etc, but I don't know how to get the vehicle itself. Thanks. Link to comment
Noki Posted December 29, 2015 Share Posted December 29, 2015 When creating the gridlist, use guiGridListSetItemData to set that row's data to the corresponding vehicle element. That way, when you select the item you can get that selected item's data (which will be a vehicle element) using guiGridListGetItemData. Link to comment
Revolt Posted December 29, 2015 Share Posted December 29, 2015 -- CLIENT SIDED CODE, REMEMBER! for _, vehicle in ipairs(vehicleTable) do --guiGridListClear(guiGridlistObject) local Row = guiGridListAddRow(guiGridlistObject) guiGridListSetItemText(guiGridlistObject, Row, 1, getVehicleName(vehicle), false, false) end Link to comment
..:D&G:.. Posted December 29, 2015 Author Share Posted December 29, 2015 -- CLIENT SIDED CODE, REMEMBER! for _, vehicle in ipairs(vehicleTable) do --guiGridListClear(guiGridlistObject) local Row = guiGridListAddRow(guiGridlistObject) guiGridListSetItemText(guiGridlistObject, Row, 1, getVehicleName(vehicle), false, false) end I managed to make it myself, thanks anyway. What's the best way of making it so that the mechanic will upgrade the vehicle when it gets near it. The thing is that I want the player to be as close as possible to the vehicle, but if I use a marker, it will only be in the center of the car and if I use a colshape, for some vehicles the player will be able to upgrade the vehicle from a distance or not be able to upgrade it as it doesn't get outside the center of the vehicle. So... what should I use? Link to comment
Revolt Posted December 29, 2015 Share Posted December 29, 2015 Can't you just reduce the colcircle radius? Link to comment
..:D&G:.. Posted December 29, 2015 Author Share Posted December 29, 2015 Can't you just reduce the colcircle radius? Then the circle won't cover the back and the front of the car, but I used onElementClicked instead. 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