Advertisement
Guest User

Kosynier

a guest
Dec 21st, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <codmod>
  4. #include <engine>
  5. #include <hamsandwich>
  6. #include <fakemeta>
  7. #include <cstrike>
  8.  
  9. new const nazwa[] = "Kosynier";
  10. new const opis[] = "Jeb kosa w leb";
  11. new const bronie = 0;
  12. new const zdrowie = 100;
  13. new const kondycja = 50;
  14. new const inteligencja = -20;
  15. new const wytrzymalosc = -30;
  16.  
  17. new skoki[33];
  18.  
  19. new ostatnio_prawym[33];
  20.  
  21. new ma_klase[33];
  22.  
  23. public plugin_init()
  24. {
  25. register_plugin(nazwa, "1.0", "amxx.pl");
  26.  
  27. cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
  28. RegisterHam(Ham_Spawn, "player", "fwSpawn_Grawitacja", 1);
  29.  
  30.  
  31. register_forward(FM_CmdStart, "fwCmdStart_MultiJump");
  32.  
  33.  
  34. register_forward(FM_PlayerPreThink, "fwPrethink_AutoBH");
  35.  
  36.  
  37. RegisterHam(Ham_TakeDamage, "player", "fwTakeDamage_JedenCios");
  38. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "fwPrimaryAttack_JedenCios");
  39. RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "fwSecondaryAttack_JedenCios");
  40.  
  41. }
  42.  
  43. public cod_class_enabled(id)
  44. {
  45.  
  46. set_rendering(id,kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255);
  47.  
  48. entity_set_float(id, EV_FL_gravity, 700.0/800.0);
  49. ma_klase[id] = true;
  50.  
  51. }
  52.  
  53. public cod_class_disabled(id)
  54. {
  55. set_rendering(id,kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255);
  56.  
  57. entity_set_float(id, EV_FL_gravity, 1.0);
  58. ma_klase[id] = false;
  59.  
  60. }
  61.  
  62. public fwSpawn_Grawitacja(id)
  63. {
  64. if(ma_klase[id])
  65. entity_set_float(id, EV_FL_gravity, 700.0/800.0);
  66. }
  67.  
  68.  
  69. public fwCmdStart_MultiJump(id, uc_handle)
  70. {
  71. if(!is_user_alive(id) || !ma_klase[id])
  72. return FMRES_IGNORED;
  73.  
  74. new flags = pev(id, pev_flags);
  75.  
  76. if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && skoki[id])
  77. {
  78. skoki[id]--;
  79. new Float:velocity[3];
  80. pev(id, pev_velocity,velocity);
  81. velocity[2] = random_float(265.0,285.0);
  82. set_pev(id, pev_velocity,velocity);
  83. }
  84. else if(flags & FL_ONGROUND)
  85. skoki[id] = 2;
  86.  
  87. return FMRES_IGNORED;
  88. }
  89.  
  90. public fwPrethink_AutoBH(id)
  91. {
  92. if(!ma_klase[id])
  93. return PLUGIN_CONTINUE
  94.  
  95. if (pev(id, pev_button) & IN_JUMP) {
  96. new flags = pev(id, pev_flags)
  97.  
  98. if (flags & FL_WATERJUMP)
  99. return FMRES_IGNORED;
  100. if ( pev(id, pev_waterlevel) >= 2 )
  101. return FMRES_IGNORED;
  102. if ( !(flags & FL_ONGROUND) )
  103. return FMRES_IGNORED;
  104.  
  105. new Float:velocity[3];
  106. pev(id, pev_velocity, velocity);
  107. velocity[2] += 250.0;
  108. set_pev(id, pev_velocity, velocity);
  109.  
  110. set_pev(id, pev_gaitsequence, 6);
  111.  
  112. }
  113. return FMRES_IGNORED;
  114. }
  115.  
  116. public fwTakeDamage_JedenCios(id, ent, attacker)
  117. {
  118. if(is_user_alive(attacker) && ma_klase[attacker] && get_user_weapon(attacker) == CSW_KNIFE && ostatnio_prawym[id])
  119. {
  120. cs_set_user_armor(id, 0, CS_ARMOR_NONE);
  121. SetHamParamFloat(4, float(get_user_health(id) + 1));
  122. return HAM_HANDLED;
  123. }
  124. return HAM_IGNORED;
  125. }
  126.  
  127. public fwPrimaryAttack_JedenCios(ent)
  128. {
  129. new id = pev(ent, pev_owner);
  130. ostatnio_prawym[id] = 1;
  131. }
  132.  
  133. public fwSecondaryAttack_JedenCios(ent)
  134. {
  135. new id = pev(ent, pev_owner);
  136. ostatnio_prawym[id] = 0;
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement