Raised This Month: $ Target: $400
 0% 

[ Solved ] How to get num of terrorists ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 08-23-2008 , 20:28   Re: How to get num of terrorists ?
Reply With Quote #5

Quote:
Originally Posted by Brad View Post
Don't use that method anyway, though it seems the most common sense way to do it.

Before I give you updated code, I have to question why the hell you'd be looping this. That's a bad idea and needless to boot. Do you want to know the current T count at any given moment?

This code will give you the T count:
Code:
new players[32], playerCnt, playerIdx, terroristCnt;
get_players(players, playerCnt);

for (playerIdx = 0; playerIdx < playerCnt; playerIdx++)
{
   if (get_user_team(players[playerIdx]) == 2)
   {
      terroristCnt++;
   }
}
You'll need to confirm if terrorists are team 1 or 2 as I can't recall at the moment.
You don't need to use both,get_players and a loop. Just use one of them.
PHP Code:
new iTRCount 0
new iMaxPlayers get_maxplayers()
for(new 
i=1;<= iMaxPlayers;i++)
{
    if(
is_user_connected(i) && get_user_team(i) == 1)
        
iTRCount++

danielkza is offline
 



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 03:10.


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