Skip to content

Instantly share code, notes, and snippets.

@x0rnn
Last active Aug 3, 2016
Embed
What would you like to do?
import minqlx
class dm17cup(minqlx.Plugin):
def __init__(self):
self.add_hook("vote_called", self.handle_vote_called)
self.add_hook("death", self.handle_death)
self.add_command("dm17cup", self.cmd_dm17cup)
def handle_vote_called(self, caller, vote, args):
if not (self.get_cvar("g_allowSpecVote", bool)) and caller.team == "spectator":
caller.tell("You are not allowed to call a vote as spectator.")
return
if vote.lower() == "oldmg":
if args.lower() == "on" and self.game.map.lower() != "longestyard":
caller.tell("^7This can only be voted on the map ^2Longest Yard^7.")
return minqlx.RET_STOP_ALL
elif args.lower() == "on" and self.game.map.lower() == "longestyard":
self.callvote("sv_altEntDir oldmg;map_restart", "Enable old (q3dm17) MG ammo position?")
self.msg("{}^7 called a vote.".format(caller.name))
return minqlx.RET_STOP_ALL
elif args.lower() == "off" and self.game.map.lower() != "longestyard":
caller.tell("^7This can only be voted on the map ^2Longest Yard^7.")
return minqlx.RET_STOP_ALL
elif args.lower() == "off" and self.game.map.lower() == "longestyard":
self.callvote('sv_altEntDir "no_sg_rg";map_restart', "Disable old (q3dm17) MG ammo position?")
self.msg("{}^7 called a vote.".format(caller.name))
return minqlx.RET_STOP_ALL
else:
caller.tell("^2/cv oldmg [on/off]^7 is the usage for this callvote command.")
return minqlx.RET_STOP_ALL
def handle_death(self, victim, killer, data):
@minqlx.delay(1.8)
def delay_spawn():
minqlx.player_spawn(victim.id)
if data['MOD'] == "SUICIDE" and (self.game.map.lower() == "longestyard" or self.game.map.lower() == "q3dm17"):
delay_spawn()
def cmd_dm17cup(self, player, msg, channel):
channel.reply("^4Running dm17cup.py")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment