Author Topic: Server bot?  (Read 7155 times)

SuperMAn

  • Committee Member
  • Autococker
  • Posts: 902
Server bot?
« on: May 16, 2009, 08:52:07 AM »
Anyone know how to set up a script to occasionally print a message to a server?  I remember qehs beginner pub had this.

m7feettall

  • Autococker
  • Posts: 818
Re: Server bot?
« Reply #1 on: May 16, 2009, 08:57:03 AM »
Joezam has that too.


KnacK

  • Global Moderator
  • Autococker
  • Posts: 3039
Re: Server bot?
« Reply #2 on: May 16, 2009, 08:59:02 AM »
talk to sk89q

but I believed he used modified server code to do it.

SuperMAn

  • Committee Member
  • Autococker
  • Posts: 902
Re: Server bot?
« Reply #3 on: May 16, 2009, 09:02:16 AM »
talk to sk89q
I sent him a pm a while ago about this.  He said he didn't have anything.

magalhaes

  • Autococker
  • Posts: 1256
Re: Server bot?
« Reply #4 on: May 16, 2009, 10:40:30 AM »
Talk to Lekky then.

T3RR0R15T

  • Map Committee
  • Autococker
  • Posts: 2593
Re: Server bot?
« Reply #5 on: May 16, 2009, 11:26:42 AM »
The qehs bot was irc based, the bot from joezam's pub is an php file, which sends a message to the server (triggered every 30 minutes by a cron).

SuperMAn

  • Committee Member
  • Autococker
  • Posts: 902
Re: Server bot?
« Reply #6 on: May 16, 2009, 01:51:57 PM »
Talk to Lekky then.
I havn't seen lekky in ages.

The qehs bot was irc based, the bot from joezam's pub is an php file, which sends a message to the server (triggered every 30 minutes by a cron).

Do you know how to make one? =s

T3RR0R15T

  • Map Committee
  • Autococker
  • Posts: 2593
Re: Server bot?
« Reply #7 on: May 16, 2009, 02:05:44 PM »
Vague has made it for joezam's pub, so i asked him.

I started it for the speed server (mapvoting info every 10 minutes), if u want see it.

I ask him, if i can give it to you.

magalhaes

  • Autococker
  • Posts: 1256
Re: Server bot?
« Reply #8 on: May 16, 2009, 03:37:52 PM »
I havn't seen lekky in ages.

He comes to the forums like once per every two weeks. PM him.

T3RR0R15T

  • Map Committee
  • Autococker
  • Posts: 2593
Re: Server bot?
« Reply #9 on: May 17, 2009, 12:25:05 PM »
Ok, here is the file for the servermessage:

SuperMAn

  • Committee Member
  • Autococker
  • Posts: 902
Re: Server bot?
« Reply #10 on: May 17, 2009, 06:12:55 PM »
Thank you very much.  I'll try it out right now.

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: Server bot?
« Reply #11 on: May 18, 2009, 01:45:33 PM »
At minimum, the code is:
Code: [Select]
#!/usr/bin/env php
<?php
$host 
"127.0.0.1";
$port 27910;
$rcon_password "hackme";
$message "Cheeeese";
$interval 5// 5 min

$sock fsockopen("udp://$host:$port"$port$errno$errstr5);

while (
true) {
    echo 
"Sent\n";
    
fwrite($socksprintf("\xFF\xFF\xFF\xFFrcon %s say %s\0"$rcon_password$message);
    
sleep(60 $interval);
}
Just keep it running on a system.

In Python:
Code: [Select]
#!/usr/bin/env python
import socket
import time

host = "127.0.0.1"
port = 27910
rcon_password = "hackme"
message = "Cheeeese"
interval = 5 # 5 min

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.connect((host, port))

while True:
    print("Sent")
    sock.send("\xFF\xFF\xFF\xFFrcon %s say %s\0" % (rcon_password, message));
    time.sleep(60 * interval)

I'm not sure why I didn't just write it at the time.

T3RR0R15T

  • Map Committee
  • Autococker
  • Posts: 2593
Re: Server bot?
« Reply #12 on: May 18, 2009, 02:29:13 PM »
Thanks, but which one is better? php or python? is python faster?

XtremeBain

  • Developer
  • Autococker
  • Posts: 1470
Re: Server bot?
« Reply #13 on: May 18, 2009, 03:36:18 PM »
Both will work equally as good, there's no point arguing over which one is faster.  The bigger problem is that Superman's servers are Windows....

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: Server bot?
« Reply #14 on: May 18, 2009, 06:41:48 PM »
Just install either Python or PHP? Not like I just wrote shell or something.

vague312

  • VM-68
  • Posts: 217
Re: Server bot?
« Reply #15 on: May 18, 2009, 09:26:47 PM »
mine is simply uploaded to a webhost with a cron job to running the script every 30 minutes. Since its an external script it will send the commands/messages regardless of the OS.

SuperMAn

  • Committee Member
  • Autococker
  • Posts: 902
Re: Server bot?
« Reply #16 on: May 19, 2009, 12:33:59 PM »
Got it working.  The problem wasn't that its running on windows.  Its that i dont have access to the entire server.  Only the paintball2 directory, which is fine.  Once I got a hold of the people that host it they got it working within seconds.  Thanks alot for the script


check out your server stats here :
http://www.gametracker.com/server_info/76.74.139.4:27910/
=)

monishakoirala

  • PGP
  • Posts: 3
Re: Server bot?
« Reply #17 on: June 10, 2009, 02:16:37 PM »
if this is a server bot why would it be in snippets when you should put it in Bots but like Daemon is saying i dunno how to add people to access these commands wat if a new bie came in and grab the code and didn't know how to use it

tartjagger

  • Stingray
  • Posts: 65
Re: Server bot?
« Reply #18 on: July 06, 2009, 07:31:00 AM »
In Python........

Thanks for that, I modified it to run from a Cron job and it works well.

FluKe

  • 68 Carbine
  • Posts: 477
Re: Server bot?
« Reply #19 on: July 06, 2009, 07:59:40 AM »
What about a script like XBain has I been looking for one like that does anyone have one that works good?