Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.31 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <zombieplague>
  4. #include <zp50_class_sniper>
  5. #include <zp50_class_dragon>
  6. #include <zp50_class_knifer>
  7. #include <zp50_class_nightcrawler>
  8. #include <zp50_gamemodes>
  9.  
  10. new bool:g_IsZspawned[33]
  11. new z_spawn_mode, z_spawn_infection, z_spawn_team_infection, z_spawn_swarm, z_spawn_team_swarm, z_spawn_plague, z_spawn_team_plague, z_spawn_nemesis, z_spawn_team_nemesis, z_spawn_survivor, z_spawn_team_survivor, z_spawn_client_settings, z_spawn_client_rate, z_spawn_client_cmdrate, z_spawn_client_updaterate
  12. new g_iDragonModeId, g_iSniperModeId, g_iNightCrawlerModeId, g_iKniferModeId
  13.  
  14. public plugin_init()
  15. {
  16. register_plugin("[ZP] Server Addon: Zspawn System", "5.5", "Game over + JaCk")
  17. register_event("TeamInfo", "event_TeamInfo", "a", "2=TERRORIST", "2=CT")
  18.  
  19. // Cvars
  20. z_spawn_mode = register_cvar("zp_spawn_mode", "2")
  21. z_spawn_infection = register_cvar("zp_spawn_infection", "1")
  22. z_spawn_team_infection = register_cvar("zp_spawn_team_infection", "0")
  23. z_spawn_swarm = register_cvar("zp_spawn_swarm", "0")
  24. z_spawn_team_swarm = register_cvar("zp_spawn_team_swarm", "0")
  25. z_spawn_plague = register_cvar("zp_spawn_plague", "0")
  26. z_spawn_team_plague = register_cvar("zp_spawn_team_plague", "0")
  27. z_spawn_nemesis = register_cvar("zp_spawn_nemesis", "0")
  28. z_spawn_team_nemesis = register_cvar("zp_spawn_team_nemesis", "0")
  29. z_spawn_survivor = register_cvar("zp_spawn_survivor", "0")
  30. z_spawn_team_survivor = register_cvar("zp_spawn_team_survivor", "0")
  31. z_spawn_client_settings = register_cvar("zp_spawn_client_settings", "1")
  32. z_spawn_client_rate = register_cvar("zp_spawn_client_rate", "15000")
  33. z_spawn_client_cmdrate = register_cvar("zp_spawn_client_cmdrate", "71")
  34. z_spawn_client_updaterate = register_cvar("zp_spawn_client_updaterate", "71")
  35. }
  36.  
  37. public plugin_cfg()
  38. {
  39. g_iDragonModeId = zp_gamemodes_get_id("Dragon Mode")
  40. g_iSniperModeId = zp_gamemodes_get_id("Dragon Mode")
  41. g_iNightCrawlerModeId = zp_gamemodes_get_id("Dragon Mode")
  42. g_iKniferModeId = zp_gamemodes_get_id("Dragon Mode")
  43. server_cmd("exec addons/amxmodx/configs/zp_zspawn_system.cfg")
  44. }
  45.  
  46. public client_putinserver(id)
  47. {
  48. g_IsZspawned[id] = false
  49. set_task(0.1, "ClientSettings", id)
  50. }
  51.  
  52. public ClientSettings(id)
  53. {
  54. if (1 == get_pcvar_num(z_spawn_client_settings))
  55. {
  56. client_cmd(id, "fakelag 0")
  57. client_cmd(id, "fakeloss 0")
  58. client_cmd(id, "rate %d", get_pcvar_num(z_spawn_client_rate))
  59. client_cmd(id, "cl_cmdrate %d", get_pcvar_num(z_spawn_client_cmdrate))
  60. client_cmd(id, "cl_updaterate %d", get_pcvar_num(z_spawn_client_updaterate))
  61. client_cmd(id, "cl_allowupload 1")
  62. client_cmd(id, "cl_allowdownload 1")
  63. client_cmd(id, "cl_corpsestay 60")
  64. }
  65. }
  66.  
  67. public event_TeamInfo()
  68. {
  69. static id
  70. id = read_data(1)
  71. if(id == 0 || is_user_alive(id) || !is_user_connected(id)) return
  72.  
  73. if (!g_IsZspawned[id])
  74. {
  75. set_task(5.0, "ZSpawnMode", id)
  76. g_IsZspawned[id] = true
  77. }
  78. }
  79.  
  80. public ZSpawnMode(id)
  81. {
  82. if(id == 0 || is_user_alive(id) || !is_user_connected(id)) return
  83. if (0 < get_pcvar_num(z_spawn_mode))
  84. switch (get_pcvar_num(z_spawn_mode))
  85. {
  86. case 1:
  87. {
  88. set_task(0.1, "ZSpawn", id)
  89. }
  90. case 2:
  91. {
  92. set_task(0.1, "ZSpawn", id)
  93. if (!is_user_alive(id))
  94. set_task(0.5, "FuncTeleport", id)
  95. }
  96. }
  97. }
  98.  
  99. public ZSpawn(id)
  100. {
  101. if(id == 0 || is_user_alive(id) || !is_user_connected(id)) return
  102. if (zp_is_nemesis_round() && get_pcvar_num(z_spawn_nemesis))
  103. {
  104. switch (get_pcvar_num(z_spawn_team_nemesis))
  105. {
  106. case 0:
  107. {
  108. zp_respawn_user(id, ZP_TEAM_ZOMBIE)
  109. }
  110. case 1:
  111. {
  112. zp_respawn_user(id, ZP_TEAM_HUMAN)
  113. }
  114. }
  115. }
  116. else if (zp_is_survivor_round() && get_pcvar_num(z_spawn_survivor))
  117. {
  118. switch (get_pcvar_num(z_spawn_team_survivor))
  119. {
  120. case 0:
  121. {
  122. zp_respawn_user(id, ZP_TEAM_ZOMBIE)
  123. }
  124. case 1:
  125. {
  126. zp_respawn_user(id, ZP_TEAM_HUMAN)
  127. }
  128. }
  129. }
  130. else if (zp_is_swarm_round() && get_pcvar_num(z_spawn_swarm))
  131. {
  132. switch (get_pcvar_num(z_spawn_team_swarm))
  133. {
  134. case 0:
  135. {
  136. zp_respawn_user(id, ZP_TEAM_ZOMBIE)
  137. }
  138. case 1:
  139. {
  140. zp_respawn_user(id, ZP_TEAM_HUMAN)
  141. }
  142. }
  143. }
  144. else if (zp_is_plague_round() && get_pcvar_num(z_spawn_plague))
  145. {
  146. switch (get_pcvar_num(z_spawn_team_plague))
  147. {
  148. case 0:
  149. {
  150. zp_respawn_user(id, ZP_TEAM_ZOMBIE)
  151. }
  152. case 1:
  153. {
  154. zp_respawn_user(id, ZP_TEAM_HUMAN)
  155. }
  156. }
  157. }
  158. else if (
  159. zp_has_round_started() &&
  160. get_pcvar_num(z_spawn_infection) &&
  161. (zp_is_nemesis_round() == 0) &&
  162. (zp_is_survivor_round() == 0) &&
  163. (zp_is_swarm_round() == 0) &&
  164. (zp_is_plague_round() == 0) &&
  165. zp_gamemodes_get_current() != g_iDragonModeId &&
  166. zp_gamemodes_get_current() != g_iSniperModeId &&
  167. zp_gamemodes_get_current() != g_iNightCrawlerModeId &&
  168. zp_gamemodes_get_current() != g_iKniferModeId
  169. )
  170. {
  171. switch (get_pcvar_num(z_spawn_team_infection))
  172. {
  173. case 0:
  174. {
  175. zp_respawn_user(id, ZP_TEAM_ZOMBIE)
  176. }
  177. case 1:
  178. {
  179. zp_respawn_user(id, ZP_TEAM_HUMAN)
  180. }
  181. }
  182. }
  183. }
  184.  
  185. public FuncTeleport(id)
  186. {
  187. static Float:iOrigin[3]
  188. pev(id, pev_origin, iOrigin)
  189.  
  190. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, iOrigin, 0)
  191. write_byte(TE_TELEPORT)
  192. engfunc(EngFunc_WriteCoord, iOrigin[0])
  193. engfunc(EngFunc_WriteCoord, iOrigin[1])
  194. engfunc(EngFunc_WriteCoord, iOrigin[2])
  195. message_end()
  196. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement