User Tools

Site Tools


script:world_event:getplayertotal

getPlayerTotal


  • 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
  • The main function of this method: Get the total number of players
  • The specific use cases are as follows:
--Get the total number of players in the current archive
local result,num=World:getPlayerTotal(-1)
Chat:sendSystemMsg("The total number of players in the current archive is:"..num)
--Get the number of players who died in the current archive
result,num=World:getPlayerTotal(0)
Chat:sendSystemMsg("The number of players who died in the current archive is:"..num)
--Get the number of players who are alive in the current archive
result,num=World:getPlayerTotal(1)
Chat:sendSystemMsg("The number of players who are alive in the current archive is:"..num)
script/world_event/getplayertotal.txt · Last modified: 2024/06/04 04:13 by don