Raised This Month: $ Target: $400
 0% 

[Help] Get total players


Post New Thread Reply   
 
Thread Tools Display Modes
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-20-2017 , 14:42   Re: [Help] Get total players
Reply With Quote #11

Quote:
Originally Posted by Natsheh View Post
how about this?

PHP Code:

get_playersnum_flags
(const flags[]="ch", const team[]="")
/* flags a=get alive players only || b=get dead players only || e=include team(use the team parameter) || c=don't include bots || h=don't include HLTV */
        
new players[32],pnum;
        
get_players(players,pnum,flags,team// check out more flags in the documentation (amxmodx.inc) 
        
return pnum;

__________________
@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
Adventx
Member
Join Date: Feb 2014
Location: Romania
Old 08-20-2017 , 15:06   Re: [Help] Get total players
Reply With Quote #12

I need to use like this, example

PHP Code:
public Function()
{
    
    if (
GetTotalInPlayers(31))
    {
        
// 3 - Both team
        // 1 - Only alive players
        
        // Execute code ...
        
    
}

    if (
GetTotalInPlayers(21))
    {
        
// 2 - Only CTerrorist
        // 3 - All, alive and dead
        
        // Execute code ...
        
    
}
    


Last edited by Adventx; 08-20-2017 at 15:08.
Adventx is offline
Send a message via Yahoo to Adventx
kristi
Senior Member
Join Date: Nov 2016
Old 08-20-2017 , 15:27   Re: [Help] Get total players
Reply With Quote #13

Why do you need to use it as a stock?
Quote:
Originally Posted by fysiks View Post
Simply use get_players() as suggested.
Spoiler

Last edited by kristi; 08-20-2017 at 15:41.
kristi is offline
Send a message via Skype™ to kristi
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-20-2017 , 15:41   Re: [Help] Get total players
Reply With Quote #14

PHP Code:
stock get_playersnum_flags(const flags[]="ch", const team[]=""
/* flags a=get alive players only || b=get dead players only || e=include team(use the team parameter) || c=don't include bots || h=don't include HLTV */ 
        
new players[32],pnumz;
        if( 
equal(team"CT&T") || equal(team"T&SPEC") || equal(team"CT&SPEC"))
        {
                 new 
ct;
                 
get_players(playersctflagsteam[0] == 'C' ?  "CT":"TERRORIST")
                 
get_players(playerspnumflagscontain(team"SPEC") > -"SPECTATOR":"TERRORIST")
                 return (
pnum ct);
         }
        
get_players(players,pnum,flags,team// check out more flags in the documentation (amxmodx.inc)  
        
return pnum


PHP Code:
if (GetTotalInPlayers(31))
    {
        
// 3 - Both team
        // 1 - Only alive players 

PHP Code:
if(get_playersnum_flags("ah""CT&T"))

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


Last edited by Natsheh; 08-23-2017 at 17:24.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Adventx
Member
Join Date: Feb 2014
Location: Romania
Old 08-22-2017 , 11:44   Re: [Help] Get total players
Reply With Quote #15

Quote:
Originally Posted by Natsheh View Post
PHP Code:
get_playersnum_flags(const flags[]="ch", const team[]=""
/* flags a=get alive players only || b=get dead players only || e=include team(use the team parameter) || c=don't include bots || h=don't include HLTV */ 
        
new players[32],pnumz;
        if( 
equal(team"CT&T") || equal(team"T&SPEC") || equal(team"CT&SPEC"))
        {
                 new 
ct;
                 
get_players(playersctflagsteam[0] == 'C' ?  "CT":"TERRORIST")
                 
get_players(playerspnumflagsteam[0] == 'T' "SPECTATOR":"TERRORIST")
                 return (
pnum ct);
         }
        
get_players(players,pnum,flags,team// check out more flags in the documentation (amxmodx.inc)  
        
return pnum


PHP Code:
if (GetTotalInPlayers(31))
    {
        
// 3 - Both team
        // 1 - Only alive players 

PHP Code:
if(get_playersnum_flags("ah""CT&T"))

Thanks, but I need something this, combined in one stock, can help me?

PHP Code:
// Get CTs -returns number of CTs connected-
fnGetCTs()
{
    static 
iCTsid
    iCTs 
0
    
    
for (id 1id <= g_maxplayersid++)
    {
        if (
g_isconnected[id])
        {            
            if (
fm_cs_get_user_team(id) == FM_CS_TEAM_CT)
                
iCTs++
        }
    }
    
    return 
iCTs;
}

// Get Ts -returns number of Ts connected-
fnGetTs()
{
    static 
iTsid
    iTs 
0
    
    
for (id 1id <= g_maxplayersid++)
    {
        if (
g_isconnected[id])
        {            
            if (
fm_cs_get_user_team(id) == FM_CS_TEAM_T)
                
iTs++
        }
    }
    
    return 
iTs;
}

// Get Alive CTs -returns number of CTs alive-
fnGetAliveCTs()
{
    static 
iCTsid
    iCTs 
0
    
    
for (id 1id <= g_maxplayersid++)
    {
        if (
g_isalive[id])
        {            
            if (
fm_cs_get_user_team(id) == FM_CS_TEAM_CT)
                
iCTs++
        }
    }
    
    return 
iCTs;
}

// Get Alive Ts -returns number of Ts alive-
fnGetAliveTs()
{
    static 
iTsid
    iTs 
0
    
    
for (id 1id <= g_maxplayersid++)
    {
        if (
g_isalive[id])
        {            
            if (
fm_cs_get_user_team(id) == FM_CS_TEAM_T)
                
iTs++
        }
    }
    
    return 
iTs;

Adventx is offline
Send a message via Yahoo to Adventx
Adventx
Member
Join Date: Feb 2014
Location: Romania
Old 08-23-2017 , 14:10   Re: [Help] Get total players
Reply With Quote #16

can someone help to combined this functions in one stock ?

PHP Code:
// Get CTs -returns number of CTs connected- 
fnGetCTs() 

    static 
iCTsid 
    iCTs 

     
    
for (id 1id <= g_maxplayersid++) 
    { 
        if (
g_isconnected[id]) 
        {             
            if (
fm_cs_get_user_team(id) == FM_CS_TEAM_CT
                
iCTs++ 
        } 
    } 
     
    return 
iCTs


// Get Ts -returns number of Ts connected- 
fnGetTs() 

    static 
iTsid 
    iTs 

     
    
for (id 1id <= g_maxplayersid++) 
    { 
        if (
g_isconnected[id]) 
        {             
            if (
fm_cs_get_user_team(id) == FM_CS_TEAM_T
                
iTs++ 
        } 
    } 
     
    return 
iTs


// Get Alive CTs -returns number of CTs alive- 
fnGetAliveCTs() 

    static 
iCTsid 
    iCTs 

     
    
for (id 1id <= g_maxplayersid++) 
    { 
        if (
g_isalive[id]) 
        {             
            if (
fm_cs_get_user_team(id) == FM_CS_TEAM_CT
                
iCTs++ 
        } 
    } 
     
    return 
iCTs


// Get Alive Ts -returns number of Ts alive- 
fnGetAliveTs() 

    static 
iTsid 
    iTs 

     
    
for (id 1id <= g_maxplayersid++) 
    { 
        if (
g_isalive[id]) 
        {             
            if (
fm_cs_get_user_team(id) == FM_CS_TEAM_T
                
iTs++ 
        } 
    } 
     
    return 
iTs

Adventx is offline
Send a message via Yahoo to Adventx
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-23-2017 , 15:03   Re: [Help] Get total players
Reply With Quote #17

I just did. Dont be a dumb.
__________________
@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
Adventx
Member
Join Date: Feb 2014
Location: Romania
Old 08-23-2017 , 15:28   Re: [Help] Get total players
Reply With Quote #18

Quote:
Originally Posted by Natsheh View Post
I just did. Dont be a dumb.
I said that I need to combine that functions.
Adventx is offline
Send a message via Yahoo to Adventx
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-23-2017 , 17:22   Re: [Help] Get total players
Reply With Quote #19

// Get CTs -returns number of CTs connected-
PHP Code:
fnGetCTs() 
PHP Code:
get_playersnum_flags("he""CT"

// Get Ts -returns number of Ts connected-
PHP Code:
fnGetTs() 
PHP Code:
get_playersnum_flags("he""TERRORIST"


// Get Alive CTs -returns number of CTs alive-
PHP Code:
fnGetAliveCTs() 
PHP Code:
get_playersnum_flags("ahe""CT"


// Get Alive Ts -returns number of Ts alive-
PHP Code:
fnGetAliveTs() 
PHP Code:
get_playersnum_flags("ahe""TERRORIST"


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


Last edited by Natsheh; 08-23-2017 at 17:23.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 08-23-2017 , 20:23   Re: [Help] Get total players
Reply With Quote #20

For GOD'S sake, this is the last reply of this post.
__________________
Relaxing 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 01:16.


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