roflmuffin / CounterStrikeSharp

CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2
https://docs.cssharp.dev
Other
741 stars 111 forks source link

GameEvent listener improvement #413

Closed Kroytz closed 3 months ago

Kroytz commented 4 months ago

I found item_equip only fire once when I receive an item but not like CSGO does(fire at everytime weapon switch). Seems like CreateEvent function fails sometimes. So we can add a hook for CreateEvent and make the bForce always true. IDK why it works at least it works for me.

Kroytz commented 4 months ago

Sorry I found HookEvent logic has done the same logic (FindListener then AddListener)

Kroytz commented 4 months ago

Test again with hook CreateEvent and change param bForce = true, then item_equip event works as expected.

roflmuffin commented 4 months ago

I'm not sure we should really be changing this bool, because the fact that it doesn't fire is coming from valve code directly, so forcing these through may have unforeseen consequences

KillStr3aK commented 4 months ago

I'm not sure we should really be changing this bool, because the fact that it doesn't fire is coming from valve code directly, so forcing these through may have unforeseen consequences

I agree