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

[CS:GO] GOTV idea.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 02-16-2018 , 10:04   [CS:GO] GOTV idea.
Reply With Quote #1

So my server is crashing from time to time by that CS:GO update which caused a lot of plugins precaching in "OnConfigsExecuted". Since I don't have that time to check what plugins is causing that and I know that enabling GOTV fixes it I was wondering will that code work? Since I don't want the bot enabled in a MG server, cause it's bugging a lot.

PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>

bool IsBotEnabled;

public 
OnConfigsExecuted()
{
    
IsBotEnabled true;
    
Handle enableGOTV FindConVar("tv_enable");
    
SetConVarInt(enableGOTV1falsefalse);
    
delete enableGOTV;
}

public 
void OnClientPutInServer(int client)
{
    if(
IsBotEnabled)
    {
        
IsBotEnabled false;
        
Handle disableGOTV FindConVar("tv_enable");
        
SetConVarInt(disableGOTV0falsefalse);
        
delete disableGOTV;
    }
}

public 
void OnClientDisconnect(int client)
{
    
int TeamCountT GetTeamClientCount(CS_TEAM_T);
    
int TeamCountCT GetTeamClientCount(CS_TEAM_CT);
    
int TeamCountSPEC GetTeamClientCount(CS_TEAM_SPECTATOR);

    if(
TeamCountT == && TeamCountCT == && TeamCountSPEC == 0)
    {
        if(!
IsBotEnabled//I'm pretty sure that check isn't necessary, but still.
        
{
            
IsBotEnabled true;
            
Handle enableGOTV FindConVar("tv_enable");
            
SetConVarInt(enableGOTV1falsefalse);
            
delete enableGOTV;
        }    
    }

Im pretty sure I must a timer, to check if the server is empty and if so to enable the bot again or I can simpy check that when a player disconnects with player count (code updated, after I noticed that the server can crash, even is someone has already connected and than disconnected leaving the server empty).
__________________

Last edited by PinHeaDi; 02-16-2018 at 10:28.
PinHeaDi is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 02-16-2018 , 11:25   Re: [CS:GO] GOTV idea.
Reply With Quote #2

why go into so much trouble?
__________________
8guawong is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 02-16-2018 , 11:28   Re: [CS:GO] GOTV idea.
Reply With Quote #3

Quote:
Originally Posted by 8guawong View Post
why go into so much trouble?
Because of this. I know that enabling GOTV fixes that, but I don't want it to be enabled when a player has already successfully connected. And right now I don't have the time to figure out which plugin is causing it.
__________________
PinHeaDi is offline
asdfxD
Veteran Member
Join Date: Apr 2011
Old 02-16-2018 , 15:00   Re: [CS:GO] GOTV idea.
Reply With Quote #4

strange. all of my linux servers are working fine without a crash. never had a single crash since the go update here https://forums.alliedmods.net/showthread.php?t=303249 gotv is not a "must".
asdfxD is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 02-16-2018 , 23:23   Re: [CS:GO] GOTV idea.
Reply With Quote #5

no i mean why not just turn gotv on and just forget about it?
__________________
8guawong is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 02-17-2018 , 01:06   Re: [CS:GO] GOTV idea.
Reply With Quote #6

Why not just figure out which plugin is causing the crash? Unless you have hundreds of plugins running, it's very easy to track down which one is causing it - any plugin that is precaching or downloading custom content OnConfigsExecuted.

You're just putting a cpu intensive bandaid over the situation, which just causes more issues for you. Doing this will probably cost you more time than fixing the bad plugin.
__________________

Last edited by sneaK; 02-17-2018 at 01:06.
sneaK 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 07:27.


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