splewis / csgo-retakes

CS:GO Sourcemod plugin for a site-retake gamemode
GNU General Public License v3.0
328 stars 115 forks source link

HookEvent player_team EventHookMode_Pre #23

Closed gabriel-munteanu closed 9 years ago

gabriel-munteanu commented 9 years ago

I installed your plugin. I joined the server and when I choose a team the server crashed. In the debug file I found this:

Program terminated with signal 11, Segmentation fault.
#0  0x00000000 in ?? ()
#0  0x00000000 in ?? ()
#1  0xef962839 in Sample::Hook_FireEvent(IGameEvent*, bool) () from /.../csgo/addons/sourcemod/war1/extensions/connect_log_fix.ext.2.csgo.so
#2  0xefaf8790 in __SourceHook_FHCls_IGameEventManager2FireEvent0::Func(IGameEvent*, bool) () from /..../csgo/addons/sourcemod/bin/sourcemod.2.csgo.so
#3  0xffeb2898 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

So the problem is from connect_log_fix extension. And I also found this post: https://forums.alliedmods.net/showpost.php?p=2278839&postcount=46 . After a little research in that thread I found this post https://forums.alliedmods.net/showthread.php?p=2203209#post2203209 that explains what is happening. That extension, which is very useful, hooks onto 'FireEvent' and check all the events in search of "player_connect" to set the IP address. I think that this hook is PreHook. Because in your plugin, you block the player_team event, it causes the server crash.

Until you will find a solution for this, I return Plugin_Continue on that hook and see a lots of team changes :D.

splewis commented 9 years ago

I don't see the issue. If someone has a fix they are free to create a pull request.

splewis commented 9 years ago

You can try the change on the usermessage-hook branch (https://github.com/splewis/csgo-retakes/commit/b75037c2187263db1bd224f04b1e682a020a4577) and see if it works.

gabriel-munteanu commented 9 years ago

Nope it didn't work. But this works: public Action Event_PlayerTeam(Handle event, const char[] name, bool dontBroadcast) { SetEventBroadcast(event, true);//disable event broadcast return Plugin_Continue; }

Thanks!

splewis commented 9 years ago

Interesting. I'll take a look at using that instead. (It could be quite useful in several of my plugins)