Raised This Month: $51 Target: $400
 12% 

GetTeamClientCount()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cooltad
Veteran Member
Join Date: Apr 2008
Old 03-05-2010 , 05:57   GetTeamClientCount()
Reply With Quote #1

I use that in the following code:
Code:
                    strCount = GetTeamClientCount(2);
                    CPrintToChat(i, "{red}%s{default} Challengers Appear!", strCount);
No compiling errors/warnings, and nothing in the error logs when Instead of getting what I should have gotten, 1 Challengers Appear!, I got the same thing, but without anything before Challengers.

Is GetTeamClientCount broken?

I think It's because I used %s instead of %f
__________________
Please, give me some rep if you found what I posted useful. :]

Last edited by Cooltad; 03-05-2010 at 06:16.
Cooltad is offline
Arson
BANNED
Join Date: Jan 2005
Old 03-05-2010 , 06:16   Re: GetTeamClientCount()
Reply With Quote #2

I know you probably know more than me but what's wrong with getting maxplayers then filtering the team?
Arson is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 03-05-2010 , 07:12   Re: GetTeamClientCount()
Reply With Quote #3

i believe it returns an int not a string or a float. Im pretty postive its not a string and a float wouldnt make sense since you cant have 1.5 players... so... im pretty sure its int, im to lazy to look in the api to be sure.

Last edited by Dr!fter; 03-05-2010 at 07:14.
Dr!fter is offline
psychonic

BAFFLED
Join Date: May 2008
Old 03-05-2010 , 07:36   Re: GetTeamClientCount()
Reply With Quote #4

PHP Code:
new count GetTeamClientCount(2);
CPrintToChat(i"{red}%d{default} Challengers Appear!"count); 
psychonic is offline
Cooltad
Veteran Member
Join Date: Apr 2008
Old 03-05-2010 , 08:17   Re: GetTeamClientCount()
Reply With Quote #5

Nice, that's what I tried using before I looked at this thread, and it works.
__________________
Please, give me some rep if you found what I posted useful. :]
Cooltad is offline
Cooltad
Veteran Member
Join Date: Apr 2008
Old 03-05-2010 , 19:39   Re: GetTeamClientCount()
Reply With Quote #6

Random question:
for(new i=1;i<=MaxClients;i++)
That usually hooks all connected clients, right?
Well..what if it's inside a 1-second timer, and that timer fires once, and I need data sent to all clients inside that timer?

I need to know if for(new i=1;i<=MaxClients;i++) hooks all players or not, because the 1-second event only is going to happen once..
__________________
Please, give me some rep if you found what I posted useful. :]
Cooltad is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 03-05-2010 , 19:41   Re: GetTeamClientCount()
Reply With Quote #7

That loops through all possible client indexes, yes.

Make sure you add

Code:
if (!IsClientInGame(i))
    continue;
though.
__________________
Greyscale is offline
Cooltad
Veteran Member
Join Date: Apr 2008
Old 03-05-2010 , 19:46   Re: GetTeamClientCount()
Reply With Quote #8

Uh, doesn't that allow it to continue instead of stopping it? O_o
__________________
Please, give me some rep if you found what I posted useful. :]
Cooltad is offline
psychonic

BAFFLED
Join Date: May 2008
Old 03-05-2010 , 19:51   Re: GetTeamClientCount()
Reply With Quote #9

Quote:
Originally Posted by Cooltad View Post
Uh, doesn't that allow it to continue instead of stopping it? O_o
"continue" jumps to the next iteration of the loop.
psychonic is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 03-05-2010 , 22:00   Re: GetTeamClientCount()
Reply With Quote #10

Kind of a misnomer. They should have named it something more like "skip" or "next" in my opinion. I was confused the first time I saw "continue;" as well.
__________________
Greyscale 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 22:08.


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