HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5.  
  6. new const PLUGIN[] = "Invis Menu"
  7. new const VERSION[] = "1.1"
  8. new const AUTHOR[] = "Ismeretlen"
  9.  
  10. #define MAX_ENTITYS 900+15*32
  11.  
  12. new bool:g_bPlayerInvisible[33];
  13. new bool:g_bWaterInvisible[33];
  14.  
  15. new bool:g_bWaterEntity[MAX_ENTITYS];
  16. new bool:g_bWaterFound;
  17.  
  18. new g_iSpectatedId[33];
  19.  
  20. public plugin_init( )
  21. {
  22. register_plugin(PLUGIN,VERSION,AUTHOR);
  23.  
  24. register_clcmd( "say /invis", "menuInvisDisplay" );
  25. register_menucmd( register_menuid( "\yInvis Menu^n^n" ), 1023, "menuInvisAction" );
  26.  
  27. register_forward( FM_AddToFullPack, "fwdAddToFullPack_Post", 1 );
  28. RegisterHam( Ham_Spawn, "player", "hamSpawnPlayer_Post", 1 );
  29.  
  30. register_event( "SpecHealth2", "eventSpecHealth2", "bd" );
  31. }
  32.  
  33. public plugin_cfg( )
  34. {
  35. new ent = -1;
  36. while( ( ent = find_ent_by_class( ent, "func_water" ) ) != 0 )
  37. {
  38.  
  39. if( !g_bWaterFound )
  40. {
  41. g_bWaterFound = true;
  42. }
  43.  
  44. g_bWaterEntity[ent] = true;
  45. }
  46.  
  47. ent = -1;
  48. while( ( ent = find_ent_by_class( ent, "func_illusionary" ) ) != 0 )
  49. {
  50. if( pev( ent, pev_skin ) == CONTENTS_WATER )
  51. {
  52. if( !g_bWaterFound )
  53. {
  54. g_bWaterFound = true;
  55. }
  56.  
  57. g_bWaterEntity[ent] = true;
  58. }
  59. }
  60.  
  61. ent = -1;
  62. while( ( ent = find_ent_by_class( ent, "func_conveyor" ) ) != 0 )
  63. {
  64. if( pev( ent, pev_spawnflags ) == 3 )
  65. {
  66. if( !g_bWaterFound )
  67. {
  68. g_bWaterFound = true;
  69. }
  70.  
  71. g_bWaterEntity[ent] = true;
  72. }
  73. }
  74. }
  75.  
  76. public fwdAddToFullPack_Post( es_handle, e, ent, host, hostflags, player, pset )
  77. {
  78. if( player && g_bPlayerInvisible[host] && host != ent && ent != g_iSpectatedId[host] && get_user_team(host) == get_user_team(ent) )
  79. {
  80. static const Float:corner[8][3] =
  81. {
  82. { -4096.0, -4096.0, -4096.0 },
  83. { -4096.0, -4096.0, 4096.0 },
  84. { -4096.0, 4096.0, -4096.0 },
  85. { -4096.0, 4096.0, 4096.0 },
  86. { 4096.0, -4096.0, -4096.0 },
  87. { 4096.0, -4096.0, 4096.0 },
  88. { 4096.0, 4096.0, -4096.0 },
  89. { 4096.0, 4096.0, 4096.0 }
  90. };
  91.  
  92. static const Float:map_distance = 7094.480108;
  93.  
  94. static Float:origin[3];
  95. get_es( es_handle, ES_Origin, origin );
  96.  
  97. static i;
  98. while( get_distance_f( origin, corner[i] ) > map_distance )
  99. {
  100. if( ++i >= sizeof( corner ) )
  101. {
  102. i = 0;
  103. }
  104. }
  105.  
  106. set_es( es_handle, ES_Origin, corner[i] );
  107. set_es( es_handle, ES_Effects, get_es( es_handle, ES_Effects ) | EF_NODRAW );
  108. }
  109. else if( g_bWaterInvisible[host] && g_bWaterEntity[ent])
  110. {
  111. set_es( es_handle, ES_Effects, get_es( es_handle, ES_Effects ) | EF_NODRAW );
  112. }
  113. }
  114.  
  115. public hamSpawnPlayer_Post( id )
  116. {
  117. g_iSpectatedId[id] = 0;
  118. }
  119.  
  120. public eventSpecHealth2( id )
  121. {
  122. g_iSpectatedId[id] = read_data( 2 );
  123. }
  124.  
  125. public menuInvisDisplay( id )
  126. {
  127. static menu[256];
  128.  
  129. new len = formatex( menu, 255, "\yInvis Menu^n^n" );
  130.  
  131. len += formatex( menu[len], 255 - len, "\r1. \wJatekosok: %s^n", g_bPlayerInvisible[id] ? "Lathatatlan" : "Lathato" );
  132.  
  133. if( g_bWaterFound )
  134. {
  135. len += formatex( menu[len], 255 - len, "\r2. \wViz: %s^n", g_bWaterInvisible[id] ? "Lathatatlan" : "Lathato" );
  136. }
  137. else
  138. {
  139. len += formatex( menu[len], 255 - len, "\r2. \wViz: Nem talalhato viz textura ezen a palyan!^n" );
  140. }
  141.  
  142. len += formatex( menu[len], 255 - len, "^n\r0. \wKilepes" );
  143.  
  144. show_menu( id, ( 1<<0 | 1<<1 | 1<<9 ), menu, -1 );
  145.  
  146. return PLUGIN_HANDLED;
  147. }
  148.  
  149. public menuInvisAction( id, key )
  150. {
  151. switch( key )
  152. {
  153. case 0:
  154. {
  155. g_bPlayerInvisible[id] = !g_bPlayerInvisible[id];
  156. menuInvisDisplay( id );
  157. }
  158. case 1:
  159. {
  160. if( g_bWaterFound )
  161. {
  162. g_bWaterInvisible[id] = !g_bWaterInvisible[id];
  163. }
  164.  
  165. menuInvisDisplay( id );
  166. }
  167. case 9: show_menu( id, 0, "" );
  168. }
  169. }
  170.  
  171. public client_connect( id )
  172. {
  173. g_bPlayerInvisible[id] = false;
  174. g_bWaterInvisible[id] = false;
  175. g_iSpectatedId[id] = 0;
  176. }