Oh my bad, The code doesn’t seem to run. When I try to open the menu, nothing happens.
Try this:
AddEventHandler('playerSpawned', function()
WarMenu.OpenMenu('lifeLike')
end)
And check your console for any errors.
Ok I will try it now, I have checked my console, no errors when trying to open.
Make sure that warmenu
and your resource were started.
Make sure that your script is actually running (added to your __resource.lua
).
Change WarMenu.debug
to true
to see if your menus were created.
The menu did not open onload. I will include what I have done in a zip file, I suspect that there is something wrong with my file structure. When I try to start warmenu, the server says that it couldn’t find warmenu. LifeLikeMenu.tar.gz (17.5 KB)
Your test menu opens then closes instantly. Any idea why?
Update 0.9.8
- Added
WarMenu.IsAnyMenuOpened()
API - Fixed
WarMenu.SetMenuWidth()
API - Fixed background sprite preloading
- Made
WarMenu.Checkbox
callback parameter as optional, updatedUsage
section - Improved input handling
I’m new to scripting in Lua, excuse any errors or questions you’ve already answered, I did look at all 169 comments before making this. I’m having a few issues.
I could be using the function wrong but whenever I try
WarMenu.SetMenuFocusColor(id, r, g, b, a)
it doesn’t error, but also doesn’t apply the color when focused. I used your example code to make sure it wasn’t something wrong with my resource
Code + Screenshot
Citizen.CreateThread(function()
local items = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }
local currentItemIndex = 1
local selectedItemIndex = 1
local checkbox = true
WarMenu.CreateMenu('test', 'Test title')
WarMenu.CreateSubMenu('closeMenu', 'test', 'Are you sure?')
WarMenu.SetMenuFocusColor('test', 0, 255, 255, 200)
while true do
if WarMenu.IsMenuOpened('test') then
if WarMenu.CheckBox('Checkbox', checkbox) then
checkbox = not checkbox
-- Do your stuff here
elseif WarMenu.ComboBox('Combobox', items, currentItemIndex, selectedItemIndex, function(currentIndex, selectedIndex)
currentItemIndex = currentIndex
selectedItemIndex = selectedIndex
-- Do your stuff here if current index was changed (don't forget to check it)
end) then
-- Do your stuff here if current item was activated
elseif WarMenu.MenuButton('Exit', 'closeMenu') then
end
WarMenu.Display()
elseif WarMenu.IsMenuOpened('closeMenu') then
if WarMenu.Button('Yes') then
WarMenu.CloseMenu()
elseif WarMenu.MenuButton('No', 'test') then
end
WarMenu.Display()
elseif IsControlJustReleased(0, 0) then --M by default
WarMenu.OpenMenu('test')
end
Citizen.Wait(0)
end
end)
I noticed how some menus people have shown have sprites, how would I go about doing that? I see the native DrawSprite(textureDict, textureName, screenX, screenY, width, height, heading, red, green, blue, alpha)
Doesn’t this just draw on the screen?
Lastly I’m trying to call a function if a menu.button is pressed, whenever I add the function to the if statement it instantly stops the resource from working.
Code
function giveCopWeapons()
giveWeapon("weapon_combatpistol")
weaponComponent("weapon_combatpistol", "COMPONENT_AT_PI_FLSH")
end
function giveWeapon(weaponHash)
GiveWeaponToPed(GetPlayerPed(-1), weaponHash, 200, false, false)
end
function weaponComponent(weaponHash, component)
if HasPedGotWeapon(GetPlayerPed(-1), GetHashKey(weaponHash), false) then
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey(weaponHash), GetHashKey(component))
end
end
Citizen.CreateThread(function()
WarMenu.CreateMenu('PDDrawClothes', 'LAPD Clothes')
--[[ToDo: Uncomment]]
-- WarMenu.SetMenuX('CopMainMenu', 0.75) --[0.0..1.0] top left corner
-- WarMenu.SetMenuY('CopMainMenu', 0.01) --[0.0..1.0] top
WarMenu.SetTitleColor('PDDrawClothes', 255, 255, 255, 255)
WarMenu.SetTitleBackgroundColor('PDDrawClothes', 0, 0, 255, 100)
WarMenu.SetSubTitle('PDDrawClothes', 'Pick Your Clothes')
WarMenu.SetMenuTextColor('PDDrawClothes', 255, 255, 255, 255)
WarMenu.SetMenuFocusColor('PDDrawClothes', 0, 0, 255, 255)
while true do
if WarMenu.IsMenuOpened('PDDrawClothes') then
if WarMenu.Button('Test') then
giveCopWeapons()
end
WarMenu.Display()
end
Citizen.Wait(0)
end
end)
I’m seeming to not be able to trigger my menu to open while inside a vehicle… Is that a limitation of WarMenu?
looks good
Can i edit the look of menu? I want to get look like my esx menu default
I can help you if you need
Hello we can not change the coordinates of the hospital menu
Why ?
Hello tell me how I have to change the coordinates of the location
to help you change that I would have to see your code that uses its coordinates I can not know it as well
This menu is far from being a shit and it works perfectly well
that dont answer the question homie