Raised This Month: $51 Target: $400
 12% 

[Solved][CS:GO] Do something to clients before server crashing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DSASDFGH
Senior Member
Join Date: Jul 2011
Location: Facebook
Old 04-01-2015 , 12:16   [Solved][CS:GO] Do something to clients before server crashing
Reply With Quote #1

I wrote the simple level plugin for ZR with use SQL, But when server crash or type '_restart' command, informations are reset to 0 for people who still playing game or connected, How can i fix this? (Or how to do something before server crashing)

-------------------------------------------------------------------------
Cause was my wrong variable usage
__________________
Learning SourceMod is happy

Last edited by DSASDFGH; 04-02-2015 at 11:16.
DSASDFGH is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 04-01-2015 , 15:14   Re: [CS:GO] Do something to clients before server crashing
Reply With Quote #2

Save stuff in OnPluginEnd or, preferably, as it gets set
Miu is offline
DSASDFGH
Senior Member
Join Date: Jul 2011
Location: Facebook
Old 04-02-2015 , 05:20   Re: [CS:GO] Do something to clients before server crashing
Reply With Quote #3

Quote:
Originally Posted by Miu View Post
Save stuff in OnPluginEnd or, preferably, as it gets set
OK, I changed connect db from OnPluginStart to OnConfigsExecuted and add save all clients stats on sql to OnPluginEnd, Seems working.
(Thanks for it, i was got cancer due to that)

But i wonder why only CS:GO works OnMapStart twice,
These are steps that i tried.

Run Server
OnMapStart fired once
Connect to server when hibernating
OnMapStart fired again
__________________
Learning SourceMod is happy

Last edited by DSASDFGH; 04-02-2015 at 05:26.
DSASDFGH is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 04-02-2015 , 06:30   Re: [CS:GO] Do something to clients before server crashing
Reply With Quote #4

Save the data periodically, say each 30 seconds or so. It depends on the plugin, but these are good times to save.
  • OnMapEnd
  • OnRoundEnd
  • OnPlayerDisconnect
  • OnPluginEnd
  • OnPlayerDeath
__________________

Last edited by Impact123; 04-02-2015 at 06:32.
Impact123 is offline
DSASDFGH
Senior Member
Join Date: Jul 2011
Location: Facebook
Old 04-02-2015 , 07:30   Re: [CS:GO] Do something to clients before server crashing
Reply With Quote #5

Quote:
Originally Posted by Impact123 View Post
Save the data periodically, say each 30 seconds or so. It depends on the plugin, but these are good times to save.
  • OnMapEnd
  • OnRoundEnd
  • OnPlayerDisconnect
  • OnPluginEnd
  • OnPlayerDeath
Well, I cannot find reasons why players data reset to '0', Is it a bug?

And load the data when 'OnClientPostAdminCheck'

PHP Code:
public is_user_valid(id)
{
 if (
id == 0)
  return 
false;
 if (!
IsClientConnected(id))
  return 
false;
 if (!
IsClientInGame(id))
  return 
false;
 if (
IsFakeClient(id))
  return 
false;
 return 
true;

and check valid player for load data
__________________
Learning SourceMod is happy

Last edited by DSASDFGH; 04-02-2015 at 07:40.
DSASDFGH is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 04-02-2015 , 09:54   Re: [CS:GO] Do something to clients before server crashing
Reply With Quote #6

OnPluginEnd won't always fire so you should probably fix the bug. If the data is actually being set to 0 in the database, you could try turning on query logging for your SQL server and see what's causing it.
Miu is offline
DSASDFGH
Senior Member
Join Date: Jul 2011
Location: Facebook
Old 04-02-2015 , 11:16   Re: [CS:GO] Do something to clients before server crashing
Reply With Quote #7

Quote:
Originally Posted by Miu View Post
OnPluginEnd won't always fire so you should probably fix the bug. If the data is actually being set to 0 in the database, you could try turning on query logging for your SQL server and see what's causing it.
Thanks for you.

For now, bug has been fixed successfully.

Cause was my wrong variable usage
__________________
Learning SourceMod is happy
DSASDFGH 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 00:01.


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