DirkScripts
Server
#lib.player.get
Get the player's information
lualocal player = lib.player.get(source)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source of the target |
#lib.player.identifier
Returns the identifier (CitizenID) of the player
lualocal citizenid = lib.player.identifier(src)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source of the target |
#lib.player.name
Returns the name of the character
lualocal firstName, lastName = lib.player.name(src)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source of the target |
#lib.player.phone_number
Return the phone number of the character
lualocal phoneNumber = lib.player.phone_number(src)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source of the target |
#lib.player.gender
Return the gender of the character
lualocal gender = lib.player.gender(src)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source of the target |
#lib.player.checkOnline
Check if a player is online by their CitizenID
lualocal isOnline = lib.player.checkOnline(identifier)
| Parameter | Type | Required | Description |
|---|---|---|---|
| identifier | String | true | Identifier to be checked for |
#lib.player.jail
Send a player to jail
lualib.player.jail(trg, data)
| Parameter | Type | Required | Description |
|---|---|---|---|
| trg | Number | true | Source to be targeted |
| data | Object | true | Data to be used, for example time |
#lib.player.addMoney
Add money to a player
lualib.player.addMoney(src, acc, amount, reason)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source to be targeted |
| acc | String | true | Account to be deposited in |
| amount | Number | true | Amount to be moved |
| reason | String | true | Transaction reason |
#lib.player.removeMoney
Remove money to a player
lualib.player.removeMoney(src, acc, amount, reason)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source to be targeted |
| acc | String | true | Account to be removed |
| amount | Number | true | Amount to be moved |
| reason | String | true | Transaction reason |
#lib.player.addItem
Add item to a player
lualib.player.addItem(src, item, amount, md, slot)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source to be targeted |
| item | String | true | Item spawncode |
| amount | Number | true | Quantity |
| md | Object | false | Metadata for the item |
| slot | Number | false | Slot to be placed in, default is next available |
#lib.player.removeItem
Remove an item for a player
lualib.player.removeItem(src, item, amount, md, slot)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source to be targeted |
| item | String | true | Item spawncode |
| amount | Number | true | Quantity |
| md | Object | false | Metadata for the item |
| slot | Number | false | Slot to be placed in, default is next available |
#lib.player.editItem
Edit the metadata of an item
lualib.player.editItem(src, slot, new_data)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source to be targeted |
| slot | Number | true | Item slot to be targeted |
| new_data | Object | true | Data to be set |
#lib.player.getInventory
Returns the inventory of the player
lualocal inventory = lib.player.getInventory(src)
Example Return:
lua{ { name = "example", label = "Example Item", count = 10, info = { metadata = true, }, slot = 1 } }
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | Number | true | Source to be targeted |
#Additional Functions
#lib.player.deleteCharacter
Delete a character
lualib.player.deleteCharacter(src, citizenId)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | number | yes | Player source |
| citizenId | string | yes | Character identifier to delete |
#lib.player.loginCharacter
Log into a character
lualib.player.loginCharacter(src, citizenId, newData)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | number | yes | Player source |
| citizenId | string | yes | Character identifier |
| newData | table | no | Additional data for login |
#lib.player.logoutCharacter
Log out of the current character
lualib.player.logoutCharacter(src, citizenId)
#lib.player.createCharacter
Create a new character
lualib.player.createCharacter(src, data)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | number | yes | Player source |
| data | table | yes | Character creation data |
#lib.player.getCharacters
Get all characters for a player
lualocal characters = lib.player.getCharacters(src)
#lib.player.getSkin
Get a player's skin/appearance data
lualocal skin = lib.player.getSkin(src)
#lib.player.setJob
Set a player's job
lualib.player.setJob(src, job, rank)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | number | yes | Player source |
| job | string | yes | Job name |
| rank | number | yes | Job grade/rank |
#lib.player.getJob
Get a player's job data
lualocal job = lib.player.getJob(src)
#lib.player.getGang
Get a player's gang data
lualocal gang = lib.player.getGang(src)
#lib.player.setDuty
Set a player's duty status
lualib.player.setDuty(src, onDuty)
#lib.player.setMoney
Set a player's account balance directly
lualib.player.setMoney(src, account, amount)
#lib.player.getMoney
Get a player's balance for a specific account
lualocal amount = lib.player.getMoney(src, account)
#lib.player.setPlayerData
Set arbitrary player data
lualib.player.setPlayerData(src, key, data)
#lib.player.getPlayerData
Get player data, or a specific key
lualocal data = lib.player.getPlayerData(src, key)
#lib.player.setMetadata
Set player metadata
lualib.player.setMetadata(src, key, data)
#lib.player.getMetadata
Get player metadata
lualocal meta = lib.player.getMetadata(src, key)
#lib.player.hasLicense
Check if a player has a license
lualocal has = lib.player.hasLicense(src, license)
#lib.player.getLicenses
Get all player licenses
lualocal licenses = lib.player.getLicenses(src)
#lib.player.hasGroup
Check if a player belongs to a group
lualocal has = lib.player.hasGroup(src, group)
#lib.player.getIdentifierType
Get a specific identifier type for a player
lualocal id = lib.player.getIdentifierType(src, type)
| Parameter | Type | Required | Description |
|---|---|---|---|
| src | number | yes | Player source |
| type | string | yes | Identifier type (e.g. "license", "discord", "steam") |
