2

TLDR: I want to be able to have terrorist.cfg and counterterrorist.cfg to change my keybinds (eg have F1 buy an AUG or an AK-47, but not an SG or an M4).

Here's my current plan. Step 1: Create a config file teambinds.cfg:

clear
say_team GLHF everyone!
condump
exec team.cfg

Step 2: In team.cfg, we loop:

wait
exec team.cfg

Step 3: Have a Python script watch for the file created by condump. That's its signal to go to work. It should find my "GLHF" message prefixed with either (Terrorist) or (Counter-Terrorist). That's how it knows which team I'm on. It then replaces team.cfg with either:

exec terrorist.cfg
condump

or

exec counterterrorist.cfg
condump

When the Python script sees the second condump, it cleans everything up and resets (deleting both condumps, replacing team.cfg with the loop).

Questions:

  • 1) Does this count as external assistance (will it get me VAC-banned)?
  • 2) Is there a way to trigger the initial execution?
  • 3) Surely surely SURELY there's a better way to figure out my team than say_team.... please?
  • 4) Can I just bypass this entire duct-tape-and-fencing-wire setup and actually have per-team configs?

2 Answers 2

2

Solution found. It still requires an external Python script, but much less weirdly so. The key here is a "game state integration", which is the same thing used by a custom HUD.

Step 1: Create a config file gamestate_integration_python.cfg:

"GameState Integration Configs"
{
    "uri"       "http://127.0.0.1:27014/"
    "timeout"   "5.0"
    "buffer"    "0.1"
    "throttle"  "0.5"
    "data"
    {
        "player_id"         "1"
    }
}

Step 2: Create a Python script (also in the csgo/cfg directory) which listens for incoming requests and updates the config files.

from flask import Flask, request
app = Flask(__name__)

@app.route("/", methods=["POST"])
def update_configs():
    if not request.json: return "", 400
    team = request.json.get("player", {}).get("team")
    with open("gsi_player_team.cfg", "w") as f:
        if team == "T":
            f.write("buy ak47")
        else:
            f.write("buy aug")
    return "" # Response doesn't matter

if __name__ == "__main__":
    app.run(host="127.0.0.1", port=27014)

Step 3: bind f1 "exec gsi_player_team"

Step 4: Make sure the Python script is always running when CS:GO is.

The game state integration is automatically triggered (many times, actually), and it's given the essential information. In fact, this can be used for many other customizations, too. As far as I can tell, this doesn't violate any rules, and shouldn't result in a VAC ban.

5
  • I would be really careful with this, having any script running in the background is always a potential for a VAC ban. All in all, this seems super complicated just to save 2 or 3 seconds at the start of the round. Making sure everything is working will take more time than just buying the right gun from the menu. Aug 29, 2018 at 18:03
  • "Having any script running"? How do you figure? You mean like... using the facilities that the gamestate integration specifically provides? Please be a bit more specific - it's 2018 and nobody is playing CS:GO on machines that aren't running at least one other program.
    – rosuav
    Aug 29, 2018 at 18:06
  • The GSI is read-only (just like logging on a server, which can be fetched by tools like hlsw), while you're manipulating game files using python scripts. You may or may not get banned for this and VAC will definitely check it out.
    – dly
    Aug 31, 2018 at 8:10
  • "Game files"? My own config files, which I'm allowed to edit anyway. Paranoia is all very well, but I'd like to see some evidence, or else a statement from Valve.
    – rosuav
    Aug 31, 2018 at 8:12
  • Good luck.. Valve never talks about VAC mechanics. They never did and never will. Might be paranoia, but having a Steam account from a few days after its release without any bans on it is worth more than some laziness about pressing one button too much ;)
    – dly
    Aug 31, 2018 at 8:17
2

You don't have to do it complicated like that.

If you want to purchase team-specific weapons using the same key for both teams you could just put both on it.

For example if you want to use F3 to buy either AK-47 or M4A1 and F4 to buy the AUG or SG depending on your team:

bind "F3" "buy ak47; buy m4a1"
bind "F4" "buy aug; buy sg556"

Pressing F3 on CT buys a M4 and on T it buys an AK-47 (and F4 for the AUG or SG).

This also works with other items available only to specific teams, like Molotov/Incendiary.

This way it is completely legal as you don't have to worry about external scripts.


Or if you really need that AUG and SG separated...

Use team based configs:

create two configs (soomething like t.cfg and ct.cfg) and put your buy scripts and other settings in there.

At the end of the t.cfg:

bind "F1" "exec ct.cfg"
echo "Terrorist Config loaded"

And vice versa the ct.cfg:

bind "F1" "exec t.cfg"
echo "Counter-Terrorist Config loaded"

You can as well replace or amend the echo with a neat sound:

play ui\now-playing-as-counter-terrorist
play ui\now-playing-as-terrorist

Now you can toggle them using F1 and don't have to worry about external scripts manipulating your game files. VAC will certainly have a look or two at your python script.

3
  • 1
    Actually, "buy ak47" will buy an M4 if you're on the CT side, and "buy aug" will buy an SG if you're on the T side. Try doing what I actually said in my post: something that will get an AUG or an AK-47, not just the items that are strict counterparts.
    – rosuav
    Aug 28, 2018 at 15:04
  • So.... I still have to manually choose which configs to use? I could have done that just by having separate binds for separate purchases. The point of this is to automate things, not to create a round-about way to still do things manually.
    – rosuav
    Aug 31, 2018 at 8:12
  • @rosuav Full automation is cheating. This just toggles the configs. And pressing F1 once or twice doesn't really hurt. Even using your script you have to press F1. My way is simple: press F1 if you're unsure and you see what's being loaded.. press F1 again, if it's the wrong team.
    – dly
    Aug 31, 2018 at 8:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .