[CS:S] FX_FireBullets error

Please post any questions about developing your plugin here. Please use the search function before posting!
rovizon
Junior Member
Posts: 22
Joined: Mon May 31, 2021 3:01 pm
Location: Donbass

[CS:S] FX_FireBullets error

Postby rovizon » Wed Jun 28, 2023 11:40 am

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)
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [CS:S] FX_FireBullets error

Postby Ayuto » Wed Jul 05, 2023 5:17 pm

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 20 guests