I have filled a table with all weapons data such as names, prices, components etc.
Then I iterate through it and call WarMenu.Button(weapon.name, weapon.price)
Iâm starting to sink into my work today and it seems pretty good so far. Iâm Using the new alpha setting and itâs pretty nice! I havenât started working with actually manipulating my data yet so thatâll be the real test for me but I still have a lot of buttons to populate
Is there a reason why my subtitle is not showing now?
WarMenu.CreateMenu('LSC', 'Los Santos Customs') -- Main menu
WarMenu.SetSubTitle('LSC', "Welcome")
WarMenu.SetTitleBackgroundColor('LSC', 0, 0, 0, 255)
WarMenu.SetTitleColor('LSC', 255, 255, 255)
Because I tried to recreate original GTA V look and it often has subtitle color same as title background one.
I will add it in the next release (in a few minutes ).
I use this for my Model Skin Changer where i need to use 0
-- LINE 361
function WarMenu.ComboBox(text, items, currentIndex, selectedIndex, callback)
local itemsCount = #items
local selectedItem = items[currentIndex]
local isCurrent = menus[currentMenu].currentOption == (optionCount + 1)
if itemsCount > 1 and isCurrent then
selectedItem = 'â '..tostring(selectedItem)..' â'
end
if WarMenu.Button(text, selectedItem) then
selectedIndex = currentIndex
callback(currentIndex, selectedIndex)
return true
elseif isCurrent then
if currentKey == keys.left then
if currentIndex > 0 then currentIndex = currentIndex - 1 else currentIndex = itemsCount end
elseif currentKey == keys.right then
if currentIndex < itemsCount then currentIndex = currentIndex + 1 else currentIndex = 0 end
end
else
currentIndex = selectedIndex
end
callback(currentIndex, selectedIndex)
return false
end
Iâm using this to create my own garage/shop/gun shop etc. Question is how like in one of the posts above would I be able to change from price to âownedâ if the user owns the item?.
Im using ES and can get a list of cars into a table (owned={}) but no matter how I try it makes the menu and game lag. Iâm doing the checking against the âownedâ table in the main thread which is filled with the cars a player has when joining IE owned ={âblistaâ, âissis2â} from ES database (so if there is a match it replaces the price with "owned"and as far as I can see, because the thread cconstantly loops to draw the menu, it also constantly loops the checking of the table And causes it to slow down.
Is there another method i could try? A separate thread or what i was thinking was another function that when a player joins, it does everything there (the check of owned table) and then the menu just needs to draw it.
Sorry if that doesnât make sense, only been learning Lua for 3 weeks. So far so good, everything else I have done is working but this part has got be stumped.
while true do
if WarMenu.IsMenuOpened('carshop') then
for _, car in ipairs(cars) do
if WarMenu.Button(car.name, car.owned) then --car.owned = nil by default, car.owned = 'Owned' if player has this car
-- Do your stuff
end
end
WarMenu.Display()
end
Citizen.Wait(0)
end