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

[CS:GO] Help with change a cvar value assuming number of players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 01-06-2016 , 18:45   [CS:GO] Help with change a cvar value assuming number of players
Reply With Quote #1

Hi everyone, I'm a beginner in scripting, but I'm trying to customize the Warmod plugin to get somethings that I want.

It has this cvar:
PHP Code:
RegAdminCmd("minready"ChangeMinReadyADMFLAG_CUSTOM1"Set or display the wm_min_ready console variable");
wm_min_ready CreateConVar("wm_min_ready""10""Sets the minimum required ready players to Live on 3"FCVAR_NOTIFY); 
So, it sets the minimum required ready players to start the match. I want to set this value assuming the number of players in the match, including coachs, if there are... But if it has less than 4 players in each or both teams I want the value stay in 8, or if there are coachs, I want the value stay in 9 (for if there is just one coach), or 10 (for 2 coachs). And if someone join to a team, this value have to be changed automatically.

I know of the existence of these:
PHP Code:
GetTeamClientCount(CS_TEAM_CT)
GetTeamClientCount(CS_TEAM_T)
GetClientCount()
SetConVarInt() 
But I don't know how to use them. Can someone script it and explain what did you do? I'm trying to learn, thanks.
joao7yt is offline
Disowned
Member
Join Date: Oct 2015
Old 01-07-2016 , 18:06   Re: [CS:GO] Help with change a cvar value assuming number of players
Reply With Quote #2

Quote:
Originally Posted by joao7yt View Post
-snape-
Warmod supports an admin command called 'minready' to set the variable, and has a custom admin flag of 'ADMFLAG_CUSTOM1', so you can limit your normal admins from being able to change this and screw up the automation.

Warmod appears to not comment their code, so this will take some digging.

Last edited by Disowned; 01-07-2016 at 18:07.
Disowned is offline
Disowned
Member
Join Date: Oct 2015
Old 01-07-2016 , 21:26   Re: [CS:GO] Help with change a cvar value assuming number of players
Reply With Quote #3

Do you have any more information on how Warmod works? I can't find any reference to 'coach' in the files. Do you actually mean spectator? If so are they limited to only spectating a certain team?

If you have a specific server in mind I'd be happy to come figure out the game mode.

Last edited by Disowned; 01-07-2016 at 21:28.
Disowned is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 01-07-2016 , 21:39   Re: [CS:GO] Help with change a cvar value assuming number of players
Reply With Quote #4

Quote:
Originally Posted by Disowned View Post
Do you have any more information on how Warmod works? I can't find any reference to 'coach' in the files. Do you actually mean spectator? If so are they limited to only spectating a certain team?

If you have a specific server in mind I'd be happy to come figure out the game mode.
I think that in the coach mode, the players coaching are counted as Spectators, this is a native feature from CS:GO, if the cvar is activated, just type "coach t" or "coach ct" to start spectating only that team. The game mode is Competitive.

I'm trying to do this, I'm almost there, but I'm having a trouble with BOTS, they are counted as players in GetClientCount. Do you know if is possible to filter the BOTS? I found some scripts in the forum, but seems don't work anymore...

Last edited by joao7yt; 01-07-2016 at 21:49.
joao7yt is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 01-07-2016 , 22:02   Re: [CS:GO] Help with change a cvar value assuming number of players
Reply With Quote #5

Quote:
Originally Posted by Disowned View Post
Do you have any more information on how Warmod works? I can't find any reference to 'coach' in the files. Do you actually mean spectator? If so are they limited to only spectating a certain team?

If you have a specific server in mind I'd be happy to come figure out the game mode.
Like this one, seems to be broken:
PHP Code:
stock GetRealClientCount(bool:inGameOnly true)
{
    new 
nonfakeclieants 0;
    for(new 
1<= GetMaxClients(); i++)
    {
        if(((
inGameOnly)?IsClientInGame(i):IsClientConnected(i)) && !IsFakeClient(i))
        {
            
nonfakeclieants++;
        }
    }
    return 
nonfakeclieants;

And I don't know how to fix/update this script...
joao7yt is offline
Disowned
Member
Join Date: Oct 2015
Old 01-07-2016 , 23:26   Re: [CS:GO] Help with change a cvar value assuming number of players
Reply With Quote #6

Apparently I didn't see your previous post.

The function you have works perfectly fine, give me a sec.

Last edited by Disowned; 01-07-2016 at 23:28.
Disowned is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 01-07-2016 , 23:30   Re: [CS:GO] Help with change a cvar value assuming number of players
Reply With Quote #7

Quote:
Originally Posted by Disowned View Post
Apparently I didn't see your previous post.

The function you have works perfectly fine, give me a sec.
http://store.steampowered.com/news/11753
joao7yt is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 01-07-2016 , 23:35   Re: [CS:GO] Help with change a cvar value assuming number of players
Reply With Quote #8

Quote:
Originally Posted by Disowned View Post
Apparently I didn't see your previous post.

The function you have works perfectly fine, give me a sec.
About this:
PHP Code:
stock GetRealClientCount(bool:inGameOnly true

    new 
nonfakeclieants 0
    for(new 
1<= GetMaxClients(); i++) 
    { 
        if(((
inGameOnly)?IsClientInGame(i):IsClientConnected(i)) && !IsFakeClient(i)) 
        { 
            
nonfakeclieants++; 
        } 
    } 
    return 
nonfakeclieants

I get this in the compiler:
Quote:
error 147: new-style declarations are required
About this line:
PHP Code:
stock GetRealClientCount(bool:inGameOnly true
joao7yt is offline
Disowned
Member
Join Date: Oct 2015
Old 01-07-2016 , 23:52   Re: [CS:GO] Help with change a cvar value assuming number of players
Reply With Quote #9

Quote:
Originally Posted by joao7yt View Post
About this line:
PHP Code:
stock GetRealClientCount(bool:inGameOnly true
What version of SM are you using? Most are using 1.7

PHP Code:
stock int GetRealClientCount(bool inGameOnly true)
{
    
int  nonfakeclients 0;
    for(
int  client_i 1client_i <= MaxClientsclient_i++)
    {
        if( ((
inGameOnly) ? IsClientInGame(client_i) : IsClientConnected(client_i)) && !IsFakeClient(client_i) )
        {
            
nonfakeclients++;
        }
    }
    return 
nonfakeclients;

This should be a modern syntax version.
Disowned is offline
Disowned
Member
Join Date: Oct 2015
Old 01-08-2016 , 00:28   Re: [CS:GO] Help with change a cvar value assuming number of players
Reply With Quote #10

In TF2 there is an entity property "m_bIsCoaching" that allows you to detect coaches. This property does not exist under the same name if at all in CS:GO. If anyone knows of a way to properly detect coaches and not spectators, help would be appreciated.

This is how you would normally get an entity property and check its value:
PHP Code:
    bool iscoach etEntProp(iProp_Send"m_bIsCoaching");
    if(
iscoach) {
        
PrintToServer("Is a coach!");
    } 
Disowned 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 18:39.


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