Click here to Skip to main content
11,708,116 members (77,602 online)
Click here to Skip to main content

Send RCON command to Counter Strike

, 29 Oct 2008 GPL3 39.5K 888 8
Rate this:
Please Sign up or sign in to vote.
In this article, I will explain how to send RCON commands to Counter Strike 1.6

Introduction

I have written an article which explains how to send commands to mohaa game server. In this article, I will explain how to send RCON command to Counter Strike 1.6 server.

Command Format

RCON commands sent to the game server should follow the following format:

0xFF0xFF0xFF0xFF0xFFCommand

The first five characters should be 0xFF and after that command which should be in byte array.

Process of Sending Command

First send challenge rcon command to server. In response, the server will give you a string which will contain a number. That number will be used to send the original command. I am calling that number as challenge code. I try to find what that number is originally called, but I am unable to find it. If anybody knows the name of that number, then please let me know. Smile | :)

After that, we send the command in the following format:

rcon "challengeCode" password command 

So, for example, I want to send status command and my challenge code is 123456789 and my password is 123456, then the format will be as follows:

rcon "123456789" 123456 status 

Using the Code

I am not a professional C# coder. So, I think most of C# community will curse me for writing such a class. Smile | :) But I hope it will save a lot of time for someone.

I have made a class CSRcon. In this class, I have added a method with the name of sendRCON. Its signature is as follows:

public string sendRCON(string serverIp, int serverPort, 
	string rconPassword, string rconCommand)	

Here, serverIp is game server IP, server port is game server port, rconPassword is the password of rcon and rconCommand is the command of rcon.

Tested Games

I test the code on Counter Strike 1.6. Since Counter Strike uses Half Life, I think it should work on other games which are based on Half Life.

I am unable to test that code on Counter Strike source. But I think it may work on that as well. If somebody tests that code on Counter Strike source, then please let me know by adding comments to this article. I will be very thankful to that person.

History

  • 29th October, 2008: Initial post

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

Waqas Badar
Software Developer (Senior) EBusiness
Pakistan Pakistan
No Biography provided

You may also be interested in...

Comments and Discussions

 
Generalcod4 Adjustment Pin
Steve Moorhouse21-May-10 4:59
memberSteve Moorhouse21-May-10 4:59 
GeneralRe: cod4 Adjustment Pin
Waqas Badar1-Jun-10 3:20
memberWaqas Badar1-Jun-10 3:20 
GeneralMy vote of 2 Pin
Fred Blom29-Jun-09 10:26
memberFred Blom29-Jun-09 10:26 
GeneralRe: My vote of 2 [modified] Pin
Waqas Badar29-Jun-09 19:56
memberWaqas Badar29-Jun-09 19:56 
GeneralDoesn't work Pin
KbCb2-Jun-09 11:14
memberKbCb2-Jun-09 11:14 
GeneralRe: Doesn't work Pin
Waqas Badar2-Jun-09 20:22
memberWaqas Badar2-Jun-09 20:22 
GeneralRe: Doesn't work Pin
KbCb3-Jun-09 5:38
memberKbCb3-Jun-09 5:38 
GeneralRe: Doesn't work Pin
Waqas Badar3-Jun-09 21:18
memberWaqas Badar3-Jun-09 21:18 
GeneralRe: Doesn't work Pin
KbCb4-Jun-09 3:27
memberKbCb4-Jun-09 3:27 
GeneralCSSource Pin
hyposnike4-Dec-08 19:28
memberhyposnike4-Dec-08 19:28 
GeneralGood Concept Pin
sinklink29-Oct-08 4:12
membersinklink29-Oct-08 4:12 
GeneralRe: Good Concept Pin
Waqas Badar29-Oct-08 19:57
memberWaqas Badar29-Oct-08 19:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150819.1 | Last Updated 29 Oct 2008
Article Copyright 2008 by Waqas Badar
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid