Server

Helpful functions for the player data structure and functions

lib.player.get

Get the player's information

local player = lib.player.get(source)
Parameter
Type
Required
Description

src

Number

Source of the target

lib.player.identifier

Returns the identifier (CitizenID) of the player

local citizenid = lib.player.identifier(src)
Parameter
Type
Required
Description

src

Number

Source of the target

lib.player.name

Returns the name of the character

local firstName, lastName = lib.player.name(src)
Parameter
Type
Required
Description

src

Number

Source of the target

lib.player.phone_number

Return the phone number of the character

local phoneNumber = lib.player.phone_number(src)
Parameter
Type
Required
Description

src

Number

Source of the target

lib.player.gender

Return the gender of the character

local gender = lib.player.gender(src)
Parameter
Type
Required
Description

src

Number

Source of the target

lib.player.checkOnline

Check if a player is online by their CitizenID

local isOnline = lib.player.checkOnline(identifier)
Parameter
Type
Required
Description

identifier

String

Identifier to be checked for

lib.player.jail

Send a player to jail

lib.player.jail(trg, data)
Parameter
Type
Required
Description

trg

Number

Source to be targeted

data

Object

Data to be used, for example time

lib.player.addMoney

Add money to a player

lib.player.addMoney(src, acc, amount, reason)
Parameter
Type
Required
Description

src

Number

Source to be targeted

acc

String

Account to be deposited in

amount

Number

Amount to be moved

reason

String

Transaction reason

lib.player.removeMoney

Remove money to a player

lib.player.removeMoney(src, acc, amount, reason)
Parameter
Type
Required
Description

src

Number

Source to be targeted

acc

String

Account to be removed

amount

Number

Amount to be moved

reason

String

Transaction reason

lib.player.addItem

Add item to a player

lib.player.addItem(src, item, amount, md, slot)
Parameter
Type
Required
Description

src

Number

Source to be targeted

item

String

Item spawncode

amount

Number

Quantity

md

Object

Metadata for the item

slot

Number

Slot to be placed in, default is next available

lib.player.removeItem

Remove an item for a player

lib.player.removeItem(src, item, amount, md, slot)
Parameter
Type
Required
Description

src

Number

Source to be targeted

item

String

Item spawncode

amount

Number

Quantity

md

Object

Metadata for the item

slot

Number

Slot to be placed in, default is next available

lib.player.editItem

Edit the metadata of an item

lib.player.editItem(src, slot, new_data)
Parameter
Type
Required
Description

src

Number

Source to be targeted

slot

Number

Item slot to be targeted

new_data

Object

Data to be set

lib.player.getInventory

Returns the inventory of the player

local inventory = lib.player.getInventory(src)

Example Return:

{
    {
        name = "example",
        label = "Example Item",
        count = 10,
        info = {
            metadata = true,
        },
        slot = 1
    }
}
Parameter
Type
Required
Description

src

Number

Source to be targeted

Last updated