Exports
This section lists all client-side and server-side exports in this script. Exports can be called from other scripts to interact with this script functionality.
Note
If you need additional exports for your implementation, please open a ticket on our Discord server.
Client Exports
OpenMenu
Opens the admin menu or one of its submenus and returns a bool whether the menu was opened. A menu only opens if the player could also open it from inside the admin menu. All other open menus are closed before.
local success = exports['hex_admin_menu']:OpenMenu(menuName)
-- open the vehicle spawner directly
exports['hex_admin_menu']:OpenMenu('spawn_vehicle')Prop
Type
| Menu | Description |
|---|---|
main_menu | Main menu |
self_menu | Self menu with godmode, nametags and noclip |
ped_menu | Ped menu |
special_menu | Special menu |
vehicle_menu | Vehicle menu |
spawn_vehicle | Vehicle spawner |
framework_menu | Framework menu |
giveitem | Item list to give items |
giveweapon | Weapon list to give weapons |
givemoney | Money types to give money |
givevehicle | Vehicle list to give vehicles |
Note
A submenu opened with this export has no menu below it, so going back closes the menu.
HasPermission
Checks if a group has a permission in Config.Permissions and returns a bool. Returns false if one of the arguments is missing. All areas and actions are listed under Permissions.
local hasPermission = exports['hex_admin_menu']:HasPermission(group, area, action)
-- can admins give items?
local canGiveItems = exports['hex_admin_menu']:HasPermission('admin', 'framework_menu', 'giveitem')Prop
Type
RunAction
Runs an action of the admin menu as the local player. The server checks the permissions of the player and sends the same notifications as the menu, so this export returns nothing.
Like in the menu, only the give actions can target other players. All other actions always affect the player who calls the export and ignore the targetId. All actions and their data are listed under Actions.
exports['hex_admin_menu']:RunAction(action, targetId, data)
-- give 5 bread to the player with the id 12
exports['hex_admin_menu']:RunAction('giveitem', 12, { item = 'bread', count = 5, reason = 'Support' })
-- repair the vehicle you are sitting in
exports['hex_admin_menu']:RunAction('repair_vehicle')Prop
Type
isInAduty
Returns a bool whether the player is in admin duty.
local isInAduty = exports['hex_admin_menu']:isInAduty()SetAdminDuty
Turns the admin duty of the player on or off.
exports['hex_admin_menu']:SetAdminDuty(state)Prop
Type
SetNoClip
Turns noclip on or off. Turning it on only works with the noclip permission and, if Config.AntiAbuse is enabled, while the player is in admin duty or their group is in Config.AntiAbuseBypass.
exports['hex_admin_menu']:SetNoClip(state, ignoreLogs)Prop
Type
setNametags
Turns the nametags of the player on or off.
exports['hex_admin_menu']:setNametags(state, ignoreLogs)Prop
Type
Server Exports
HasPermission
Checks if a group has a permission in Config.Permissions and returns a bool. Works the same as the client export.
local hasPermission = exports['hex_admin_menu']:HasPermission(group, area, action)Prop
Type
RunAction
Runs an action of the admin menu and returns a bool whether it was successful and an error code if not.
- With
data.adminthe action runs as this staff member. Their permissions are checked and the logs show their name. - Without
data.adminthe action runs as system without a permission check and is logged asSystem (resource name). This only works for give actions.
Like in the menu, only the give actions can target other players. All other actions affect data.admin and ignore the targetId.
local success, errorCode = exports['hex_admin_menu']:RunAction(action, targetId, data)
-- give a vehicle as system, for example as an event reward
local success, errorCode = exports['hex_admin_menu']:RunAction('givevehicle', 12, { model = 'adder', reason = 'Event Reward' })
-- repair the vehicle the staff member is sitting in
local success, errorCode = exports['hex_admin_menu']:RunAction('repair_vehicle', nil, { admin = source })Prop
Type
Note
The server can not check vehicle models. Make sure the model of givevehicle exists and pass the vehicle class for boats and helicopters, otherwise the vehicle is saved as car.
Actions
Every action has the same name as its permission in Config.Permissions. When a player runs an action, their group needs this permission.
| Action | Data | Description |
|---|---|---|
giveitem | item, count, reason | Gives an item to the target |
giveweapon | weapon, reason | Gives a weapon with 250 ammo to the target |
givemoney | account, amount, reason | Gives money to the target |
givevehicle | model, class, reason | Adds a vehicle to the garage of the target |
clear_peds | radius | Deletes all peds in the radius |
clear_vehicles | radius | Deletes all vehicles in the radius |
clear_objects | radius | Deletes all objects in the radius |
spawn_vehicle | model | Spawns a vehicle and replaces the current one like in the menu |
delete_vehicle | - | Deletes the vehicle the player is sitting in |
repair_vehicle | - | Repairs the vehicle the player is sitting in |
flip_vehicle | - | Flips the vehicle the player is sitting in |
clean_ped | - | Cleans the ped |
add_health | - | Sets the health to the maximum |
add_armour | - | Sets the armour to 100 |
ped_changer | model | Changes the ped model, without model the ped is reset |
Only the four give actions use the targetId. All other actions affect the player who runs them, which is the local player on the client and data.admin on the server.
Data Object
Prop
Type
Error Codes
The server export RunAction returns one of these codes if the action failed. On the client the player gets a notification instead.
| Code | Meaning |
|---|---|
invalid_action | the action does not exist |
invalid_staff | data.admin is missing or not a loaded player, all actions except give need it |
no_permission | the group of the staff member has no permission for this action |
invalid_target | the target player is missing or not online |
invalid_data | a field in data is missing or invalid |
no_vehicle | the staff member is not sitting in a vehicle |
already_has_weapon | the target already has this weapon |
Permissions
These are the default areas and actions in Config.Permissions. They are used by all exports on this page.
| Area | Actions |
|---|---|
self_menu | godmode, nametags, noclip |
ped_menu | clean_ped, add_health, add_armour, ped_changer |
special_menu | superjump, noragdoll, superspeed, superpunch, supersize |
vehicle_menu | spawn_vehicle, delete_vehicle, repair_vehicle, flip_vehicle |
framework_menu | giveitem, giveweapon, givemoney, givevehicle, clear_peds, clear_vehicles, clear_objects |