Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <DR>
  3. #include <engine>
  4. #include <fakemeta>
  5. #include <hamsandwich>
  6.  
  7. new const nazwa[] = "Carl Johnson (7.38zl)";
  8. new const opis[] = "Posiada dodatkowy oraz jedna apteczke 100HP";
  9. new const bronie = (1<<CSW_SMOKEGRENADE)|(1<<CSW_USP);
  10. new const zdrowie = 0;
  11. new const kondycja = 0;
  12. new const wytrzymalosc = 0;
  13. new const grawitacja = 200;
  14. new const obrazenia321 = 0;
  15.  
  16. new sprite_white_apteczki;
  17. new ilosc_apteczek_gracza[33];
  18.  
  19. new skoki[33];
  20. new ma_klase[33];
  21.  
  22. public plugin_init()
  23. {
  24. register_plugin(nazwa, "1.0", "CSC");
  25. cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, wytrzymalosc, grawitacja, obrazenia321);
  26. register_think("medkit", "Think_Apteczki");
  27. RegisterHam(Ham_Spawn, "player", "fwSpawn_Apteczki", 1);
  28. register_forward(FM_CmdStart, "fwCmdStart_MultiJump");
  29. }
  30.  
  31. public plugin_precache()
  32. {
  33. sprite_white_apteczki = precache_model("sprites/white.spr");
  34. precache_model("models/w_medkit.mdl");
  35. }
  36. public client_disconnect(id)
  37. {
  38. new entApteczki = find_ent_by_class(0, "medkit");
  39. while(entApteczki > 0)
  40. {
  41. if(entity_get_edict(entApteczki, EV_ENT_owner) == id)
  42. remove_entity(entApteczki);
  43.  
  44. entApteczki = find_ent_by_class(entApteczki, "medkit");
  45. }
  46. }
  47.  
  48. public cod_class_enabled(id)
  49. {
  50. ilosc_apteczek_gracza[id] = 1;
  51. ma_klase[id] = true;
  52. }
  53.  
  54. public cod_class_disabled(id)
  55. {
  56. ma_klase[id] = false;
  57. }
  58.  
  59. public cod_class_skill_used(id)
  60. {
  61. if (!ilosc_apteczek_gracza[id])
  62. {
  63. client_print(id, print_center, "Masz tylko 1 apteczke na runde!");
  64. }
  65. else
  66. {
  67. ilosc_apteczek_gracza[id]--;
  68. new Float:origin[3];
  69. entity_get_vector(id, EV_VEC_origin, origin);
  70. new ent = create_entity("info_target");
  71. entity_set_string(ent, EV_SZ_classname, "medkit");
  72. entity_set_edict(ent, EV_ENT_owner, id);
  73. entity_set_int(ent, EV_INT_solid, SOLID_NOT);
  74. entity_set_vector(ent, EV_VEC_origin, origin);
  75. entity_set_float(ent, EV_FL_ltime, halflife_time() + 7 + 0.1);
  76. entity_set_model(ent, "models/w_medkit.mdl");
  77. set_rendering ( ent, kRenderFxGlowShell, 255,0,0, kRenderFxNone, 255 );
  78. drop_to_floor(ent);
  79. entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.1);
  80. }
  81. }
  82.  
  83. public fwSpawn_Apteczki(id)
  84. {
  85. if(is_user_alive(id))
  86. ilosc_apteczek_gracza[id] = 1;
  87. }
  88.  
  89. public Think_Apteczki(ent)
  90. {
  91. if(!is_valid_ent(ent))
  92. return PLUGIN_CONTINUE;
  93.  
  94. new id = entity_get_edict(ent, EV_ENT_owner);
  95. new dist = 300;
  96. new heal = 5;
  97. if (entity_get_edict(ent, EV_ENT_euser2) == 1)
  98. {
  99. new Float:forigin[3];
  100. entity_get_vector(ent, EV_VEC_origin, forigin);
  101. new entlist[33];
  102. new numfound = find_sphere_class(0,"player", float(dist),entlist, 32,forigin);
  103.  
  104. for (new i=0; i < numfound; i++)
  105. {
  106. new pid = entlist[i];
  107. if (get_user_team(pid) != get_user_team(id))
  108. continue;
  109.  
  110. new maksymalne_zdrowie = 100+cod_get_user_health(pid);
  111. new zdrowie = get_user_health(pid);
  112. new Float:nowe_zdrowie = (zdrowie+heal<maksymalne_zdrowie)?zdrowie+heal+0.0:maksymalne_zdrowie+0.0;
  113. if (is_user_alive(pid)) entity_set_float(pid, EV_FL_health, nowe_zdrowie);
  114. }
  115.  
  116. entity_set_edict(ent, EV_ENT_euser2, 0);
  117. entity_set_float(ent, EV_FL_nextthink, halflife_time() + 1.5);
  118. return PLUGIN_CONTINUE;
  119. }
  120.  
  121. if (entity_get_float(ent, EV_FL_ltime) < halflife_time() || !is_user_alive(id))
  122. {
  123. remove_entity(ent);
  124. return PLUGIN_CONTINUE;
  125. }
  126.  
  127. if (entity_get_float(ent, EV_FL_ltime)-2.0 < halflife_time())
  128. set_rendering ( ent, kRenderFxNone, 255,255,255, kRenderTransAlpha, 100 );
  129.  
  130. new Float:forigin[3];
  131. entity_get_vector(ent, EV_VEC_origin, forigin);
  132. new iOrigin[3];
  133. for(new i=0;i<3;i++)
  134. iOrigin[i] = floatround(forigin[i]);
  135.  
  136. message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin );
  137. write_byte( TE_BEAMCYLINDER );
  138. write_coord( iOrigin[0] );
  139. write_coord( iOrigin[1] );
  140. write_coord( iOrigin[2] );
  141. write_coord( iOrigin[0] );
  142. write_coord( iOrigin[1] + dist );
  143. write_coord( iOrigin[2] + dist );
  144. write_short( sprite_white_apteczki );
  145. write_byte( 0 ); // startframe
  146. write_byte( 0 ); // framerate
  147. write_byte( 10 ); // life
  148. write_byte( 10 ); // width
  149. write_byte( 255 ); // noise
  150. write_byte( 255 ); // r, g, b
  151. write_byte( 100 );// r, g, b
  152. write_byte( 100 ); // r, g, b
  153. write_byte( 128 ); // brightness
  154. write_byte( 0 ); // speed
  155. message_end();
  156. entity_set_edict(ent, EV_ENT_euser2 ,1);
  157. entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.5);
  158.  
  159. return PLUGIN_CONTINUE;
  160. }
  161.  
  162. public fwCmdStart_MultiJump(id, uc_handle)
  163. {
  164. if(!is_user_alive(id) || !ma_klase[id])
  165. return FMRES_IGNORED;
  166.  
  167. new flags = pev(id, pev_flags);
  168. if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && skoki[id])
  169. {
  170. skoki[id]--;
  171. new Float:velocity[3];
  172. pev(id, pev_velocity,velocity);
  173. velocity[2] = random_float(265.0,285.0);
  174. set_pev(id, pev_velocity,velocity);
  175. }
  176. else if(flags & FL_ONGROUND)
  177. skoki[id] = 1;
  178.  
  179. return FMRES_IGNORED;
  180. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement