[FREE] WarMenu - Lua Menu Framework

Pull request was merged, so you can update your local copy ^)

Tip for Git users:

You can use my resource as well as others as a submodule:

  1. Run git submodule add https://github.com/adikanchukov/warmenu.git inside your server data directory.
  2. Run git submodule update for updating, then git commit -a with a comment like Updated *resource name* submodule.

See here for more details.

2 Likes

Ammu-Nation looks amazing with WarMenu GUI 0.9.7dev:

5 Likes

How’d you get the prices in there? I didn’t see it in the example :stuck_out_tongue:

1 Like

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)

1 Like

Cheers! Nice resource btw, makes it easy for GUI-Inept people like me :stuck_out_tongue:

3 Likes

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

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) 

2017-08-19 16_05_53-Grand Theft Auto V

1 Like

Because it’s using titleBackgroundColor and you have it black.

1 Like

Yeah i literally just figured that out. Is there a reason why you have those two set the same or can we get something to set the subtitle text color.

1 Like

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 :grin:).

2 Likes

No worries and thanks a lot!

2017-08-19 16_21_50-Grand Theft Auto V

It’s not bad but it’d just be nice to be able to adjust it separately or default to the background color would be nice :slight_smile:

**
It also appears that the alpha for background affects the subtitle as well as the background of the title.

1 Like

Update 0.9.7

1

Changelog

  • Added new WarMenu.SetMenuSubTextColor() API
  • @alberto2345: Added alpha parameters to color functions (with default values, so no worry for existing code)
  • Improved default subText color (see image)
  • Fixed flickering after reopening menu
  • @alberto2345: Fixed button execution after reopening menu
  • Fixed subTitle sub menu initializing
  • Corrected WarMenu.CheckBox usage example
2 Likes

I’m really liking that new update! It’s going to just spice up the menus just a bit more :slight_smile: Thanks @Warxander

2017-08-19 18_20_20-Grand Theft Auto V

Now, back to actually scripting.

2 Likes

Is it possible to add “descriptions” like such:
image

1 Like

I’m planning to implement this in the next update.

5 Likes

Great Stuff! so i didn’t write descriptions for nothing :stuck_out_tongue:

1 Like

I need it for my server, that’s why :stuck_out_tongue_closed_eyes:

1 Like

Default ComboBox min: 1
New ComboBox min: 0

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

If the next update has a hover option I’ll ahem be happy :slight_smile: but still a very great resource :slight_smile:

1 Like

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.

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