Raised This Month: $ Target: $400
 0% 

[INSURGENCY] Execute a command when a certain amount of connected players is reached.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KALASH NICOLE
Member
Join Date: Feb 2016
Old 09-12-2016 , 16:22   [INSURGENCY] Execute a command when a certain amount of connected players is reached.
Reply With Quote #1

Hello, I would need a plugin for Insurgency automatically executing a .cfg which would apply at the next map.

the conditions to execute the .cfg are : at least 25 players connected at the end of the last round of the current map.

Last edited by KALASH NICOLE; 09-17-2016 at 04:03.
KALASH NICOLE is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-12-2016 , 16:40   Re: [INSURGENCY] Execute a command when a certain amount of connected players is reac
Reply With Quote #2

https://www.sourcemod.net/plugins.ph...tion=&search=1
__________________
Do not Private Message @me
Bacardi is offline
KALASH NICOLE
Member
Join Date: Feb 2016
Old 09-12-2016 , 16:50   Re: [INSURGENCY] Execute a command when a certain amount of connected players is reac
Reply With Quote #3

thanks for the link, but how to add the conditions I gave ? :

- a minimum of 26 players to execute the command
- execute the command at the end of the last round

Last edited by KALASH NICOLE; 09-12-2016 at 17:01.
KALASH NICOLE is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-12-2016 , 17:01   Re: [INSURGENCY] Execute a command when a certain amount of connected players is reac
Reply With Quote #4

...can't. Need create new plugin for this kind action
__________________
Do not Private Message @me
Bacardi is offline
KALASH NICOLE
Member
Join Date: Feb 2016
Old 09-12-2016 , 18:19   Re: [INSURGENCY] Execute a command when a certain amount of connected players is reac
Reply With Quote #5

I found an interresting code posted by CrimsonGT here :

https://forums.alliedmods.net/showthread.php?t=6667

Last edited by KALASH NICOLE; 09-12-2016 at 19:29.
KALASH NICOLE is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-13-2016 , 09:40   Re: [INSURGENCY] Execute a command when a certain amount of connected players is reac
Reply With Quote #6

Quote:
Originally Posted by KALASH NICOLE View Post
ok i finally got it works !

here is my code edit, inspired by the code given by CrimsomGT :
...
But you just said...
Quote:
Originally Posted by KALASH NICOLE View Post
thanks for the link, but how to add the conditions I gave ? :

- a minimum of 26 players to execute the command
- execute the command at the end of the last round
If you are happy now, then no problem.
__________________
Do not Private Message @me
Bacardi is offline
KALASH NICOLE
Member
Join Date: Feb 2016
Old 09-16-2016 , 02:14   Re: [INSURGENCY] Execute a command when a certain amount of connected players is reac
Reply With Quote #7

Big Thanks to XINES for helping me to create a working script !


here is the working code (at last )


PHP Code:
#include <sourcemod>
#pragma semicolon 1

ConVar g_cvar_PlayerLimit//Amount of Players Connected before Custom Theater is enabled.

public Plugin myinfo =
{
    
name "Player Count Variables",
    
author "XINES",
    
description "Automatically execute a specific .cfg file based on player count at end of each round",
    
version "1.0",
    
url "http://www.steamsourceservers.com/"
};

//SET CVARS
public void OnPluginStart()

    
HookEvent("round_end"OnRoundEnd);
        
g_cvar_PlayerLimit CreateConVar("sm_playerlimit""25""Number of players needed to execute the concerned .cfg"0true0.0true64.0);
}

//PUBLIC FUNCTIONS
public Action OnRoundEnd(Event event, const char[] namebool dontBroadcast)
{
    if(
GetClientCount() < GetConVarInt(g_cvar_PlayerLimit))
    {
        
ServerCommand("exec ins-server.cfg"); 
        
PrintToChatAll("[Round End Check] Less than 25 Players are currently connected, next map will NOT use the custom theater with the additional weapons.");
    }
    else if(
GetClientCount() >= GetConVarInt(g_cvar_PlayerLimit))
    {
        
ServerCommand("exec custom_server.cfg"); 
        
PrintToChatAll("[Round End Check] At least 25 Players are currently connected, next map will use the custom theater with the additional weapons."); 
    }
    
    return 
Plugin_Continue;


Last edited by KALASH NICOLE; 09-18-2016 at 11:17.
KALASH NICOLE is offline
KALASH NICOLE
Member
Join Date: Feb 2016
Old 09-16-2018 , 12:19   Re: [INSURGENCY] Execute a command when a certain amount of connected players is reac
Reply With Quote #8

Hello, i would need a feature addition to this plugin :

I would like to add the possibility for the plugin to randomly select a nextmap from a certain maplist according to the amount of player.

something like this :

if(GetClientCount() < GetConVarInt(g_cvar_PlayerLimit))
{
ServerCommand("exec ins-server.cfg");
ServerCommand ("nextlevel #randomfromLIST1#);

#LIST1#
[[mapname1
mapname2
mapname3
mapname4
Mapname5
]]
PrintToChatAll("[Round End Check] Less than 25 Players are currently connected, next map will be an official one.");
}



else if(GetClientCount() >= GetConVarInt(g_cvar_PlayerLimit))
{
ServerCommand("exec custom_server.cfg");
ServerCommand ("nextlevel #randomfromLIST2#);

#LIST2#
[[mapname6
mapname7
mapname8
mapname9
mapname10
]]
PrintToChatAll("[Round End Check] At least 25 Players are currently connected, next map will be a custom one.");
}

Last edited by KALASH NICOLE; 09-16-2018 at 12:25.
KALASH NICOLE is offline
dustinandband
Senior Member
Join Date: May 2015
Old 09-18-2018 , 02:00   Re: [INSURGENCY] Execute a command when a certain amount of connected players is reac
Reply With Quote #9

Quote:
Originally Posted by KALASH NICOLE View Post
Hello, i would need a feature addition to this plugin :

I would like to add the possibility for the plugin to randomly select a nextmap from a certain maplist according to the amount of player.

something like this :

if(GetClientCount() < GetConVarInt(g_cvar_PlayerLimit))
{
ServerCommand("exec ins-server.cfg");
ServerCommand ("nextlevel #randomfromLIST1#);

#LIST1#
[[mapname1
mapname2
mapname3
mapname4
Mapname5
]]
PrintToChatAll("[Round End Check] Less than 25 Players are currently connected, next map will be an official one.");
}



else if(GetClientCount() >= GetConVarInt(g_cvar_PlayerLimit))
{
ServerCommand("exec custom_server.cfg");
ServerCommand ("nextlevel #randomfromLIST2#);

#LIST2#
[[mapname6
mapname7
mapname8
mapname9
mapname10
]]
PrintToChatAll("[Round End Check] At least 25 Players are currently connected, next map will be a custom one.");
}

You should include a complete map list at least, for people not familiar with the game.

e.g. L4D2 map list, as it appears on game info / server browser
PHP Code:
#define OFFICIAL_MAPS   54
char OfficialMaps[OFFICIAL_MAPS][] =
{
    
"c1m1_hotel",
    
"c1m2_streets",
    
"c1m3_mall",
    
"c1m4_atrium",
    
"c2m1_highway",
    
// etc.

Also at the end of a round in Insurgency, does any kind of map vote pop up by default (on an unmodded server)? If so, it might take more work to code the feature into the plugin
dustinandband 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 22:59.


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