本文整理汇总了Python中minqlx.set_cvar函数的典型用法代码示例。如果您正苦于以下问题:Python set_cvar函数的具体用法?Python set_cvar怎么用?Python set_cvar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_cvar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: instagib
def instagib(self, value):
if isinstance(value, bool):
minqlx.set_cvar("g_instaGib", str(int(value)))
elif value == 0 or value == 1:
minqlx.set_cvar("g_instaGib", str(value))
else:
raise ValueError("instagib needs to be 0, 1, or a bool.")
示例2: loadout
def loadout(self, value):
if isinstance(value, bool):
minqlx.set_cvar("g_loadout", str(int(value)))
elif value == 0 or value == 1:
minqlx.set_cvar("g_loadout", str(value))
else:
raise ValueError("loadout needs to be 0, 1, or a bool.")
示例3: tags
def tags(self, new_tags):
if isinstance(new_tags, str):
minqlx.set_cvar("sv_tags", new_tags)
elif hasattr(new_tags, "__iter__"):
minqlx.set_cvar("sv_tags", ",".join(new_tags))
else:
raise ValueError("tags need to be a string or an iterable returning strings.")
示例4: set_initial_fps
def set_initial_fps(self, cvarval):
if (cvarval != STD_SVFPS):
if (self.check_value(cvarval, minqlx.CHAT_CHANNEL)):
minqlx.set_cvar("sv_fps", str(cvarval), -1)
else:
self.msg("Will not set sv_fps to value of qlx_svfps as the latter contains an incompatible value.")
else:
pass
示例5: game_countdown
def game_countdown(self):
self.play_sound("sound/items/protect3.ogg")
minqlx.set_cvar("g_infiniteAmmo", "0")
if self.game.type_short != "duel":
for p in self.players():
p.noclip = True
if self.purgersBirthday:
p.powerups(quad=10)
else:
p.powerups(battlesuit=10)
self.donation_message("Consider ^2!donating^7 to ^4The Purgery^7, it would really help a lot.")
示例6: cmd_svfps
def cmd_svfps(self, player, msg, channel):
if len(msg) < 2:
return minqlx.RET_USAGE
try:
sv_fps = int(msg[1])
except ValueError:
channel.reply("You must specify a positive integer greater than or equal to {}.".format(STD_SVFPS))
return minqlx.RET_STOP
if (self.check_value(sv_fps, channel)):
minqlx.set_cvar("sv_fps", str(sv_fps), -1)
channel.reply("sv_fps is now set to {}.".format(sv_fps))
示例7: set_cvar
def set_cvar(cls, name, value, flags=0):
"""Sets a cvar. If the cvar exists, it will be set as if set from the console,
otherwise create it.
:param name: The name of the cvar.
:type name: str
:param value: The value of the cvar.
:type value: Anything with an __str__ method.
:param flags: The flags to set if, and only if, the cvar does not exist and has to be created.
:type flags: int
:returns: True if a new cvar was created, False if an existing cvar was set.
:rtype: bool
"""
if cls.get_cvar(name) is None:
minqlx.set_cvar(name, value, flags)
return True
else:
minqlx.console_command("{} \"{}\"".format(name, value))
return False
示例8: set_cvar_limit
def set_cvar_limit(cls, name, value, minimum, maximum, flags=0):
"""Sets a cvar with upper and lower limits. If the cvar exists, it will be set
as if set from the console, otherwise create it.
:param name: The name of the cvar.
:type name: str
:param value: The value of the cvar.
:type value: int, float
:param minimum: The minimum value of the cvar.
:type value: int, float
:param maximum: The maximum value of the cvar.
:type value: int, float
:param flags: The flags to set if, and only if, the cvar does not exist and has to be created.
:type flags: int
:returns: True if a new cvar was created, False if an existing cvar was set.
:rtype: bool
"""
if cls.get_cvar(name) is None:
minqlx.set_cvar(name, value, flags)
return True
else:
minqlx.console_command("{} \"{}\"".format(name, value))
return False
示例9: fraglimit
def fraglimit(self, new_limit):
minqlx.set_cvar("fraglimit", str(new_limit))
示例10: set_cvar_once
def set_cvar_once(name, value, flags=0):
if minqlx.get_cvar(name) is None:
minqlx.set_cvar(name, value, flags)
return True
return False
示例11: map_load
def map_load(self, mapname, factory):
# turn on infinite ammo for warm-up
minqlx.set_cvar("g_infiniteAmmo", "1")
self.readyPlayers = []
示例12: teamsize
def teamsize(self, new_size):
minqlx.set_cvar("teamsize", str(new_size))
示例13: hostname
def hostname(self, value):
minqlx.set_cvar("sv_hostname", str(value))
示例14: capturelimit
def capturelimit(self, new_limit):
minqlx.set_cvar("capturelimit", str(new_limit))
示例15: scorelimit
def scorelimit(self, new_limit):
minqlx.set_cvar("scorelimit", str(new_limit))