Raised This Month: $ Target: $400
 0% 

Randomly select players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
elpouletorange
Senior Member
Join Date: Oct 2007
Old 07-14-2008 , 14:10   Randomly select players
Reply With Quote #1

Hi, I want to select (1/4) of player playing each 5 rounds and make them have special ability (too they are tranfered in Ts team and all orther in CTs team). But I have really no idea how to make this. Can someone please make me a the basic of this.

Thanks
__________________
I am 42% addicted to Counterstrike. What about you?

No more CS for me....
elpouletorange is offline
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
elpouletorange
Senior Member
Join Date: Oct 2007
Old 07-18-2008 , 16:59   Re: Randomly select players
Reply With Quote #3

Do the selected players are transfered and Ts team and all orther in Cts one ?
Where do I put the special ability ? (exemple: set_user_armor(id, "255")

Thanks a lot!
__________________
I am 42% addicted to Counterstrike. What about you?

No more CS for me....
elpouletorange is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-18-2008 , 17:15   Re: Randomly select players
Reply With Quote #4

Edited code for an example for what you want.
Also, I think you should read and understand the code before you use it.
That way, you can try stuff yourself
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
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 05:36.


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