Raised This Month: $ Target: $400
 0% 

Randomly select players


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-14-2008 , 17:01   Re: Randomly select players
Reply With Quote #2

Code:
new g_Rounds; public plugin_init() {     register_event("HLTV", "eventNewRound", "a", "1=0", "2=0");         return PLUGIN_CONTINUE; } public eventNewRound() {     if( ++g_Rounds < 5 )     {         return PLUGIN_CONTINUE;     }         g_Rounds = 0;         new players[32], pnum;     get_players(players, pnum, "c");         // calculate total players being picked     new count = floatround(float(pnum) * 0.25, floatround_ceil);     new i, j;         new specialppl[8], total; // the special people chosen     while( total < count )     {         i = random(pnum); // choose a random player and save         specialppl[total++] = players[i];                 // shift the players down 1 to remove the player just picked         for( j = i; j < pnum; j++ )         {             if( (j + 1) == pnum )             {                 players[j] = 0;             }             else             {                 players[j] = players[j + 1];             }         }     }         new id;     for( new i = 0; i < total; i++ )     {         id = specialppl[i];                 cs_set_user_team(id, CS_TEAM_T);         // you can do other stuff with id as well     }         for( new i = 0; i < pnum; i++ )     {         id = players[i];                 cs_set_user_team(id, CS_TEAM_CT);         // you can do other stuff with id as well     }         return PLUGIN_CONTINUE; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 07-18-2008 at 17:15.
Exolent[jNr] 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 05:36.


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