Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <zombie_plague_advance>
  5.  
  6. #define PLUGIN "ZP Extra RespawnMenu"
  7. #define VERSION "1.0.0"
  8.  
  9. new g_respawn_cost = 5
  10. new g_roundend
  11.  
  12. new const respawn_sound[] = { "warcraft3/soundpack/reincarnation.wav" }
  13. new const respawn_sprite[] = { "sprite/respawn2.spr" }
  14.  
  15. public plugin_init()
  16. {
  17. register_plugin(PLUGIN, VERSION, "yokomo")
  18.  
  19. register_event("HLTV", "EventRoundStart", "a", "1=0", "2=0")
  20.  
  21. register_clcmd("say /zs", "ShowRespawnMenu")
  22. register_clcmd("say /respawn", "ShowRespawnMenu")
  23. }
  24.  
  25. public plugin_precache()
  26. {
  27. precache_sound(respawn_sound)
  28. precache_model(respawn_sound)
  29. }
  30.  
  31. public EventRoundStart(id)
  32. {
  33. g_roundend = false
  34. client_print(id, print_chat, "[ZP] This server using respawn, say /zs or /zspawn to precache item, only dead people.")
  35. }
  36.  
  37. public zp_round_ended()
  38. {
  39. g_roundend = true
  40. }
  41.  
  42. public ShowRespawnMenu(id)
  43. {
  44. if (g_roundend)
  45. {
  46. // To prevent people from spamming respawn at roundend
  47. client_print(id, print_chat, "[ZP] No respawn at this time.")
  48. return PLUGIN_HANDLED
  49. }
  50.  
  51. if (is_user_alive(id))
  52. {
  53. client_print(id, print_chat, "[ZP] Item not available at this time.")
  54. return PLUGIN_HANDLED
  55. }
  56.  
  57. new menu_title[64], item_1[64], item_2[64], item_3[64], item_4[64]
  58. format(menu_title, charsmax(menu_title), "\r[ZP] Respawn As: (cost 5 ammo packs)")
  59. format(item_1, charsmax(item_1), "\wRespawn a Human", g_respawn_cost)
  60. format(item_2, charsmax(item_2), "\wRespawn a Zombie", g_respawn_cost)
  61. format(item_3, charsmax(item_3), "\wRespawn Random", g_respawn_cost)
  62. format(item_4, charsmax(item_4), "\wD'ont Respawn")
  63.  
  64. new mHandleID = menu_create(menu_title, "RespawnMenuHandler")
  65. menu_additem(mHandleID, item_1, "1", 0)
  66. menu_additem(mHandleID, item_2, "2", 0)
  67. menu_additem(mHandleID, item_3, "3", 0)
  68. menu_additem(mHandleID, item_4, "4", 0)
  69. menu_display(id, mHandleID, 0)
  70.  
  71. return PLUGIN_HANDLED
  72. }
  73.  
  74. public RespawnMenuHandler(id, menu, item)
  75. {
  76. if (g_roundend)
  77. {
  78. // To prevent people from spamming respawn at roundend
  79. client_print(id, print_chat, "[ZP] No respawn at this time.")
  80. return PLUGIN_HANDLED
  81. }
  82.  
  83. if (is_user_alive(id))
  84. {
  85. client_print(id, print_chat, "[ZP] Item not available at this time. Only dead people can precache this item")
  86. return PLUGIN_HANDLED
  87. }
  88.  
  89. if (item == MENU_EXIT)
  90. {
  91. menu_destroy(menu)
  92. return PLUGIN_HANDLED
  93. }
  94.  
  95. new current_ap = zp_get_user_ammo_packs(id)
  96.  
  97. if (current_ap < g_respawn_cost)
  98. {
  99. client_print(id, print_chat, "[ZP] Not enough Ammo Packs.")
  100. return PLUGIN_HANDLED
  101. }
  102.  
  103. switch (item)
  104. {
  105. case 0:
  106. {
  107. // Respawn as Human
  108. if (zp_is_survivor_round() && zp_is_sniper_round()) return PLUGIN_HANDLED
  109.  
  110. zp_set_user_ammo_packs(id, current_ap - g_respawn_cost)
  111. zp_respawn_user(id, ZP_TEAM_HUMAN)
  112. emit_sound(id, CHAN_VOICE, respawn_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  113.  
  114. new origin[3]
  115. get_user_origin(id,origin)
  116.  
  117. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  118. write_byte(TE_SPRITE)
  119. write_coord(origin[0])
  120. write_coord(origin[1])
  121. write_coord(origin[2]+=30)
  122. write_short(respawn_sprite)
  123. write_byte(8)
  124. write_byte(255)
  125. message_end()
  126. }
  127. case 1:
  128. {
  129. if (zp_is_nemesis_round() && zp_is_assassin_round() && zp_is_boss_round()) return PLUGIN_HANDLED
  130.  
  131. zp_set_user_ammo_packs(id, current_ap - g_respawn_cost)
  132. zp_respawn_user(id, ZP_TEAM_HUMAN)
  133. }
  134. case 2:
  135. {
  136. // Respawn as Random Class between Human & Zombie
  137. if (!zp_is_survivor_round() && !zp_is_nemesis_round() && zp_is_sniper_round() && zp_is_assassin_round() && zp_is_boss_round())
  138. {
  139. switch(random_num(0,1))
  140. {
  141. case 0:
  142. {
  143. zp_set_user_ammo_packs(id, current_ap - g_respawn_cost)
  144. zp_respawn_user(id, ZP_TEAM_HUMAN)
  145. emit_sound(id, CHAN_VOICE, respawn_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  146.  
  147. new origin[3]
  148. get_user_origin(id,origin)
  149.  
  150. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  151. write_byte(TE_SPRITE)
  152. write_coord(origin[0])
  153. write_coord(origin[1])
  154. write_coord(origin[2]+=30)
  155. write_short(respawn_sprite)
  156. write_byte(8)
  157. write_byte(255)
  158. message_end()
  159. }
  160. case 1:
  161. {
  162. zp_set_user_ammo_packs(id, current_ap - g_respawn_cost)
  163. zp_respawn_user(id, ZP_TEAM_ZOMBIE)
  164. }
  165. }
  166. }
  167. }
  168. case 3:
  169. {
  170. return PLUGIN_HANDLED
  171. }
  172. }
  173.  
  174. menu_destroy(menu)
  175. return PLUGIN_HANDLED
  176. }
  177. }
  178. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  179. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  180. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement