[HL2:DM] Infinite aux power for sprinting OR breathing
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
We don't currently have the CBasePlayer::PlayerRunCommand virtual function for HL2:MP in our data. So, the following uses a tick listener instead:
If need be, I can add ConVars for sprinting and breathing to allow one to be active instead of always both.
*Note that this requires the newest version of Source.Python (version 305) as it uses 2 properties I just added to the data.
*Edit: I have added CBasePlayer.run_command for hl2mp, so now the following works, as well (as of SP version 306):
Syntax: Select all
from filters.players import PlayerIter
from listeners import OnTick
SPRINTING = 1
BREATHING = 4
@OnTick
def _tick():
for player in PlayerIter('alive'):
active_devices = player.active_devices
if active_devices & SPRINTING:
player.active_devices = active_devices & ~SPRINTING
player.suit_power_load = 0
if active_devices & BREATHING:
player.active_devices = active_devices & ~BREATHING
player.suit_power_load = 0
If need be, I can add ConVars for sprinting and breathing to allow one to be active instead of always both.
*Note that this requires the newest version of Source.Python (version 305) as it uses 2 properties I just added to the data.
*Edit: I have added CBasePlayer.run_command for hl2mp, so now the following works, as well (as of SP version 306):
Syntax: Select all
from entities.hooks import EntityCondition
from entities.hooks import EntityPreHook
from memory import make_object
from players.entity import Player
SPRINTING = 1
BREATHING = 4
@EntityPreHook(EntityCondition.is_player, 'run_command')
def pre_run_command(stackdata):
player = make_object(Player, stackdata[0])
if player.dead:
return
active_devices = player.active_devices
if active_devices & SPRINTING:
player.active_devices = active_devices & ~SPRINTING
player.suit_power_load = 0
if active_devices & BREATHING:
player.active_devices = active_devices & ~BREATHING
player.suit_power_load = 0
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Hi Satoon i have problems.
Syntax: Select all
18:48:20 [SP] Unloading plugin 'auxpower'...
[SP] Caught an Exception:
Traceback (most recent call last):
File '../addons/source-python/packages/source-python/plugins/command.py', line 204, in call_command
self[sub_command](*args)
File '../addons/source-python/packages/source-python/plugins/command.py', line 342, in reload_plugin
self.unload_plugin(plugin_name)
File '../addons/source-python/packages/source-python/plugins/command.py', line 320, in unload_plugin
del self.manager[plugin_name]
File '../addons/source-python/packages/source-python/plugins/manager.py', line 149, in __delitem__
self._remove_modules(plugin_name)
File '../addons/source-python/packages/source-python/plugins/manager.py', line 197, in _remove_modules
instance._unload_instance()
File '../addons/source-python/packages/source-python/entities/hooks.py', line 143, in _unload_instance
_waiting_entity_hooks.remove(self)
ValueError: list.remove(x): x not in list
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Syntax: Select all
9:41:53 sp load auxpower
19:41:53 [SP] Loading plugin 'auxpower'...
[SP] Caught an Exception:
Traceback (most recent call last):
File '../addons/source-python/packages/source-python/plugins/manager.py', line 71, in __missing__
instance = self.instance(plugin_name, self.base_import)
File '../addons/source-python/packages/source-python/plugins/instance.py', line 82, in __init__
self._plugin = import_module(import_name)
File '../addons/source-python/plugins/auxpower/auxpower.py', line 10, in <module>
@EntityPreHook(EntityCondition.is_player, 'run_command')
File '../addons/source-python/packages/source-python/entities/hooks.py', line 103, in __call__
if self.initialize(entity):
File '../addons/source-python/packages/source-python/entities/hooks.py', line 131, in initialize
self.hooked_function = getattr(entity, self.function)
File '../addons/source-python/packages/source-python/entities/entity.py', line 98, in __getattr__
raise AttributeError('Attribute '{0}' not found'.format(attr))
AttributeError: Attribute 'run_command' not found
[SP] Plugin 'auxpower' was unable to be loaded.
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
Ok i have updated SP and works fine.
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
Since the SP update it does not work anymore as it should.
There is no boost.
You can only walk
There is no boost.
You can only walk
Syntax: Select all
from entities.hooks import EntityCondition
from entities.hooks import EntityPreHook
from memory import make_object
from players.entity import Player
SPRINTING = 1
BREATHING = 4
@EntityPreHook(EntityCondition.is_player, 'run_command')
def pre_run_command(stackdata):
player = make_object(Player, stackdata[0])
if player.dead:
return
active_devices = player.active_devices
if active_devices & SPRINTING:
player.active_devices = active_devices & ~SPRINTING
player.suit_power_load = 0
if active_devices & BREATHING:
player.active_devices = active_devices & ~BREATHING
player.suit_power_load = 0
Last edited by Ayuto on Wed May 08, 2019 7:16 pm, edited 1 time in total.
Reason: code --> python
Reason: code --> python
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
Oh, I think I know where the problem is. A week ago we improved the speed of many player properties by using a different implementation. However, the new implementation is probably reading the address of "active_devices" using the wrong data type. It's probably unsinged int/short instead of just int. I will investigate this next week.
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
ok,
thanks in advance.
thanks in advance.
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
Should be fixed with version 687:
https://github.com/Source-Python-Dev-Te ... 75dcbf3634
https://github.com/Source-Python-Dev-Te ... 75dcbf3634
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
Thank you works fine.
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
After a long test, I noticed that the same error always appears at the end of the map.
-
- Junior Member
- Posts: 10
- Joined: Tue Nov 20, 2012 1:21 am
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
It will be time to learn python
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
Baster1985 wrote:It will be time to learn python
Yes, if you have time for it?
I would be glad.
-
- Junior Member
- Posts: 10
- Joined: Tue Nov 20, 2012 1:21 am
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
I rather meant you. Then you do not have to ask others about every little thing
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
There are scripters and craftsmen
I am a craftsperson.
I'm so sorry for something I did not create. I am very happy about the support of the community.
As I said, I also like to pay money.
viewtopic.php?f=9&t=2009
I am a craftsperson.
I'm so sorry for something I did not create. I am very happy about the support of the community.
As I said, I also like to pay money.
viewtopic.php?f=9&t=2009
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
There's still spending that mistake.
It works in the beginning but after a certain time, not anymore.
It works in the beginning but after a certain time, not anymore.
Code: Select all
2019-06-02 08:47:29 - sp - EXCEPTION
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/auxpower/auxpower.py", line 20, in pre_run_command
player.suit_power_load = 0
File "../addons/source-python/packages/source-python/entities/_base.py", line 125, in __setattr__
object.__setattr__(self, attr, value)
ValueError: Unable to find property 'm_flSuitPowerLoad'.
Re: [HL2:DM] Infinite aux power for sprinting OR breathing
Just commited a fix:
https://github.com/Source-Python-Dev-Te ... b201fd0b2a
I will publish a new release today (version 690).
https://github.com/Source-Python-Dev-Te ... b201fd0b2a
I will publish a new release today (version 690).
Who is online
Users browsing this forum: No registered users and 64 guests