More read functions of the Player table. General condition: the character is logged in (state LOGGED or higher); otherwise the function returns 0 / an empty string / false as described for each function. Most functions take only the aIndex parameter (integer, character index); functions with extra parameters list them explicitly.
PK
Player.GetPKCount
Returns the character's current number of player kills (PK points).
Player.GetPKCount(aIndex) -> integer
Parameter: aIndex. Returns: the PK count; 0 if invalid. Short name: GetObjectPKCount.
local pk = Player.GetPKCount(aIndex)
Player.GetPKLevel
Returns the PK level (hero / commoner / murderer status).
Player.GetPKLevel(aIndex) -> integer
Parameter: aIndex. Returns: the PK level; 0 if invalid. Short name: GetObjectPKLevel.
| Value | Meaning |
|---|---|
0 | Hero |
1 | Hero level 2 |
2 | Hero level 1 |
3 | Commoner |
4 | Murderer level 1 |
5 | Murderer level 2 |
6 | Murderer level 3 |
local lv = Player.GetPKLevel(aIndex)
Player.GetPKTimer
Returns the character's PK points / PK time counter (the PKPoints value in GameServer).
Player.GetPKTimer(aIndex) -> integer
Parameter: aIndex. Returns: the counter value; 0 if invalid. Short name: GetObjectPKTimer.
local t = Player.GetPKTimer(aIndex)
Player.GetPKTotalCount
Returns the statistic of the total number of times the character has killed other players.
Player.GetPKTotalCount(aIndex) -> integer
Parameter: aIndex. Returns: the total count; 0 if invalid.
local total = Player.GetPKTotalCount(aIndex)
Party and guild
Player.GetPartyNumber
Returns the character's party number.
Player.GetPartyNumber(aIndex) -> integer
Parameter: aIndex. Returns: the party number; -1 if not in a party. Short name: GetObjectPartyNumber.
local party = Player.GetPartyNumber(aIndex)
if party == -1 then return end
Player.GetGuildNumber
Returns the character's guild number.
Player.GetGuildNumber(aIndex) -> integer
Parameter: aIndex. Returns: the guild number; 0 if invalid or the character has no guild. Short name: GetObjectGuildNumber.
local g = Player.GetGuildNumber(aIndex)
Player.GetGuildStatus
Returns the character's rank in the guild.
Player.GetGuildStatus(aIndex) -> integer
Parameter: aIndex. Returns: 128 guild master, 64 assistant guild master, 32 battle master, 0 member, -1 no guild. Short name: GetObjectGuildStatus.
if Player.GetGuildStatus(aIndex) == 128 then Message.Send(aIndex, 1, "You are the guild master") end
Player.GetGuildName
Returns the name of the character's guild.
Player.GetGuildName(aIndex) -> string
Parameter: aIndex. Returns: the guild name; an empty string if there is no guild. Short name: GetObjectGuildName.
local gname = Player.GetGuildName(aIndex)
Player.GetGuildRelationship
Returns the guild relationship between two characters.
Player.GetGuildRelationship(aIndex, bIndex) -> integer
| Parameter | Type | Description |
|---|---|---|
aIndex | integer | Index of the first character |
bIndex | integer | Index of the second character |
Returns: the relationship code; 0 if either character is invalid. Short name: GetObjectGuildRelationship.
| Value | Meaning |
|---|---|
0 | No relationship (or one of them has no guild) |
1 | Same alliance |
2 | Hostile (a guild set as a rival, including when hostile to a guild in the other player's alliance) |
local rel = Player.GetGuildRelationship(aIndex, bIndex)
Player.GetGuildUnionNumber
Returns the alliance number of the character's guild.
Player.GetGuildUnionNumber(aIndex) -> integer
Parameter: aIndex. Returns: the alliance number; 0 if none. Short name: GetObjectGuildUnionNumber.
local union = Player.GetGuildUnionNumber(aIndex)
Player.GetGuildUnionName
Returns the name of the alliance master guild.
Player.GetGuildUnionName(aIndex) -> string
Parameter: aIndex. Returns: the name of the alliance master guild; an empty string if none. Short name: GetObjectGuildUnionName.
local un = Player.GetGuildUnionName(aIndex)
Player.GetCastleSiegeSide
Returns the side the character takes in the Castle Siege.
Player.GetCastleSiegeSide(aIndex) -> integer
Parameter: aIndex. Returns: the attacker / defender side code (see the table below); 0 if invalid or not participating. Short name: GetObjectCSGuildSide.
| Value | Meaning |
|---|---|
0 | Not participating |
1 | Defender side |
2, 3, 4 | Attacker sides (attacker 1, 2, 3) |
local side = Player.GetCastleSiegeSide(aIndex)
Gens
Player.GetGensRank
Returns the character's Gens ranking position.
Player.GetGensRank(aIndex) -> integer
Parameter: aIndex. Returns: the rank; 0 if invalid. Short name: GetObjectGensRank.
local r = Player.GetGensRank(aIndex)
Player.GetGensSymbol
Returns the character's Gens rank tier (symbol).
Player.GetGensSymbol(aIndex) -> integer
Parameter: aIndex. Returns: the Gens rank tier; 0 if invalid. Short name: GetObjectGensSymbol.
local s = Player.GetGensSymbol(aIndex)
Player.GetGensFamily
Returns the character's Gens family.
Player.GetGensFamily(aIndex) -> integer
Parameter: aIndex. Returns: 1 Duprian, 2 Vanert (the value stored by the server); 0 no family / invalid.
GetObjectGensFamily reverses the two families: it returns 1 for Vanert and 2 for Duprian. Use only one of them consistently within the same script to avoid mix-ups.if Player.GetGensFamily(aIndex) == 1 then Log.Add("Duprian") end
Player.GetGensContribution
Returns the Gens contribution points.
Player.GetGensContribution(aIndex) -> integer
Parameter: aIndex. Returns: the contribution points; 0 if invalid. Short name: GetObjectGensContribution.
local c = Player.GetGensContribution(aIndex)
GM authority
Player.GetAuthority
Returns the account's authority code.
Player.GetAuthority(aIndex) -> integer
Parameter: aIndex. Returns: the authority code; 0 if invalid. Short name: GetObjectAuthority.
local a = Player.GetAuthority(aIndex)
Player.IsGameMaster
Checks whether the character is a GM with authority switched on (the .auth command).
Player.IsGameMaster(aIndex) -> boolean
Parameter: aIndex. Returns: true if it is a GM with authority switched on; otherwise false. Short name: CommandCheckGameMasterLevel(aIndex, level) returns 1 / 0 and ignores the level parameter.
if not Player.IsGameMaster(aIndex) then return 0 end
Player.HasAdminFlag
Checks whether the GM has a specific permission flag.
Player.HasAdminFlag(aIndex, flag) -> boolean
| Parameter | Type | Description |
|---|---|---|
aIndex | integer | Character index |
flag | integer | Permission flag code (greater than 0) |
Returns: true if the character is a GM and has that flag; otherwise false.
Flags are additive bits stored in the character data (the character's permission-flag column in the game database). The value of each flag:
| Value | Flag | Value | Flag |
|---|---|---|---|
1 | PARTY | 2048 | TALK |
2 | TRADE | 4096 | MOVE |
4 | GLOBAL | 8192 | RELOAD |
8 | TRACE | 16384 | MONSTER |
16 | KICK | 32768 | ZEN |
32 | EVENTS | 65536 | GUILD_TALK |
64 | MUTE | 131072 | RESTRICTION |
128 | ITEM | 262144 | SHUTDOWN |
256 | ITEM_EVENT | 524288 | PANEL |
512 | BAN | 1048576 | BUFF |
1024 | POST | 2097152 | MASIVE |
The function checks using a bitwise AND with the flag value you pass in.
if Player.HasAdminFlag(aIndex, 1) then ... end
Account and machine
Player.GetIP
Returns the player's IP address.
Player.GetIP(aIndex) -> string
Parameter: aIndex. Returns: the IP string; an empty string if invalid. Short name: GetObjectIpAddress.
local ip = Player.GetIP(aIndex)
Player.GetMac
Returns the MAC address of the player's machine, as sent to the server by the account.
Player.GetMac(aIndex) -> string
Parameter: aIndex. Returns: the MAC string; an empty string if invalid. Short name: GetPlayerMac.
local mac = Player.GetMac(aIndex)
Player.GetDiskSerial
Returns the hard disk serial number of the player's machine.
Player.GetDiskSerial(aIndex) -> integer
Parameter: aIndex. Returns: the disk serial; 0 if invalid. Short name: GetPlayerSerial (returns a string).
local serial = Player.GetDiskSerial(aIndex)
Player.GetHardwareId
Returns the machine identifier, combined from the MAC and the hard disk serial in the form MAC-SERIAL (the serial is 8 hex digits).
Player.GetHardwareId(aIndex) -> string
Parameter: aIndex. Returns: the machine identifier string; an empty string if invalid. Short name: GetObjectHardwareId.
local hw = Player.GetHardwareId(aIndex)
Player.GetCodePage
Returns the code page stored for the account.
Player.GetCodePage(aIndex) -> integer
Parameter: aIndex. Returns: the code page number; 0 if invalid.
local cp = Player.GetCodePage(aIndex)
Player.IsOffline
Checks whether the character is in offline mode.
Player.IsOffline(aIndex) -> boolean
Parameter: aIndex. Returns: true if offline; otherwise false. Short name: GetObjectOfflineFlag (returns 1 / 0).
if Player.IsOffline(aIndex) then return end
Status
Player.GetInterface
Returns the code of the interface window the character currently has open (warehouse, trade, shop...).
Player.GetInterface(aIndex) -> string
Parameter: aIndex. Returns: the window code string; an empty string if invalid. Short name: GetObjectInterface.
When no window is open the function returns "interface_none". Other strings: interface_shop, interface_warehouse, interface_chaos_machine, interface_blood_castle_entrance, interface_devil_square_entrance, interface_party, interface_trade, interface_guild, interface_guild_request, interface_guild_alliance, interface_duel, interface_duel_gate, interface_pet_trainer, interface_quest_support_giver, interface_quest_evolution_giver, interface_mix_jewel, interface_cash_shop, interface_harmony_refine, interface_harmony_smelt, interface_harmony_restore, interface_lucky, interface_seed_creation, interface_seed_research, interface_chaos_card, interface_castle_siege_lever, interface_lord_mix, interface_land_of_trials_guard, interface_castle_guard, interface_castle_siege_machine, interface_personal_store_open, interface_illusion_temple_entrance, interface_guild_war_request, interface_arca_battle_lesnar, interface_arka_war_sign_register, interface_arka_war_exchange, interface_adniel, interface_mining, interface_chaos_castle_mait, interface_acheron_entrance, interface_cent_town, interface_cent_entrance, interface_eunice_town, interface_eunice_entrance, interface_moss_merchant, interface_mix_recovery.
local ui = Player.GetInterface(aIndex)
Player.GetDeathLocation
Returns where the character most recently died during the current login session.
Player.GetDeathLocation(aIndex) -> map, x, y | nil
Parameter: aIndex. Returns: 3 values map, x, y; nil if the character has not died even once in this login session. Short names: GetObjectDeathMap, GetObjectDeathMapX, GetObjectDeathMapY (return -1 if there is none).
local map, x, y = Player.GetDeathLocation(aIndex)
if map then Player.MoveTo(aIndex, map, x, y) end
Player.GetAccumulatedDamage
Returns the character's accumulated damage according to the GameServer counter.
Player.GetAccumulatedDamage(aIndex) -> number
Parameter: aIndex. Returns: the accumulated value; 0 if invalid.
This counter only increases when the player (or their Dark Spirit) attacks the statue / gate in the Castle Siege and does not have the Potion of Bless / Potion of Soul buff. Each time it exceeds 100, GameServer reduces the weapon durability during the siege and then resets the counter to 0; the counter also returns to 0 when the character data is reset (entering / leaving the game).
local dmg = Player.GetAccumulatedDamage(aIndex)
Player.GetTradeZen
Returns the amount of zen the character has put in the trade window.
Player.GetTradeZen(aIndex) -> integer
Parameter: aIndex. Returns: the zen in the trade; 0 if not trading or invalid.
local z = Player.GetTradeZen(aIndex)
Player.GetMuteTime
Returns the remaining seconds of the chat mute.
Player.GetMuteTime(aIndex) -> integer
Parameter: aIndex. Returns: the remaining seconds; 0 if not muted or invalid.
if Player.GetMuteTime(aIndex) > 0 then Message.Send(aIndex, 1, "You are muted") end
Player.IsActionBlocked
Checks whether an action of the character is currently blocked by Player.BlockAction.
Player.IsActionBlocked(aIndex, action) -> boolean
| Parameter | Type | Description |
|---|---|---|
aIndex | integer | Character index |
action | integer | Action code, an ACTION_* constant in System\Constants.lua (0 to 26) |
Returns: true if the action is blocked; false if it is not blocked or the parameters are wrong. Short name: PermissionCheck(aIndex, perm) (see Player.BlockAction).
if Player.IsActionBlocked(aIndex, ACTION_TRADE) then ... end