Hey guys,
I'd like to block the hud element that notifies you when you pick up a weapon (the yellow picture of the weapon you picked up on the right).
I tried using hidehudflags, ResetHUD and the ItemPickup Usermesage with no luck.
Maybe someone here knows how to achieve this. Thank you!
An alternative approach to my problem would be to give weapons (weapon_flashbang) without triggering the Hud Message.
[CS:S] Blocking item pickup notification
Re: [CS:S] Blocking item pickup notification
I'm not 100% sure this will work properly, but maybe try stopping the pickup event from broadcasting to players:
Syntax: Select all
from events.hooks import EventAction, PreEvent
@PreEvent('item_pickup')
def _pre_pickup(game_event):
return EventAction.STOP_BROADCAST
Re: [CS:S] Blocking item pickup notification
Thank you for the reply!
I tried your code but sadly it did not work. I even tried to use EventAction.BLOCK to just block the event completely which didn't work either.
I tried your code but sadly it did not work. I even tried to use EventAction.BLOCK to just block the event completely which didn't work either.
- L'In20Cible
- Project Leader
- Posts: 1536
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Re: [CS:S] Blocking item pickup notification
Kami wrote:Thank you for the reply!
I tried your code but sadly it did not work. I even tried to use EventAction.BLOCK to just block the event completely which didn't work either.
That is likely happening client-side when a new weapon is added to the player's inventory. Your best bet, and likely only alternative server-side, is likely to always keep the ammo > 1 so it doesn't count as a new weapon.
Re: [CS:S] Blocking item pickup notification
It seems that setting ammo for grenades counts as giving new ones. So everytime i add ammo, it shows as a picked up weapon. ResetHUD can actually remove the Image but its not reliable (I have to send multiple ResetHUDs to remove the image without blinking). I've seen servers where it does not show for grenades, but I could not figure out how.
- L'In20Cible
- Project Leader
- Posts: 1536
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Re: [CS:S] Blocking item pickup notification
Kami wrote:It seems that setting ammo for grenades counts as giving new ones. So everytime i add ammo, it shows as a picked up weapon. ResetHUD can actually remove the Image but its not reliable (I have to send multiple ResetHUDs to remove the image without blinking). I've seen servers where it does not show for grenades, but I could not figure out how.
Bummer. What's the end goal anyways? Infinite ammo? If so, then you can get away with it by blocking the ammo removal:
Syntax: Select all
from entities.hooks import EntityCondition
from entities.hooks import EntityPreHook
from memory import Convention
from memory import DataType
@EntityPreHook(
EntityCondition.is_player,
lambda player: player.make_virtual_function(
254,
Convention.THISCALL,
(DataType.POINTER, DataType.INT, DataType.INT),
DataType.VOID
)
)
def pre_remove_ammo(stack_data):
if stack_data[2] == 12:
return False
Re: [CS:S] Blocking item pickup notification
Yes the endgoal is infinite ammo for weapon_flashbang and this seems to be exactly what I needed! Thank you very much. It never occured to me that I could just block ammo consumption.
Could you maybe explain, how you found out which function you needed to hook?
Could you maybe explain, how you found out which function you needed to hook?
- L'In20Cible
- Project Leader
- Posts: 1536
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Re: [CS:S] Blocking item pickup notification
Kami wrote:Yes the endgoal is infinite ammo for weapon_flashbang and this seems to be exactly what I needed! Thank you very much. It never occured to me that I could just block ammo consumption.
Could you maybe explain, how you found out which function you needed to hook?
That is basically a hook on:
Syntax: Select all
_ZN20CBaseCombatCharacter10RemoveAmmoEii // void CBaseCombatCharacter::RemoveAmmo(CBaseCombatCharacter *this, int, int)
Where the first integer is the amount to remove, and the second the type of ammo. You can get the offset with this:
viewtopic.php?f=8&t=972
And the type of ammo with this:
Syntax: Select all
Weapon.find_or_create('weapon_flashbang').ammoprop
If you have more specific questions feel free to ask.

Re: [CS:S] Blocking item pickup notification
Thank you very much for taking the time to explain it to me!
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 96 guests