logoHourGlass
Foreach.Player

Foreach.Player

Foreach.Player(PlayerFunction)

函數功能

對所有在線玩家執行指定函數(PlayerFunction)。

參數說明

  • PlayerFunction函數型 可執行的lua函數。

返回值

執行成功的次數。 -1爲參數錯誤。

語法

PlayerFunction(CharIndex)

參數說明

返回值

參考實例

-- 定義一個PlayerFunction
function MyForeachPlayer(CharIndex)
  print("MyForeachPlayer: "..CharIndex.." called"..Char.GetData(CharIndex, %對象_CDK%))
  return 0
end

Foreach.Player(MyForeachPlayer); -- 對在線玩家批量執行PlayerFunction