Raised This Month: $433 Target: $400
 108% 

warmup plugin problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ItsExTacY
Member
Join Date: Jul 2017
Location: Israel
Old 03-26-2020 , 12:28   warmup plugin problems
Reply With Quote #1

I'm trying to make a plugin that will make a paused warmup when there are less than two players on the server.
The warmup timer should run and the game would start when there are two players or more.
The OnClientPutInServer works fine but the OnClientDisconnect does nothing...
any help? :\


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

#pragma semicolon 1
#pragma newdecls required


public void OnPluginStart() { 



public 
void OnClientPutInServer(int client

    if(
GetClientCount() < 2){ 
        
ServerCommand("mp_warmup_start"); 
        
ServerCommand("mp_warmup_pausetimer 1"); 
    } 
    else{ 
        
ServerCommand("mp_warmup_pausetimer 0"); 
    } 



public 
void OnClientDisconnect(int client)

    if(
GetClientCount() < 2){ 
        
ServerCommand("mp_warmup_start"); 
        
ServerCommand("mp_warmup_pausetimer 1"); 
    } 
    else{ 
        
ServerCommand("mp_warmup_pausetimer 0"); 
    } 



Last edited by ItsExTacY; 03-26-2020 at 12:33.
ItsExTacY is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-26-2020 , 12:58   Re: warmup plugin problems
Reply With Quote #2

Why I have a feeling that, this feature is in csgo ? Like in csgo match.
Let me look little bit.
__________________
Do not Private Message @me
Bacardi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-26-2020 , 14:25   Re: warmup plugin problems
Reply With Quote #3

CSGO warmup did not work like I was thinking.


If you count human players and not bots, try this event "switch_team"
This exlude spectators, when there are two players on field then it make action.


PHP Code:
/*
Server event "switch_team", Tick 4997:
- "numPlayers" = "0"
- "numSpectators" = "1"
- "avg_rank" = "0"
- "numTSlotsFree" = "15"
- "numCTSlotsFree" = "15"
*/

public void OnPluginStart()
{
    
HookEventEx("switch_team"switch_team);
}

public 
void switch_team(Event event, const char[] namebool dontBroadcast)
{
    
int numPlayers event.GetInt("numPlayers");
    
    if(
numPlayers 2)
    {
        
ServerCommand("mp_warmup_start");
        
ServerCommand("mp_warmup_pausetimer 1");
    } 
    else
    { 
        
ServerCommand("mp_warmup_pausetimer 0"); 
    } 

__________________
Do not Private Message @me

Last edited by Bacardi; 03-26-2020 at 14:27.
Bacardi is offline
ItsExTacY
Member
Join Date: Jul 2017
Location: Israel
Old 03-26-2020 , 15:39   Re: warmup plugin problems
Reply With Quote #4

Quote:
Originally Posted by Bacardi View Post
CSGO warmup did not work like I was thinking.


If you count human players and not bots, try this event "switch_team"
This exlude spectators, when there are two players on field then it make action.


PHP Code:
/*
Server event "switch_team", Tick 4997:
- "numPlayers" = "0"
- "numSpectators" = "1"
- "avg_rank" = "0"
- "numTSlotsFree" = "15"
- "numCTSlotsFree" = "15"
*/

public void OnPluginStart()
{
    
HookEventEx("switch_team"switch_team);
}

public 
void switch_team(Event event, const char[] namebool dontBroadcast)
{
    
int numPlayers event.GetInt("numPlayers");
    
    if(
numPlayers 2)
    {
        
ServerCommand("mp_warmup_start");
        
ServerCommand("mp_warmup_pausetimer 1");
    } 
    else
    { 
        
ServerCommand("mp_warmup_pausetimer 0"); 
    } 

Thank you! btw what are those comments above ?

/*
Server event "switch_team", Tick 4997:
- "numPlayers" = "0"
- "numSpectators" = "1"
- "avg_rank" = "0"
- "numTSlotsFree" = "15"
- "numCTSlotsFree" = "15"
*/
ItsExTacY is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-26-2020 , 17:14   Re: warmup plugin problems
Reply With Quote #5

It's a example of event in console output.

You can see by enabling
sm_cvar net_showevents 2
__________________
Do not Private Message @me
Bacardi 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 13:26.


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