Thread: Server Players
View Single Post
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