3

Context: I want to run a certain set of commands every round without binding them to a key and then pressing the key every round so that they would apply to the next round, e.g. I'll do bind "p" "[command 1]; [command 2]; [exec [file containing more commands].cfg]" and the press p every round.

  • Most of the commands I want to run apply at the beginning of the next round and last only for that round. So, if I forget, then I have to restart the entire game since, to my knowledge, there's no round version for mp_restartgame.

    • While I've seen round restarts happen a lot in CSGO professional games, I don't believe those are by a simple command or two.

I've found a thread on AlliedMods [CSGO] plugin that run specified commands at round end, where there is a PHP code to automatically run commands at the end (start) of a round that are given in a file called round_end.cfg (round_start.cfg).

Question: How do I run this PHP code?

I have tried putting this is in a cfg file which I run, but the round_start.cfg and the round_end.cfg don't seem do the trick. Forgetting for now any issues as to the correctness of the code, my question is about running PHP codes in general. Do I just put them in a cfg file which I would run? Or do I have to create or edit a BSP file using Hammer or Entspy or something?

4

Short answer:
You can't.

Long answer:

That's not PHP code. The forum there just says so, because they used a [code] tag for it and it doesn't know the code they put in there. It doesn't translate the language they put in so it will always say PHP.

It is basically like the code block we have here, just without saying "PHP" in the title:

public OnPluginStart()
{
    HookEvent("round_start", RoundStart, EventHookMode_Post)
    HookEvent("round_end", RoundEnd, EventHookMode_Post)
}

public Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    ServerCommand("exec round_start.cfg");
}

public Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    ServerCommand("exec round_end.cfg");
}  

CSGO plugins are server side. In this case you've found a thread for a SourceMod plugin. You can not run a plugin like that as a player. You could only use them if the server runs them and provides usable commands (most notably voting commands, kick/ban for moderators, etc).

| improve this answer | |
  • Thanks! Including playing with bots only? – Mitjackson May 21 '19 at 9:32
0

You're looking at a forum that's primarily about server-side modding. That gives you a LOT of power to reconfigure things, but it's a bit of work to set up. It sounds to me like you might benefit from doing it, though.

Look into running a CS:GO Dedicated Server. If you just want to play on your own (with bots), or on a local network, it isn't too hard; there's a bit of extra hassle if you want to open it up to the internet, but for LAN usage, you can basically just download the server software, plop it on the same computer you're gaming on, fire it up, and have fun.

To be able to run mods like that, you'll need MetaMod and SourceMod, so that'd be the next things to look into. Again, not hugely difficult, but it has some initial setup work. The reward is a hugely flexible server (and endless fun messing around with game settings!).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.