Raised This Month: $ Target: $400
 0% 

ID of an Random T


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 06-27-2010 , 06:39   ID of an Random T
Reply With Quote #1

Good afternoon AM!

Can you tell me how to get the ID of a random alive Terrorist?


Thanks

I tried it myself but that cant work:
PHP Code:
    new random1
    
new players[32], pnumtempid;
    new 
max1 0
    get_players
(playerspnum"a");

    for( new 
ii<pnumi++ )
    {
        
tempid players[i]
        
vip[tempid] = 0
        
if(cs_get_user_team(tempid) == CS_TEAM_T)
        {
            
max1++
        }
    }
    
    
random1 random_num(1max1

Mottzi
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers

Last edited by mottzi; 06-27-2010 at 06:42.
mottzi is offline
Send a message via MSN to mottzi
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-27-2010 , 06:59   Re: ID of an Random T
Reply With Quote #2

PHP Code:
    new random1
    
new players[32], pnumtempid;
    new 
max1 0terrs32 ];
    
get_players(playerspnum"a");

    for( new 
ii<pnumi++ )
    {
        
tempid players[i]
    
//    vip[tempid] = 0
        
if(cs_get_user_team(tempid) == CS_TEAM_T)
        {
            
terrsmax1++ ] = tempid;
        }
    }
    
    
random1 terrsrandom_num(1max1) ]; 
__________________
xPaw is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-27-2010 , 07:18   Re: ID of an Random T
Reply With Quote #3

PHP Code:
new players[32], num;
get_players(playersnum"a""TERRORIST");
 
new 
players[random(num)]; 
__________________
hleV is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 06-27-2010 , 15:33   Re: ID of an Random T
Reply With Quote #4

Quote:
Originally Posted by hleV View Post
PHP Code:
new players[32], num;
get_players(playersnum"a""TERRORIST");
 
new 
players[random(num)]; 
So easy? Is this going to work fine, without bugs?

@xPaw thanks. Im going to use ur code if the easier one dont work =)
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers

Last edited by mottzi; 06-28-2010 at 04:00.
mottzi is offline
Send a message via MSN to mottzi
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 14:47.


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