Raised This Month: $ Target: $400
 0% 

get_players only from CT & TT(don't count Spectator and Unassigned players)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugg
Senior Member
Join Date: Jan 2012
Old 02-15-2014 , 13:49   get_players only from CT & TT(don't count Spectator and Unassigned players)
Reply With Quote #1

I want count all players only from "TERRORIST" And "CT" Teams.

but with this --> count all players, i dont wanna count players from Spectator team and unassigned players.
PHP Code:
new players[32], count;    
    
get_players(playerscount); 
Im looking here http://www.amxmodx.org/doc/index.htm...et_players.htm

But no flags for that :S.

Ty.
Bugg is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-15-2014 , 13:58   Re: get_players only from CT & TT(don't count Spectator and Unassigned players)
Reply With Quote #2

PHP Code:
get_playersplayerscount"eh" "CT" 
That will get only the players on the CT team.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 02-15-2014 at 13:59.
wickedd is offline
Bugg
Senior Member
Join Date: Jan 2012
Old 02-15-2014 , 15:12   Re: get_players only from CT & TT(don't count Spectator and Unassigned players)
Reply With Quote #3

Yeah, but i need CT and TT at the same time.
Bugg is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-15-2014 , 15:52   Re: get_players only from CT & TT(don't count Spectator and Unassigned players)
Reply With Quote #4

PHP Code:
get_playersplayerscount_ct"eh" "CT" )
get_playersplayerscount_t"eh""TERRORIST" 
Before you ask anymore question, search the forum.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Bugg
Senior Member
Join Date: Jan 2012
Old 02-15-2014 , 16:42   Re: get_players only from CT & TT(don't count Spectator and Unassigned players)
Reply With Quote #5

This looks good?

PHP Code:
new ts[32],cts[32], countTcountCT;        
    
get_players(tscountT"e""TERRORIST");
    
get_players(ctscountCT"e""CT");
    
    if (
countT && countCT)              
    {
        new 
iPlayer ts && cts[random(countT && countCT)]; 
Bugg is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-15-2014 , 18:21   Re: get_players only from CT & TT(don't count Spectator and Unassigned players)
Reply With Quote #6

No it doesn't. What are you trying to do?
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 02-15-2014 , 19:59   Re: get_players only from CT & TT(don't count Spectator and Unassigned players)
Reply With Quote #7

It would probably be easier just to make your own loop in this case.
This seems pretty stupid:
Code:
    new players[33], playersnum;     new players_t[32], players_ct[32], playersnum_t, playersnum_ct;     get_players(players_t, playersnum_t, "eh", "TERRORIST");     get_players(players_ct, playersnum_ct, "eh", "CT");         copy(players, charsmax(players), players_t);     copy(players[playersnum_t], charsmax(players) - playersnum_t, players_ct);     playersnum = playersnum_t + playersnum_ct;         new randomplayer = players[random(playersnum)];
__________________
Black Rose is offline
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 02-16-2014 , 04:11   Re: get_players only from CT & TT(don't count Spectator and Unassigned players)
Reply With Quote #8

PHP Code:
stock ActivePlayers(team /*1 = TR | 2 = CT*/bool:alive false) {
    static 
players[32], num;
    
get_players(playersnumalive "aceh" "bce"team == "TERRORIST" "CT");

    return 
num;

Example plugin:
PHP Code:
#include <amxmodx>

new all_ttall_ct;
new 
alive_ttalive_ct;

public 
plugin_init() register_clcmd("say /test""TestCommand");

public 
TestCommand(id) {
    
UpdatePlayers();

    
client_print(id3"On the server is:");
    
client_print(id3"%i terrorists (%i alive), %i cts (%i alive)"all_ttalive_ttall_ctalive_ct);
}

stock UpdatePlayers() {
    
all_tt ActivePlayers(1);
    
all_ct ActivePlayers(2);
    
alive_tt ActivePlayers(1true);
    
alive_ct ActivePlayers(2true);
}

stock ActivePlayers(teambool:alive false) {
    static 
players[32], num;
    
get_players(playersnumalive "aceh" "bce"team == "TERRORIST" "CT");

    return 
num;

Can also like this:

PHP Code:
stock ActivePlayers(CsTeams:teambool:alive false) {
    static 
gracze[32], ileiactive;
    
get_players(graczeilealive "ach" "bc");
    
active 0;
    for(
0ile; ++i)
        if(
cs_get_user_team(gracze[i]) == teamactive++;

    return 
active;

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

new all_ttall_ct;
new 
alive_ttalive_ct;

public 
plugin_init() register_clcmd("say /test""TestCommand");

public 
TestCommand(id) {
    
UpdatePlayers();

    
client_print(id3"On the server is:");
    
client_print(id3"%i terrorists (%i alive), %i cts (%i alive)"all_ttalive_ttall_ctalive_ct);
}

stock UpdatePlayers() {
    
all_tt ActivePlayers(CS_TEAM_T);
    
all_ct ActivePlayers(CS_TEAM_CT);
    
alive_tt ActivePlayers(CS_TEAM_Ttrue);
    
alive_ct ActivePlayers(CS_TEAM_CTtrue);
}

stock ActivePlayers(CsTeams:teambool:alive false) {
    static 
players[32], numiactive;
    
get_players(playersnumalive "ach" "bc");
    
active 0;
    for(
0numi++)
        if(
cs_get_user_team(players[i]) == teamactive++;

    return 
active;


Last edited by OnePL; 02-16-2014 at 04:20.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
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 04:56.


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