Advertisement
LinkiNPark

HP_BAR_V0.4

Dec 7th, 2012
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.64 KB | None | 0 0
  1. #include a_samp
  2.  
  3. new
  4.     Text: hpDraw [ 2 ] ;
  5.  
  6. public OnFilterScriptInit ( )
  7. {
  8.     for ( new i ; i != 2 ; ++ i )
  9.         hpDraw [ i ] = TextDrawCreate ( 550.6100, 70.1500, "." ),
  10.         TextDrawBackgroundColor ( hpDraw [ i ], -1 ),
  11.         TextDrawFont ( hpDraw [ i ], 2),
  12.         TextDrawLetterSize ( hpDraw [ i ], 0.0, 0.10000 ),
  13.         TextDrawColor ( hpDraw [ i ], -1 ),
  14.         TextDrawSetOutline ( hpDraw [ i ], 0 ),
  15.         TextDrawSetProportional ( hpDraw [ i ], 1 ),
  16.         TextDrawSetShadow ( hpDraw [ i ], 0 ),
  17.         TextDrawUseBox ( hpDraw [ i ], 1 ),
  18.         TextDrawBoxColor ( hpDraw [ i ], -1 ),
  19.         TextDrawTextSize ( hpDraw [ i ], 604.00, 0.0 ) ;
  20.     SetTimer ( "Update", 200, false ) ;
  21.     return 1;
  22. }
  23. public OnFilterScriptExit ( )
  24. {
  25.     for ( new i ; i != 2 ; ++ i )
  26.         TextDrawHideForAll ( hpDraw [ i ] ), TextDrawDestroy ( hpDraw [ i ] ) ;
  27.     return 1 ;
  28. }
  29. forward Update ( ) ;
  30. public Update ( )
  31. {
  32.     for ( new i ; i != MAX_PLAYERS; ++ i )
  33.     {
  34.         if ( !IsPlayerConnected ( i ) ) continue ;
  35.         new
  36.             color_red, color_green, Float: player_hp ;
  37.         GetPlayerHealth ( i, player_hp ) ;
  38.         if ( player_hp > 100 ) player_hp = 100 ;
  39.         TextDrawTextSize ( hpDraw [ 1 ], 544.8 + player_hp * 0.591, 0.0 ) ;
  40.         color_red = floatround ( ( 100 - player_hp ) * 2.55 ), color_green = floatround ( player_hp * 2.55 ) ;
  41.         TextDrawBoxColor ( hpDraw [ 1 ], ( color_red * 0x1000000 ) + ( color_green * 0x10000 ) + 0xFF ) ;
  42.         TextDrawBoxColor ( hpDraw [ 0 ], ( color_red * 0x1000000 ) + ( color_green * 0x10000 ) + 0x33 ) ;
  43.         TextDrawShowForPlayer ( i, hpDraw [ 0 ] ), TextDrawShowForPlayer ( i, hpDraw[ 1 ] ) ;
  44.     }
  45.     SetTimer ( "Update", 200, false ) ;
  46.     return 1;
  47. }
  48. //by LinkiNParkPark
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement