D3CEPTION wrote:[...] maybe find the respective register in memory [...]
Are you sure you mean register?
But yeah, you can hook the RemoveAmmo() method and simply block it from executing. There is no need to do anything more. But again: it requires you to use additional game data, which I would avoid if possible, because it can easily break in the next update and forces you to update your plugin.
D3CEPTION, since you are interested in that solution, here is the code:
Syntax: Select all
import memory
from memory import Convention
from memory import DataType
from entities.hooks import EntityPreHook
from entities.hooks import EntityCondition
def prepare_hook(entity):
# CBaseCombatCharacter::RemoveAmmo(int, int)
return entity.pointer.make_virtual_function(
254,
Convention.THISCALL,
[DataType.POINTER, DataType.INT, DataType.INT],
DataType.VOID
)
@EntityPreHook(EntityCondition.is_player, prepare_hook)
def pre_remove_ammo(args):
return 0
Edit: Just figured out that you can force unlimited ammo using cvars. Though, it will set the ammo count to 999 (but it won't decrement).
Code: Select all
ammo_338mag_max -2
ammo_357sig_max -2
ammo_45acp_max -2
ammo_50AE_max -2
ammo_556mm_box_max -2
ammo_556mm_max -2
ammo_57mm_max -2
ammo_762mm_max -2
ammo_9mm_max -2
ammo_buckshot_max -2
ammo_flashbang_max -2
ammo_hegrenade_max -2
ammo_smokegrenade_max -2