es.getmaxplayercount() equivalent

Please post any questions about developing your plugin here. Please use the search function before posting!
Omega_K2
Senior Member
Posts: 227
Joined: Sat Jul 07, 2012 3:05 am
Location: Europe
Contact:

Looking for certain eventscripts equivalents for porting stuff

Postby Omega_K2 » Thu Dec 06, 2012 3:13 pm

es.getmaxplayercount() equivalent

Is there one?

maxClients variable doesn't seem to be exposed anyway to the python side of things.

--

A way to retrieve the player language or client variables (language is stored in cl_language, but in es you could just do es.createplaylist(userid)[userid]['language'])

--

es.stringtable('downloadables', ...) equivalnt


EDIT: Added more stuff I can't seem to find equivalents for
Libraries: k2tools
Plugins (any): GSRPG (soon) | Pretty Status List | MySQLAds (soon)
Plugins (game-specific): None atm

If you happen to find a bug or need help, either post in the release threads or contact me in IRC gamesurge.net:6667 / #sourcepython
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

Postby Tuck » Thu Dec 06, 2012 4:14 pm

Here you go (copied from addons\source-python\_libs\players\entity.py):


Syntax: Select all

GameEngine.GetClientConVarValue(self.info, 'cl_language')
-Tuck
User avatar
Spiked
Junior Member
Posts: 15
Joined: Mon Aug 27, 2012 8:00 pm
Location: Texas

Postby Spiked » Thu Dec 06, 2012 5:25 pm

yeah, getting player count doesn't seem to be available.

maxplayers: only responds in KV pairs inside config files (setter only)
sv_visiblemaxplayers: set to -1 by default
maxplayers_override: only exists as a command line param
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Thu Dec 06, 2012 5:50 pm

Hey guys,

The following should work:

Syntax: Select all

from Entity import Entities
from entities.helpers import index_from_edict

def get_max_players():
for edict in Entities('cs_team_manager'):
if edict.GetPropInt('CTeam.m_iTeamNum'):
continue
return index_from_edict(edict) - 1


L'In20Cible

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 8 guests