HEX
HexscriptsClassicAdmin Menu

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

MenuDescription
main_menuMain menu
self_menuSelf menu with godmode, nametags and noclip
ped_menuPed menu
special_menuSpecial menu
vehicle_menuVehicle menu
spawn_vehicleVehicle spawner
framework_menuFramework menu
giveitemItem list to give items
giveweaponWeapon list to give weapons
givemoneyMoney types to give money
givevehicleVehicle 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.admin the action runs as this staff member. Their permissions are checked and the logs show their name.
  • Without data.admin the action runs as system without a permission check and is logged as System (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.

ActionDataDescription
giveitemitem, count, reasonGives an item to the target
giveweaponweapon, reasonGives a weapon with 250 ammo to the target
givemoneyaccount, amount, reasonGives money to the target
givevehiclemodel, class, reasonAdds a vehicle to the garage of the target
clear_pedsradiusDeletes all peds in the radius
clear_vehiclesradiusDeletes all vehicles in the radius
clear_objectsradiusDeletes all objects in the radius
spawn_vehiclemodelSpawns 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_changermodelChanges 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.

CodeMeaning
invalid_actionthe action does not exist
invalid_staffdata.admin is missing or not a loaded player, all actions except give need it
no_permissionthe group of the staff member has no permission for this action
invalid_targetthe target player is missing or not online
invalid_dataa field in data is missing or invalid
no_vehiclethe staff member is not sitting in a vehicle
already_has_weaponthe 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.

AreaActions
self_menugodmode, nametags, noclip
ped_menuclean_ped, add_health, add_armour, ped_changer
special_menusuperjump, noragdoll, superspeed, superpunch, supersize
vehicle_menuspawn_vehicle, delete_vehicle, repair_vehicle, flip_vehicle
framework_menugiveitem, giveweapon, givemoney, givevehicle, clear_peds, clear_vehicles, clear_objects