Page 2 of 2

Re: [CS:S] JumpStats

Posted: Sun Dec 22, 2019 8:28 pm
by L'In20Cible
InvisibleSoldiers wrote:

Syntax: Select all

@PreHook(GameMovement.AIRACCELERATE)
def pre_airaccelerate(stack_data):
game_movement = make_object(GameMovement, stack_data[0])
index = index_from_pointer(game_movement.player_pointer)
player = PLAYERS[index]

[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/jumpstats/jumpstats.py", line 38, in pre_airaccelerate
index = index_from_pointer(game_movement.player_pointer)

ValueError: Conversion from "Pointer" (<_memory.Pointer object at 0xe81ddd10>) to "Index" failed.


Syntax: Select all

'pointer_attribute': {
'player_pointer': {
'type': 'POINTER',
'offset': 4
}
}

Full code?

InvisibleSoldiers wrote:
L'In20Cible wrote:Try without _srv suffix.


Still the error.

Well, are you trying that on windows? Remember, .so = linux, .dll = windows.

Re: [CS:S] JumpStats

Posted: Sun Dec 22, 2019 8:30 pm
by InvisibleSoldiers

Syntax: Select all

manager = TypeManager()
gamemovement = {
'binary': 'server',
'function': {
'AIRACCELERATE': {
'identifier': aa_signature,
'args': (DataType.POINTER, DataType.POINTER, DataType.FLOAT, DataType.FLOAT),
'return_type': DataType.VOID,
'convention': Convention.THISCALL
},
'FRICTION': {
'identifier': friction_signature,
'args': (DataType.POINTER, ),
'return_type': DataType.VOID,
'convention': Convention.THISCALL
}
},
'pointer_attribute': {
'player_pointer': {
'type': 'POINTER',
'offset': 4
}
}
}
if PLATFORM == 'linux':
gamemovement['function']['GETAIRSPEEDCAP'] = {
'identifier': getairspeedcap_signature,
'args': (DataType.POINTER, ),
'return_type': DataType.FLOAT,
'convention': Convention.THISCALL
}
elif PLATFORM == 'windows':
gamemovement['virtual_function']['GETAIRSPEEDCAP'] = {
'offset': getairspeedcap_offset,
'args': (DataType.POINTER, ),
'return_type': DataType.FLOAT,
'convention': Convention.THISCALL
}
GameMovement = manager.create_type_from_dict('GameMovement', gamemovement)


Syntax: Select all

from .config import GameMovement

@PreHook(GameMovement.AIRACCELERATE)
def pre_airaccelerate(stack_data):
game_movement = make_object(GameMovement, stack_data[0])
index = index_from_pointer(game_movement.player_pointer)
player = PLAYERS[index]

if not BOTS_ALLOWED and player.is_fake_client(): return

if player.is_jumping:
wishdir = make_object(Vector, stack_data[1])
wishspeed = stack_data[2]
player.get_stats(wishdir, wishspeed, stack_data[0])

player.friction_ticks = 0

Re: [CS:S] JumpStats

Posted: Sun Dec 22, 2019 8:32 pm
by InvisibleSoldiers
Well, are you trying that on windows? Remember, .so = linux, .dll = windows.

I use Linux for the server.

Re: [CS:S] JumpStats

Posted: Sun Dec 22, 2019 8:42 pm
by L'In20Cible
Use 'instance_attribute' instead of 'pointer_attribute'.

Re: [CS:S] JumpStats

Posted: Sun Dec 22, 2019 8:47 pm
by InvisibleSoldiers
L'In20Cible wrote:Use 'instance_attribute' instead of 'pointer_attribute'.

[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/jumpstats/jumpstats.py", line 44, in pre_airaccelerate
wishdir = make_object(Vector, stack_data[1])

IndexError: Index out of range.

Syntax: Select all

print(GameMovement.AIRACCELERATE.arguments)
(_memory.DataType.POINTER,)

Re: [CS:S] JumpStats

Posted: Sun Dec 22, 2019 8:54 pm
by L'In20Cible
InvisibleSoldiers wrote:
L'In20Cible wrote:Use 'instance_attribute' instead of 'pointer_attribute'.

[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/jumpstats/jumpstats.py", line 44, in pre_airaccelerate
wishdir = make_object(Vector, stack_data[1])

IndexError: Index out of range.

Syntax: Select all

print(GameMovement.AIRACCELERATE.arguments)
(_memory.DataType.POINTER,)

You need to use 'arguments', not 'args'. Also, you need to not provide the this pointer as it is already assumed by the TypeManager internally. And you also need to pass them as 'POINTER', 'FLOAT', etc. just like earlier.

Re: [CS:S] JumpStats

Posted: Sun Dec 22, 2019 8:55 pm
by InvisibleSoldiers
L'In20Cible wrote:
InvisibleSoldiers wrote:
L'In20Cible wrote:Use 'instance_attribute' instead of 'pointer_attribute'.

[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/jumpstats/jumpstats.py", line 44, in pre_airaccelerate
wishdir = make_object(Vector, stack_data[1])

IndexError: Index out of range.

Syntax: Select all

print(GameMovement.AIRACCELERATE.arguments)
(_memory.DataType.POINTER,)

You need to use 'arguments', not 'args'. Also, you need to not provide the this pointer as it is already assumed by the TypeManager internally.

I should use 'arguments': ('POINTER', 'FLOAT', 'FLOAT'),' because it parses like from config.

Re: [CS:S] JumpStats

Posted: Sun Dec 22, 2019 9:13 pm
by InvisibleSoldiers
Ok, thank you for this long correspondence! I hope everything will work well now on Windows and Linux!

Re: [CS:S] JumpStats

Posted: Sun Dec 22, 2019 9:53 pm
by L'In20Cible
InvisibleSoldiers wrote:Ok, thank you for this long correspondence! I hope everything will work well now on Windows and Linux!

This line raises a KeyError because you haven't set the virtual_function dictionary:

Syntax: Select all

elif PLATFORM == 'windows':
gamemovement['virtual_function'] = {}
gamemovement['virtual_function']['GETAIRSPEEDCAP'] = {


This line also raises because you haven't replaced the ? with 2A as previously mentioned:

Syntax: Select all

friction_signature = memory.get('windows-friction', '55 8B EC F3 0F 10 1D 2A 2A 2A 2A 83 EC 08 56 8B F1 8B 4E 04')

Re: [CS:S] JumpStats

Posted: Sat Jan 25, 2020 12:42 pm
by InvisibleSoldiers
Rewrote the plugin in a more compact and comfortable form but this plugin is closely interwoven with another which I can't share for now, still maybe someone will be interested.

Eyesight changes:
1. Removed HUD print.
2. Removed CGameMovement::Friction hook.
3. Now printing current jump count can be toggle to ON or OFF.
3. Removed all delta stats.
4. Instead fixed range of jumps in row for stats there are now dynamic range which player can choose from 1 to 25 in my case.
5. Added preference option which allow to choose targets for printing themselves stats : Self (player itself), Other players (observer targets of player), Replay (From another plugin, not the point).
6. Instead delta height which was calculated form start jump position to another, there are now true jump height aka maximum Z coordinate which player has achieved for a jump. For example 55.5 units when you jump without duck, and 57.0 with duck in general, but there are still other parameters affecting this, so this is the whole art, and now you may see the height.
7. Added 'Distance' option in two-dimensional and three-dimensional view, it it calculated from start jump position to another landing position, simple but useful.

All other features remained same.