TransWikia.com

How are PHP codes supposed to be run in CSGO console?

Arqade Asked by Mitjackson on July 27, 2021

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?

2 Answers

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).

Answered by dly on July 27, 2021

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!).

Answered by rosuav on July 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP