Raised This Month: $32 Target: $400
 8% 

How to detect an empty team.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 08-21-2014 , 14:57   How to detect an empty team.
Reply With Quote #1

Hello, I'd like to know how to detect an empty team.
for example I have a plugin that does something to a certain team if a player said something.

how to know that the team has no players and stop that command ?
Moody92 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-21-2014 , 14:58   Re: How to detect an empty team.
Reply With Quote #2

Use get_players with flag e and pass the needed team, then check if playersnum is 0.

Sth like this should work just perfect.

Code:
bool:UTIL_IsTeamEmpty( const team[ ] = "" ) {     new iPlayers[ 32 ], iNum     get_players( iPlayers, iNum, "e", team )         if( iNum == 0 )     {         return true     }         return false }

Then you can do:

Code:
if( UTIL_IsTeamEmpty( "TERRORIST" ) ) {     //tero team is empty } if( UTIL_IsTeamEmpty( "CT" ) ) {     //ct team is empty }
__________________

Last edited by HamletEagle; 08-21-2014 at 15:03.
HamletEagle is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 08-22-2014 , 15:10   Re: How to detect an empty team.
Reply With Quote #3

PHP Code:
bool:UTIL_IsTeamEmpty( const team[ ] )
{
     new 
iPlayers32 ], iNum
     get_players 
iPlayersiNum"e" team )

     return ( !
Num )

__________________
alan_el_more is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-23-2014 , 03:17   Re: How to detect an empty team.
Reply With Quote #4

Quote:
Originally Posted by alan_el_more View Post
PHP Code:
bool:UTIL_IsTeamEmpty( const team[ ] )
{
     new 
iPlayers32 ], iNum
     get_players 
iPlayersiNum"e" team )

     return ( !
Num )

There is no difference between them.
__________________
HamletEagle is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 08-25-2014 , 21:45   Re: How to detect an empty team.
Reply With Quote #5

Thank you both. Appreciate the help.
Moody92 is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 08-26-2014 , 01:14   Re: How to detect an empty team.
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
There is no difference between them.
There sure is.
mottzi is offline
Send a message via MSN to mottzi
Old 08-26-2014, 03:27
ZASTRELIS
This message has been deleted by ZASTRELIS.
Old 08-26-2014, 04:36
HamletEagle
This message has been deleted by HamletEagle. Reason: ZASTRELIS deleted his post. My one is not needed anymore.
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 00:25.


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