用户与角色函数¶
GetUser(aIndex)¶
返回指定玩家索引的 GameObject,未连接时返回 nil。使用内部缓存以提升性能。
local player = GetUser(aIndex)
if player then
LogAdd(LOG_BLUE, "Player: " .. player.Name .. " Level: " .. player.Level)
end
UserLogOut(aIndex)¶
对玩家发起优雅注销(5 秒倒计时)。
- 返回值:
boolean
UserDisconnect(aIndex, type)¶
立即断开玩家连接。
- 返回值:
boolean
UserLogOutByName(name)¶
通过角色名进行优雅注销。
- 返回值:
boolean
UserDisconnectByName(name, type)¶
通过角色名立即断开连接。
- 返回值:
boolean
UserKick(aIndex, reason)¶
断开玩家连接并可选附带通知消息。
- 返回值:
boolean
UserKickByName(name, reason)¶
通过角色名踢出玩家并可选附带原因。
- 返回值:
boolean
gObjAllLogOut()¶
对所有已连接玩家发起注销。
gObjAllDisconnect(type)¶
立即断开所有玩家连接。
UserCalcAttribute(aIndex)¶
重新计算玩家的所有属性(属性点、伤害、防御等)。
- 返回值:
boolean
UserInfoSend(aIndex)¶
重新计算属性并刷新玩家的视野(外观更新)。
- 返回值:
boolean
LevelUpSend(aIndex)¶
重新计算属性并向客户端发送升级通知。
- 返回值:
boolean
MasterLevelUpSend(aIndex)¶
重新计算属性并发送大师等级升级通知。
- 返回值:
boolean
player.MasterLevel = player.MasterLevel + 1
player.MasterPoint = player.MasterPoint + 1
MasterLevelUpSend(aIndex)
PKLevelSend(aIndex, pkLevel)¶
设置 PK 等级并向客户端发送外观更新。传入 -1 仅刷新。
- 返回值:
boolean
gObjDel(aIndex)¶
从服务器删除一个对象(用于怪物/NPC,不要用于玩家)。
- 返回值:
number
gObjAuthorityCodeSet(aIndex, code)¶
设置玩家的权限代码。
gObjAccountLevelExpireProc(lpObj)¶
处理 VIP/高级账号的等级过期。
gObjRebuildMasterSkillTree(lpObj)¶
为玩家重建大师技能树(修改大师技能后使用)。
CashShopAddPoint(aIndex, WC, WP, GP)¶
为玩家添加商城货币点数。
Help