Syntax: Select all
from filters.players import PlayerIter
from listeners.tick import Repeat
def load():
laser_aiming.start(1)
def unload():
laser_aiming.stop()
alive_players = PlayerIter(['alive', 'human'])
@Repeat
def laser_aiming():
for player in alive_players:
weapon = player.get_active_weapon()
if weapon is None:
return
classname = weapon.classname.split('_')[1]
if classname not in ['awp','scout']:
continue
scoped = player.get_property_bool('m_bIsScoped')
if scoped == True:
continue
Code: Select all
[2024-04-26 23:27:31]:
[Source.Python]
[2024-04-26 23:27:31]:
[SP] Caught an Exception:
[2024-04-26 23:27:31]: Traceback (most recent call last):
[2024-04-26 23:27:31]: File "../addons/source-python/packages/source-python/listeners/tick.py", line 79, in _tick
[2024-04-26 23:27:31]: self.pop(0).execute()
[2024-04-26 23:27:31]: File "../addons/source-python/packages/source-python/listeners/tick.py", line 160, in execute
[2024-04-26 23:27:31]: return self.callback(*self.args, **self.kwargs)
[2024-04-26 23:27:31]: File "../addons/source-python/packages/source-python/listeners/tick.py", line 607, in _execute
[2024-04-26 23:27:31]: self.callback(*self.args, **self.kwargs)
[2024-04-26 23:27:31]: File "../addons/source-python/plugins/crosshair/crosshair.py", line 21, in laser_aiming
[2024-04-26 23:27:31]: scoped = player.get_property_bool('m_bIsScoped')
[2024-04-26 23:27:31]: ValueError: Unable to find property 'm_bIsScoped'.