魔力宝贝

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz

[Foreach] Player

[复制链接]
发表于 前天 20:29 | 显示全部楼层 |阅读模式

Player
Foreach.Player(PlayerFunction)
函数功能
对所有在线玩家执行指定函数(PlayerFunction)。

参数说明
PlayerFunction: 函数型 可执行的lua函数。
返回值
执行成功的次数。 -1为参数错误。

PlayerFunction(CharIndex)
参数说明
CharIndex: 数值型 玩家对象Index。
返回值


参考实例
-- 定义一个PlayerFunction
function MyForeachPlayer(CharIndex)
  print("MyForeachPlayer: "..CharIndex.." called"..Char.GetData(CharIndex, %對象_CDK%))
  return 0
end

Foreach.Player(MyForeachPlayer); -- 对在线玩家批量执行PlayerFunction
回复

使用道具 举报

Archiver|魔力研究社

GMT+8, 2025-5-12 19:12 , Processed in 0.092337 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表