Raised This Month: $ Target: $400
 0% 

Getting random id


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-18-2007 , 05:52   Re: Getting random id
Reply With Quote #8

You're retrieve a player list with get_players().

players[x] return a player id where 0 <= x <= ctnum - 1.

also players[random_num(1, ctnum)] should be players[random(ctnum)] since players[] start at 0.



It should work fine.

Code:
    get_randomCT_id()     {         static iPlayers[32], iCT_num;         get_players( iPlayers, iCT_num, "e", "CT" );                 if( !iCT_num )             return;                 return iCT_num > 1 ? iPlayers[ random( iCT_num ) ] : iPlayers[ iCT_num - 1 ];     }
__________________

Last edited by Arkshine; 10-18-2007 at 06:06.
Arkshine 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 01:19.


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