script:world_event:getallplayers
getAllPlayers
- Parameters and types:
- alive: numberplayer status (0 means dead, 1 means alive, default -1 means all players)
- Return value and type:
- code: numberSuccess (ErrorCode.OK) ErrorCode
- num: numberGet the number
- list: tableobject objid group
- The main function of this method: Get all players
- The specific use cases are as follows:
--Get the list of all players in the current archive
--Parameters: -1 all players 0 dead players 1 alive players
local result,num,array=World:getAllPlayers(-1)
--Display the number in the chat box
Chat:sendSystemMsg("There are a total of "..num.." players in the current archive")
--Display the list in the chat box
for i,a in ipairs(array) do
Chat:sendSystemMsg("The first "..i..": "..a)
end
script/world_event/getallplayers.txt · Last modified: 2024/06/04 04:16 by don