Sign in to follow this  
Followers 0
Erik.

TCP, want to connect to game consule

22 posts in this topic

#1 ·  Posted (edited)

Hi,

i want to connect to a game server for Call of Duty 2

i hope someone know what i mean

in call of duty 1 and 2 you have a game consule

you can login into it and you type a command like map mp_toujane and the map toujane is loading

now do i want to make a remote control to see players ping and to warn them when it is to high

also do i want to control the server whit it so change map and map type

and also scan the game consule for dirty words so the get a warn from the consule

now do i want to make it whit autoit

you need to connect to the consule whit a password

in the game you do

/rcon login (password)

if tha password is right you can control the server when it's not you do not have acces

now do i hope that someone can help me whit it

i had told me that it's posible whit TCP so thats why you see it in my title

Greets Erik

Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello Erik.

The most important thing you need to know first is how this can be done. The answer is UDP.

To use the UDP-functions you need to have one of the latest beta-versions of AutoIt.

Then you need to know what to send to the server. I just tried "getstatus" and "rcon", and

they both seem to work perfectly well. You also need to know what kind of format the

server responds in.

To make it easier for you, you could just download my Quake3-UDFs here, and modify them

if you need to; however Q3ServerQuery and Q3AdminRcon should get you started pretty soon.

To use rcon-commands, for example for map-changing, try this :

_Q3AdminRcon("10.0.0.1", "mypass", "map efdm10", 28960)oÝ÷ Ù8b³¥­m«"r)ߢ¹¶*'iº.¶Ø^±êïz¶®¶­seõ56W'fW%VW'gV÷C³ãããgV÷C²ÂgV÷C¶vWG7FGW2gV÷C²Â#c

I've been thinking of updating the UDFs with lots of fixes, but I haven't got to it quite yet,

so if you got any bugs then just report it in my UDF-topic. Btw, I don't think you can get

the text from the chat.. something like that would require a server-mod.

Edited by Helge

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

thanks for posting

good

when you want to connect to the server you need the rcon pass rcon means remote control .....

now you need that pass and need to send it to the server

if you want to load a new map you need so send the command /rcon (for the remote control) map mp_toujane

map (that you want to load the map) mp_toujane (name of the map)

but i also want to receive the status you do it whit rcon status

that is only a example of all the functions you have.

i hope you can help me whit it

EDIT:

i am not so smart that i know what to do now

do you have a simple script that can login and that can send a command and receive one and looks if some words are in it?

Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ok, before I answer anything more (which I've probably already answered), I need to know

what you need this for. Because if you just want to change the map whenever a match is over

(for example) then this can be done with a config. Og forresten, om du er norsk så skriv på norsk :whistle:

Edited by Helge

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

it is only to control it not to change map after a match

for to kick players ect..

ban

dirty words

ect..

EDIT

i am loking for Q3ServerQuery

Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

it seems hardly then it was before:P

i have this and i know it's wrong but you can see what i am doing

Func _Q3AdminRcon()

    Local $sRespond = _Q3AdminRcon("195.114.20.27", "pass", "rcon map mp_toujane", 28961)
    If @error Then
        SetError(@error)
        Return ""
    EndIf
    
    If $sRespond = "ÿÿÿÿprint" & @LF & "Bad rconpassword." & @LF Then
        SetError(3)
        Return
    EndIf

Func _Q3ServerQuery()

    Local  _Q3ServerQuery("195.114.20.27", "rcon status" , 28961)
    
    If @error Then
        UDPCloseSocket ($aSocket)
        SetError(1)
        Return
    EndIf
    
    If UDPSend ($aSocket, "ÿÿÿÿ" & $sQuery) = 0 Then
        UDPCloseSocket ($aSocket)
        SetError(2)
        Return
    EndIf
    
    Do
        $sRecv = UDPRecv ($aSocket, 65507)
        $sRespond &= $sRecv
    Until $sRecv = ""
    
    UDPCloseSocket ($aSocket)
    Return $sRespond
EndFunc ;==>_Q3ServerQuery

i first want to try to connect and then let a message come so i know i am login

now you only need to login ones so when you start you need to login and then you don't when you close the program and open it again you need to connect

Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

Hi,

okey now i tried this:

UDPStartup()
$socket = UDPBind("195.114.20.27", 28961)
UDPOpen("195.114.20.27",28961)
UDPSend($socket,"rcon login 12345")
While 1
    $data = UDPRecv($socket, 50)
    If $data <> "" Then
        MsgBox(0, "UDP DATA", $data, 1)
    EndIf
    sleep(100)
WEnd
Func OnAutoItExit()
    UDPCloseSocket($socket)
    UDPShutdown()
EndFunc

i get a messagebox whit yyyydiconnected

does it works ore what?


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

This displays "invalid password", so if you change "password" to the actual

password, and "command" to an actual command, then things should start

to happen.

UDPStartup()
$socket = UDPBind("195.114.20.27", 28961)
UDPOpen("195.114.20.27",28961)
UDPSend($socket,"ÿÿÿÿrcon password command")
While 1
    $data = UDPRecv($socket, 50)
    If $data <> "" Then
        MsgBox(0, "UDP DATA", $data, 1)
    EndIf
    sleep(100)
WEnd
Func OnAutoItExit()
    UDPCloseSocket($socket)
    UDPShutdown()
EndFunc

Share this post


Link to post
Share on other sites

Hi,

Okej now that works

When it loads the new map uou get the message yyyyprint

now do i want to try to get the status


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Copy this script and save it in the same folder where you got my unmodified Quake3.au3 :

#include "Quake3.au3"

UDPStartup()
$status = _Q3ServerQuery("195.114.20.27", "getstatus", 28961)
$rcon = _Q3AdminRcon("195.114.20.27", "password", "map efdm10", 28961)

MsgBox(64, "status", $status)
MsgBox(64, "rcon", $rcon)

There are some issues with these UDFs that I need to look at, but until then you

have to play a little bit on your own..

Edited by Helge

Share this post


Link to post
Share on other sites

Thanks for that

is there a way to do it into 1 file not 2?


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

Thanks for that

is there a way to do it into 1 file not 2?

You're basically saying the solution in your question. Just remove "#include "Quake.au3"

from the top of your script and put everything in Quake3.au3 at the end of your script.

Share this post


Link to post
Share on other sites

Yes i know but it will be a bg script that i did not made so i do not know how it mades.

what i want to try is to get the server status and to get the consule what the players saying so i can scan fr dirty words and for ping


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

- "Yes i know.."

- "..i do not know"

Which one is it ?

- "what i want to try is to get the server status"

This is done with "getstatus", where the clients are listed in the end.

- "..scan fr dirty words"

For the third time... it's not possible to do that this way !

You have to get a server-mod and I can't help you with that !!

Try google.

- "..and for ping"

This is also done with "getstatus".

Share this post


Link to post
Share on other sites

lol

sorry

i try to do

i am not so good in english so i can not explain it very well


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

Hi,

i tried your quake 3 test program and it works very well.

i have one more question.

How can i set a max ping

when someone get over the ping then it gest a warning and after serveral times it get kicked

how can i do that?

i want to read the ping of the player and to get the player name whit the high ping to the warning say

!/playername\! To high ping!

like that

i do not know how to read the player ping and to get the player name


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

As I already said, this can be done in a much easier way, without AutoIt.

Just change "sv_maxping" in your config to the number you want to.

However, if you absolutely want to use AutoIt to do this, check out this :

#include "Quake3.au3"

$ip = "194.150.120.33" ; server-ip
$port = 28931 ; server-port
$maxping = 100 ; maximum allowed ping
$password = "mypass" ; rcon-password
$checkinterval = 60 * 1000; how often to check (default is 60 seconds)

UDPStartup ()

While 1
    $clients = _Q3ServerClients ($ip, $port)
    If @error Then
        MsgBox(16, "Failed", "Error : " & @error)
        Exit
    EndIf
    
    For $i = 1 To $clients[0][0]
        
        If $clients[$i][2] > $maxping Then
            MsgBox(64, "", "Client" & $i & " got " & $clients[$i][2] & " in ping !")
            
            ;$command = "say Your're ping is too high, " & _Q3StripColors($clients[$i][0], False)
            ;_Q3AdminRcon($ip, $password, $command, $port)
        EndIf
    Next
    
    Sleep($checkinterval)
WEnd

I'm waaay to kind ! :whistle:

Edited by Helge

Share this post


Link to post
Share on other sites

Hi,

Okey

i explain:

When you want to get into the server the maxping is 100 i know

but when your into the server and someone want's to cheat and want to use a lagg bind then he will get a warning

ore when i am downloading and i try many times i get into the server and when i am into the server i can get a ping of 400 so that why i want to...


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

Hi,

Okey

i explain:

When you want to get into the server the maxping is 100 i know

but when your into the server and someone want's to cheat and want to use a lagg bind then he will get a warning

ore when i am downloading and i try many times i get into the server and when i am into the server i can get a ping of 400 so that why i want to...

Was there a question there or did you just want to try and explain ?

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

i just want to explain you sorry.

Nic that works

i now try to make it so it say's the player name and then it send it to the server and at least:P

the problem is that when someone connects it also as a ping of 999 is there a solution for?

EDIT:

what is the function of $i is that the client number?

Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0