Skip to content
forked from Xogy/MenuAPI

Standalone menu API for fivem

License

Notifications You must be signed in to change notification settings

d3st1nyh4x/MenuAPI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Standalone menu API

This menu is for my projects, it is upon you if you like it and want to use it.
However, it isn't really ready to use and it has only like 4 functions and single
type of the menu. So use it on your own decision

MenuAPI

1. Functions (client side)



Example

local menu = CreateMenu("identifier")

menu.SetMenuTitle("Healing menu")

menu.SetProperties({
    float = "right",
    position = "top",
})

menu.AddItem(1 ,"heal me", function()
    SetEntityHealth(PlayerPedId(), 200)
    menu.Close()
end)

menu.Open()

Example with events

local vehicles = {
    [1] = { label = "police car", model = "police"},
    [2] = { label = "A FOCKING TANK?!", model = "rhino"},
    [3] = { label = "a nice car!", model = "cerberus3"}
}

local menu = CreateMenu("identifier")

menu.SetMenuTitle("Vehicle spawner")

menu.SetProperties({
    float = "right",
    position = "top",
})

for k,v in ipairs(vehicles) do
    menu.AddItem(k, v.label, nil, { model = v.model })
end

menu.OnSelectEvent(function(index, data)
    RequestModel(data.model)
    local coords = GetEntityCoords(PlayerPedId())
    while not HasModelLoaded(data.model) do
        Wait(33)
    end
    local vehicle = CreateVehicle(data.model, coords.x, coords.y, coords.z, GetEntityHeading(PlayerPedId()), true, true)
    SetVehicleOnGroundProperly(vehicle)
    SetModelAsNoLongerNeeded(data.model)
    TaskWarpPedIntoVehicle(PlayerPedId(), vehicle, -1)    
end)

menu.Open()

About

Standalone menu API for fivem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 53.7%
  • JavaScript 21.5%
  • CSS 19.1%
  • HTML 5.7%