Digital Paint Discussion Board

Paintball 2: The Game => Help and Support => Topic started by: Ace on November 08, 2014, 11:21:18 PM

Title: "r_con [password] say" help
Post 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.
Title: Re: "r_con [password] say" help
Post by: gotmtdew on November 09, 2014, 01:50:34 AM
referring to this?

http://dplogin.com/forums/index.php?topic=26893.0
Title: Re: "r_con [password] say" help
Post by: mRokita on November 09, 2014, 04:13:17 AM
Code: [Select]
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.
Title: Re: "r_con [password] say" help
Post by: Ace on November 09, 2014, 12:50:32 PM
I must be blind, thanks guys.
Title: Re: "r_con [password] say" help
Post by: mRokita on November 09, 2014, 01:56:09 PM
I must be blind, thanks guys.
Np, talk to me on IRC when you will have any problem :).
Title: Re: "r_con [password] say" help
Post by: mRokita on December 30, 2014, 05:21:24 AM
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
Code: [Select]
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