HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2.  
  3. #include <cstrike>
  4.  
  5. #include <engine>
  6.  
  7. #include <zp50_core>
  8.  
  9. #include <zp50_items>
  10.  
  11. #include <zp50_class_nemesis>
  12.  
  13. #include <zp50_class_survivor>
  14.  
  15. #include <colorchat>
  16.  
  17.  
  18.  
  19. new const PLUGIN[] = "Jetpack Lite";
  20.  
  21. new const VERSION[] = "1.0";
  22.  
  23. new const AUTHOR[] = "v3x & Dare & Mercede & H.RED.ZONE";
  24.  
  25.  
  26.  
  27. new const CVAR_JP_ACTIVE[] = "jp_active";
  28.  
  29. new const CVAR_JP_SPEED[] = "jp_speed";
  30.  
  31. new const CVAR_JP_TRAIL[] = "jp_trail";
  32.  
  33. new const CVAR_JP_DOD[] = "jp_dropondeath";
  34.  
  35.  
  36.  
  37. new JP_SOUND [ ] = "jetpack.wav";
  38.  
  39.  
  40.  
  41. new flame , smoke;
  42.  
  43. new bool:has_jp[33];
  44.  
  45. new bool:has_started;
  46.  
  47. new frame[33];
  48.  
  49. new current_jps;
  50.  
  51. new g_jetpack;
  52.  
  53. new cvar_enable_jp
  54.  
  55. new cvar_allow_survivor_jp
  56.  
  57.  
  58.  
  59. public plugin_init() {
  60.  
  61. register_plugin(PLUGIN , VERSION , AUTHOR);
  62.  
  63.  
  64.  
  65. g_jetpack = zp_items_register ( "JetPack" , 50 )
  66.  
  67.  
  68.  
  69. register_clcmd ( "say /dropjp" , "drop_jp" );
  70.  
  71. register_clcmd ( "dropjp" , "drop_jp" );
  72.  
  73.  
  74.  
  75. cvar_enable_jp = register_cvar ( "zp_jp_enable" , "1" )
  76.  
  77. cvar_allow_survivor_jp = register_cvar ( "zp_jp_survivor" , "1" )
  78.  
  79. register_cvar ( CVAR_JP_ACTIVE , "1" );
  80.  
  81. register_cvar ( CVAR_JP_SPEED , "500" );
  82.  
  83. register_cvar ( CVAR_JP_TRAIL , "1" );
  84.  
  85. register_cvar ( CVAR_JP_DOD , "1" );
  86.  
  87.  
  88.  
  89. register_event ( "DeathMsg" , "Event_DeathMsg" , "a" );
  90.  
  91. register_event ( "HLTV" , "did_not_start" , "a" , "1=0" , "2=0" );
  92.  
  93.  
  94.  
  95. register_logevent ( "did_start" , 2 , "1=Round_Start" );
  96.  
  97.  
  98.  
  99. register_touch ( "jetpack" , "player" , "mmm_touchy" ); }
  100.  
  101.  
  102.  
  103. public did_not_start ( ) {
  104.  
  105. has_started = false;
  106.  
  107. new ent = -1;
  108.  
  109. while ( ( ent = find_ent_by_class ( ent , "jetpack" ) ) != 0 ) {
  110.  
  111. remove_entity ( ent ); }
  112.  
  113. current_jps = 0;
  114.  
  115. new aPlayers [ 32 ] , iNum , i;
  116.  
  117. get_players ( aPlayers , iNum);
  118.  
  119. for ( i = 1; i <= iNum; i++) {
  120.  
  121. if ( has_jp[aPlayers [ i ] ] ) {
  122.  
  123. current_jps++; } } }
  124.  
  125.  
  126.  
  127. public did_start() {
  128.  
  129. has_started = true; }
  130.  
  131.  
  132.  
  133. public client_connect ( id ) {
  134.  
  135. has_jp[id] = false; }
  136.  
  137.  
  138.  
  139. public client_disconnect ( id ) {
  140.  
  141. has_jp[id] = false; }
  142.  
  143.  
  144.  
  145. public plugin_precache ( ) {
  146.  
  147. smoke = precache_model ( "sprites/smoke.spr" );
  148.  
  149. flame = precache_model ( "sprites/rjet1.spr" );
  150.  
  151. precache_model( "models/p_egon.mdl" );
  152.  
  153. precache_model( "models/w_egon.mdl" );
  154.  
  155. precache_sound( JP_SOUND ); }
  156.  
  157.  
  158.  
  159. public zp_user_infected_post(id) {
  160.  
  161. if (is_user_alive(id)) {
  162.  
  163. if (zp_core_is_zombie(id)) {
  164.  
  165. has_jp[id] = false; } } }
  166.  
  167.  
  168.  
  169. public client_PreThink(id) {
  170.  
  171. if(!get_cvar_num(CVAR_JP_ACTIVE)) {
  172.  
  173. return PLUGIN_CONTINUE; }
  174.  
  175. if(!is_user_connected(id) || !is_user_alive(id)) {
  176.  
  177. return PLUGIN_CONTINUE; }
  178.  
  179. if(!(get_user_button(id) & IN_JUMP)) {
  180.  
  181. return PLUGIN_CONTINUE; }
  182.  
  183. if(!has_started || !has_jp[id]) {
  184.  
  185. return PLUGIN_CONTINUE; }
  186.  
  187. new Float:fAim[3] , Float:fVelocity[3];
  188.  
  189. VelocityByAim(id , get_cvar_num(CVAR_JP_SPEED) , fAim);
  190.  
  191.  
  192.  
  193. fVelocity[0] = fAim[0];
  194.  
  195. fVelocity[1] = fAim[1];
  196.  
  197. fVelocity[2] = fAim[2];
  198.  
  199.  
  200.  
  201. set_user_velocity(id , fVelocity);
  202.  
  203.  
  204.  
  205. entity_set_int(id , EV_INT_gaitsequence , 6);
  206.  
  207.  
  208.  
  209. emit_sound(id , CHAN_VOICE , JP_SOUND , 1.0 , ATTN_NORM , 0 , PITCH_NORM);
  210.  
  211.  
  212.  
  213. if(frame[id] >= 3) {
  214.  
  215. frame[id] = 0;
  216.  
  217. if(get_cvar_num(CVAR_JP_TRAIL)) {
  218.  
  219. smoke_effect(id); }
  220.  
  221. entity_set_string(id , EV_SZ_weaponmodel , "models/p_egon.mdl"); }
  222.  
  223. frame[id]++;
  224.  
  225.  
  226.  
  227. return PLUGIN_CONTINUE; }
  228.  
  229.  
  230.  
  231. public smoke_effect(id) {
  232.  
  233. new origin[3];
  234.  
  235. get_user_origin(id, origin, 0);
  236.  
  237. origin[2] = origin[2] - 10;
  238.  
  239.  
  240.  
  241. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  242.  
  243. write_byte ( 17);
  244.  
  245. write_coord ( origin [ 0 ] );
  246.  
  247. write_coord ( origin [ 1 ] );
  248.  
  249. write_coord ( origin [ 2 ] );
  250.  
  251. write_short ( ( get_cvar_num ( CVAR_JP_TRAIL ) == 1 ) ? smoke : flame);
  252.  
  253. write_byte(10);
  254.  
  255. write_byte(115);
  256.  
  257. message_end(); }
  258.  
  259.  
  260.  
  261. public Event_DeathMsg ( ) {
  262.  
  263. if ( get_cvar_num ( CVAR_JP_DOD ) ) {
  264.  
  265. drop_jp(read_data ( 2 ) );
  266.  
  267. } else { has_jp[read_data(2)] = false; } }
  268.  
  269.  
  270.  
  271.  
  272.  
  273. public zp_fw_items_select_pre ( id , itemid ) {
  274.  
  275. if ( itemid == g_jetpack ) {
  276.  
  277. if (get_pcvar_num( cvar_enable_jp ) == 0)
  278.  
  279. return ZP_ITEM_DONT_SHOW;
  280.  
  281. if ( zp_class_nemesis_get ( id ) || zp_core_is_zombie ( id ) )
  282.  
  283. return ZP_ITEM_DONT_SHOW;
  284.  
  285. if ( get_pcvar_num ( cvar_allow_survivor_jp ) == 0 && zp_class_survivor_get ( id ) )
  286.  
  287. return ZP_ITEM_DONT_SHOW;
  288.  
  289. return ZP_ITEM_AVAILABLE; }
  290.  
  291. return ZP_ITEM_AVAILABLE; }
  292.  
  293.  
  294.  
  295. public zp_fw_items_select_post ( id , itemid ) {
  296.  
  297. if( itemid == g_jetpack ) {
  298.  
  299. ColorChat ( id , GREEN , "^1[^4ZP^1] Mostmar^4 repulhetsz magasra" )
  300.  
  301. ClCmd_BuyJP ( id ); }
  302.  
  303. return PLUGIN_CONTINUE; }
  304.  
  305.  
  306.  
  307.  
  308.  
  309. public ClCmd_BuyJP(id) {
  310.  
  311. if(!get_cvar_num(CVAR_JP_ACTIVE)) {
  312.  
  313. client_print(id , print_chat , "[AMXX] Sajnaljuk, jelenleg tiltva van a jetpack!");
  314.  
  315. return PLUGIN_HANDLED; }
  316.  
  317.  
  318.  
  319. if(!is_user_alive(id)) {
  320.  
  321. client_print(id , print_chat , "[AMXX] Halottkent nem lehet Jetpackot venni!!");
  322.  
  323. return PLUGIN_HANDLED; }
  324.  
  325.  
  326.  
  327. if(has_jp[id]) {
  328.  
  329. client_print(id , print_chat , "[AMXX] Neked mar van 1 jetpackod!");
  330.  
  331. return PLUGIN_HANDLED; }
  332.  
  333.  
  334.  
  335. has_jp[id] = true;
  336.  
  337.  
  338.  
  339. client_print(id , print_chat , "[AMXX] Hasznalat : Ctrl+SPACE+W ");
  340.  
  341. client_print(id , print_chat , "[AMXX] Eldobashoz ird chatbe : /dropjp");
  342.  
  343.  
  344.  
  345. emit_sound(id , CHAN_VOICE , "items/gunpickup2.wav" , 1.0 , ATTN_NORM , 0 , PITCH_NORM);
  346.  
  347.  
  348.  
  349. current_jps++;
  350.  
  351.  
  352.  
  353. return PLUGIN_HANDLED; }
  354.  
  355.  
  356.  
  357. public drop_jp(id) {
  358.  
  359. if ( !has_jp [ id ] ) return PLUGIN_HANDLED;
  360.  
  361.  
  362.  
  363. new Float:fAim [ 3 ] , Float:fOrigin [ 3 ];
  364.  
  365. VelocityByAim ( id , 64 , fAim ) ;
  366.  
  367. entity_get_vector ( id , EV_VEC_origin , fOrigin ) ;
  368.  
  369.  
  370.  
  371. fOrigin[0] += fAim[0];
  372.  
  373. fOrigin[1] += fAim[1];
  374.  
  375.  
  376.  
  377. new jp = create_entity("info_target");
  378.  
  379.  
  380.  
  381. entity_set_string(jp , EV_SZ_classname , "jetpack");
  382.  
  383. entity_set_model(jp , "models/w_egon.mdl");
  384.  
  385.  
  386.  
  387. entity_set_size(jp , Float:{-16.0,-16.0,-16.0} , Float:{16.0,16.0,16.0});
  388.  
  389.  
  390.  
  391. entity_set_int(jp , EV_INT_solid , 1);
  392.  
  393. entity_set_int(jp , EV_INT_movetype , 6);
  394.  
  395.  
  396.  
  397. entity_set_vector(jp , EV_VEC_origin , fOrigin);
  398.  
  399.  
  400.  
  401. has_jp[id] = false;
  402.  
  403.  
  404.  
  405. return PLUGIN_HANDLED; }
  406.  
  407.  
  408.  
  409. public mmm_touchy(jp , id) {
  410.  
  411. if(!is_user_alive(id)) return PLUGIN_CONTINUE;
  412.  
  413. if(has_jp[id]) return PLUGIN_CONTINUE;
  414.  
  415.  
  416.  
  417. has_jp[id] = true;
  418.  
  419.  
  420.  
  421. emit_sound(id , CHAN_VOICE , "items/gunpickup2.wav" , 1.0 , ATTN_NORM , 0 , PITCH_NORM);
  422.  
  423.  
  424.  
  425. remove_entity(jp);
  426.  
  427.  
  428.  
  429. return PLUGIN_CONTINUE; }
  430.  
  431.  
  432.  
  433.  
  434.  
  435. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  436.  
  437. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  438.  
  439. */
  440.  
  441.