Raised This Month: $32 Target: $400
 8% 

How to make when all players alive ready set warmuptime 0


Post New Thread Reply   
 
Thread Tools Display Modes
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 07-26-2017 , 13:48   Re: How to make when all players alive ready set warmuptime 0
Reply With Quote #11

Try this

PHP Code:
#include <sourcemod> 

ConVar mp_warmup_time null
bool g_bPlayerReady[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
mp_warmup_time FindConVar"mp_warmuptime" ); 
    
RegConsoleCmd"sm_ready"command_ready"Allows players to toggle whether or not they are ready" );
}

public 
void OnClientDisconnectint client )
{
    
g_bPlayerReady[client] = false;
}

void checkPlayers() 

    if( ( 
GetTeamAliveAndReadyCount) + GetTeamAliveAndReadyCount) ) ==  GetPlayerCount() ) 
    {
        
mp_warmup_time.IntValue 0;
    }


stock int GetTeamAliveAndReadyCountint iTeamNum )
{
    
int iCount;
    
    for( 
int iClient 1iClient <= MaxClientsiClient++ )
    {
        if( 
IsClientInGameiClient ) && GetClientTeamiClient ) == iTeamNum && IsPlayerAliveiClient ) && g_bPlayerReady[iClient] )
        {
            
iCount++;
        }
    }
    
    return 
iCount
}

stock int GetPlayerCount() 
{
    
int iCount
    
    for( 
int i 1<= MaxClientsi++ ) 
    { 
        if( 
IsClientInGame) && !IsFakeClient) ) 
        { 
            
iCount++; 
        } 
    }

    return 
iCount
}

public 
Action command_readyint clientint args )
{
    
g_bPlayerReady[client] = !g_bPlayerReady[client];
    
    
int ready_count GetTeamAliveAndReadyCount) + GetTeamAliveAndReadyCount);
    
int total GetPlayerCount();
    
    if( 
g_bPlayerReady[client] )
    {
        
PrintToChatAll"[SM] %N is now ready! (%i/%i)"clientready_counttotal );
        
checkPlayers();
    }
    else
    {
        
PrintToChatAll"[SM] %N is no longer ready. (%i/%i)"clientready_counttotal );
    }
    
    return 
Plugin_Handled;

__________________

Last edited by vortex.; 07-26-2017 at 13:53.
vortex. is offline
arku
Junior Member
Join Date: Jul 2017
Old 07-26-2017 , 13:53   Re: How to make when all players alive ready set warmuptime 0
Reply With Quote #12

Quote:
Originally Posted by vortex. View Post
PHP Code:
mp_warmup_time 
changed to mp_warmuptime

PHP Code:
#include <sourcemod> 

ConVar mp_warmup_time null
bool g_bPlayerReady[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
mp_warmup_time FindConVar"mp_warmuptime" ); 
    
RegConsoleCmd"sm_ready"command_ready"Allows players to toggle whether or not they are ready" );
}

public 
void OnClientDisconnectint client )
{
    
g_bPlayerReady[client] = false;
}

void checkPlayers() 

    if( ( 
GetTeamAliveAndReadyCount) + GetTeamAliveAndReadyCount) ) ==  GetPlayerCount() ) 
    {
        
mp_warmup_time.IntValue 0;
    }


stock int GetTeamAliveAndReadyCountint iTeamNum )
{
    
int iCount;
    
    for( 
int iClient 1iClient <= MaxClientsiClient++ )
    {
        if( 
IsClientInGameiClient ) && GetClientTeamiClient ) == iTeamNum && IsPlayerAliveiClient ) && g_bPlayerReady[iClient] )
        {
            
iCount++;
        }
    }
    
    return 
iCount
}

stock int GetPlayerCount() 
{
    
int iCount
    
    for( 
int i 1<= MaxClientsi++ ) 
    { 
        if( 
IsClientInGame) && !IsFakeClient) ) 
        { 
            
iCount++; 
        } 
    }

    return 
iCount
}

public 
Action command_readyint clientint args )
{
    
g_bPlayerReady[client] = !g_bPlayerReady[client];
    
    
int ready_count GetTeamAliveAndReadyCount) + GetTeamAliveAndReadyCount);
    
int total GetPlayerCount();
    
    if( 
g_bPlayerReady[client] )
    {
        
PrintToChatAll"[SM] %N is now ready! (%i/%i)"clientready_counttotal );
        
checkPlayers();
    }
    else
    {
        
PrintToChatAll"[SM] %N is no longer ready. (%i/%i)"clientready_counttotal );
    }
    
    return 
Plugin_Handled;

Thanks ! It works perfectly !
For who needs this plugin, can be found here !
Attached Files
File Type: sp Get Plugin or Get Source (plugin.sp - 125 views - 1.8 KB)

Last edited by headline; 07-27-2017 at 04:08.
arku is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 07-26-2017 , 14:05   Re: How to make when all players alive ready set warmuptime 0
Reply With Quote #13

...I remember, CSGO have server command to disable warmup. So not need change cvar value
*edit
I can't find it for now
__________________
Do not Private Message @me

Last edited by Bacardi; 07-26-2017 at 14:06.
Bacardi is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 07-26-2017 , 15:21   Re: How to make when all players alive ready set warmuptime 0
Reply With Quote #14

Quote:
Originally Posted by Bacardi View Post
...I remember, CSGO have server command to disable warmup. So not need change cvar value
*edit
I can't find it for now
mp_do_warmup_period 0?
Which has never worked for me and had to execute mp_warmup_end after a very short period of time after map start...
__________________
ambn is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 07-26-2017 , 18:09   Re: How to make when all players alive ready set warmuptime 0
Reply With Quote #15

Woops, misspelled the ConVar
hmmmmm is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 07-26-2017 , 22:07   Re: How to make when all players alive ready set warmuptime 0
Reply With Quote #16

Quote:
Originally Posted by hmmmmm View Post
Woops, misspelled the ConVar
Uh, not really i guess as i checked again and seems the spelling is fine ..
https://developer.valvesoftware.com/..._warmup_period
__________________
ambn is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 07-27-2017 , 02:46   Re: How to make when all players alive ready set warmuptime 0
Reply With Quote #17

Sorry, didn't mean the mp_do_warmup_period thing. The thing I posted earlier had mp_warmup_time instead of mp_warmuptime
hmmmmm 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 20:41.


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