💻
alt:V Athena Docs v3.0.0
  • Info
    • Introduction
    • Patreon & Support
    • Athena Discord
    • FAQ
  • Installation
    • Common Issues
    • Windows
    • Linux (Ubuntu 20.04+)
    • Debugging
    • Updating
  • Info
    • Admin
    • Configuration
    • Console
    • Database
    • Hotkeys
    • Identifier
  • Plugins
    • Load Plugins
    • Create Plugins
    • Mods
    • Clothing
  • Controllers
    • What is a Controller?
    • Blip Controller
    • Interaction Controller
    • Marker Controller
    • Object Controller
    • Ped Controller
    • Text Label Controller
    • World Notification Controller
  • Systems
    • Interiors
    • Inventory & Items
    • Inventory Rules
    • Jobs
    • Time
    • Weather
  • Menus
    • Menu Types
    • Action Menus
    • Input Menu
    • Wheel Menu
  • Player
    • Admin-Commands
    • Animations
    • Attach Objects
    • Credits
    • Currency
    • Commands
    • Error Screen
    • Message
    • Meta
    • Notifications
    • Particle
    • Progress Bar
    • Save
    • Shard
    • Sound
    • Spinners
    • Task Timeline
  • Custom WebViews
    • Introduction
    • Your First Page
    • CSS Framework
  • Misc
    • Custom Sounds
    • Custom Streamers
    • Custom Icons
    • Adding Locale / Translations
    • Adding Vehicle Rules
    • Adding Whitelist
    • Adding Wheel Menus
    • Adding Parking Garages
Powered by GitBook
On this page
  • How to be an Admin?
  • How do Permissions Work?
  • Unrestricted Command
  • Moderators Only Command
  • Admins Only Command
  • Admins and Moderators
  • How to Set Permission Level
  • Adding Additional Permission Levels
Edit on GitHub
  1. Info

Admin

Administrative stuff for Athena Framework

PreviousUpdatingNextConfiguration

Last updated 2 years ago

Athena Framework does have some generic administrative modes but they're mostly restricted to the console at the moment. However, you can give certain accounts access to commands through the permission system.

How to be an Admin?

If you want to give yourself admin permissions. You need to get your discord id out of discord.

Then right-click on yourself in any server, channel, etc. and get your identifier.

Start your server and make sure you already have an account and have logged into that account.

In your console type /setadmin your_discord_id_here 4

How do Permissions Work?

Let's talk about how permissions work and why you really need to understand this concept when you're writing commands. Permissions use a bitwise function to determine who can access what commands.

This means that only certain accounts should be able to access certain commands depending on the permissions you pass to a command.

Unrestricted Command

function doSomething(player: alt.Player) {
    console.log('Someone did something');
}

ChatController.addCommand('dosomething', '/dosomething - It does something?', PERMISSIONS.NONE, doSomething);

Moderators Only Command

function doSomething(player: alt.Player) {
    console.log('Moderator did something');
}

ChatController.addCommand('dosomething', '/dosomething - It does something?', PERMISSIONS.MODERATOR, doSomething);

Admins Only Command

function doSomething(player: alt.Player) {
    console.log('Admin did something');
}

ChatController.addCommand('dosomething', '/dosomething - It does something?', PERMISSIONS.ADMIN, doSomething);

Admins and Moderators

function doSomething(player: alt.Player) {
    console.log('Admin or Mod did something');
}

ChatController.addCommand('dosomething', '/dosomething - It does something?', PERMISSIONS.ADMIN | PERMISSIONS.MODERATOR, doSomething);

How to Set Permission Level

Permissions by default are currently set to the following:

export enum PERMISSIONS {
    NONE = 0,
    VIP = 1,
    MODERATOR = 2,
    ADMIN = 4
}

(This config can be found in /core/shared/flags/permissionFlags.ts)

To give someone access to all admin commands you can write into your server terminal the following command:

/setadmin <discord_id> <permission_level>

This requires the player to be online and in-game.

The discord_id is their actual identifier from Discord Developer mode

Adding Additional Permission Levels

Permissions are bitwise meaning that they MUST be a certain number in order for them to work. This means that if you do not use the right number it could ruin your server because you didn't read this right.

This is why I'm giving you an example to follow. Please ensure you follow this pattern.

export enum PERMISSIONS {
    NONE = 0,
    VIP = 1,
    MODERATOR = 2, // 1 + 1 = this
    ADMIN_LEVEL_1 = 4, // 2 + 2 = this
    ADMIN_LEVEL_2 = 8, // 4 + 4 = this
    ADMIN_LEVEL_3 = 16, // 8 + 8 = this
    ADMIN_LEVEL_4 = 32, // 16 + 16 = this
    ADMIN_LEVEL_5 = 64, // 32 + 32 = this
    GOD_LEVEL_1 = 128, // 64 + 64 = this
    GOD_LEVEL_2 = 256, // 128 + 128 = this
    GOD_LEVEL_3 = 512, // 256 + 256 = this
    SWEAT_LORD = 1024 // 512 + 512 = this
    // What do you think goes here?
}

Notice how each value increases by itself each time

The answer to the above question is 2048. Thanks for reading.