[FREE] WarMenu - Lua Menu Framework

Check this for example:

https://github.com/adikanchukov/los-santos-v/blob/update-4.0/resources/[los-santos-v]/lsv-main/client/ammunation.lua

https://github.com/adikanchukov/los-santos-v/blob/update-4.0/resources/[los-santos-v]/lsv-main/server/ammunation.lua

ok I got it to work kind of but it only shows one vehicle and not really good with for _,v in pairs(vehicles) do but this is what I got so far.

Before while-true

ESX.TriggerServerCallback('eden_garage:getVehicles', function(vehicles)
				for _,v in pairs(vehicles) do
			
					local hashVehicle = v.vehicle.model
					local vehicleName = GetDisplayNameFromVehicleModel(hashVehicle)
					if(v.state) then
						labelvehicle = vehicleName..': Returns'
					else
						labelvehicle = vehicleName..': Exit'
					end	
			end
		end)

In while-true

if WarMenu.Button(labelvehicle) then               
end

You rewrite labelvehicle on each loop step.
Probably you should use this, but I’m not sure what are you trying to do:

vehicleLabels= { }
ESX.TriggerServerCallback('eden_garage:getVehicles', function(vehicles)
				for _,v in pairs(vehicles) do
					local hashVehicle = v.vehicle.model
					local vehicleName = GetDisplayNameFromVehicleModel(hashVehicle)
                    local vehicleLabel
					if(v.state) then
						vehicleLabel= vehicleName..': Returns'
					else
						vehicleLabel= vehicleName..': Exit'
					end
                    table.insert(vehicleLabels, vehicleLabel)
			end
		end)

-- Inside while-true menu loop
for _, vehicleLabel in pairs(vehicleLabels) do
    if WarMenu.Button(vehicleLabel) then
        --- Do stuff
    end
end

I feel really dumb right now but thanks for all the help so far the only problem now is that it doesn’t update when the vehicle comes out. when I take the vehicle out it wont updated to Exit it just says Returns. This is probably really simple to fix but i’m brain farting hard right now.

Do you think I should put the before while true part in its own while true to get it to update?

how i instal the mod in five m plzz help me

http://prntscr.com/ixsbbp // http://prntscr.com/ixsbmd

You don’t need it.

(20 ch)

Hello i start my new server five m in local host just for test but i saw your warmenu but i dont no how to put this in the game or in my folder resource i dont no what to do? Do you have a video for me to see where i put API or Usage i dont no sorry for my noob skillz i am new in this …?Thanks

Hello I’m back again and I got it working but was wondering how I could do a table.insert and have two values but the second one hidden because it would help spawn the car so like this

                      model = vehicles[i].plate
                      name = GetDisplayNameFromVehicleModel(vehicles[i].model)
			          executed = true
                      table.insert(vehicleLabels, {name, model})

any recommendations for my problem?

this is the script part

	ESX.TriggerServerCallback('netr_garages:getVehiclesInGarage', function (vehicles)
									if not executed then
                    for i=1, #vehicles, 1 do
                      number = i
                      model = vehicles[i].plate
                      name = GetDisplayNameFromVehicleModel(vehicles[i].model)
											executed = true
                      table.insert(vehicleLabels, name)
                    end
								  end

                end)

								for _ , name , model in pairs(vehicleLabels) do
                  if WarMenu.Button(name) then
                    pulloutcar(name)
                    Citizen.Wait(1000)
                    local currentVehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
                    SetVehicleNumberPlateText(currentVehicle, model)
                    TriggerEvent('esx:showNotification', model)
										WarMenu.CloseMenu('list')
										Citizen.Wait(0)
										executed = false
										vehicleLabels = {}
									end
								end

Hey, just a quick question. I am trying to open another warmenu through the current one I am using. What’s the required code, if there is any? Was trying to use WarMenu.OpenMenu :confused:

It shouldn’t be a problem.
Use the same pattern as in the Usage example and create another thread for your menu.
It also could be a good idea to keep each menu processing in its own thread.

I can’t answer you because you incorrectly formulated the problem.
Also, your code contains at least one runtime error - check Lua for-loop syntax.

This resource is for developers. Are you sure that you’re one of them?

And for opening another menu you should use WarMenu.MenuButton API.

Heres another example of WarMenu we used on our server for our custom race script. Non interactive menu up the top right for showing ready players.

2 Likes

Yeah plzz can i have this plzz

No point in doing WarMenu.Display() after each button, just call it once at the end of the loop before you Wait(0).