Community Forum

vehicle mass for shop sorting

Forum Overview >> Scripting

CategoryScripting
Created23.01.2024 00:45


Daniel Nübold (eniac86) 23.01.2024 00:45
Hey, can someone tell me what variable is used to show the vehicle weight/mass in the shop?
I'm trying to add some more sorting functionality to SuperShopSorting mod for myself.
I already got it to work with vehicle years mod, but this weight sorting leaves me clueless.

(FS22)

Daniel Nübold (eniac86) 23.01.2024 04:03
i found a solution:


if SortingMode == "weight" then
table.sort(ShopItems, function (left, right)
local leftWeight=Vehicle.getSpecValueWeight(left);
local rightWeight=Vehicle.getSpecValueWeight(right);
print("left: " ..tostring(leftWeight).." /n right: " ..tostring(rightWeight));
if leftWeight ~= nil and rightWeight == nil then return true; end;

if leftWeight ~= nil and rightWeight ~= nil then

return leftWeight < rightWeight
end;
end)
end;


Note: Log in to post. Create a new account here.