PDA

View Full Version : ID of an Random T


mottzi
06-27-2010, 06:39
Good afternoon AM!

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


Thanks :wink:

I tried it myself but that cant work:

new random1
new players[32], pnum, tempid;
new max1 = 0
get_players(players, pnum, "a");

for( new i; i<pnum; i++ )
{
tempid = players[i]
vip[tempid] = 0
if(cs_get_user_team(tempid) == CS_TEAM_T)
{
max1++
}
}

random1 = random_num(1, max1)


Mottzi

xPaw
06-27-2010, 06:59
new random1
new players[32], pnum, tempid;
new max1 = 0, terrs[ 32 ];
get_players(players, pnum, "a");

for( new i; i<pnum; i++ )
{
tempid = players[i]
// vip[tempid] = 0
if(cs_get_user_team(tempid) == CS_TEAM_T)
{
terrs[ max1++ ] = tempid;
}
}

random1 = terrs[ random_num(1, max1) ];

hleV
06-27-2010, 07:18
new players[32], num;
get_players(players, num, "a", "TERRORIST");

new t = players[random(num)];

mottzi
06-27-2010, 15:33
new players[32], num;
get_players(players, num, "a", "TERRORIST");

new t = 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 =)