G API - Epix-Incorporated/Adonis GitHub Wiki

First of all, what is the _G API?

The _G API is an API which allows scripts to interact globally. Adonis uses this to create select functions that can be interacted with by any server script, meaning any server script can access certain Adonis events using _G.Adonis.

Using the API

Settings

To start, you need to have the appropriate settings enabled.

  • settings.G_API = true This needs to be set to true so that the _G.Adonis API can be used.
  • settings.G_Access = false This is optional for security, can be left false if you want. This controls whether scripts need an access key to use _G.Adonis.
  • settings.G_Access_Key = "Example_Key" This can be used to set an access key if the above setting is set to true. Example_Key is excluded and will not work.
  • settings.G_Access_Perms = "Read" This controls what permissions other scripts have over the _G API, read or write.

Usage in scripts

With _G.Access disabled:

  • _G.Adonis.Function(Input, Player(s))

For example,

_G.Adonis.Hint("Message", game.Players:GetPlayers()) would create a hint for all players with the word "Message".

With _G.Access enabled:

  • Functions = _G.Adonis.Access("API Key", "Functions") - Replace Functions with whatever functions you wish to access.

For example,

  • local AdminAccess = _G.Adonis.Access("TEST_KEY_SAMPLE", "Admin")
  • AdminAccess.AddAdmin(game:GetService("Players")["epix_agent"], 900) would give Creator admin to the player called "epix_agent".

Functions

These are all the functions you can use with _G.Adonis. Most of them are self-explanatory.

  • CheckAdmin / IsAdmin

Checks if a player... is an admin. Obviously. Usage: _G.Adonis.CheckAdmin(player)

  • CheckBan / IsBanned

Checks if a player is banned. Usage: _G.Adonis.CheckBan(player)

  • IsMuted

Checks if a player is muted. Usage: _G.Adonis.IsMuted(player)

  • CheckDonor

Checks if a player is a donor. Usage: _G.Adonis.CheckDonor(player)

  • GetLevel

Gets the player's admin level. Usage: _G.Adonis.GetLevel(player)

  • SetLighting

Sets the game lighting. Usage: _G.Adonis.SetLighting(property, value)

  • SetPlayerLighting

Sets the lighting for an individual player. Usage: _G.Adonis.SetLighting(player, property, value)

  • NewParticle

Creates a new particle effect on a player. Usage: _G.Adonis.NewParticle(player, particleType, properties)

  • RemoveParticle

Removes a particle effect from a player. Usage: _G.Adonis.NewParticle(player, particleName)

  • NewLocal

Removes a particle effect from a player. Usage: _G.Adonis.NewLocal(player, class, properties, parent)

  • MakeLocal

Makes an object local. Usage: _G.Adonis.MakeLocal(player, object, parent, isClone)

  • MoveLocal

Moves a local object from one player to another. Usage: _G.Adonis.MoveLocal(player, object, parent, newParent)

  • RemoveLocal

Removes a local object. Usage: _G.Adonis.RemoveLocal(player, object, parent, shouldMatch)

  • Hint

Makes a hint. Usage: _G.Adonis.Hint(message, players, duration, title, image)

  • Message

Makes a big message. Usage: _G.Adonis.Message(sender, title, message, image, players, scroll, duration)

  • RunCommandAsNonAdmin

Runs a command as if the player was a non-admin Usage: _G.Adonis.RunCommandAsNonAdmin(command, plr, ...)