Raised This Month: $62 Target: $400
 15% 

[CS:S] Enable/disable plugin AFTER after certain amount of players connected


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
playhardloveenemy
Member
Join Date: Dec 2015
Old 04-14-2019 , 09:11   [CS:S] Enable/disable plugin AFTER after certain amount of players connected
Reply With Quote #1

Enable/disable plugin AFTER after certain amount of players connected

Hallo there!
I'm looking for a plugin like this, but i doesn't seem to find one.
I don't know if it's possible, but my idea is to track players time in the server, but i only want the plugin to be working (to count players time, but still be able to see the TOP) if there are 12-15 players connected.

Here's the plugin that i'm useing: https://forums.alliedmods.net/showthread.php?p=1751973

Thank you in advance!
playhardloveenemy is offline
Pilo
AlliedModders Donor
Join Date: Jan 2019
Location: Israel
Old 04-17-2019 , 10:17   Re: [CS:S] Enable/disable plugin AFTER after certain amount of players connected
Reply With Quote #2

PHP Code:
#include <sourcemod>

ConVar g_playerslimit;

public 
void OnPluginStart()
{
    
g_playerslimit CreateConVar("sm_players_limit""12""Max players need to start the plugin");
}

public 
void OnMapStart()
{
    
int playerscount 0;
    for (
int i 1<= MaxClientsi++)
    if (
IsClientInGame(i))++playerscount;
    
int max GetConVarInt(g_playerslimit);
    if (
playerscount max)
    {
        
ServerCommand("sm plugins unload mostactive");
    }
    else
    {
        
ServerCommand("sm plugins load mostactive");
    }
}

public 
void OnClientConnected(int client)
{
    
int playerscount 0;
    for (
int i 1<= MaxClientsi++)
    if (
IsClientInGame(i))++playerscount;
    
int max GetConVarInt(g_playerslimit);
    if (
playerscount >= max)
    {
        
ServerCommand("sm plugins load mostactive");
    }
}

public 
void OnClientDisconnect(int client)
{
    
int playerscount 0;
    for (
int i 1<= MaxClientsi++)
    if (
IsClientInGame(i))++playerscount;
    
int max GetConVarInt(g_playerslimit);
    if (
playerscount max)
    {
        
ServerCommand("sm plugins unload mostactive");
    }

Really weird plugin but try that, (Untested)
__________________

Taking Private(PAID) Plugins In PM
Feel free to Donate with PayPal
Feel free to message me in Discord Pilo#8253
Total donated : 5$
Pilo is offline
playhardloveenemy
Member
Join Date: Dec 2015
Old 04-17-2019 , 11:35   Re: [CS:S] Enable/disable plugin AFTER after certain amount of players connected
Reply With Quote #3

Wow, bro, so far it's working
Great and simple.
Really appreciate it!
Thank you for your time!
playhardloveenemy is offline
Pilo
AlliedModders Donor
Join Date: Jan 2019
Location: Israel
Old 04-17-2019 , 11:38   Re: [CS:S] Enable/disable plugin AFTER after certain amount of players connected
Reply With Quote #4

No problem.
__________________

Taking Private(PAID) Plugins In PM
Feel free to Donate with PayPal
Feel free to message me in Discord Pilo#8253
Total donated : 5$
Pilo is offline
Reply


Thread Tools
Display Modes

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 03:06.


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