Source2ZE / CS2Fixes

A Metamod plugin with fixes and features aimed but not limited to zombie escape
GNU General Public License v3.0
252 stars 122 forks source link

[Question] Is there any way to add PRE round end? #287

Closed Gawnz1 closed 3 months ago

Gawnz1 commented 3 months ago

Such events/code can be handled at PRE round end I think? https://github.com/Source2ZE/CS2Fixes/blob/main/src/zombiereborn.cpp#L1627-L1636

Vauff commented 3 months ago

The CS2 hl2sdk does not expose any concept of pre/post event hooks, all event hooks are post hooks.

xen-000 commented 3 months ago

Technically, events are just fired by game code at specific points in time, there's no concept of pre/post here. Round starts in CS actually fire 2 events, one before (round_prestart) and one after (round_start) the round restart logic. There's also cs_pre_restart which is fired 0.3s before the round restarts.

Gawnz1 commented 3 months ago

Thanks for the information, really appreciating it as I am a newbie and I did know that in Sourcemod (csgo) https://wiki.alliedmods.net/Events_(SourceMod_Scripting)#Hooking_Events they did exist, but I was not fully sure for here.

@xen-000 Yes, I reviewed everything before opening issue, but there is no pre for the round end, so I decided to ask if it is possible or is there any way? Maybe with signature or?

Vauff commented 3 months ago

I'm sure you could find a function signature to pre-hook. But we avoid extra gamedata when possible, since it's susceptible to breaking on game updates. So the timer on round_time_warning still makes more sense.