Skip to content

Functions

Owain edited this page May 19, 2019 · 3 revisions

Here are the functions that are provided with xAdmin

Groups

xAdmin.Core.RegisterGroup

Desc: Used to register a new group

Arguments:

Arguments Type
name string
power integer

xAdmin.Core.GetGroupPower

Desc: Used to get a group's power

Arguments:

Arguments Type
name string

Returns:

Name Type
power integer

xAdmin.Core.GetGroupsWithPower

Desc: Used to get a table of groups that meet the provided power

Arguments:

Arguments Type
power integer

Returns:

Name Type
groups table

Commands

xAdmin.Core.RegisterCommand

Desc: Used to register a new command

Arguments:

Arguments Type
command string
desc string
power integer
func function

xAdmin.Core.IsCommand

Desc: Used to check if the provided string is the name of a command

Arguments:

Arguments Type
command string

Returns:

Name Type
iscommand boolean

Player

xAdmin.Core.GetUser

Desc: Used to get a user from a provided string

Arguments:

Arguments Type
string string
admin player

Returns:

Name Type
target player or nil

xAdmin.Core.GetID64

Desc: Used to get an SteamID64 from a provided string

Arguments:

Arguments Type
string string
admin player

Returns:

Name Type
target_id string or nil
target ply or nil

xAdmin.Database.UpdateUsersGroup

Desc: Used to update a target's usergroup in the database (Does not automatically update their realtime rank if they're currently online)

Arguments:

Arguments Type
targetid string
rank string

xAdmin.Database.GetUsersGroup

Desc: Used to get a target's group straight from the database

Arguments:

Arguments Type
targetid string
callback function

Bans

xAdmin.Database.CreateBan

Desc: Adds an active ban to the databases (This will not kick the user if they are currently in-game). When providing the banend, it should be how many seconds they are banned for.

Arguments:

Arguments Type
targetid string
username string or nil
adminid string
adminname string or nil
reason string or nil
banend int

xAdmin.Database.DestroyBan

Desc: End an active ban

Arguments:

Arguments Type
targetid string

xAdmin.Database.IsBanned

Desc: Check if the provided id is banned

Arguments:

Arguments Type
targetid string
callback function or nil

Misc

xAdmin.Core.FormatArguments

Desc: Used to format a table of words into arguments

Arguments:

Arguments Type
words table

Returns:

Name Type
words table

xAdmin.Core.Msg

Desc: Used to send a chat message

Arguments:

Arguments Type
args table
target player or nil