Guest User

Untitled

a guest
Jul 31st, 2020
22
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <engine>
  4.  
  5. #define PLUGIN "Parachute"
  6. #define VERSION "1.0"
  7. #define AUTHOR "EFFx"
  8.  
  9. new para_ent[33];
  10.  
  11. public plugin_init()
  12. {
  13. register_plugin(PLUGIN, VERSION, AUTHOR)
  14.  
  15. register_forward(FM_PlayerPreThink, "FWD_ParachutePreThink")
  16. }
  17. public plugin_precache()
  18. {
  19. precache_model("models/wings.mdl")
  20. }
  21. public FWD_ParachutePreThink(id)
  22. {
  23. if(is_user_alive(id))
  24. {
  25. if (get_user_button(id) & IN_USE )
  26. {
  27. if ( !( get_entity_flags(id) & FL_ONGROUND ) )
  28. {
  29. new Float:velocity[3]
  30. entity_get_vector(id, EV_VEC_velocity, velocity)
  31. if(velocity[2] < 0)
  32. {
  33. if (para_ent[id] == 0)
  34. {
  35. para_ent[id] = create_entity("info_target")
  36. if (para_ent[id] > 0)
  37. {
  38. entity_set_model(para_ent[id], "models/surfparachute.mdl")
  39. entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
  40. entity_set_edict(para_ent[id], EV_ENT_aiment, id)
  41. }
  42. }
  43. if (para_ent[id] > 0)
  44. {
  45. velocity[2] = (velocity[2] + 150.0 < -50) ? velocity[2] + 150.0 : -50.0
  46. entity_set_vector(id, EV_VEC_velocity, velocity)
  47. if (entity_get_float(para_ent[id], EV_FL_frame) < 0.0 || entity_get_float(para_ent[id], EV_FL_frame) > 254.0)
  48. {
  49. if (entity_get_int(para_ent[id], EV_INT_sequence) != 1)
  50. {
  51. entity_set_int(para_ent[id], EV_INT_sequence, 1)
  52. }
  53. entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  54. }
  55. else
  56. {
  57. entity_set_float(para_ent[id], EV_FL_frame, entity_get_float(para_ent[id], EV_FL_frame) + 1.0)
  58. }
  59. }
  60. }
  61. else
  62. {
  63. if (para_ent[id] > 0)
  64. {
  65. remove_entity(para_ent[id])
  66. para_ent[id] = 0
  67. }
  68. }
  69. }
  70. else
  71. {
  72. if (para_ent[id] > 0)
  73. {
  74. remove_entity(para_ent[id])
  75. para_ent[id] = 0
  76. }
  77. }
  78. }
  79. else if (get_user_oldbutton(id) & IN_USE)
  80. {
  81. if (para_ent[id] > 0)
  82. {
  83. remove_entity(para_ent[id])
  84. para_ent[id] = 0
  85. }
  86. }
  87. }
  88.  
  89. return PLUGIN_CONTINUE
  90. }
RAW Paste Data