Adding Wheel Menus
Learn how to build a Wheel Menu.

Summary

Wheel Menu's are exactly how they sound. It's a wheel with a bunch of items you can select. Those items inside of the menu can have other items buried behind it. They can currently only be created on client-side.

Video Guide

Basic Example

This example simply has an event where if an event is passed from server to client. It will open this menu.
1
import * as alt from 'alt-client';
2
import { IWheelItem, WheelMenu } from '../utility/wheelMenu';
3
// May not be a valid path. Use auto-import feature from your code editor.
4
5
alt.onServer('open:MyMenu', () => {
6
7
WheelMenu.create(
8
'Description in Middle',
9
[
10
{
11
name: 'Say Hi in Console',
12
callback: () => {
13
alt.log('Hello World!');
14
}
15
}
16
],
17
true // Should we move the cursor to the middle for this menu?
18
);
19
});
Copied!

Nested Example

1
import * as alt from 'alt-client';
2
import { IWheelItem, WheelMenu } from '../utility/wheelMenu';
3
// May not be a valid path. Use auto-import feature from your code editor.
4
5
alt.onServer('open:MyMenu', () => {
6
WheelMenu.create(
7
'First Menu',
8
[
9
{
10
name: 'Go to "A" Second Menu',
11
callback: aSecondMenu
12
},
13
{
14
name: 'Go to "B" Second Menu',
15
callback: bSecondMenu
16
}
17
],
18
true // Should we move the cursor to the middle for this menu?
19
);
20
});
21
22
function aSecondMenu() {
23
WheelMenu.create(
24
'Second Menu A',
25
[
26
{
27
name: 'log something',
28
callback: () => {
29
console.log('item from a')
30
}
31
}
32
],
33
false
34
);
35
}
36
37
function bSecondMenu() {
38
WheelMenu.create(
39
'Second Menu B',
40
[
41
{
42
name: 'log something',
43
callback: () => {
44
console.log('item from b');
45
}
46
}
47
],
48
false
49
);
50
}
Copied!
Last modified 3mo ago