Advertisement
Qovii

parachute cs 1.6

Feb 2nd, 2020
4,197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4. #include <cstrike>
  5. #include <fun>
  6.  
  7. new para_ent[33]
  8.  
  9. public plugin_init()
  10. {
  11. register_plugin("Parachute", "1.3 Fixed", "KRoT@L/JTP10181 & Fixed sector")
  12.  
  13. register_event("ResetHUD", "newSpawn", "be")
  14. register_event("DeathMsg", "death_event", "a")
  15. }
  16.  
  17. public plugin_natives()
  18. {
  19. set_native_filter("native_filter")
  20. }
  21.  
  22. public native_filter(const name[], index, trap)
  23. {
  24. if (!trap) return PLUGIN_HANDLED
  25. return PLUGIN_CONTINUE
  26. }
  27.  
  28. public client_connect(id)
  29. {
  30. parachute_reset(id)
  31. }
  32.  
  33. public client_disconnect(id)
  34. {
  35. parachute_reset(id)
  36. }
  37.  
  38. public death_event()
  39. {
  40. new id = read_data(2)
  41. parachute_reset(id)
  42. }
  43.  
  44. parachute_reset(id)
  45. {
  46. if(para_ent[id] > 0)
  47. {
  48. if (is_valid_ent(para_ent[id]))
  49. {
  50. remove_entity(para_ent[id])
  51. }
  52. }
  53.  
  54. if(is_user_alive(id)) set_user_gravity(id, 1.0)
  55. para_ent[id] = 0
  56. }
  57.  
  58. public newSpawn(id)
  59. {
  60. if(para_ent[id] > 0)
  61. {
  62. remove_entity(para_ent[id])
  63. set_user_gravity(id, 1.0)
  64. para_ent[id] = 0
  65. }
  66. }
  67.  
  68. public client_PreThink(id)
  69. {
  70. if(!is_user_alive(id)) return
  71.  
  72. new Float:fallspeed = 100 * -1.0
  73. new Float:frame
  74. new button = get_user_button(id)
  75. new oldbutton = get_user_oldbutton(id)
  76. new flags = get_entity_flags(id)
  77. if(para_ent[id] > 0 && (flags & FL_ONGROUND))
  78. {
  79. if(get_user_gravity(id) == 0.1) set_user_gravity(id, 1.0)
  80. {
  81. if(entity_get_int(para_ent[id],EV_INT_sequence) != 2)
  82. {
  83. entity_set_int(para_ent[id], EV_INT_sequence, 2)
  84. entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  85. entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  86. entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  87. entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
  88. entity_set_float(para_ent[id], EV_FL_framerate, 0.0)
  89. return
  90. }
  91. frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
  92. entity_set_float(para_ent[id],EV_FL_fuser1,frame)
  93. entity_set_float(para_ent[id],EV_FL_frame,frame)
  94. if(frame > 254.0)
  95. {
  96. remove_entity(para_ent[id])
  97. para_ent[id] = 0
  98. }
  99. else
  100. {
  101. remove_entity(para_ent[id])
  102. set_user_gravity(id, 1.0)
  103. para_ent[id] = 0
  104. }
  105. return
  106. }
  107. }
  108. if (button & IN_USE)
  109. {
  110. new Float:velocity[3]
  111. entity_get_vector(id, EV_VEC_velocity, velocity)
  112. if(velocity[2] < 0.0)
  113. {
  114. if(para_ent[id] <= 0)
  115. {
  116. para_ent[id] = create_entity("info_target")
  117. if(para_ent[id] > 0)
  118. {
  119. entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
  120. entity_set_edict(para_ent[id], EV_ENT_aiment, id)
  121. entity_set_edict(para_ent[id], EV_ENT_owner, id)
  122. entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
  123. entity_set_int(para_ent[id], EV_INT_sequence, 0)
  124. entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  125. entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  126. entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  127. }
  128. }
  129. if(para_ent[id] > 0)
  130. {
  131. entity_set_int(id, EV_INT_sequence, 3)
  132. entity_set_int(id, EV_INT_gaitsequence, 1)
  133. entity_set_float(id, EV_FL_frame, 1.0)
  134. entity_set_float(id, EV_FL_framerate, 1.0)
  135. set_user_gravity(id, 0.1)
  136. velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
  137. entity_set_vector(id, EV_VEC_velocity, velocity)
  138. if(entity_get_int(para_ent[id],EV_INT_sequence) == 0)
  139. {
  140. frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
  141. entity_set_float(para_ent[id],EV_FL_fuser1,frame)
  142. entity_set_float(para_ent[id],EV_FL_frame,frame)
  143. if (frame > 100.0)
  144. {
  145. entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
  146. entity_set_float(para_ent[id], EV_FL_framerate, 0.4)
  147. entity_set_int(para_ent[id], EV_INT_sequence, 1)
  148. entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  149. entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  150. entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  151. }
  152. }
  153. }
  154. }
  155. else if(para_ent[id] > 0)
  156. {
  157. remove_entity(para_ent[id])
  158. set_user_gravity(id, 1.0)
  159. para_ent[id] = 0
  160. }
  161. }
  162. else if((oldbutton & IN_USE) && para_ent[id] > 0 )
  163. {
  164. remove_entity(para_ent[id])
  165. set_user_gravity(id, 1.0)
  166. para_ent[id] = 0
  167. }
  168. }
  169. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  170. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
  171. */
  172. [/code]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement