kennymd28

Untitled

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