mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 06:28:54 +00:00
radial onSelect using exports
This commit is contained in:
1 parent
3cd716ed7f
commit
1bbf1823a9
1 file changed
+20
-8
@@ -36,7 +36,7 @@ lib.addRadialItem(items)
|
|||||||
* label: `string`
|
* label: `string`
|
||||||
* menu?: `string`
|
* menu?: `string`
|
||||||
* Id of a menu to open.
|
* Id of a menu to open.
|
||||||
* onSelect: `function(currentMenu: string | nil, itemIndex: number)`
|
* onSelect: `function(currentMenu: string | nil, itemIndex: number)` | `string`
|
||||||
* Function that's ran when a user clicks the item.
|
* Function that's ran when a user clicks the item.
|
||||||
|
|
||||||
### lib.removeRadialItem
|
### lib.removeRadialItem
|
||||||
@@ -90,7 +90,7 @@ lib.registerRadial(radial)
|
|||||||
* label: `string`
|
* label: `string`
|
||||||
* menu?: `string`
|
* menu?: `string`
|
||||||
* Id of a menu to open.
|
* Id of a menu to open.
|
||||||
* onSelect?: `function`
|
* onSelect?: `function(currentMenu: string | nil, itemIndex: number)` | `string`
|
||||||
* Function that's ran when a user clicks the item.
|
* Function that's ran when a user clicks the item.
|
||||||
|
|
||||||
### lib.hideRadial
|
### lib.hideRadial
|
||||||
@@ -129,15 +129,21 @@ Here's a use case example with some global options and an option utilising the l
|
|||||||
<TabItem value='Lua'>
|
<TabItem value='Lua'>
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
|
exports('myMenuHandler', function(menu, item)
|
||||||
|
print(menu, item)
|
||||||
|
|
||||||
|
if menu == 'police_menu' and item == 1 then
|
||||||
|
print('Handcuffs')
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
lib.registerRadial({
|
lib.registerRadial({
|
||||||
id = 'police_menu',
|
id = 'police_menu',
|
||||||
items = {
|
items = {
|
||||||
{
|
{
|
||||||
label = 'Handcuff',
|
label = 'Handcuff',
|
||||||
icon = 'handcuffs',
|
icon = 'handcuffs',
|
||||||
onSelect = function()
|
onSelect = 'myMenuHandler'
|
||||||
print('Handcuffs')
|
|
||||||
end
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label = 'Frisk',
|
label = 'Frisk',
|
||||||
@@ -207,15 +213,21 @@ Points system in the lib isn't available for the npm package.
|
|||||||
```ts
|
```ts
|
||||||
import lib from '@overextended/ox_lib/client'
|
import lib from '@overextended/ox_lib/client'
|
||||||
|
|
||||||
|
exports('myMenuHandler', (menu, item) => {
|
||||||
|
console.log(menu, item)
|
||||||
|
|
||||||
|
if (menu === 'police_menu' and item === 1) {
|
||||||
|
console.log('Handcuffs')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
lib.registerRadial({
|
lib.registerRadial({
|
||||||
id: 'police_menu',
|
id: 'police_menu',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
label: 'Handcuff',
|
label: 'Handcuff',
|
||||||
icon: 'handcuffs',
|
icon: 'handcuffs',
|
||||||
onSelect: () => {
|
onSelect: 'myMenuHandler'
|
||||||
console.log('Handcuffs')
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Frisk',
|
label: 'Frisk',
|
||||||
|
|||||||
Reference in new issue
Block a user