AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   hook mapchange before client_disconnect (https://forums.alliedmods.net/showthread.php?t=164156)

sparkey 08-07-2011 21:25

hook mapchange before client_disconnect
 
Hello,

Is there any way to hook a mapchange event before the client_disconnect function is called? I only want code to be executed if the client is really retrying or disconnecting and not if the map is changed.

I have tried with the following events but none of them seems to be hooked before the client_disconnect function.
PHP Code:

register_srvcmd("changelevel""call_mapchange");

register_forward(FM_ChangeLevel"call_mapchange");

register_forward(FM_ServerDeactivate"call_mapchange"); 

best regards

Exolent[jNr] 08-07-2011 22:12

Re: hook mapchange before client_disconnect
 
plugin_end()

sparkey 08-07-2011 23:53

Re: hook mapchange before client_disconnect
 
Quote:

Originally Posted by Exolent[jNr] (Post 1527948)
plugin_end()

Tried that also but the client_disconnect function gets called before.

jim_yang 08-08-2011 00:09

Re: hook mapchange before client_disconnect
 
as for the amxx design, client_disconnect is always executed before other forwards in server deactivating. Although FM_ServerDeactivate should be executed before client_disconnect(), but fakemeta executes after amxx core, so it still be executed even after plugin_end(). You can edit meta_api.cpp in amxx, add a forward yourself, right before client_disconnect forward in C_ServerDeactivate function.

sparkey 08-08-2011 02:05

Re: hook mapchange before client_disconnect
 
Thanks alot!

Hunter-Digital 08-08-2011 05:09

Re: hook mapchange before client_disconnect
 
Doesn't SVC_INTERMISSION also call before the map ends, just when the scoreboard is forced upon clients ?

fysiks 08-08-2011 08:12

Re: hook mapchange before client_disconnect
 
Quote:

Originally Posted by Hunter-Digital (Post 1528044)
Doesn't SVC_INTERMISSION also call before the map ends, just when the scoreboard is forced upon clients ?

It is called <mp_chattime> seconds before mapchange. But, I guess that could be an acceptable method in this case.


All times are GMT -4. The time now is 03:20.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.