Advertisement
iXdoctor

Random prefix color

Jun 23rd, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5.  
  6. enum _: Cvars
  7. {
  8. iTextPrefix
  9. }
  10.  
  11. new pCvar[ Cvars ];
  12.  
  13. public plugin_init()
  14. {
  15. pCvar[ iTextPrefix ] = register_cvar( "hnr_prefix", "Shoot`" );
  16. }
  17.  
  18. stock ColorChat( const index, const string[], { Float, Sql, Resul,_ }:... )
  19. {
  20. new msg[ 191 ], players[ 32 ], count = 1, iPrefix[ 32 ];
  21.  
  22. get_cvar_string( "hnr_prefix", iPrefix, charsmax( iPrefix ) );
  23.  
  24. static len[ 3 ];
  25.  
  26. len[ 0 ] = formatex( msg, charsmax( msg ), "^1[ ^4%s^1 ] ", iPrefix )
  27.  
  28. len[ 1 ] = formatex( msg, charsmax( msg ), "^3[ ^4%s^3 ]^1 ", iPrefix )
  29.  
  30. len[ 2 ] = formatex( msg, charsmax( msg ), "^4[ ^3%s^4 ]^1 ", iPrefix )
  31.  
  32. new iRandom = random_num( len[ 0 ], len[ 2 ] );
  33.  
  34. vformat( msg[ iRandom ], charsmax( msg ) - iRandom, string, 3 );
  35.  
  36. if( index )
  37. players[ 0 ] = index;
  38.  
  39. else
  40. get_players( players, count, "ch" );
  41.  
  42. for( new i = 0; i < count; i++ )
  43. {
  44. if( !is_user_connected( players[ i ] ) )
  45. continue;
  46.  
  47. message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
  48.  
  49. write_byte( players[ i ] );
  50.  
  51. write_string( msg );
  52.  
  53. message_end( );
  54.  
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement