This is the way of getting the Core API Functions (Server Side)
local TPZ = exports.tpz_core:getCoreAPI()
Get Player Object
This is the following example of how to get the Player Object for using all the following functions.
local xPlayer = TPZ.GetPlayer(source)
Player Functions
Loaded Player
local hasPlayerLoaded = xPlayer.loaded()
Get Player Identifier
local identifier = xPlayer.getIdentifier()
Get Player Character Identifier
local charIdentifier = xPlayer.getCharacterIdentifier()
Get Player Gender
local gender = xPlayer.getGender()
Get Player Dob
local dob = xPlayer.getDob()
Set Player Dob
-- @param day (string / integer) : the required day.
-- @param month(string / integer) : the required month.
-- @param year(string / integer) : the required year.
xPlayer.setDob(day, month, year)
Get Player Group
local group = xPlayer.getGroup()
Set Player Group
-- @param source (integer): the required online player source id.
-- @param group (string): the required group to be applied to the player source.
xPlayer.setGroup(group)
Get Player First name
local firstname = xPlayer.getFirstName()
Set Player First name
-- @param source (integer): the required online player source id.
-- @param firstname (string): the required firstname to change the player source firstname into.
xPlayer.setFirstName(firstname)
Get Player Last name
-- @lastname returns the character lastname.
local lastname = xPlayer.getLastName()
Set Player Last name
-- @param source (integer): the required online player source id.
-- @param lastname (string): the required lastname to change the player source lastname into.
xPlayer.setLastName(lastname)
Get Player Job
local job = xPlayer.getJob()
Set Player Job
-- @param job (string): the required job name to change & update on the player source.
xPlayer.setJob(job)
Get Player Job Grade
-- @jobGrade returns the current player job grade.
local jobGrade = xPlayer.getJobGrade()
Set Player Job Grade
-- @param grade (integer): the required job grade to change & update on the player source.
xPlayer.setJobGrade(grade)
-- @param account (integer):
-- @account 0 : dollars
-- @account 1 : gold
-- @account 2 : black money
-- @param quantity (integer): the input quantity to deposit into the selected account.
xPlayer.addAccount(account, quantity)
Remove Player Account (0-3 Available)
-- @param account (integer):
-- @account 0 : dollars
-- @account 1 : gold
-- @account 2 : black money
-- @param quantity (integer): the input quantity to remove from the selected account.
xPlayer.removeAccount(account, quantity)
Get Player Identity Id
-- returns the identity id of the player.
local identityId = xPlayer.getIdentityId()
Change Player Identity Id (To change automatically the identity id by the system). Nobody should be able to generate an ID manually, it can be the same as other characters without knowledge.
xPlayer.changeIdentityId()
Get Player Outfit Comps
local skinComp = xPlayer.getOutfitComponents()
Get Player Last Saved Location
local lastLocation = xPlayer.getLastSavedLocation()
Save Player Current Location
-- @param coords (table): the required coords for the player source to teleport to in a table form.
-- @param heading (integer): a non-required parameter for teleporting properly the player source with the correct face heading.
xPlayer.saveLocation(coords, heading)
Player Teleport Target Coords
-- @param coords (table): the required coords for the player source to teleport to in a table form.
xPlayer.teleportToCoords(coords)
Player Teleport Target Source
-- @param targetSource (integer): the required online player target source id to teleport into.
xPlayer.teleportTo(targetSource)
Player Bring (Tphere) Target Source
-- @param targetSource (integer): the required online player target source id to bring (tphere) to our player source location.
xPlayer.bring(targetSource)
Has Player Administrator Permissions (Boolean)
-- @param groups (table): the required groups in a table form: { 'admin', 'mod' } , if no groups, set it to {}
-- @param discordRoles (table): the requires discord roles in a table form: { 111111111111, 222222222222 } , if no discord roles, set it to {}
local hasPermissions = xPlayer.hasAdministratorPermissions(groups, discordRoles)