eBot-CSGO icon indicating copy to clipboard operation
eBot-CSGO copied to clipboard

Add chat command

Open lexccdc opened this issue 3 years ago • 2 comments

Hey all!

Maybe, someone knows how to add a chat command for the eBot(i mean commands like: !pause, !ready, !unpause, etc)? I want to add timeout commands(timeout_ct_start and timeout_terrorist_start), but I don't know how. I think this may be useful not only for me. Please, help me if u can. Thank you

lexccdc avatar Sep 30 '21 11:09 lexccdc

Hello, If you want to code it, here is the explaination of how to do it.

You can add your command in Match.php like it is for "pause". You will have to differenciate CT and T pause.

https://github.com/deStrO/eBot-CSGO/blob/179db02043bfb1ee775c70c6f23d0553f0536332/src/eBot/Match/Match.php#L1337

umberd avatar Sep 30 '21 11:09 umberd

@vince52 Thank you for the fast answer! Do you mean add commands after the 1337 line?

I tried to do that

       ` }
    } elseif ($this->isCommand($message, "tac")) {
        if ($this->isMatchRound() && $this->isPaused && $this->enable) {
            if ($message->getUserTeam() == "CT") {
                $team = ($this->side['team_a'] == "ct") ? $this->teamAName : $this->teamBName;

                if (!$this->timeout_ct_start['ct']) {
                    $this->timeout_ct_start['ct'] = true;
                    $this->say($team . " (CT) wants to tactical pause, the match will be paused in the next freezetime.");
                }
            } elseif ($message->getUserTeam() == "TERRORIST") {
                $team = ($this->side['team_a'] == "t") ? $this->teamAName : $this->teamBName;

                if (!$this->timeout_terrorist_start['t']) {
                    $this->timeout_terrorist_start['t'] = true;
                    $this->say($team . " (T) wants to tactical pause, the match will be paused in the next freezetime.");
                }
            }
            $this->timeoutMatch();`

But it doesn't work

lexccdc avatar Sep 30 '21 12:09 lexccdc