Page 1 of 1

[CS:S] FX_FireBullets error

Posted: Wed Jun 28, 2023 11:40 am
by rovizon
Hello! I am trying to make FireBullets function in CSS. It seems working, but gives error:

Code: Select all

RuntimeError: Access violation while reading address '8'.


And it doesn't deal damage.

How to fix it?

Syntax: Select all

import memory
from memory import Convention
from memory import DataType
from memory.hooks import PreHook
from weapons.constants import WeaponID
from commands.typed import TypedClientCommand
from players.entity import Player

server = memory.find_binary('server')

fire_bullets = server[b'\x55\x8B\xEC\x81\xEC\x20\x02\x00\x00\x53\x56'].make_function(
Convention.THISCALL,
[DataType.POINTER, DataType.INT, DataType.POINTER, DataType.POINTER, DataType.INT, DataType.INT, DataType.INT, DataType.FLOAT, DataType.FLOAT, DataType.FLOAT],
DataType.VOID)

@TypedClientCommand('fb')
def fb(cmd_info):
player = Player(cmd_info.index)
fire_bullets(player.pointer, player.index, player.eye_location, player.view_angle, WeaponID.GLOCK, 0, 100, 0.01, 0.06, 10.0)

Re: [CS:S] FX_FireBullets error

Posted: Wed Jul 05, 2023 5:17 pm
by Ayuto
The calling convention is not correct. It should be CDECL. Moreover, FX_FireBullets is just for creating the effect, but not for any damage. This has to be done manually e. g. by calling Player.take_damage.