Digital Paint Discussion Board
Paintball 2: The Game => Server Discussion => Topic started by: SuperMAn 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.
-
Joezam has that too.
-
talk to sk89q
but I believed he used modified server code to do it.
-
talk to sk89q
I sent him a pm a while ago about this. He said he didn't have anything.
-
Talk to Lekky then.
-
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).
-
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
-
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.
-
I havn't seen lekky in ages.
He comes to the forums like once per every two weeks. PM him.
-
Ok, here is the file for the servermessage:
-
Thank you very much. I'll try it out right now.
-
At minimum, the code is:
#!/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, $errstr, 5);
while (true) {
echo "Sent\n";
fwrite($sock, sprintf("\xFF\xFF\xFF\xFFrcon %s say %s\0", $rcon_password, $message);
sleep(60 * $interval);
}
Just keep it running on a system.
In Python:
#!/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.
-
Thanks, but which one is better? php or python? is python faster?
-
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....
-
Just install either Python or PHP? Not like I just wrote shell or something.
-
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.
-
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/
=)
-
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
-
In Python........
Thanks for that, I modified it to run from a Cron job and it works well.
-
What about a script like XBain has I been looking for one like that does anyone have one that works good?
-
i dunno how i have to put the script or message in my server , cansomeone help?
-
Be More Specific. And it would help to start you're own thread rather than reviving an old one.
-
Be More Specific. And it would help to start you're own thread rather than reviving an old one.
No, better to stay in this thread rather than merging stuff that is based on the same topic... You ARE allowed to revive old threads.
-
Do u mean add both in the server, if so then the command is "addbot"
-
i dunno how i have to put the script or message in my server , cansomeone help?
Read sk89qs post on the first page.
There is a php version and a python version. So you have to have either php or python installed on the computer that is running the script.
-
and again :O
tho I'm not an expert in pc and php stuff ... i just want to know how to put or set this in my server,
Do i need to copy it in my server window (when started)?
-
and again :D
There is a php version and a python version. So you have to have either php or pythonl installed on the computer that is running the script.