Raised This Month: $60 Target: $400
 15% 

how get count of players


Post New Thread Reply   
 
Thread Tools Display Modes
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-04-2011 , 00:25   Re: how get count of players
Reply With Quote #11

Quote:
Originally Posted by Doc-Holiday View Post

iPlayers[i] -> iPlayers[iNum] ??
Yes.
And < to <=, my bad.
__________________
- tired and retired -
ConnorMcLeod is offline
Old 10-05-2011, 03:57
a7811311622
This message has been deleted by a7811311622. Reason: mistake
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 10-09-2011 , 07:07   Re: how get count of players
Reply With Quote #12

ConnorMcLeod
how to add a bots (PODBot v 3x) to this count of players?
They does not have a [BOT] tag in scoreboard table. The have instead [bot] a ping numbers..
__________________
sorry my bad english...

Last edited by alonelive; 10-09-2011 at 07:35.
alonelive is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-09-2011 , 10:17   Re: how get count of players
Reply With Quote #13

This will count any type of bot, not just podbot.
PHP Code:
new iT iCT iBots;
CountTeamsiT iCT iBots );

CountTeams(&TERRORISTS, &CTS, &BOTS)
{
    
TERRORISTS 0
    CTS 
0
    BOTS 
0

    
new iPlayers[32], iNum iPlayer
    get_players
(iPlayersiNum"h")
    
    if( !
iNum )
    {
        return
    }
    
    for ( new 
iNum p++ )
    {
        
iPlayer iPlayers]
        
        if ( 
is_user_botiPlayer ) )
            ++
BOTS
        
        
switch( cs_get_user_team(iPlayer) )
        {
            case 
CS_TEAM_T:++TERRORISTS
            
case CS_TEAM_CT:++CTS
        
}
    }

__________________

Last edited by Bugsy; 10-09-2011 at 13:56.
Bugsy is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 10-09-2011 , 12:48   Re: how get count of players
Reply With Quote #14

Quote:
L 10/09/2011 - 20:47:23: "AloneLive<1><STEAM_ID_LAN><TERRORIST>" committed suicide with "world"
L 10/09/2011 - 20:47:23: World triggered "Round_Draw" (CT "0") (T "0")
L 10/09/2011 - 20:47:23: [AMXX] Displaying debug trace (plugin "asd.amxx")
L 10/09/2011 - 20:47:23: [AMXX] Run time error 4: index out of bounds
L 10/09/2011 - 20:47:23: [AMXX] [0] asd.sma::CountTeams (line 45)
L 10/09/2011 - 20:47:23: [AMXX] [1] asd.sma::round_end (line 24)
PHP Code:
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("round_end"2"1=Round_End");
    
// Add your code here...
}

public 
round_end()
{
new 
iT iCT iBots;
CountTeamsiT iCT iBots ); 
}



CountTeams(&TERRORISTS, &CTS, &BOTS)
{
    
TERRORISTS 0
    CTS 
0
    BOTS 
0

    
new iPlayers[32], iNum iPlayer
    get_players
(iPlayersiNum"h")
    
    if( !
iNum )
    {
        return
    }
    
    for(--
iNumiNum<=0iNum--)
    {
        
iPlayer iPlayersiNum ]
        
        if ( 
is_user_botiPlayer ) )
            ++
BOTS
        
        
switch( cs_get_user_team(iPlayer) )
        {
            case 
CS_TEAM_T:++TERRORISTS
            
case CS_TEAM_CT:++CTS
        
}
        if(
TERRORISTS == 1)
    
client_print(0print_chat"123")
    }


__________________
sorry my bad english...

Last edited by alonelive; 10-09-2011 at 12:50.
alonelive is offline
ROKronoS
Senior Member
Join Date: Oct 2010
Location: Bucharest, Romania
Old 10-09-2011 , 13:18   Re: how get count of players
Reply With Quote #15

You should check if the player id is valid:
Code:
0 < id < 33
ROKronoS is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 10-09-2011 , 13:43   Re: how get count of players
Reply With Quote #16

Quote:
Originally Posted by ROKronoS View Post
You should check if the player id is valid:
Code:
0 < id < 33
Don't understand..
__________________
sorry my bad english...
alonelive is offline
ROKronoS
Senior Member
Join Date: Oct 2010
Location: Bucharest, Romania
Old 10-09-2011 , 13:47   Re: how get count of players
Reply With Quote #17

PHP Code:
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("round_end"2"1=Round_End");
    
// Add your code here...
}

public 
round_end()
{
new 
iT iCT iBots;
CountTeamsiT iCT iBots ); 
}



CountTeams(&TERRORISTS, &CTS, &BOTS)
{
    
TERRORISTS 0
    CTS 
0
    BOTS 
0

    
new iPlayers[32], iNum iPlayer
    get_players
(iPlayersiNum"h")
    
    if( !
iNum )
    {
        return
    }
    
    for(--
iNumiNum<=0iNum--)
    {
        
iPlayer iPlayersiNum ]

        if( 
iPlayer 33 )
        {
                if ( 
is_user_botiPlayer ) )
                    ++
BOTS
        
                
switch( cs_get_user_team(iPlayer) )
                {
                    case 
CS_TEAM_T:++TERRORISTS
                    
case CS_TEAM_CT:++CTS
                
}
                if(
TERRORISTS == 1)
                    
client_print(0print_chat"123")
        }
    }


ROKronoS is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-09-2011 , 13:58   Re: how get count of players
Reply With Quote #18

That is not the problem, rokronos. get_players only returns players. I edited above code.
__________________
Bugsy is offline
Old 10-09-2011, 13:59
alonelive
This message has been deleted by alonelive. Reason: out of date
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 10-09-2011 , 14:03   Re: how get count of players
Reply With Quote #19

Bugsy
New code works fine, thanx!

But.. Why podbot is bad? I have a linux server.. Too hard with bots in linux..
__________________
sorry my bad english...
alonelive is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 10-09-2011 , 16:04   Re: how get count of players
Reply With Quote #20

Tested with podbot v 3xx - works fine too.
__________________
sorry my bad english...
alonelive 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 23:01.


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