Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Wklejka 6kfik44br8xv dodana przez Cichy Zefir, 20.09.2016 07:20
zombie madness
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321.
/*================================================================================ --------------------------------- -*- [ZP] Item: Zombie Madness -*- --------------------------------- This plugin is part of Zombie Plague Mod and is distributed under the terms of the GNU General Public License. Check ZP_ReadMe.txt for details. ================================================================================*/ #define ITEM_NAME "Zombie Madness" #define ITEM_COST 15 #include <amxmodx> #include <cstrike> #include <hamsandwich> #include <amx_settings_api> #include <cs_ham_bots_api> #include <zp50_items> #define LIBRARY_GRENADE_FROST "zp50_grenade_frost" #include <zp50_grenade_frost> #define LIBRARY_GRENADE_FIRE "zp50_grenade_fire" #include <zp50_grenade_fire> #define LIBRARY_NEMESIS "zp50_class_nemesis" #include <zp50_class_nemesis> #define LIBRARY_ASSASSIN "zp50_class_assassin" #include <zp50_class_assassin> // Settings file new const ZP_SETTINGS_FILE[] = "zombieplague.ini" // Default sounds new const sound_zombie_madness[][] = { "zombie_plague/zombie_madness1.wav" } #define SOUND_MAX_LENGTH 64 new Array:g_sound_zombie_madness #define TASK_MADNESS 100 #define TASK_AURA 200 #define ID_MADNESS (taskid - TASK_MADNESS) #define ID_AURA (taskid - TASK_AURA) #define flag_get(%1,%2) (%1 & (1 << (%2 & 31))) #define flag_get_boolean(%1,%2) (flag_get(%1,%2) ? true : false) #define flag_set(%1,%2) %1 |= (1 << (%2 & 31)) #define flag_unset(%1,%2) %1 &= ~(1 << (%2 & 31)) new g_ItemID new g_MadnessBlockDamage new cvar_zombie_madness_time new cvar_madness_aura_color_R, cvar_madness_aura_color_G, cvar_madness_aura_color_B public plugin_init() { register_plugin("[ZP] Item: Zombie Madness", ZP_VERSION_STRING, "ZP Dev Team") RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1) RegisterHamBots(Ham_Spawn, "fw_PlayerSpawn_Post", 1) RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack") RegisterHamBots(Ham_TraceAttack, "fw_TraceAttack") RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage") RegisterHamBots(Ham_TakeDamage, "fw_TakeDamage") RegisterHam(Ham_Killed, "player", "fw_PlayerKilled_Post", 1) RegisterHamBots(Ham_Killed, "fw_PlayerKilled_Post", 1) cvar_zombie_madness_time = register_cvar("zp_zombie_madness_time", "5.0") cvar_madness_aura_color_R = register_cvar("zp_madness_aura_color_R", "150") cvar_madness_aura_color_G = register_cvar("zp_madness_aura_color_G", "0") cvar_madness_aura_color_B = register_cvar("zp_madness_aura_color_B", "0") g_ItemID = zp_items_register(ITEM_NAME, ITEM_COST) } public plugin_precache() { // Initialize arrays g_sound_zombie_madness = ArrayCreate(SOUND_MAX_LENGTH, 1) // Load from external file amx_load_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "ZOMBIE MADNESS", g_sound_zombie_madness) // If we couldn't load custom sounds from file, use and save default ones new index if (ArraySize(g_sound_zombie_madness) == 0) { for (index = 0; index < sizeof sound_zombie_madness; index++) ArrayPushString(g_sound_zombie_madness, sound_zombie_madness[index]) // Save to external file amx_save_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "ZOMBIE MADNESS", g_sound_zombie_madness) } // Precache sounds new sound[SOUND_MAX_LENGTH] for (index = 0; index < ArraySize(g_sound_zombie_madness); index++) { ArrayGetString(g_sound_zombie_madness, index, sound, charsmax(sound)) precache_sound(sound) } } public plugin_natives() { register_library("zp50_item_zombie_madness") register_native("zp_item_zombie_madness_get", "native_item_zombie_madness_get") //madnes do ruletki register_native("daj_madness", "native_daj_madness", 1); set_module_filter("module_filter") set_native_filter("native_filter") } public native_daj_madness(id) { // Do not take damage flag_set(g_MadnessBlockDamage, id) // Madness aura set_task(0.1, "madness_aura", id+TASK_AURA, _, _, "b") // Madness sound new sound[SOUND_MAX_LENGTH] ArrayGetString(g_sound_zombie_madness, random_num(0, ArraySize(g_sound_zombie_madness) - 1), sound, charsmax(sound)) emit_sound(id, CHAN_VOICE, sound, 1.0, ATTN_NORM, 0, PITCH_NORM) // Set task to remove it set_task(get_pcvar_float(cvar_zombie_madness_time), "remove_zombie_madness", id+TASK_MADNESS) return PLUGIN_CONTINUE; } public module_filter(const module[]) { if (equal(module, LIBRARY_ASSASSIN) || equal(module, LIBRARY_NEMESIS) || equal(module, LIBRARY_GRENADE_FROST) || equal(module, LIBRARY_GRENADE_FIRE)) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; } public native_filter(const name[], index, trap) { if (!trap) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; } public native_item_zombie_madness_get(plugin_id, num_params) { new id = get_param(1) if (!is_user_alive(id)) { log_error(AMX_ERR_NATIVE, "[ZP] Invalid Player (%d)", id) return false; } return flag_get_boolean(g_MadnessBlockDamage, id); } public zp_fw_items_select_pre(id, itemid, ignorecost) { // This is not our item if (itemid != g_ItemID) return ZP_ITEM_AVAILABLE; // Zombie madness only available to zombies if (!zp_core_is_zombie(id)) return ZP_ITEM_DONT_SHOW; // Zombie madness not available to Nemesis if (LibraryExists(LIBRARY_NEMESIS, LibType_Library) && zp_class_nemesis_get(id) || LibraryExists(LIBRARY_ASSASSIN, LibType_Library) && zp_class_assassin_get(id)) return ZP_ITEM_DONT_SHOW; // Player already has madness if (flag_get(g_MadnessBlockDamage, id)) return ZP_ITEM_NOT_AVAILABLE; return ZP_ITEM_AVAILABLE; } public zp_fw_items_select_post(id, itemid, ignorecost) { // This is not our item if (itemid != g_ItemID) return; // Do not take damage flag_set(g_MadnessBlockDamage, id) // Madness aura set_task(0.1, "madness_aura", id+TASK_AURA, _, _, "b") // Madness sound new sound[SOUND_MAX_LENGTH] ArrayGetString(g_sound_zombie_madness, random_num(0, ArraySize(g_sound_zombie_madness) - 1), sound, charsmax(sound)) emit_sound(id, CHAN_VOICE, sound, 1.0, ATTN_NORM, 0, PITCH_NORM) // Set task to remove it set_task(get_pcvar_float(cvar_zombie_madness_time), "remove_zombie_madness", id+TASK_MADNESS) } // Ham Player Spawn Post Forward public fw_PlayerSpawn_Post(id) { // Not alive or didn't join a team yet if (!is_user_alive(id) || !cs_get_user_team(id)) return; // Remove zombie madness from a previous round remove_task(id+TASK_MADNESS) remove_task(id+TASK_AURA) flag_unset(g_MadnessBlockDamage, id) } // Ham Trace Attack Forward public fw_TraceAttack(victim, attacker) { // Non-player damage or self damage if (victim == attacker || !is_user_alive(attacker)) return HAM_IGNORED; // Prevent attacks when victim has zombie madness if (flag_get(g_MadnessBlockDamage, victim)) return HAM_SUPERCEDE; return HAM_IGNORED; } // Ham Take Damage Forward (needed to block explosion damage too) public fw_TakeDamage(victim, inflictor, attacker) { // Non-player damage or self damage if (victim == attacker || !is_user_alive(attacker)) return HAM_IGNORED; // Prevent attacks when victim has zombie madness if (flag_get(g_MadnessBlockDamage, victim)) return HAM_SUPERCEDE; return HAM_IGNORED; } public zp_fw_grenade_frost_pre(id) { // Prevent frost when victim has zombie madness if (flag_get(g_MadnessBlockDamage, id)) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; } public zp_fw_grenade_fire_pre(id) { // Prevent burning when victim has zombie madness if (flag_get(g_MadnessBlockDamage, id)) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; } public zp_fw_core_cure(id, attacker) { // Remove zombie madness task remove_task(id+TASK_MADNESS) remove_task(id+TASK_AURA) flag_unset(g_MadnessBlockDamage, id) } // Ham Player Killed Post Forward public fw_PlayerKilled_Post(victim, attacker, shouldgib) { // Remove zombie madness task remove_task(victim+TASK_MADNESS) remove_task(victim+TASK_AURA) flag_unset(g_MadnessBlockDamage, victim) } // Remove Spawn Protection Task public remove_zombie_madness(taskid) { // Remove aura remove_task(ID_MADNESS+TASK_AURA) // Remove zombie madness flag_unset(g_MadnessBlockDamage, ID_MADNESS) } public client_disconnect(id) { // Remove tasks on disconnect remove_task(id+TASK_MADNESS) remove_task(id+TASK_AURA) flag_unset(g_MadnessBlockDamage, id) } // Madness aura task public madness_aura(taskid) { // Get player's origin static origin[3] get_user_origin(ID_AURA, origin) // Colored Aura message_begin(MSG_PVS, SVC_TEMPENTITY, origin) write_byte(TE_DLIGHT) // TE id write_coord(origin[0]) // x write_coord(origin[1]) // y write_coord(origin[2]) // z write_byte(20) // radius write_byte(get_pcvar_num(cvar_madness_aura_color_R)) // r write_byte(get_pcvar_num(cvar_madness_aura_color_G)) // g write_byte(get_pcvar_num(cvar_madness_aura_color_B)) // b write_byte(2) // life write_byte(0) // decay rate message_end() }
Dodanych wklejek: 11179
Powered By (Pav32) Pastebin © 2011