Skip to content

User & Character Functions

GetUser(aIndex)

Returns the GameObject for the given player index, or nil if not connected. Uses an internal cache for performance.

local player = GetUser(aIndex)
if player then
    LogAdd(LOG_BLUE, "Player: " .. player.Name .. " Level: " .. player.Level)
end

UserLogOut(aIndex)

Initiates a graceful logout (5-second countdown) for the player.

  • Returns: boolean
UserLogOut(aIndex)

UserDisconnect(aIndex, type)

Immediately disconnects the player.

  • Returns: boolean
UserDisconnect(aIndex, 0)

UserLogOutByName(name)

Graceful logout by character name.

  • Returns: boolean
UserLogOutByName("PlayerOne")

UserDisconnectByName(name, type)

Immediate disconnect by character name.

  • Returns: boolean
UserDisconnectByName("PlayerOne", 0)

UserKick(aIndex, reason)

Disconnects a player with an optional notice message.

  • Returns: boolean
UserKick(aIndex, "You have been kicked for AFK.")

UserKickByName(name, reason)

Kicks a player by name with an optional reason.

  • Returns: boolean
UserKickByName("BadPlayer", "Violating server rules.")

gObjAllLogOut()

Initiates logout for all connected players.

gObjAllLogOut()

gObjAllDisconnect(type)

Disconnects all players immediately.

gObjAllDisconnect(0)

UserCalcAttribute(aIndex)

Recalculates all attributes (stats, damage, defense, etc.) for the player.

  • Returns: boolean
UserCalcAttribute(aIndex)

UserInfoSend(aIndex)

Recalculates attributes and refreshes the player's viewport (appearance update).

  • Returns: boolean
player.Strength = player.Strength + 10
UserInfoSend(aIndex)

LevelUpSend(aIndex)

Recalculates attributes and sends a level-up notification to the client.

  • Returns: boolean
player.Level = player.Level + 1
player.LevelUpPoint = player.LevelUpPoint + 5
LevelUpSend(aIndex)

MasterLevelUpSend(aIndex)

Recalculates attributes and sends a Master Level-up notification.

  • Returns: boolean
player.MasterLevel = player.MasterLevel + 1
player.MasterPoint = player.MasterPoint + 1
MasterLevelUpSend(aIndex)

PKLevelSend(aIndex, pkLevel)

Sets the PK level and sends a visual update to the client. Pass -1 to just refresh.

  • Returns: boolean
PKLevelSend(aIndex, 3) -- Set PK level to 3 (Hero)

gObjDel(aIndex)

Deletes an object from the server (use for monsters/NPCs, not players).

  • Returns: number
gObjDel(monsterIndex)

gObjAuthorityCodeSet(aIndex, code)

Sets the authority/permission code for a player.

gObjAuthorityCodeSet(aIndex, 32) -- Set GM authority

gObjAccountLevelExpireProc(lpObj)

Processes account level expiration for VIP/premium accounts.

gObjAccountLevelExpireProc(player)

gObjRebuildMasterSkillTree(lpObj)

Rebuilds the Master Skill Tree for the player (use after modifying master skills).

gObjRebuildMasterSkillTree(player)

CashShopAddPoint(aIndex, WC, WP, GP)

Adds Cash Shop currency points to the player.

CashShopAddPoint(aIndex, 100, 0, 50) -- +100 WCoin, +50 GoblinPoints