Sign in to follow this  
Followers 0
Mumms

TCP Help?

6 posts in this topic

So my program is an "Admin Bot" for Soldier of Fortune 2. When Players "report" another player while in game, It logs thier Id, and the reason they were reported. When a player has been reported 3 times, I want it to send an admin running the program a message saying that they are needed in the server, but have no clue how to do that.

My guess would be to use TCP but have to clue how to make it work, any help :unsure:

Func reportAdd()
$kill = IniRead("demo/MP/AdminBot/Reports.ini", "ID: " & $userName, $reason,0)
$kills = ($kill + 1)

$totalReport = IniRead("demo/MP/AdminBot/Reports.ini", "ID: " & $userName, "Total Reports ",0)
$totalReports = ($totalReport + 1)
IniWrite("demo/MP/AdminBot/Reports.ini", "ID: " & $userName, $reason, $kills)
IniWrite("demo/MP/AdminBot/Reports.ini", "ID: " & $userName, "Total Reports ", $totalReports)

If $totalReports = 3 Then
    _KickReportWarn()
Elseif $totalReports = 5 Then
    _KickReport()
Else
printReport()
EndIf
EndFunc

Func printReport()
    $s_FileName = _TempFile("demo/MP/", "vPlaybind", ".cfg")
    FileWrite("demo/MP/vPlaybind.cfg",'rcon "')
    FileWrite("demo/MP/vPlaybind.cfg","^3[^3AdminBot^3]^7: ID: ^3" & $userName & " ^7has been reported for: ^3" & $reason)
    FileWrite("demo/MP/vPlaybind.cfg",'"')
    Sleep(1755)
    Send("{Home}")
    FileDelete("demo/MP/vPlaybind.cfg")
EndFunc

Func _KickReportWarn()
    $s_FileName = _TempFile("demo/MP/", "vPlaybind", ".cfg")
    FileWrite("demo/MP/vPlaybind.cfg",'rcon "')
    FileWrite("demo/MP/vPlaybind.cfg","^3[^3AdminBot^3]^7: ID: ^3" & $userName & " ^7has been reported ^33 ^7or more times.")
    FileWrite("demo/MP/vPlaybind.cfg",'"')
    Sleep(1755)
    Send("{Home}")
    FileDelete("demo/MP/vPlaybind.cfg")
    _SendAdmin()
EndFunc


Func _SendAdmin()
    $s_FileName = _TempFile("demo/MP/", "vPlaybind", ".cfg")
    FileWrite("demo/MP/vPlaybind.cfg",'rcon "')
    FileWrite("demo/MP/vPlaybind.cfg","^3[^3AdminBot^3]^7: ID: ^3" & $userName & " ^7has been ^3Reported^7 to an Admin.")
    FileWrite("demo/MP/vPlaybind.cfg",'"')
    Sleep(1755)
        ;This is where i would add the TCP message or whatever I need to do.
    _GetStatus()
EndFunc

Share this post


Link to post
Share on other sites



Errr /... support for bots isn't really allowed ! :unsure:

Share this post


Link to post
Share on other sites

You must read this before !


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

But this isn't a game automation. For example if someone is constantly swearing in our server, I want to message an admin that there is someone doing it. Then the admin will go into the game and check it out. So the Bot is just reading logs and if something it sees is wrong it flags an admin. :> Thats it :unsure:

P.S - The name doesn't really mean its a bot. Basicly the program is for our admins. ITs annoying to sit and watch the server 24/7 when they have other shit they could be doing. This just messages them when they are needed.

Edited by Mumms

Share this post


Link to post
Share on other sites

I assume you're thinking of having some kind of client program the admins would run to connect and wait for messages?

It wouldn't have to be a very complex program if all it has to do is connect and wait for notifications, but you then would have to consider how to handle things server side if no admins are connected. Some kind of notice queue that gets dumped on the next admin to connect I imagine.

You'll need to check out the TCPListen() and TCPAccept() functions for server side. Also TCPConnect() and TCPRecv() for client side (at the least). Reviewing all of the TCP functions and their examples should really get you started.

Share this post


Link to post
Share on other sites

Thanks for the Help, I got it working using a Hamachi VPN.

Now is it possible to send color messages like through a GUI, and / or a Sound, if they have the file? :unsure:

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