Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <fakemeta_util>
  4. #include <hamsandwich>
  5. #include <zp50_items_vip>
  6.  
  7. new bool:g_WallClimb[33]
  8. new Float:g_wallorigin[32][3]
  9. new g_maxplayers, item_climb
  10.  
  11. public plugin_init()
  12. {
  13. register_plugin("[ZP] Extra Item: Wall climb ", "1.0", "Python1320 & Accelerator")
  14. register_forward(FM_Touch, "fwd_touch")
  15. register_forward(FM_PlayerPreThink, "fwd_playerprethink")
  16. RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  17.  
  18. g_maxplayers = get_maxplayers()
  19.  
  20. item_climb = zp_items_vip_register("Wall climb", 60)
  21. }
  22.  
  23. public zp_fw_items_select_vip_pre(id, itemid, ignorecost)
  24. {
  25.  
  26. if(itemid != item_climb)
  27. return ZP_ITEM_AVAILABLE;
  28.  
  29. if(!zp_core_is_zombie(id))
  30. return ZP_ITEM_DONT_SHOW;
  31.  
  32. return ZP_ITEM_AVAILABLE;
  33. }
  34.  
  35. public zp_fw_items_select_vip_post(player, itemid)
  36. {
  37. if (itemid != item_climb)
  38. return;
  39.  
  40. g_WallClimb[player] = true
  41. client_print(player, print_chat, "[ZP] You bought Wall climb");
  42. }
  43.  
  44. public zp_user_infected_post(id, infector)
  45. g_WallClimb[id] = false
  46.  
  47. public zp_user_humanized_post(id, survivor)
  48. g_WallClimb[id] = false
  49.  
  50. public fw_PlayerKilled(victim, attacker, shouldgib)
  51. g_WallClimb[victim] = false
  52.  
  53. public zp_round_ended(winteam)
  54. {
  55. for (new id=1; id<=g_maxplayers; id++)
  56. g_WallClimb[id] = false
  57. }
  58.  
  59. public client_connect(id)
  60. g_WallClimb[id] = false
  61.  
  62. public fwd_touch(id, world)
  63. {
  64. if(!is_user_alive(id) || !g_WallClimb[id])
  65. return FMRES_IGNORED
  66.  
  67. pev(id, pev_origin, g_wallorigin[id])
  68.  
  69. return FMRES_IGNORED
  70. }
  71.  
  72. public wallclimb(id, button)
  73. {
  74. static Float:origin[3]
  75. pev(id, pev_origin, origin)
  76.  
  77. if(get_distance_f(origin, g_wallorigin[id]) > 25.0)
  78. return FMRES_IGNORED // if not near wall
  79.  
  80. if(fm_get_entity_flags(id) & FL_ONGROUND)
  81. return FMRES_IGNORED
  82.  
  83. if(button & IN_FORWARD)
  84. {
  85. static Float:velocity[3]
  86. velocity_by_aim(id, 120, velocity)
  87. fm_set_user_velocity(id, velocity)
  88. }
  89. else if(button & IN_BACK)
  90. {
  91. static Float:velocity[3]
  92. velocity_by_aim(id, -120, velocity)
  93. fm_set_user_velocity(id, velocity)
  94. }
  95. return FMRES_IGNORED
  96. }
  97.  
  98. public fwd_playerprethink(id)
  99. {
  100. if(!g_WallClimb[id])
  101. return FMRES_IGNORED
  102.  
  103. new button = fm_get_user_button(id)
  104.  
  105. if(button & IN_USE) //Use button = climb
  106. wallclimb(id, button)
  107.  
  108. return FMRES_IGNORED
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement