Skip to content

Instantly share code, notes, and snippets.

@x0rnn
Last active August 3, 2016 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save x0rnn/44e6e8f53d699c81f407ab88ee4d917f to your computer and use it in GitHub Desktop.
Save x0rnn/44e6e8f53d699c81f407ab88ee4d917f to your computer and use it in GitHub Desktop.
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