Playerlib.getPlayerList

From EventScripts Community Encyclopedia



Method: getPlayerList

Module: playerlib
Class: None
EventScripts version: 2.0.0.250a

Method Overview

Table of Contents

Contents


Description

Returns a list of playerlib.Player instances of users who fit the filters specified by filtername. If filtername is omitted a list of playerlib.Player instances for every connected user will be returned.

Arguments

  • filtername
    A comma-separated string value containing the following filter names or filters as created by playerlib.registerPlayerListFilter:
    • '#alive'
    • '#all'
    • '#bot'
    • '#ct'
      • Returns a list of playerlib.Player instances of all players that are on the Counter-Terrorist team.
    • '#dead'
    • '#human'
    • '#spec'
      • Returns a list of playerlib.Player instances of all players that are on the Specator team (players that are spectating).
    • '#t'
      • Returns a list of playerlib.Player instances of all players that are on the Terrorist team.
    • '#un'
      • Returns a list of playerlib.Player instances of all players that are on the Unassigned team (players that have not yet selected a team).


Examples

import es
import playerlib
 
# Creates a list of Player objects using a filter
myPlayerList = playerlib.getPlayerList('#ct,#alive')
# Go through the players, get some attributes and print them to the chat area
for ply in myPlayerList:
    es.msg(ply.weapon)
    # Now you can get their Userid from the filtered getPlayerList
    es.tell(ply.userid, 'You are a living CT!')

Notes

  • Default filters for playerlib.getPlayerList are the following: #alive, #all, #bot, #ct, #dead, #human, #spec, #t, #un
  • Custom filters can be added to playerlib.getPlayerList by using playerlib.registerPlayerListFilter.

See Also

blog comments powered by Disqus