Raised This Month: $12 Target: $400
 3% 

Randomizer some terrorists


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kostov
Member
Join Date: Jan 2010
Location: Bulgaria, Sofia
Old 02-10-2010 , 14:01   Randomizer some terrorists
Reply With Quote #1

hi

How can, I set before you started the new round is to choose 2 or 3 terrorists? I had a few suggestions how to do but failed: (

P.S:
sorry for the two subjects I have little trouble browser!

Last edited by kostov; 02-10-2010 at 14:03.
kostov is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-10-2010 , 14:13   Re: Randomizer some terrorists
Reply With Quote #2

Cvar:
random_terrorists <value>
- Set to an integer value for a constant amount of terrorists (Eg. "2" is 2 terrorists always)
- Set to a decimal percent for a percentage of the players should be terrorists (Eg. "0.5" is 50% of players will be terrorist)

Code:
#include < amxmodx > #include < cstrike > #include < hamsandwich > new pCvar_Terrorists; public plugin_init( ) {     register_plugin( "Random Terrorists", "0.0.1", "Exolent" );         register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" );         pCvar_Terrorists = register_cvar( "random_terrorists", "2" ); } public EventNewRound( ) {     new iPlayers[ 32 ], iNum;     get_players( iPlayers, iNum, "a" );         for( new i = 0; i < iNum; i++ )     {         if( !( CS_TEAM_T <= cs_get_user_team( iPlayers[ i ] ) <= CS_TEAM_CT ) )         {             iPlayers[ i-- ] = iPlayers[ --iNum ];         }     }         new szCount[ 16 ], iCount;     get_pcvar_string( pCvar_Terrorists, szCount, 15 );         if( contain( szCount, "." ) >= 0 )     {         iCount = floatround( str_to_float( szCount ) * iNum, floatround_ceil );     }     else     {         iCount = str_to_num( szCount );     }         if( iCount > iNum )     {         iCount = iNum;     }         SortCustom1D( iPlayers, iNum, "RandomizePlayers" );         new iPlayer;     for( new i = 0; i < iCount; i++ )     {         iPlayer = iPlayers[ i ];         if( cs_get_user_team( iPlayer ) != CS_TEAM_T )         {             cs_set_user_team( iPlayer, CS_TEAM_T );             ExecuteHamB( Ham_CS_RoundRespawn, iPlayer );         }     }         for( new i = iCount; i < iNum; i++ )     {         iPlayer = iPlayers[ i ];         if( cs_get_user_team( iPlayer ) != CS_TEAM_CT )         {             cs_set_user_team( iPlayer, CS_TEAM_CT );             ExecuteHamB( Ham_CS_RoundRespawn, iPlayer );         }     } } public RandomizePlayers( iIndex1, iIndex2, iArray[ ], iData[ ], iDataSize ) {     // Example: 50     // 0-49 = return -1     // 50-99 = return 1     static const RANGE = 50;     return ( random( RANGE * 2 ) / RANGE / 2 - 1 ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 02-10-2010 at 14:37.
Exolent[jNr] is offline
kostov
Member
Join Date: Jan 2010
Location: Bulgaria, Sofia
Old 02-10-2010 , 14:33   Re: Randomizer some terrorists
Reply With Quote #3

Thank you, but you doesn't compile giving error:

PHP Code:
cs_set_user_teamiPlayerCS_TEAM_T ); 
54 row
kostov is offline
Old 02-10-2010, 14:36
wrecked_
This message has been deleted by wrecked_.
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-10-2010 , 14:37   Re: Randomizer some terrorists
Reply With Quote #4

Fixed.
__________________
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 14:48.


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