Notice: Trying to access array offset on value of type null in /customers/1/2/4/mrwaggel.be/httpd.www/admin/kernel/db/db_posts.class.php on line 390 Notice: Trying to access array offset on value of type null in /customers/1/2/4/mrwaggel.be/httpd.www/admin/kernel/db/db_pages.class.php on line 337 Notice: Trying to access array offset on value of type null in /customers/1/2/4/mrwaggel.be/httpd.www/admin/kernel/db/db_comments.class.php on line 283 Deprecated: Function get_magic_quotes_runtime() is deprecated in /customers/1/2/4/mrwaggel.be/httpd.www/admin/boot/rules/4-remove_magic.bit on line 18 Deprecated: Function get_magic_quotes_gpc() is deprecated in /customers/1/2/4/mrwaggel.be/httpd.www/admin/boot/rules/4-remove_magic.bit on line 23
A small explanation on how to listen to game events. This example is made for CS:GO, but will work on other Source based games too (some event names may be different). The example is meant for class based plugins. So if you are creating static functions you'll have to do things a little bit different.
If you are in need of hooking into a continuous loop of a source dedicated server, for rejoining a thread for example, you cannot rely on the "GameFrame" loop, because it will simply stop looping if there are no clients connected to the server. So in that case you will need to hook into "Think" which loops both in hibernation mode and when a client is connected ("GameFrame").
You probably came across valve developers wiki's page "Server plugins" that contains very outdated information, and actually not compatible with CSGO servers (you can't even compile their own Sample). Although there is a SDK for CSGO, it's also outdated and totally undocumented. Luckily there is a third party SDK that works wonderfully and has much more functionality and is pretty much the only way to create native plugins, and you should use this SDK. This guide is based for Windows platforms, and just to get you started.