Raised This Month: $32 Target: $400
 8% 

[CS:S] server_shutdown HookEvent


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
frekons
New Member
Join Date: Jun 2018
Old 06-02-2018 , 00:27   [CS:S] server_shutdown HookEvent
Reply With Quote #1

PHP Code:
public void OnPluginStart() {
    
HookEvent("server_shutdown"OnServerShutdown);
}

public 
void OnServerShutdown(Event event, const char[] namebool dontBroadcast) {

    new 
iPort GetConVarIntFindConVar"hostport" ) );
    
    new 
String:clientstr[512];
    
IntToString(iPort,clientstr,512);

    
HTTPRequest req HTTPRequest("GET""http://xxxx/xxx.php""OnRequestComplete");
    
req.headers.SetString("User-Agent""HTTPRequests for SourceMod");
    
req.params.SetString("serverport"clientstr);
    
req.SendRequest();


when i close server by writing quit, OnServerShutdown doesnt being called

Last edited by frekons; 06-02-2018 at 00:27.
frekons is offline
psychonic

BAFFLED
Join Date: May 2008
Old 06-02-2018 , 09:16   Re: [CS:S] server_shutdown HookEvent
Reply With Quote #2

SM is probably unloaded before that event fires.
psychonic is offline
pride95
Senior Member
Join Date: Aug 2015
Old 06-03-2018 , 08:32   Re: [CS:S] server_shutdown HookEvent
Reply With Quote #3

try server_pre_shutdown
pride95 is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 06-04-2018 , 22:55   Re: [CS:S] server_shutdown HookEvent
Reply With Quote #4

Or try to put the hook in EventHookMode_Pre
__________________
LenHard is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 06-05-2018 , 00:32   Re: [CS:S] server_shutdown HookEvent
Reply With Quote #5

in what way is the server being shut down, if i had to guess the server will probably crash before this event is ever fired. If you have any plugins that are specifically closing the server than you might as well create a forward for other plugins to use.
Mitchell is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 06-06-2018 , 23:53   Re: [CS:S] server_shutdown HookEvent
Reply With Quote #6

Wouldn't plugins unload before the server shuts down? (I'm not sure) But If so, use OnPluginEnd()
__________________
LenHard is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:49.


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