1
Paintball 2 Discussion / Re: Is this game open REALLY open-source?
« on: November 06, 2016, 12:52:07 AM »
Thanks
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
What? Every DP script/mod I ever released is on GPLOkay, glad we cleared this up, topic closed.
Oh my bad, replace Server with pypb2lib.Server and it will work.You tested my code?
(I wrote that script without running python )
I've just tested it on my VPS so i can confirm that it works.
Now I don't have any syntax errors now, but apart from lagging my running pb2 server crazy (script launched --> instant lag, later timeout ingame), the script does NOTHING.
UMaster, you should google "Python indentation". Python uses it instead of brackets.Thank you, rockitude. Now I don't have any syntax errors now, but apart from lagging my running pb2 server crazy, the script does NOTHING.
if data["mapname"] == "airtimeoi":
s.rcon("sv_consolename 4")
Should be:
if data["mapname"] == "airtimeoi":
s.rcon("sv_consolename 4")
^--- 4 spaces
I would probably do it like this. I'm not sure if it works, but you should get the idea.Code: [Select]code ...
import pypb2lib
from pypb2lib import Server
while True:
s = Server(', '109.235.71.123', 11111)
data = s.Status()
if data["mapname"] == "airtimeoi":
s.rcon("sv_consolename 4")
s.rcon("say TEST")
elif data["mapname"] == "airtime2":
s.rcon("sv_consolename 3")
s.rcon("say TEST")
elif data["mapname"] == "airtime3":
s.rcon("sv_consolename 1")
s.rcon("say TEST")
Yes it does.Ah thanks. expert 8 was just an example
The expert command applies expert mode to the next map so it won't work the way you expect it to work i think.
So I would use this solution instead:Code: [Select]import pypb2lib
WARNING - THIS METHOD REQUIRES ACCESS TO THE LOGFILE
def mapchange(data):
# data['map'] == name of the loaded map
s.rcon('expert 8') # Set expert mode for the next map
s.rcon('map ' + data['map']) # Reload the map
if __name__ == '__main__':
s = Server(rcon_password='rcon_password', hostname='ip', port=27910, logfile='path_to_servers_logfile.log')
s.Bind(pypb2lib.EVT_MAPCHANGE, mapchange)
import pypb2lib
from pypb2lib import Server
while True:
s = Server('rcon', '109.235.71.123', 11111)
data = s.Status()
if data["mapname"] == "airtimeoi":
s.rcon("sv_consolename 4")
s.rcon("say TEST")
elif data["mapname"] == "airtime2":
s.rcon("sv_consolename 3")
s.rcon("say TEST")
elif data["mapname"] == "airtime3":
s.rcon("sv_consolename 1")
s.rcon("say TEST")
umaster@23246:/paintball/umaster/pball/scripts$ python cvar_cpublic.py
File "cvar_cpublic.py", line 7
s.rcon("sv_consolename 4")
^
IndentationError: expected an indented block
I don't check the forums very often nowadays, I do it once a month or something like this. The 'Python' word in the topic has captured my attention though.Ah, hTml, thank you very much
You can use pypb2lib for this thing I think - https://github.com/mRokita/pypb2lib
prolandr, pgptrain, pfo, spaint, freedom, london, carp, reminission, shz33, ub_columbia, beta/walled_b3, beta/spcup_kingdom_b?, beta/sald_b3Thanks for the suggestion. Weekly election will be held.
Also, I suggest to make a weekly election about the maplist to keep that updated, Beppo told me the old [K&S] serveradmins were using this system and it worked out pretty well. (Have to admit that there used to be way more players back then, tho)