Hey guys,
I'm trying SP for CSS with a little script, but I need to know how I can read the .ini files in the ./_libs/_data directory.
I wanna use the values for "t" and "ct" in ./_libs/_data/players/teams/cstrike.ini. How would I go about doing that?
Thank you
How to read the .ini files in ./_libs/_data ?
The only module, I believe, that uses that file, is the filters.players module. This is how it reads the data:[python]_game_teams = ConfigObj(
DATA_PATH.joinpath('players', 'teams', GAME_NAME + '.ini'), unrepr=True)[/python]Note that you will need to import ConfigObj, DATA_PATH, and GAME_NAME if you use this method.
Satoon
DATA_PATH.joinpath('players', 'teams', GAME_NAME + '.ini'), unrepr=True)[/python]Note that you will need to import ConfigObj, DATA_PATH, and GAME_NAME if you use this method.
Satoon
satoon101 wrote:The only module, I believe, that uses that file, is the filters.players module. This is how it reads the data:[python]_game_teams = ConfigObj(
DATA_PATH.joinpath('players', 'teams', GAME_NAME + '.ini'), unrepr=True)[/python]Note that you will need to import ConfigObj, DATA_PATH, and GAME_NAME if you use this method.
Satoon
Yeah, I already managed to do that. I thought there'd be some type of extra function/method for this
This will possibly get moved to another module at some point, but you can always use the PlayerTeams dictionary from filters.players to get player teams for the current game:
Satoon
Syntax: Select all
from filters.players import PlayerTeams
for team in PlayerTeams:
print(team + ': %s' % PlayerTeams[team].team)
Satoon
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 23 guests