Code Monkey home page Code Monkey logo

menuapi's Introduction

#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()

menuapi's People

Contributors

xogy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.