Digital Paint Discussion Board
Paintball 2: The Game => Help and Support => Topic started by: Ace on November 08, 2014, 11:21:18 PM
-
What I am looking for is a script or something that tells the console to print out a message every so often. I know superman's servers do it, but I couldn't find anything on forums about it. If anyone has the script for this, let me know. I'd rather use one that works than write my own.
-
referring to this?
http://dplogin.com/forums/index.php?topic=26893.0
-
import socket
import time
host = "83.3.12.43" #your servers ip
port = 1111 #your servers port
rcon_password = "rcon_password" #your servers rcon password
command = "say" #command
interval = 7 #in minutes
messages = ['message 1', 'message 2'] #message list
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.connect((host, port))
i = 0
while True:
print("Sending..")
sock.send("\xFF\xFF\xFF\xFFrcon %s %s %s\0" % (rcon_password, command, messages[i%len(messages)]));
i=i+1
time.sleep(60*interval)
You must to have python2.7 installed on the computer you want to run it on.
Just save this code to a *.py file and run it.
-
I must be blind, thanks guys.
-
I must be blind, thanks guys.
Np, talk to me on IRC when you will have any problem :).
-
Now, with pypb2lib you can do it in an easier way.
On linux, simply clone the github repo (git clone https://github.com/hTmlDP/pyp2lib (https://github.com/hTmlDP/pyp2lib)
Thats an example python script
from pypb2lib import *
from time import sleep
s=Server(hostname='127.0.0.1', port=27910, rcon_password='1234')
while 1:
s.Say('{C}9visit {C}S{I}{U}http://htmldp.com') #{C} - color {I}- italic {U} -underline
sleep(120) # wait 120 seconds