ValvePython / csgo

🔫 Python package for interacting with CS:GO Game Coordinator
http://csgo.readthedocs.io
124 stars 17 forks source link

Can we please have an example of using request_full_match_info without using classes? #59

Open Lok3rn3t opened 1 year ago

Lok3rn3t commented 1 year ago

Can we please have an example of using request_full_match_info without using classes?

Lok3rn3t commented 1 year ago

The working version, I figured out how it all works.

from steam.client import SteamClient
from csgo.client import CSGOClient
from csgo.enums import ECsgoGCMsg
from csgo import sharecode

client = SteamClient()
cs = CSGOClient(client)

def getSharecodeInfo(matchcode: str):
    info = sharecode.decode(matchcode)
    return info

@client.on('logged_on')
def start_csgo():
   cs.launch()

@cs.on('ready')
def gc_ready():
   print("[CS-GO] info: %s" % cs.ready)

   Sharecode = getSharecodeInfo("SHARE CODE THIS!!!!")

   cs.request_full_match_info(matchid=Sharecode['matchid'], outcomeid=Sharecode['outcomeid'], token=Sharecode['token'])

   response = cs.wait_event('full_match_info')

   print("[CS-GO] response: %s" % response)

client.cli_login(username="LOGIN STEAM ACCOUNT THIS!!!!", password="PASSWORD STEAM ACCOUNT THIS!!!!")
client.run_forever()
sadsergo commented 1 year ago

Thank you!!!