|
-
Mar 19th, 2003, 08:49 AM
#1
Thread Starter
Addicted Member
How to send commands to Counter-Strike
I would like to know how to send text and commands to Counter-Strike. It could be good when checking the time and stuff like that.
What i want to know is:
How to send commands to CS, like echo "the time time_var"
and time_var would be changed each second from the app to the current time on the computer.
Is this possible?
-
Mar 19th, 2003, 11:15 AM
#2
Frenzied Member
it would be cool to be able to send to the program too...
if the program could sens if you press a button in cs and then send you the current time back!
-
Mar 19th, 2003, 11:26 AM
#3
Registered User
Commands to CStrike
HI,
I actually wrote a server program for Half-Life TFC, called TFCLauncher.
CStrike uses the same type of command structure.
How it works is that what you are writing to is text files, not to the program, and the program reads the text files.
Since the files are all text files, they are pretty easy to read and write to/from.
They are files like autoexec.cfg, server.cfg, mapcycle.txt, motd.txt (message of the day), listenserver.cfg, config.cfg, game.cfg.
You can run a dedicated server or a listenserver.
A listenserver is one that you are actually in the game and control it from in there using command lines.
A dedicated server is one where it is just a server running with a dos command window.
You can send commands to the dos command window, but I did not do that in my program, since you can just type in the commands in the server window.
with a dedicated server, you can join your own game on the same pc, which is kind of handy.. it can raise your ping level and increase lag on the server though...
After you set all the variables in these files the way you want, you then launch the game with the variables in a commmand line something like this:
VB Code:
Function runMapName(ByVal MapHere As String) As Boolean
Dim progdir As String
Dim portnum As String
Dim x As Integer
On Error Resume Next
progdir = MainForm.GamePath & "\hl.exe"
portnum = MainForm.port
GamePath = MainForm.GamePath
maxplay = MainForm.maxplayers
mapuse = MainForm.Combo1.Text
On Error Resume Next
ChDir GamePath
x = ShellExecute(0, "Open", progdir, " -game cstrike" & " -console" & " +sv_lan 0" & " +maxplayers " & maxplay & " +map " & mapuse, GamePath, SW_SHOW)
End Function
GamePath, SW_SHOW)
you then call the above function with something like this:
VB Code:
Call runMapName(MainForm.Combo1)
where combo1 on your form has the name of the map selected that you want to run.
I hope this helps.
you can look at my program at:
http://www.tfclauncher.com
kevin rea
Last edited by krea; Mar 19th, 2003 at 11:46 AM.
-
Mar 19th, 2003, 11:35 AM
#4
Thread Starter
Addicted Member
well, i my description is kinda wrong, becuase what i really want is to be able to do something like this:
In CS (when running): user types "current_time" in console
if they've done that, send command to my_app to show time in cs,
my_app sends command back to cs in console showing "The time is 00:00:00".
That's what i wanted.
-
Mar 19th, 2003, 11:39 AM
#5
Registered User
oh...
I see...well, i don't believe there is any way to do that.. you have to work within the product as it is written...do you have a full listing of available commands and stuff for cstrike ?
if not, that would be the place to start.
But as for having another program interacting with it, from the inside of cstrike out, i think would be pretty tough.
but, i am a still a newbie in vb programming, so i don't have all the answers... but i do know the half-life gaming structure pretty well.
-
Mar 19th, 2003, 11:46 AM
#6
Thread Starter
Addicted Member
Half-Life manager is able to retrieve commands from CS and control winamp, so that works, but im not sure if sending it back will work...
-
Mar 19th, 2003, 07:54 PM
#7
Fanatic Member
Krea, what commands do u send to WON.net to get the server list? I started writing a server browser for HL.. but after I connect to WON, I dont know what to send/recieve.
-
Mar 20th, 2003, 12:33 AM
#8
Addicted Member
AutH
I was trying to make this App that connects the WoN's Auth servers so people can check if there cd-key was invalid or in use. Got stuck though. I have to find out what form the pC sends the Info in.
Sonikku`- First Days of VB
[vbcode]
Dim Text1.Text as String
[/vbcode]
<Sonikku`> Whats wrong with this code, i keep getting an error about reserved keyword?
<od`Sinchro> LOL!
<Sonikku`> ?
-
Mar 20th, 2003, 01:50 AM
#9
Thread Starter
Addicted Member
Sending the command back is maybe not needed if i can get my hands on the server mod that allows a player to check the current time with thetime. some servers got this mod, and when someone says thetime, the server speaks the current time. so, if i get my hands on it, i will only need to know the command for sending from cs to my_app...
-
Mar 20th, 2003, 08:02 AM
#10
Thread Starter
Addicted Member
I discovered that HL manager is able to send back commands to CS. So it is possible somehow, just need to find out how...
-
Mar 20th, 2003, 11:22 AM
#11
Registered User
scr0p...
if i remember right, it's been awhile since i was programming this kind of thing, but i think that the command to get the server listing from WON was getsv
kevin rea
-
Mar 20th, 2003, 04:46 PM
#12
Fanatic Member
VB Code:
Private Sub Form_Load()
Winsock1.RemoteHost = "half-life.east.won.net"
Winsock1.RemotePort = 6003
Winsock1.Connect
End Sub
It connects, now I SendData "getsv" but after that I do not recieve anything bacK ;[]!
-
Mar 21st, 2003, 03:20 PM
#13
Addicted Member
my clan made exactly what your talkinga bout, [MxM] Cs script pack. try to find it online. It sends commands to the CS and you dont have to deal with any sticky code!
-
Mar 21st, 2003, 05:06 PM
#14
Thread Starter
Addicted Member
i'll try to search for it...
Edit: Can't find it, do you know their site?
Edit 2: What's the full name of your clan?
Last edited by vigge89; Mar 22nd, 2003 at 04:14 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|