Click here to Skip to main content
Licence GPL3
First Posted 29 Oct 2008
Views 27,476
Downloads 295
Bookmarked 8 times

Send RCON command to Counter Strike

By | 29 Oct 2008 | Article
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. :)

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

About the Author

Waqas Badar

Software Developer (Senior)
EBusiness
Pakistan Pakistan

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalcod4 Adjustment PinmemberSteve Moorhouse4:59 21 May '10  
GeneralRe: cod4 Adjustment PinmemberWaqas Badar3:20 1 Jun '10  
GeneralMy vote of 2 PinmemberFred Blom10:26 29 Jun '09  
GeneralRe: My vote of 2 [modified] PinmemberWaqas Badar19:56 29 Jun '09  
GeneralDoesn't work PinmemberKbCb11:14 2 Jun '09  
GeneralRe: Doesn't work PinmemberWaqas Badar20:22 2 Jun '09  
GeneralRe: Doesn't work PinmemberKbCb5:38 3 Jun '09  
GeneralRe: Doesn't work PinmemberWaqas Badar21:18 3 Jun '09  
GeneralRe: Doesn't work PinmemberKbCb3:27 4 Jun '09  
GeneralCSSource Pinmemberhyposnike19:28 4 Dec '08  
GeneralGood Concept Pinmembersinklink4:12 29 Oct '08  
GeneralRe: Good Concept PinmemberWaqas Badar19:57 29 Oct '08  

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.

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