Results 1 to 14 of 14

Thread: How to send commands to Counter-Strike

  1. #1

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172

    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?


  2. #2
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755
    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!
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

  3. #3
    Registered User
    Join Date
    Jun 1999
    Location
    palmdale, ca. USA
    Posts
    150

    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:
    1. Function runMapName(ByVal MapHere As String) As Boolean
    2.     Dim progdir As String
    3.     Dim portnum As String
    4.     Dim x As Integer
    5.     On Error Resume Next
    6.     progdir = MainForm.GamePath & "\hl.exe"
    7.     portnum = MainForm.port
    8.     GamePath = MainForm.GamePath
    9.     maxplay = MainForm.maxplayers
    10.     mapuse = MainForm.Combo1.Text
    11.        
    12.   On Error Resume Next
    13.     ChDir GamePath
    14. x = ShellExecute(0, "Open", progdir, " -game cstrike" & " -console" & " +sv_lan 0" & " +maxplayers " & maxplay & " +map " & mapuse, GamePath, SW_SHOW)
    15.        
    16. End Function
    17. GamePath, SW_SHOW)

    you then call the above function with something like this:
    VB Code:
    1. 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.

  4. #4

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    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.


  5. #5
    Registered User
    Join Date
    Jun 1999
    Location
    palmdale, ca. USA
    Posts
    150

    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.

  6. #6

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    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...


  7. #7
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    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.
    asdf

  8. #8
    Addicted Member Sonikku`'s Avatar
    Join Date
    Oct 2002
    Location
    NyC~
    Posts
    165

    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`> ?

  9. #9

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    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...


  10. #10

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    I discovered that HL manager is able to send back commands to CS. So it is possible somehow, just need to find out how...


  11. #11
    Registered User
    Join Date
    Jun 1999
    Location
    palmdale, ca. USA
    Posts
    150

    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

  12. #12
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    VB Code:
    1. Private Sub Form_Load()
    2.     Winsock1.RemoteHost = "half-life.east.won.net"
    3.     Winsock1.RemotePort = 6003
    4.     Winsock1.Connect
    5. End Sub
    It connects, now I SendData "getsv" but after that I do not recieve anything bacK ;[]!
    asdf

  13. #13
    Addicted Member Illiad's Avatar
    Join Date
    Mar 2003
    Location
    Chicago
    Posts
    196
    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!

  14. #14

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    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
  •  



Click Here to Expand Forum to Full Width