Knowing if it is Warmup time? #674
-
Hi, my usecase is to know for statistics purposes, if a kill happened during warmup. For that i have tried to access the gamerules entity, since it has helpful fields, at least by name. I find that the gamerules entity fields are mostly uninitialized. I have tried to access them in the onroundstart, onplayerdeath, onplayerhurt events. Is the gamerules entity supposed to be used for that? My next attempt will be to keep state myself based on various events.. and i hesitate since i fear its not going to be trivial ( edge case state transitions i dont know ). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey! yes, gamerules can be used to retrieve various game phases, mind sharing the code you've tried? it might go wrong somewhere also what gametype and gamemode? |
Beta Was this translation helpful? Give feedback.
-
After experimenting and stumbling on these docs: https://cs2.poggu.me/dumped-data/entity-list/ |
Beta Was this translation helpful? Give feedback.
After experimenting and stumbling on these docs: https://cs2.poggu.me/dumped-data/entity-list/
I managed to get gamerules working by changing
var gameRules = Utilities.FindAllEntitiesByDesignerName<CBaseEntity>("cs_gamerules").Single().As<CCSGameRules>();
to
var gameRules = Utilities.FindAllEntitiesByDesignerName<CBaseEntity>("cs_gamerules").Single().As<CCSGameRulesProxy>().GameRules!;