Jump to content

Mechanic job questions


..:D&G:..

Recommended Posts

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

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

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