Example #1
0
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import asyncio

from dplib.server import Server

s = Server(hostname='127.0.0.1',
           port=27910,
           logfile=r'C:\Games\Paintball2\pball\qconsole27910.log',
           rcon_password='******')


@asyncio.coroutine
def streak(killer_nick):
    for i in range(1, 3):
        print(killer_nick, i)
        yield from s.wait_for_elim(killer_nick=killer_nick)


@s.event
def on_elim(killer_nick, killer_weapon, victim_nick, victim_weapon):
    try:
        yield from asyncio.wait_for(streak(killer_nick), timeout=20)
        s.say('{U}%s ZABUJCA!{U}' % killer_nick)
Example #2
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Ranking system

from dplib.server import Server
from shutil import copyfile
import os
import time
import threading

s = Server(hostname='127.0.0.1', port=22222,
           logfile=r'/home/paintball/paintball2/pball/qconsole22222.log',
           rcon_password='******')
           
           
def add_feedback(feedback, nick, good):
    players=s.get_players()
    #### Retrieve player's ID ###
    playerid = 0
    for player in players:
        if player.nick == nick:
            playerid=player.dplogin
            break
    
    ### Define hostname specific file paths ###
    status = s.get_status()
    servername=status.get("hostname")
Example #3
0
#Config file for DP2skip
from dplib.server import Server

# Define the portnumber, logfile and rcon_password
s = Server(hostname='127.0.0.1',
           port=11111,
           logfile=r'/home/paintball/paintball2/pball/qconsole11111.log',
           rcon_password='******')

# Define the path to server map rotation
rotation = "/home/paintball/paintball2/pball/configs/rotation_test.txt"

# Define the length of timeout, before a new vote can be called
timeout = 10

#Define the messages to be said in the game
# Use "{C}#text" where '#' is a number or letter for colors
# Use "{I}text{/I}" for italic text
# Use "{U}text{/U}" for underlined text

# When first player says '!skip'
# e.g "Vote to skip map requested! To vote yes type '!skip'"
text1 = "{C}0***{C}DVote to skip map requested! To vote yes type {C}?'!skip'{C}0***"

# When map has just changed
# e.g "Wait few seconds before a new vote"
text2 = "{C}0***{C}DWait few seconds before a new vote{C}0***"

# When player votes to skip
# e.g "Votes still needed to skip: 2"
text3 = "{C}0***{C}DVotes still needed to skip:{C}O"
Example #4
0
    total_time_elim FLOAT DEFAULT '0.0',
    shots_to_sec FLOAT DEFAULT '0.0',   
    FOREIGN KEY (match_id) REFERENCES matches (match_id),
    FOREIGN KEY (player_id) REFERENCES players (player_id)
    );
    
    """)
    con.close()
    print("DataBase Created succesfully")
except sqlite3.OperationalError as e:
    print("DataBase already exists")
    print(e)

# Configure server to listen to
s = Server(hostname='localhost',
           port=27910,
           logfile=r'C:/Games/Paintball2/pball/qconsole27910.log',
           rcon_password='******')

round_started = False


@s.event
def on_round_started():
    """
    Declare round started

    :return:
    """
    global round_started
    round_started = True
Example #5
0
from dplib.server import Server
import random
from time import sleep


# ***config***

s = Server(hostname='127.0.0.1', port=27911,
           logfile=r'/home/user/paintball2/pball/qconsole27911.log',
           rcon_password='******')

# you can add silly names for the bots here
# separate names with comma ","
# name_list = ["whoa", "Toolwut"]
name_list = ['Colton']

# how many bots to add when player joins
bot_count = 10

# ***config ends***


active_players = []

s.rcon("g_autobalance 0")
s.rcon("debug3 1")
s.rcon("g_autojoin 0")


def load_names():
    try:
Example #6
0
import discord
import threading
from dplib.server import Server

s = Server(hostname='127.0.0.1',
           port=xxxx,
           logfile=r'/path/to/logfile/qconsolexxxx.log',
           rcon_password='******')

TOKEN = 'discord_bot_token'

client = discord.Client()
channel = ""


@client.event
async def on_message(message):
    if message.author == client.user:
        pass
    elif message.channel != client.get_channel(your_desired_channel_id):
        pass
    else:
        nick = message.author.display_name
        channel = client.get_channel(your_desired_channel)
        msg = message.content
        data = str(nick) + ": " + str(msg)
        s.say(data)
        await message.channel.purge(limit=1)
        await channel.send('```diff\n+ {0}: {1}```'.format(nick, msg))

Example #7
0
from dplib.server import Server
import random
from time import sleep
import asyncio

# ***config***

s = Server(hostname='127.0.0.1', port=33333,
           logfile=r'/home/paintball/paintball2/pball/qconsole33333.log',
           rcon_password='******')

# you can add silly names for the bots here
# separate names with comma ","
# name_list = ["whoa", "Toolwut"]
name_list = []

# how many bots to add when player joins
bot_count = 10

# ***config ends***


active_players = []


class PlayerInfo():
    def __init__(self, nick, id):
        self.nick = nick
        self.id = id

Example #8
0
from dplib.server import Server
import random
from time import sleep
import asyncio

s = Server(hostname='127.0.0.1', port=11111,
           logfile=r'/home/paintball/paintball2/pball/qconsole11111.log',
           rcon_password='******'s hostage gamemode script running!")
s.rcon("debug3 1;debug1 0;grenadeffire 0;ffire 0;elim 1")

game_started = False
hostage = None
bots = True
player_list = []
guards = []


def get_teams():
    status = s.get_status()
    scores = status.get("_scores")
    team_color = scores.split()
    return team_color


def get_player_list():
    players = s.get_players()
    for player in players:
        if not player.dplogin == "bot":
            player_list.append(player)
Example #9
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Ranking system

from dplib.server import Server
from shutil import copyfile
import os
import time
import threading

s = Server(hostname='127.0.0.1',
           port=11111,
           logfile=r'/home/paintball/paintball2/pball/qconsole11111.log',
           rcon_password='******')


### Unchanged from mapfeedback.py - store feedback in map specific file with nick ###
def add_feedback(feedback, nick):
    status = s.get_status()
    mapname = status.get("mapname")
    if mapname.startswith("beta"):
        mapname = mapname.replace("beta/", "")
    elif mapname.startswith("inprogress"):
        mapname = mapname.replace("inprogress/", "")
    filename = "/var/www/html/whoa.ga/feedback/" + mapname + ".txt"

    if os.path.exists(filename):
        append_write = 'a'  # append if already exists
Example #10
0
from dplib.server import Server
import threading
from time import sleep

# Config
s = Server(hostname='127.0.0.1',
           port=55555,
           logfile=r'/paintball2/pball/qconsole55555.log',
           rcon_password='******')

rotation = "/paintball2/pball/configs/rotation_oddball.txt"

holding_time = 5
# Config ends

print("whoa's oddball gamemode script running!")

s.rcon("sv forcejoin all obs")
timer = False
maplist = []
red_team = []
blue_team = []
yellow_team = []
purple_team = []
score = {"Red": 0, "Blue": 0, "Yellow": 0, "Purple": 0}
flag_holder = "none"
flag_team = "none"
round_started = False
not_dm = True