[CS:S] JumpStats

Release your plugins here!
User avatar
L'In20Cible
Project Leader
Posts: 1229
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: [CS:S] JumpStats

Postby L'In20Cible » Sun Dec 22, 2019 8:28 pm

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.
User avatar
InvisibleSoldiers
Member
Posts: 81
Joined: Fri Mar 15, 2019 6:08 am
Location: Russian Federation
Contact:

Re: [CS:S] JumpStats

Postby InvisibleSoldiers » Sun Dec 22, 2019 8:30 pm

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
User avatar
InvisibleSoldiers
Member
Posts: 81
Joined: Fri Mar 15, 2019 6:08 am
Location: Russian Federation
Contact:

Re: [CS:S] JumpStats

Postby InvisibleSoldiers » Sun Dec 22, 2019 8:32 pm

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

I use Linux for the server.
User avatar
L'In20Cible
Project Leader
Posts: 1229
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: [CS:S] JumpStats

Postby L'In20Cible » Sun Dec 22, 2019 8:42 pm

Use 'instance_attribute' instead of 'pointer_attribute'.
User avatar
InvisibleSoldiers
Member
Posts: 81
Joined: Fri Mar 15, 2019 6:08 am
Location: Russian Federation
Contact:

Re: [CS:S] JumpStats

Postby InvisibleSoldiers » Sun Dec 22, 2019 8:47 pm

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,)
User avatar
L'In20Cible
Project Leader
Posts: 1229
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: [CS:S] JumpStats

Postby L'In20Cible » Sun Dec 22, 2019 8:54 pm

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.
User avatar
InvisibleSoldiers
Member
Posts: 81
Joined: Fri Mar 15, 2019 6:08 am
Location: Russian Federation
Contact:

Re: [CS:S] JumpStats

Postby InvisibleSoldiers » Sun Dec 22, 2019 8:55 pm

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.
User avatar
InvisibleSoldiers
Member
Posts: 81
Joined: Fri Mar 15, 2019 6:08 am
Location: Russian Federation
Contact:

Re: [CS:S] JumpStats

Postby InvisibleSoldiers » Sun Dec 22, 2019 9:13 pm

Ok, thank you for this long correspondence! I hope everything will work well now on Windows and Linux!
User avatar
L'In20Cible
Project Leader
Posts: 1229
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: [CS:S] JumpStats

Postby L'In20Cible » Sun Dec 22, 2019 9:53 pm

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')

Return to “Plugin Releases”

Who is online

Users browsing this forum: No registered users and 2 guests