Advertisement
LinkiNPark

colors_menu_textdraw

Oct 13th, 2012 (edited)
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.24 KB | None | 0 0
  1. /*
  2.  
  3.     by: LinkiNPark 19.06.2012
  4.  
  5. */
  6.  
  7. #include a_samp
  8. #define MAX_COLOR 400
  9. #define X_SIZE 130.0
  10. #define X_MAX > 472.0
  11. #define X_PLUS += 18.0
  12. #define Y_SIZE 110.0
  13. #define Y_PLUS += 16.0
  14. new
  15.     Text: Draw[ MAX_COLOR + 1 ], color[ MAX_COLOR ] ;
  16. public OnFilterScriptInit()
  17. {
  18.     Draw[ 400 ] = TextDrawCreate(123.0, 104.0, "."), TextDrawBackgroundColor( Draw[ 400 ], 255);
  19.     TextDrawFont( Draw[ 400 ], 1), TextDrawLetterSize( Draw[ 400 ], 0.0, 36.20);
  20.     TextDrawUseBox( Draw[ 400 ], 1), TextDrawBoxColor( Draw[ 400 ], 255);
  21.     TextDrawTextSize( Draw[ 400 ], 490.0, 0.0);
  22.     for ( new i, Float: x = X_SIZE, Float: y = Y_SIZE ; i != sizeof color ; i ++ )
  23.     {
  24.         if ( x X_MAX ) x = X_SIZE, y Y_PLUS ;
  25.         Draw[ i ] = TextDrawCreate(x, y, "."), TextDrawTextSize( Draw[ i ], x + 10.0, 10.00);
  26.         TextDrawBackgroundColor( Draw[ i ], 0x00000000 ), TextDrawFont( Draw[ i ], 1);
  27.         TextDrawLetterSize( Draw[ i ], 0.0, 1.00 ), TextDrawColor( Draw[ i ], -1);
  28.         TextDrawSetOutline( Draw[ i ], 0), TextDrawSetProportional( Draw[ i ], 1);
  29.         TextDrawSetShadow( Draw[ i ], 0), TextDrawUseBox( Draw[ i ], 1);
  30.         color[ i ] = ( ( random ( 0xFF ) * 0x1000000) + ( random ( 0xFF ) * 0x10000) + ( random ( 0xFF ) * 0x100 ) + 0xFF );
  31.         TextDrawBoxColor( Draw[ i ], color[ i ] ), x X_PLUS ;
  32.         TextDrawSetSelectable ( Draw[ i ], true ) ;
  33.     }
  34.     return 1 ;
  35. }
  36. public OnFilterScriptExit()
  37. {
  38.     for ( new i ; i != sizeof( Draw ) ; i ++ ) TextDrawHideForAll( Draw[ i ] ), TextDrawDestroy ( Draw[ i ] ) ;
  39.     return 1 ;
  40. }
  41. public OnPlayerClickTextDraw( playerid, Text:clickedid )
  42. {
  43.     for ( new i ; i != sizeof( Draw ) ; i ++ )
  44.         if ( Draw[ i ] == clickedid )
  45.         {
  46.             SetPlayerColor( playerid, color[ i ] ), CancelSelectTextDraw( playerid ) ;
  47.             for ( new t ; t != sizeof( Draw ); t ++ ) TextDrawHideForPlayer( playerid, Draw[ t ] ) ;
  48.             return 1;
  49.         }
  50.     if ( _:clickedid == INVALID_TEXT_DRAW )
  51.     {
  52.         for ( new t ; t != sizeof( Draw ); t ++ ) TextDrawHideForPlayer( playerid, Draw[ t ] ) ;
  53.     }
  54.     return 1 ;
  55. }
  56. public OnPlayerCommandText(playerid, cmdtext[])
  57. {
  58.     if(strcmp(cmdtext, "/color", true) == 0)
  59.     {
  60.         for ( new i ; i != sizeof( Draw ); i ++ ) TextDrawShowForPlayer( playerid, Draw[ i ]) ;
  61.         SelectTextDraw( playerid, -1 ) ;
  62.         return 1 ;
  63.     }
  64.     return 0;
  65. }
  66. //by LinkiNPark
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement