Syntax: Select all
from events import Event
from filters.players import PlayerIter
from listeners.tick import tick_delays
stop_check = 0
my_delay = 0
@Event
def round_end(game_event):
global stop_check
stop_check = 0
tick_delays.cancel_delay(my_delay)
@Event
def round_start(game_event):
check_human()
@Event
def player_death(game_event):
global stop_check
stop_check = 1
def check_human():
global my_delay
if stop_check == 1:
if len(PlayerIter(['ct', 'alive'])) != 0:
my_delay = tick_delays.delay(3, check_human)
else:
for userid in PlayerIter(['ct', 'alive'], return_types = 'userid'):
print("last human")
tick_delays.cancel_delay(my_delay)
else:
print("test")
my_delay = tick_delays.delay(3, check_human)
Code: Select all
[SP] Caught an Exception:
Traceback (most recent call last):
File '../addons/source-python/packages/source-python/events/listener.py', line 90, in fire_game_event
callback(game_event)
File '../addons/source-python/plugins/test/test.py', line 21, in round_end
tick_delays.cancel_delay(my_delay)
File '../addons/source-python/packages/source-python/listeners/tick/delays.py', line 207, in cancel_delay
'tick_delays.cancel_delay requires a _Delay instance.')
TypeError: tick_delays.cancel_delay requires a _Delay instance.