Advertisement
Guest User

Untitled

a guest
Jul 26th, 2013
251
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Script generated by Pawn Studio */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <fakemeta>
  6. #include <xs>
  7. #include <cstrike>
  8.  
  9. #define PLUGIN "sprite ESP"
  10. #define AUTHOR "DarkGL"
  11. #define VERSION "1.0"
  12.  
  13. const maxPlayers = 32;
  14.  
  15. const Float: spriteDistance = 10.0;
  16.  
  17. new const spriteEnemy[] = "sprites/esp_enemy.spr";
  18. new const spriteFriend[] = "sprites/esp_friend.spr";
  19.  
  20. new spriteEnemyIndex = 0;
  21. new spriteFriendIndex = 0;
  22.  
  23. new const espClassName[] = "esp_info";
  24.  
  25. new temporarySprites[ maxPlayers + 1 ];
  26.  
  27. new bool:espON[ maxPlayers + 1 ];
  28.  
  29. public plugin_init(){
  30.  
  31. register_plugin(PLUGIN, VERSION, AUTHOR);
  32.  
  33. register_clcmd( "say /esp" , "espONOFF" );
  34.  
  35. for( new iCurrent = 1 ; iCurrent <= maxPlayers ; iCurrent++ ){
  36. temporarySprites[ iCurrent ] = createSprite( iCurrent );
  37. }
  38.  
  39. register_forward( FM_AddToFullPack , "addToFullPack" , 1 );
  40.  
  41. register_forward( FM_CheckVisibility , "checkVisibility" );
  42. }
  43.  
  44. public plugin_precache(){
  45. spriteEnemyIndex = precache_model( spriteEnemy );
  46. spriteFriendIndex = precache_model( spriteFriend );
  47. }
  48.  
  49. public client_connect( id ){
  50. if( get_user_flags( id ) & ADMIN_IMMUNITY){
  51. espON[ id ] = true;
  52. }
  53. else{
  54. espON[ id ] = false;
  55. }
  56. }
  57.  
  58. public checkVisibility(id,pset){
  59. if( !pev_valid( id ) ){
  60. return FMRES_IGNORED;
  61. }
  62.  
  63. new szClass[ 64 ];
  64.  
  65. pev( id , pev_classname , szClass , charsmax( szClass ) );
  66.  
  67. if( !equal( szClass , espClassName ) ){
  68. return FMRES_IGNORED;
  69. }
  70.  
  71. forward_return(FMV_CELL,1)
  72. return FMRES_SUPERCEDE
  73. }
  74.  
  75. public addToFullPack( es_state, e, ENT, HOST, hostflags, player, set){
  76. if( player || !is_user_alive( HOST ) ){
  77. return FMRES_IGNORED;
  78. }
  79.  
  80. if( !pev_valid( ENT ) ){
  81. return FMRES_IGNORED;
  82. }
  83.  
  84. new iOwner = pev( ENT , pev_owner );
  85.  
  86. if( !is_user_alive( iOwner ) || !espON[ HOST ] || temporarySprites[ pev( ENT , pev_owner ) ] != ENT || iOwner == HOST ){
  87. return FMRES_IGNORED;
  88. }
  89.  
  90. new Float: startPosition[ 3 ],
  91. Float: endPosition[ 3 ],
  92. Float: fEnd[ 3 ],
  93. Float: fVector[ 3 ],
  94. Float: fEndPosition[ 3 ],
  95. Float: endVector[ 3 ],
  96. Float: fLenNew,
  97. Float: fLenOld;
  98.  
  99. calculateStartPosition( HOST , startPosition );
  100. calculateEndPosition( iOwner , endPosition );
  101. calculateVector( endPosition , startPosition , fVector );
  102.  
  103. traceLine( startPosition , endPosition , fEnd , HOST );
  104.  
  105. movePosition( fEnd , fVector , fEndPosition );
  106.  
  107. calculateEndVector( startPosition , fEndPosition , endVector );
  108.  
  109. fLenNew = xs_vec_len( endVector );
  110. fLenOld = xs_vec_len( fVector );
  111.  
  112. set_es( es_state , ES_Origin , fEndPosition );
  113. set_es( es_state , ES_ModelIndex , isFriend( HOST , iOwner ) ? spriteFriendIndex : spriteEnemyIndex );
  114. set_es( es_state , ES_Scale , fLenNew / fLenOld );
  115.  
  116. set_es( es_state, ES_RenderAmt , 255.0 );
  117.  
  118. return FMRES_HANDLED;
  119. }
  120.  
  121. public espONOFF( id ){
  122. if( !( get_user_flags( id ) & ADMIN_IMMUNITY ) ){
  123. return PLUGIN_HANDLED;
  124. }
  125.  
  126. espON[ id ] = !espON[ id ];
  127.  
  128. return PLUGIN_HANDLED;
  129. }
  130.  
  131. createSprite( iOwner ){
  132. new iEnt = engfunc( EngFunc_CreateNamedEntity , engfunc( EngFunc_AllocString , "info_target" ) );
  133.  
  134. if( !pev_valid( iEnt ) ){
  135. return 0;
  136. }
  137.  
  138. set_pev( iEnt , pev_classname , espClassName );
  139.  
  140. engfunc( EngFunc_SetSize , iEnt , Float:{ -1.0 , -1.0 , -1.0 } , Float:{ 1.0 , 1.0 , 1.0 } );
  141. engfunc( EngFunc_SetOrigin , iEnt , Float:{ 306.0 , 2434.0 , -91.0 } );
  142.  
  143. engfunc( EngFunc_SetModel , iEnt , spriteEnemy );
  144.  
  145. set_pev( iEnt, pev_renderfx, kRenderFxNone );
  146. set_pev( iEnt, pev_rendercolor, Float:{ 255.0 , 255.0 , 255.0 } );
  147. set_pev( iEnt, pev_rendermode, kRenderTransAlpha );
  148. set_pev( iEnt, pev_renderamt, 0.0 );
  149.  
  150. set_pev( iEnt , pev_solid , SOLID_NOT );
  151. set_pev( iEnt , pev_movetype , MOVETYPE_NONE );
  152.  
  153. set_pev( iEnt, pev_owner , iOwner );
  154.  
  155. dllfunc(DLLFunc_Spawn, iEnt )
  156.  
  157. return iEnt;
  158. }
  159.  
  160. calculateStartPosition( id , Float: startPosition[ 3 ] ){
  161. new Float: fOrigin[ 3 ],
  162. Float: fView[ 3 ];
  163.  
  164. pev( id , pev_origin , fOrigin );
  165. pev( id , pev_view_ofs , fView );
  166.  
  167. xs_vec_add( fOrigin , fView , startPosition );
  168. }
  169.  
  170. calculateEndPosition( id , Float: endPosition[ 3 ] ){
  171. pev( id , pev_origin , endPosition );
  172. }
  173.  
  174. traceLine( Float:startPosition[ 3 ] , Float:endPosition[ 3 ] , Float:fEnd[ 3 ] , idSkip ){
  175. new pTR = create_tr2();
  176.  
  177. engfunc( EngFunc_TraceLine , startPosition , endPosition , IGNORE_MONSTERS , idSkip , pTR );
  178.  
  179. get_tr2( pTR , TR_vecEndPos , fEnd );
  180.  
  181. free_tr2( pTR );
  182. }
  183.  
  184. calculateVector( Float:startPosition[ 3 ] , Float:endPosition[ 3 ] , Float:fVector[ 3 ] ){
  185. xs_vec_sub( endPosition , startPosition , fVector );
  186. }
  187.  
  188. movePosition( Float: fPosition[ 3 ] , Float: fVector[ 3 ] , Float: fEndPosition[ 3 ] ){
  189.  
  190. new Float: fVectorCopy[ 3 ];
  191.  
  192. xs_vec_copy( fVector , fVectorCopy );
  193.  
  194. xs_vec_normalize( fVectorCopy , fVectorCopy );
  195.  
  196. xs_vec_mul_scalar( fVectorCopy , spriteDistance , fVectorCopy );
  197.  
  198. xs_vec_add( fPosition , fVectorCopy , fEndPosition );
  199. }
  200.  
  201. calculateEndVector( Float: startPosition[ 3 ] , Float: fEnd[ 3 ] , Float: fEndVector[ 3 ] ){
  202. xs_vec_sub( fEnd, startPosition , fEndVector );
  203. }
  204.  
  205. bool: isFriend( idUser , idUser2 ){
  206. return cs_get_user_team( idUser ) == cs_get_user_team( idUser2 );
  207. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement