Raised This Month: $ Target: $400
 0% 

Server Players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
feren02
Senior Member
Join Date: Mar 2012
Old 08-23-2021 , 00:23   Server Players
Reply With Quote #1

Hi good day!

Hope everyone is coping during the pandemic times.

I was wondering if this would matter:

***I run latest YapB in my server and I want to add and kick bots every X***

1. (could be every certain rounds - e.g. every 7th, 15th, 28th round)
2. (could be every X server running time - e.g. every 7 mins or every 15 mins.)
3. (can be modified how many bots are kicked and how many bots are added during X)

Is this possible?

Tried doing these:

PHP Code:
#include <amxmodx>
#include <cstrike>

#define PLUGIN  "addkick"
#define VERSION "1.0"
#define AUTHOR  "nobody"

#define MSGID 81045

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32;
#endif

enum _:ePlayerInfo
{
    
iTotalPlayers,
    
iCtPlayers,
    
iCtAlive,
    
iTerPlayers,
    
iTerAlive
};

new 
iInfo[ePlayerInfo];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
}

public 
client_putinserver(id)
{
    
iInfo[iTotalPlayers]++;

    if(!
task_exists(MSGID))
    {
        
set_task(10.0"displayMessage"MSGID);
    }
}


#if AMXX_VERSION_NUM < 183
public client_disconnect(id)
#else
public client_disconnected(id)
#endif
{
    if( 
get_user_teamid ) == )
        
iInfoiCtPlayers ]--
    else if( 
get_user_teamid ) == )
        
iInfoiTerPlayers ]--

    if(
iInfoiCtPlayers ] + iInfoiTerPlayers ] == )
    {
        
remove_task(MSGID);
        
server_cmd("yb kick");
    }

-- in the 1st script above, my trial goal is to kick a bot when ct / t players are equivalent to 8 players combined. However nothing happens. What can be the problem?


------------------------------------------------------------


PHP Code:
#include < amxmodx >
#include < cstrike >
#include < fakemeta >

#define PLUGIN  "AddKick"
#define VERSION "1.0"
#define AUTHOR  "nobody"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
}

public 
New_Roundid 

    static 
iRoundCount 
    
++iRoundCount 
     
    
if(iRoundCount == 2)        // Restart on the 2nd round 
    

        
//iRoundCount = 0 
        
server_cmd("yb kick")
        
server_cmd("yb kick")
        
server_cmd("yb kick")
    } 



public 
New_Round2id 

    static 
iRoundCount 
    
++iRoundCount 
     
    
if(iRoundCount == 15)        // Restart on the 15th round 
    

        
iRoundCount 
        server_cmd
("yb add 4 1 5")
    } 


public 
New_Round3id 

    static 
iRoundCount 
    
++iRoundCount 
     
    
if(iRoundCount == 18)        // Restart on the 18th round 
    

        
iRoundCount 
        server_cmd
("yb add 4 1 5")
        
server_cmd("yb add 4 1 5")
        
server_cmd("yb add 4 1 5")
    } 


public 
New_Round4id 

    static 
iRoundCount 
    
++iRoundCount 
     
    
if(iRoundCount == 21)        // Restart on the 21st round 
    

        
iRoundCount 
        server_cmd
("yb kick")
        
server_cmd("yb kick")
    } 


public 
New_Round5id 

    static 
iRoundCount 
    
++iRoundCount 
     
    
if(iRoundCount == 24)        // Restart on the 24th round 
    

        
iRoundCount 
        server_cmd
("yb kick")
    } 

-- in the 2nd script I am doing, it aims to add or kick bots during X rounds, which is more easier. But still nothing happens in-game. What do I lack?



LOOKING FORWARD! Thank you!
feren02 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 08-23-2021 , 04:03   Re: Server Players
Reply With Quote #2

Perhaps u wanna share the original code of the first plugin you're using? It looks like a code i wrote a while ago, but shit's missing. You're never increasing iCtPlayers & iTerPlayers, so their value will always be 0.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
feren02
Senior Member
Join Date: Mar 2012
Old 08-23-2021 , 20:56   Re: Server Players
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
Perhaps u wanna share the original code of the first plugin you're using? It looks like a code i wrote a while ago, but shit's missing. You're never increasing iCtPlayers & iTerPlayers, so their value will always be 0.
Hi sure, this is the script I used which was posted in the SCRIPTING HELP section. Thanks! Can you help me? And also on the script I posted per x ROUNDS to add or kick bots? Looking forward.


PHP Code:
#include <amxmodx>
#include <cstrike>

#define PLUGIN  "Show Players"
#define VERSION "1.0"
#define AUTHOR  "NapoleoN#"

#define MSGID 81045

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32;
#endif

enum _:ePlayerInfo
{
    
iTotalPlayers,
    
iCtPlayers,
    
iCtAlive,
    
iTerPlayers,
    
iTerAlive
};

new 
iInfo[ePlayerInfo];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
}

public 
client_putinserver(id)
{
    
iInfo[iTotalPlayers]++;

    if(!
task_exists(MSGID))
    {
        
set_task(10.0"displayMessage"MSGID);
    }
}


#if AMXX_VERSION_NUM < 183
public client_disconnect(id)
#else
public client_disconnected(id)
#endif
{
    if( 
get_user_teamid ) == )
        
iInfoiCtPlayers ]--
    else if( 
get_user_teamid ) == )
        
iInfoiTerPlayers ]--

    if(
iInfoiCtPlayers ] + iInfoiTerPlayers ] == )
    {
        
remove_task(MSGID);
        
server_cmd("restart");
    }
}

public 
displayMessage()
{
    if(
task_exists(MSGID))
    {
        new 
iPlayers[MAX_PLAYERS], iNum;

        
get_players(iPlayersiNum"e""TERRORIST");
        
iInfo[iTerPlayers] = iNum;

        
get_players(iPlayersiNum"ae""TERRORIST");
        
iInfo[iTerAlive] = iNum;

        
get_players(iPlayersiNum"e""CT");
        
iInfo[iCtPlayers] = iNum;

        
get_players(iPlayersiNum"ae""CT");
        
iInfo[iCtAlive] = iNum;

        
get_players(iPlayersiNum);

        for(new 
iiNumi++)
        {
            
set_hudmessage(25515550, -1.00.000.01.10.10.23);            
            
//set_hudmessage(random(255), random(255), random(255), -1.0, 0.0, 0, 0.0, 1.1, 0.1, 0.2, -1);
            
show_hudmessage(iPlayers[i], "Terrorists: %i/%i | Counter-Terrorists: %i/%i",
                              
iInfo[iTerAlive], iInfo[iTerPlayers],
                              
iInfo[iCtAlive], iInfo[iCtPlayers]);
        }
        
set_task(1.1"displayMessage"MSGID);
    }

feren02 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 08-23-2021 , 21:49   Re: Server Players
Reply With Quote #4

It's actually really simple.

PHP Code:
#include <amxmodx>

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

new const iPlayersReq 8;

new 
g_iTotalPlayers;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
}

public 
client_putinserver(id)
{
    if(++
g_iTotalPlayers == iPlayersReq)
    {
        
server_cmd("yb kick");
    }

PHP Code:
#include <amxmodx>

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

new g_iRoundNum;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);

    
register_event("HLTV""newRound""a""1=0""2=0");
    
register_event("TextMsg""commenceRestart""a""2&#Game_C""2&#Game_w");
}

public 
newRound()
{
    switch(++
g_iRoundNum// g_iRoundNum is increased at this point.
    
{
        case 
2
        {
            for(new 
i2i++)
            {
                
server_cmd("yb kick");
                
log_amx("Bot # %i kicked."i);
            }
        }
        case 
15
        {
            
server_cmd("yb add 4 1 5");
            
server_cmd("sv_restart 1");

            
log_amx("Round %i."g_iRoundNum);

            
commenceRestart(); // g_iRoundNum is reset to 0, we're having a new round.

        
}
    }
}

public 
commenceRestart()
{
    
g_iRoundNum 0;
    
log_amx("Variable succesfuly reset.");

__________________

Last edited by Napoleon_be; 08-28-2021 at 08:28.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
feren02
Senior Member
Join Date: Mar 2012
Old 08-23-2021 , 22:26   Re: Server Players
Reply With Quote #5

Quote:
Originally Posted by Napoleon_be View Post
It's actually really simple.

PHP Code:
#include <amxmodx>

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

new const iPlayersReq 8;

new 
g_iTotalPlayers;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
}

public 
client_putinserver(id)
{
    if(++
g_iTotalPlayers == iPlayersReq)
    {
        
server_cmd("yb kick");
    }

PHP Code:
#include <amxmodx>

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

new g_iRoundNum;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);

    
register_event("HLTV""newRound""a""1=0""2=0");
}

public 
newRound()
{
    switch(++
g_iRoundNum)
    {
        case 
2
        {
            for(new 
i2i++)
            {
                
server_cmd("yb kick");
            }
        }
        case 
15
        {
            
server_cmd("yb add 4 1 5");
            
server_cmd("sv_restart 1");
            
g_iRoundNum 0;
        }
    }


Let me try these. Will get back what happens soonest. Thank you for giving out our time.
feren02 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-24-2021 , 00:42   Re: Server Players
Reply With Quote #6

You should've reset the variable g_iRoundNum on game commencing and on round restart. ( g_iRoundNum = 0 )
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
feren02
Senior Member
Join Date: Mar 2012
Old 08-24-2021 , 01:22   Re: Server Players
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
You should've reset the variable g_iRoundNum on game commencing and on round restart. ( g_iRoundNum = 0 )
What does this mean?
feren02 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-24-2021 , 01:30   Re: Server Players
Reply With Quote #8

Quote:
Originally Posted by feren02 View Post
What does this mean?

PHP Code:
public plugin_init()
{
   
register_event("TextMsg""commence_restart_event""a""2=#Game_Commencing""2=#Game_will_restart_in");
}

public 
commence_restart_event()
{
   
g_iRoundNum 0;

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
feren02
Senior Member
Join Date: Mar 2012
Old 08-24-2021 , 01:37   Re: Server Players
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
PHP Code:
public plugin_init()
{
   
register_event("TextMsg""commence_restart_event""a""2=#Game_Commencing""2=#Game_will_restart_in");
}

public 
commence_restart_event()
{
   
g_iRoundNum 0;

Yep meaning it will not add or kick when game commences?
feren02 is offline
feren02
Senior Member
Join Date: Mar 2012
Old 08-24-2021 , 03:46   Re: Server Players
Reply With Quote #10

Quote:
Originally Posted by feren02 View Post
Let me try these. Will get back what happens soonest. Thank you for giving out our time.
I initially tried the add and kick based on X Rounds. Nothing is happening in-game.

Compilation good. No errors in debug. It's just that nothing happens no bots are added.
feren02 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:53.


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