Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import random
- from Credentials import botowner, botname, botpassword
- from SubspaceBot import *
- TYPE_RULES1 = 1
- TYPE_RULES2 = 2
- TYPE_RULES3 = 3
- TYPE_CAP = 4
- TYPE_ROLL = 5
- random_number = random.randrange(1, 999)
- Caps = 0
- Captains = []
- started = 0
- capfound = False
- if __name__ == '__main__':
- bot = SubspaceBot(botowner, 'Siege event bot')
- bot.connectToServer('66.235.184.102', 7900, botname, botpassword, '#python')
- print "Bot connected to server"
- msg_command_id = bot.registerCommand('!msg', 'Arena Message', allowed_players=['American','Dbz'])
- lock_command_id = bot.registerCommand('!lock', 'Locks Arena', allowed_players=['American','Dbz'])
- start_command_id = bot.registerCommand('!start', 'Starts Event', allowed_players=['American','Dbz'])
- while bot.isConnected():
- event = bot.waitForEvent()
- if event.type == EVENT_COMMAND:
- if event.command.id == msg_command_id:
- bot.sendArenaMessage(event.arguments_after[0] + ' - ' + event.player.name)
- elif event.command.id == lock_command_id:
- bot.sendPublicMessage('*lock')
- bot.sendPrivateMessage(event.player.name, ' Un/locked' )
- elif event.command.id == start_command_id:
- bot.sendArenaMessage('Welcome to Siege!')
- timers = []
- bot.setTimer(1, user_data = TYPE_RULES1)
- ##timers.append(bot.setTimer(5, TYPE_RULES1))
- ##timers.append(bot.setTimer(5 * 2, TYPE_RULES2))
- ##timers.append(bot.setTimer(5 * 3, TYPE_RULES3))
- started = 1
- elif event.type == EVENT_TIMER:
- if event.user_data == 1:
- bot.sendArenaMessage('[Rules] go here.')
- bot.setTimer(2, user_data = TYPE_RULES2)
- elif event.user_data == 2:
- bot.sendArenaMessage('[Rules] MORE RULES :D.')
- bot.setTimer(3, user_data = TYPE_RULES3)
- elif event.user_data == 3:
- bot.sendArenaMessage('[Rules] THE LAST RULES :D.')
- bot.setTimer(5, user_data = TYPE_CAP)
- elif event.user_data == 4:
- bot.sendArenaMessage('We will be typing random numbers for captains')
- bot.setTimer(5, user_data = TYPE_ROLL)
- elif event.user_data == 5:
- capfound = False
- random_number = random.randrange(1, 999)
- bot.sendArenaMessage('[Random] Type: ' + str(random_number) + ' Now!')
- bot.setTimer(10)
- else:
- if not capfound:
- bot.setTimer(5, user_data = TYPE_ROLL)
- elif event.type == EVENT_MESSAGE:
- if event.message_type in [MESSAGE_TYPE_PUBLIC,MESSAGE_TYPE_PRIVATE,MESSAGE_TYPE_FREQ,MESSAGE_TYPE_TEAM]:
- if event.message.lower() == str(random_number):
- __cap__ = event.player.name
- if __cap__ in Captains:
- bot.sendArenaMessage(event.player.name + ' is already a captain, rolling again.')
- else:
- cfreq = (len(Captains) + 1) * 100
- Captains.append(event.player.name)
- bot.sendPrivateMessage(event.player.name, '*setship 8')
- bot.sendArenaMessage(event.player.name + ' is the new Captain for freq ' + str(cfreq))
- Caps = Caps + 1
- capfound = True
- if Caps < 4 and started:
- bot.setTimer(1, user_data = TYPE_ROLL)
- print "Bot disconnected"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement