Guest User

Untitled

a guest
Dec 20th, 2014
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 369.60 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5. #include <xs>
  6. #include <fun>
  7. #include <cstrike>
  8. #include <engine>
  9. #include <fvault>
  10.  
  11. /*================================================================================
  12. [Plugin Customization]
  13. =================================================================================*/
  14.  
  15. #define ONE_COLOR // color de la burbuja.
  16. #define CAMPO_TASK // task = cuanto dura el campo de fuerza y lo elimina.
  17.  
  18. //#define RANDOM_COLOR // color por default.
  19.  
  20. #if defined ONE_COLOR
  21. new Float:colour_force_shield[3] = { 255.0 , 255.0 , 255.0 } // color de la burbuja ( red, gree, blue ).
  22. #endif
  23.  
  24. new g_bubble_bomb[33] // variable del campo
  25. new const model_grenade[] = "models/zombie_plague/v_auragren.mdl" // model "v_".
  26. new const model[] = "models/zombie_plague/aura8.mdl" // model de la burbuja.
  27. new const w_model[] = "models/zombie_plague/w_aura.mdl" // model "w_".
  28. new const entclas[] = "campo_grenade_forze" // nombre de la clase de entidad.
  29.  
  30. new const horas[] = { 22,23,24,00,01,02,03,04,05,06,08,08 }
  31. new bool: g_happytime
  32.  
  33. new const AMMOTYPE[][] = { "", "357sig", "", "762nato", "", "buckshot", "", "45acp", "556nato", "", "9mm", "57mm", "45acp",
  34. "556nato", "556nato", "556nato", "45acp", "9mm", "338magnum", "9mm", "556natobox", "buckshot",
  35. "556nato", "9mm", "762nato", "", "50ae", "556nato", "762nato", "", "57mm" }
  36.  
  37. // Access Flags Required (check CMDACCESS.INI for console commands)
  38. const ACCESS_FLAG = ADMIN_BAN // to access the admin menu
  39. const ACCESS_FLAG2 = ADMIN_RCON // to turn the mod on/off
  40. const ACCESS_FLAG3 = ADMIN_BAN // to get admin models
  41.  
  42. // Player Models (randomly chosen if more than one)
  43. new const model_nemesis[][] = { "[VG]Nemesis" } // Nemesis
  44. new const model_survivor[][] = { "leet", "sas" } // Survivor
  45. new const model_admin[][] = { "vip" } // Admin (human)
  46. new const model_admin_zombie[][] = { "zombie_source" } // Admin (zombie)
  47.  
  48. // LEVELS
  49. new const NIVELES[1001] = { 0, 2, 8, 18, 32, 50, 72, 98, 128, 162, 200, 242, 288, 338, 450, 512, 578, 648, 722, 800, 882, 968, 1058, 1152, 1250, 1352, 1458,
  50. 1568, 1682, 1800, 1922, 2048, 2178, 2312, 2450, 2592, 2738, 2888, 3042, 3200, 3362, 3528, 3692, 3872, 4050, 4232, 4418, 4608,
  51. 4802, 5000, 5202, 5408, 5618, 5832, 6050, 6272, 6498, 6728, 6962, 7200, 7442, 7688, 7938, 8192, 8450, 8712, 8978,
  52. 9248, 9522, 9800, 10082, 10368, 10658, 10952, 11250, 11552, 11858, 12168, 12482, 12800, 13122, 13448, 13778, 14112, 14450,
  53. 14792, 15138, 15488, 15842, 16200, 16562, 16928, 17298, 17672, 18050, 18432, 18818, 19208, 19602, 20000, 20402, 20808, 21218,
  54. 21632, 22050, 22472, 22898, 23328, 23762, 24200, 24642, 25088, 25538, 25992, 26450, 26912, 27378, 27848, 28322, 28800, 29282,
  55. 29768, 30258, 30752, 31250, 31752, 32258, 32768, 33282, 33800, 34322, 34848, 35378, 35912, 36450, 36992, 37538, 38088,
  56. 38642, 39200, 39762, 40328, 40898, 41472, 42050, 42632, 43218, 43808, 44402, 45000, 45602, 46208, 46818, 47432,
  57. 48050, 48672, 49298, 49928, 50562, 51200, 51842, 52488, 53138, 53792, 54450, 55112, 55778, 56448, 57122, 57800,
  58. 58482, 59168, 59858, 60552, 61250, 61952, 62658, 63368, 64082, 64800, 65522, 66248, 66978, 67712, 68450, 69192,
  59. 69938, 70688, 71442, 72200, 72962, 73728, 74498, 75272, 76050, 76832, 77618, 78408, 79202, 80000, 80802, 81608,
  60. 82418, 83232, 84050, 84872, 85698, 86528, 87362, 88200, 89042, 89888, 90738, 91592, 92450, 93312, 94178, 95048,
  61. 95922, 96800, 97682, 98568, 99458, 100352, 101250, 102152, 103058, 103968, 104882, 105800, 106722, 107648, 108578, 109512,
  62. 110450, 111392, 112338, 113288, 114242, 115200, 116162, 117128, 118098, 119072, 120050, 121032, 122018, 123008, 124002, 125000,
  63. 126002, 127008, 128018, 129032, 130050, 131072, 132098, 133128, 134162, 135200, 136242, 137288, 138338, 139392, 140450, 141512,
  64. 142578, 143648, 144722, 145800, 146882, 147968, 149058, 150152, 151250, 152352, 153458, 154568, 155682, 156800, 157922, 159048,
  65. 160178, 161312, 162450, 163592, 164738, 165888, 167042, 168200, 169362, 170528, 171698, 172872, 174050, 175232, 176418, 177608,
  66. 178802, 180000, 181202, 182408, 183618, 184832, 186050, 187272, 188498, 189728, 190962, 192200, 193442, 194688, 195938, 197192,
  67. 198450, 199712, 200978, 202248, 203522, 204800, 206082, 207368, 208658, 209952, 211250, 212552, 213858, 215168, 216482, 217800,
  68. 219122, 220448, 221778, 223112, 224450, 225792, 227138, 228488, 229842, 231200, 232562, 233928, 235298, 236672, 238050, 239432,
  69. 240818, 242208, 243602, 245000, 246402, 247808, 249218, 250632, 252050, 253472, 254898, 256328, 257762, 259200, 260652, 262088,
  70. 263538, 264992, 266450, 267912, 269378, 270848, 272322, 273800, 275282, 276768, 278258, 281250, 282752, 284258, 285768, 287282,
  71. 288800, 290332, 291848, 293378, 294912, 296450, 297992, 299538, 301088, 302642, 304200, 305762, 307328, 308898, 310472, 312050,
  72. 313632, 315218, 316808, 318402, 320000, 321602, 323208, 324818, 326432, 328050, 329672, 331298, 332928, 334562, 336200, 337842,
  73. 339488, 341138, 342792, 344450, 346112, 347778, 349448, 351122, 352800, 354482, 356168, 357858, 359552, 361250, 362952, 364652,
  74. 366368, 368082, 369800, 371522, 373248, 374978, 376712, 378450, 380192, 381938, 383688, 385442, 387200, 388962, 390728, 392498,
  75. 384272, 396050, 397832, 399618, 401408, 403202, 406000, 406802, 408608, 410418, 412232, 414050, 415872, 417698, 419529, 421362,
  76. 423200, 425042, 426888, 428738, 430592, 432450, 434312, 436178, 438048, 439922, 441800, 443682, 445568, 447458, 449352, 451250,
  77. 453152, 455058, 456968, 458882, 460800, 462722, 464648, 466578, 468512, 470450, 472392, 474338, 476288, 478242, 480200, 482162,
  78. 484128, 486098, 488072, 490050, 492032, 494018, 496008, 498002, 500000, 502002, 504008, 506018, 508032, 510050, 512072, 514098,
  79. 516128, 518162, 520200, 522242, 524288, 526338, 528392, 530450, 532512, 534578, 536648, 538722, 540800, 542882, 544968, 547058,
  80. 549152, 551250, 553352, 555458, 557568, 559682, 561800, 563922, 566048, 568178, 570312, 572450, 574592, 576738, 578888, 581042,
  81. 583200, 585362, 587528, 589698, 591872, 594050, 596232, 598418, 600608, 602802, 605000, 607202, 609408, 611618, 613832, 616050,
  82. 620498, 622728, 624962, 627200, 629442, 631688, 633938, 636192, 638450, 640712, 642978, 645248, 647522, 649800, 652082, 654360,
  83. 656658, 658952, 661250, 663552, 665858, 668168, 670482, 672800, 675122, 677448, 679778, 682112, 684450, 686792, 689138, 691488,
  84. 693842, 696200, 698562, 700928, 703298, 705672, 708050, 710432, 712818, 715208, 717602, 720000, 722402, 724808, 727218, 729632,
  85. 732050, 734472, 736898, 739328, 741762, 744200, 746642, 749088, 751538, 753992, 756452, 758912, 761378, 763848, 766322, 768800,
  86. 771282, 773768, 776258, 778752, 781250, 783752, 786258, 788768, 791282, 793800, 796322, 798848, 801378, 803912, 806450, 808992,
  87. 811538, 814088, 816642, 819200, 821762, 824328, 826898, 829472, 832050, 834632, 837218, 839808, 842402, 845000, 847602, 850208,
  88. 852818, 855432, 858050, 860672, 863298, 865928, 868562, 871200, 873842, 876488, 879138, 881792, 884450, 887112, 889778, 892448,
  89. 895122, 897800, 900482, 903168, 905858, 908552, 911250, 913952, 916658, 919368, 922082, 924800, 927522, 930248, 932978, 935712,
  90. 938450, 941192, 943938, 946688, 949442, 952200, 954962, 957728, 960498, 963272, 966050, 968832, 971618, 977202, 980000, 982802,
  91. 985608, 988418, 991232, 994050, 996872, 999698, 1002528, 1005362, 1008200, 1011042, 1013888, 1016738, 1019592, 1022450, 1025312, 1028178, 1031048,
  92. 1033922, 1036800, 1039682, 1042568, 1045458, 1048352, 1051250, 1054152, 1057058, 1059968, 1062882, 1065800, 1068722, 1071648, 1074578, 1077512, 1080450,
  93. 1083392, 1086338, 1089288, 1092242, 1095200, 1098162, 1101128, 1104098, 1107072, 1110050, 1113032, 1116018, 1119008, 1122002, 1125000, 1128002, 1131008,
  94. 1134018, 1137032, 1140050, 1143072, 1146098, 1149128, 1152162, 1155200, 1158242, 1161288, 1164338, 1167392, 1170450, 1173512, 1176578, 1179648, 1182722,
  95. 1185800, 1188882, 1191968, 1195058, 1198152, 1201250, 1204352, 1207458, 1210568, 1213682, 1216800, 1219922, 1223048, 1226178, 1229312, 1232450, 1235592,
  96. 1238738, 1241888, 1245042, 1248200, 1251362, 1254528, 1257698, 1260872, 1264050, 1267232, 1270418, 1273608, 1276802, 1280000, 1283202, 1286408, 1289618,
  97. 1292832, 1296050, 1299272, 1302498, 1305728, 1308962, 1312200, 1315442, 1318688, 1321938, 1325192, 1328450, 1331712, 1334978, 1338248, 1341522, 1344800,
  98. 1348082, 1351386, 1351368, 1354658, 1357952, 1361250, 1364552, 1367858, 1371168, 1374482, 1377800, 1381122, 1384448, 1387778, 1391112, 1394450, 1397792,
  99. 1401138, 1404488, 1407842, 1411200, 1414562, 1417928, 1421298, 1424672, 1428050, 1431432, 1434818, 1438208, 1455218, 1458632, 1462050, 1465472, 1468898,
  100. 1472328, 1475762, 1479200, 1482642, 1486088, 1489538, 1492992, 1496450, 1499912, 1503378, 1506848, 1510322, 1513800, 1517282, 1520768, 1524258, 1527752,
  101. 1531250, 1534752, 1538258, 1541768, 1545282, 1548800, 1552322, 1555848, 1557389, 1562712, 1566450, 1569992, 1573538, 1577088, 1580642, 1584200, 1587762,
  102. 1591328, 1594898, 1598472, 1602050, 1605632, 1608218, 1612808, 1616402, 1620000, 1623602, 1627202, 1630818, 1634432, 1638050, 1641672, 1645298, 1648928,
  103. 1652562, 1656200, 1659842, 1663488, 1667138, 1670792, 1674450, 1678112, 1681778, 1685448, 1689122, 1692800, 1696482, 1700168, 1703858, 1707552, 1701125,
  104. 1711250, 1714952, 1718658, 1722368, 1726082, 1729800, 1733522, 1737248, 1740978, 1744712, 1748450, 1752192, 1755938, 1759688, 1763442, 1767200, 1770962,
  105. 1774728, 1778498, 1782272, 1786050, 1789832, 1793618, 1797408, 1801202, 1805000, 1808802, 1812608, 1816418, 1820232, 1824050, 1827872, 1831698, 1835528,
  106. 1839362, 1843200, 1847042, 1850888, 1854738, 1858592, 1862450, 1866312, 1870178, 1874048, 1877922, 1881800, 1885682, 1889568, 1893458, 1897352, 1901250,
  107. 1905152, 1909058, 1912968, 1916882, 1920800, 1924722, 1928648, 1932578, 1936512, 1940450, 1944392, 1948338, 1952288, 1956242, 1960200, 1964162, 1968128,
  108. 1972098, 1976072, 1980050, 1984032, 1988018, 1992008, 1996002, 2000000, 2004002, 2008006, 2012012, 2016024, 2020048, 99999999 }
  109.  
  110. // Weapon Models
  111. new const model_vknife_nemesis[] = { "models/zombie_plague/v_knife_zombie.mdl" }
  112. new const model_vm249_survivor[] = { "models/v_m249.mdl" }
  113. new const model_grenade_infect[] = { "models/zombie_plague/v_grenade_infect.mdl" }
  114. new const model_grenade_fire[] = { "models/zombie_plague/v_grenade_fire.mdl" }
  115. new const model_grenade_frost[] = { "models/zombie_plague/v_grenade_frost.mdl" }
  116. new const model_grenade_flare[] = { "models/zombie_plague/v_grenade_flare.mdl" }
  117. new const model_akdestruction_human[] = { "models/[VG]/v_akdestruction.mdl" }
  118. new const model_akdestruction_human1[] = { "models/[VG]/p_akdestruction.mdl" }
  119. new const model_ultimate_human[] = { "models/[VG]/v_ultimate.mdl" }
  120. new const model_ultimate_human1[] = { "models/[VG]/p_ultimate.mdl" }
  121. new const model_atomic_human[] = { "models/[VG]/v_atomic.mdl" }
  122. new const model_atomic_human1[] = { "models/[VG]/p_atomic.mdl" }
  123. new const model_masive_human[] = { "models/[VG]/v_masive.mdl" }
  124. new const model_masive_human1[] = { "models/[VG]/p_masive.mdl" }
  125. new const model_navi_human[] = { "models/[VG]/v_navi.mdl" }
  126. new const model_navi_human1[] = { "models/[VG]/p_navi.mdl" }
  127. new const model_overpower_human[] = { "models/[VG]/v_overpower.mdl" }
  128. new const model_overpower_human1[] = { "models/[VG]/p_overpower.mdl" }
  129. new const model_stfu_human[] = { "models/[VG]/v_stfu.mdl" }
  130. new const model_stfu_human1[] = { "models/[VG]/p_stfu.mdl" }
  131. new const model_rlp_human[] = { "models/[VG]/v_rlp.mdl" }
  132. new const model_rlp_human1[] = { "models/[VG]/p_rlp.mdl" }
  133. new const model_m4_human[] = { "models/[VG]/v_m4.mdl" }
  134. new const model_m4_human1[] = { "models/[VG]/p_m4.mdl" }
  135. new const model_barret_human[] = { "models/[VG]/v_barret.mdl" }
  136. new const model_barret_human1[] = { "models/[VG]/p_barret.mdl" }
  137. new const model_devil_human[] = { "models/[VG]/v_devil.mdl" }
  138. new const model_devil_human1[] = { "models/[VG]/p_devil.mdl" }
  139. new const model_rampage_human[] = { "models/[VG]/v_rampage.mdl" }
  140. new const model_rampage_human1[] = { "models/[VG]/p_rampage.mdl" }
  141. new const model_supermide_human[] = { "models/[VG]/v_supermide.mdl" }
  142. new const model_supermide_human1[] = { "models/[VG]/p_supermide.mdl" }
  143. new const model_farger_human[] = { "models/[VG]/v_farger.mdl" }
  144. new const model_farger_human1[] = { "models/[VG]/p_farger.mdl" }
  145. new const model_storm_human[] = { "models/[VG]/v_storm.mdl" }
  146. new const model_storm_human1[] = { "models/[VG]/p_storm.mdl" }
  147. new const model_adge_human[] = { "models/[VG]/v_adge.mdl" }
  148. new const model_adge_human1[] = { "models/[VG]/p_adge.mdl" }
  149. new const model_ultra_human[] = { "models/[VG]/v_ultra.mdl" }
  150. new const model_ultra_human1[] = { "models/[VG]/p_ultra.mdl" }
  151. new const model_nule_human[] = { "models/[VG]/v_nule.mdl" }
  152. new const model_nule_human1[] = { "models/[VG]/p_nule.mdl" }
  153. new const model_super_human[] = { "models/[VG]/v_super.mdl" }
  154. new const model_super_human1[] = { "models/[VG]/p_super.mdl" }
  155. new const model_ultrak_human[] = { "models/[VG]/v_ultrak.mdl" }
  156. new const model_ultrak_human1[] = { "models/[VG]/p_ultrak.mdl" }
  157. new const model_raampage_human[] = { "models/[VG]/v_raampage.mdl" }
  158. new const model_raampage_human1[] = { "models/[VG]/p_raampage.mdl" }
  159. new const model_nemesis2[] = { "models/player/[VG]Nemesis/[VG]NemesisT.mdl" }
  160. new const model_nemesis3[][] = { "[VG]Sonidos/[VG]Infeccion.wav" }
  161. new const model_nemesis4[][] = { "[VG]Sonidos/[VG]Nemesis.wav" }
  162. new const model_nemesis5[][] = { "[VG]Sonidos/[VG]Survivor.wav" }
  163. new const model_nemesis6[][] = { "[VG]Sonidos/[VG]SwarmPlague.wav" }
  164.  
  165. // Grenade Sprites
  166. new const sprite_grenade_trail[] = { "sprites/laserbeam.spr" }
  167. new const sprite_grenade_ring[] = { "sprites/shockwave.spr" }
  168. new const sprite_grenade_fire[] = { "sprites/flame.spr" }
  169. new const sprite_grenade_smoke[] = { "sprites/black_smoke3.spr" }
  170. new const sprite_grenade_glass[] = { "models/glassgibs.mdl" }
  171. new const sprite_thunder[] = { "sprites/lvlupvg.spr" }
  172. new const sprite_thunder2[] = { "sprites/lvlupvg.spr" } // es el efecto del rayo, si querés le podes poner otro
  173.  
  174. // Sounds (randomly chosen if more than one)
  175. new const sound_win_zombies[][] = { "[VG]Sonidos/[VG]ZombieWin.wav" }
  176. new const Subes[][] = { "ambience/subes.wav" }
  177. new const Bajas[][] = { "ambience/bajas.wav" }
  178. new const HoraLoca[][] = { "[VG]Sonidos/HoraLoca.wav" }
  179. new const sound_win_humans[][] = { "[VG]Sonidos/[VG]HumanWin.wav" }
  180. new const sound_win_no_one[][] = { "[VG]Sonidos/[VG]NadieGana.wav" }
  181. new const zombie_infect[][] = { "[VG]Sonidos/[VG]OtroZombie.wav" }
  182. new const zombie_pain[][] = { "zombie_plague/zombie_pain1.wav", "zombie_plague/zombie_pain2.wav", "zombie_plague/zombie_pain3.wav", "zombie_plague/zombie_pain4.wav", "zombie_plague/zombie_pain5.wav" }
  183. new const nemesis_pain[][] = { "[VG]Sonidos/[VG]NemeDolor.wav" }
  184. new const zombie_die[][] = { "zombie_plague/zombie_die1.wav", "zombie_plague/zombie_die2.wav", "zombie_plague/zombie_die3.wav", "zombie_plague/zombie_die4.wav", "zombie_plague/zombie_die5.wav" }
  185. new const zombie_fall[][] = { "zombie_plague/zombie_fall1.wav" }
  186. new const zombie_miss_slash[][] = { "weapons/knife_slash1.wav", "weapons/knife_slash2.wav" }
  187. new const zombie_miss_wall[][] = { "weapons/knife_hitwall1.wav" }
  188. new const zombie_hit_normal[][] = { "weapons/knife_hit1.wav", "weapons/knife_hit2.wav", "weapons/knife_hit3.wav", "weapons/knife_hit4.wav" }
  189. new const zombie_hit_stab[][] = { "weapons/knife_stab.wav" }
  190. new const zombie_idle[][] = { "nihilanth/nil_now_die.wav", "nihilanth/nil_slaves.wav", "nihilanth/nil_alone.wav", "zombie_plague/zombie_brains1.wav", "zombie_plague/zombie_brains2.wav" }
  191. new const zombie_idle_last[][] = { "nihilanth/nil_thelast.wav" }
  192. new const zombie_madness[][] = { "zombie_plague/zombie_madness1.wav" }
  193. new const sound_nemesis[][] = { "[VG]Sonidos/Evolution.wav" }
  194. new const sound_survivor[][] = { "[VG]Sonidos/Evolution.wav" }
  195. new const sound_swarm[][] = { "[VG]Sonidos/[VG]StartSwarmPlague.wav" }
  196. new const sound_multi[][] = { "[VG]Sonidos/[VG]StartSwarmPlague.wav" }
  197. new const sound_plague[][] = { "[VG]Sonidos/[VG]StartSwarmPlague.wav" }
  198. new const grenade_infect[][] = { "zombie_plague/grenade_infect.wav" }
  199. new const grenade_infect_player[][] = { "scientist/scream20.wav", "scientist/scream22.wav", "scientist/scream05.wav" }
  200. new const grenade_fire[][] = { "zombie_plague/grenade_explode.wav" }
  201. new const grenade_fire_player[][] = { "zombie_plague/zombie_burn3.wav","zombie_plague/zombie_burn4.wav","zombie_plague/zombie_burn5.wav","zombie_plague/zombie_burn6.wav","zombie_plague/zombie_burn7.wav" }
  202. new const grenade_frost[][] = { "warcraft3/frostnova.wav" }
  203. new const grenade_frost_player[][] = { "warcraft3/impalehit.wav" }
  204. new const grenade_frost_break[][] = { "warcraft3/impalelaunch1.wav" }
  205. new const grenade_flare[][] = { "items/nvg_on.wav" }
  206. new const sound_antidote[][] = { "items/smallmedkit1.wav" }
  207. new const sound_thunder[][] = { "zombie_plague/thunder1.wav", "zombie_plague/thunder2.wav" }
  208.  
  209. // ganancia admin
  210. enum _:ganancia
  211. {
  212. Admin,
  213. Ganancia,
  214. HH
  215. }
  216.  
  217. new const admganancia[][ganancia] =
  218. {
  219. {ADMIN_LEVEL_E, 12, 24},
  220. {ADMIN_LEVEL_H, 9, 18},
  221. {ADMIN_LEVEL_G, 6, 12},
  222. {ADMIN_LEVEL_F, 3, 6} // Les explico, el primero ven que dice ADMIN_LEVEL_F? Significa que el admin con el flag F es uno de los que tendra mas ganancia, el "2" Significa cuanta ganancia va a tener, el usuario tiene 1, y el tiene 2, y el "4" significa la ganancia que va a tener en HappyHour si es que tenes el happy hour.
  223. }
  224.  
  225.  
  226. // Uncomment the following line to enable ambience sounds
  227. //#define AMBIENCE_SOUNDS
  228.  
  229. #if defined AMBIENCE_SOUNDS // Ambience Sounds List (only .wav and .mp3 formats supported)
  230. // Infection Rounds
  231. new const sound_ambience1[][] = { "[VG]Sonidos/[VG]Infeccion.wav" } // sounds (played randomly)
  232. new const Float:sound_ambience1_duration[] = { 380.0 } // duration in seconds of each sound
  233. // Nemesis Rounds
  234. new const sound_ambience2[][] = { "[VG]Sonidos/[VG]Nemesis.wav" }
  235. new const Float:sound_ambience2_duration[] = { 150.0 }
  236. // Survivor Rounds
  237. new const sound_ambience3[][] = { "ambience/Survivor.wav" }
  238. new const Float:sound_ambience3_duration[] = { 147.0 }
  239. // Swarm Rounds
  240. new const sound_ambience4[][] = { "[VG]Sonidos/[VG]SwarmPlague.wav" }
  241. new const Float:sound_ambience4_duration[] = { 195.0 }
  242. // Plague Rounds
  243. new const sound_ambience5[][] = { "[VG]Sonidos/[VG]SwarmPlague.wav" }
  244. new const Float:sound_ambience5_duration[] = { 195.0 }
  245. #endif
  246.  
  247. // Buy Menu: Primary and Secondary Weapons
  248. new bool: g_akdestruction[33]
  249. new bool: g_ultimate[33]
  250. new bool: g_atomic[33]
  251. new bool: g_masive[33]
  252. new bool: g_navi[33]
  253. new bool: g_power[33]
  254. new bool: g_stfu[33]
  255. new bool: g_rlp[33]
  256. new bool: g_m4[33]
  257. new bool: g_barret[33]
  258. new bool: g_devil[33]
  259. new bool: g_rampage[33]
  260. new bool: g_supermide[33]
  261. new bool: g_farger[33]
  262. new bool: g_storm[33]
  263. new bool: g_adge[33]
  264. new bool: g_ultra[33]
  265. new bool: g_nule[33]
  266. new bool: g_super[33]
  267. new bool: g_ultrak[33]
  268. new bool: g_raampage[33]
  269.  
  270. new const lvlarmas[] = { 0, 22, 44, 66, 88, 110, 132, 154, 176, 198, 220, 242, 264, 286 } // ay te agrege el nivel para el arma nueva
  271. new const resetarmas[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } // reset armas
  272.  
  273. new const ArmasName[][] = { "Schmidt TMP", "Ingram MAC-10", "UMP 45", "MP5 Navy", "ES P90", "M3 Super 90", "Schmidt Scout", "Famas", "IMI Galil", "Steyr AUG A1", "SG-552 Commando", "M4A1 Carabine", "AK-47 Kalashnikov", "XM1014 M4" } // y el name XD
  274. new const g_primary_items[][] = { "weapon_tmp", "weapon_mac10", "weapon_ump45", "weapon_mp5navy", "weapon_p90", "weapon_m3", "weapon_scout",
  275. "weapon_famas", "weapon_galil", "weapon_aug", "weapon_sg552", "weapon_m4a1", "weapon_ak47", "weapon_xm1014"}
  276. new const g_secondary_items[][] = { "weapon_p228", "weapon_fiveseven", "weapon_glock18", "weapon_elite", "weapon_deagle", "weapon_usp" }
  277.  
  278. // Extra Items: Weapons and their costs
  279. new const g_extra_names[][] = { "Bomba Hielo", "Bomba Fuego" }
  280. new const g_extra_items[][] = { "weapon_flashbang", "weapon_hegrenade" }
  281. new const g_extra_costs[] = { 5, 6 }
  282.  
  283. // Extra Items: costs for Night Vision, Antidote, Zombie Madness,Infection Bomb, and burbuja
  284. new const g_extra_costs2[] = { 10, 35, 12, 35 }
  285.  
  286. // Weather Effects: uncomment a line to have the desired effect
  287. //#define AMBIENCE_RAIN // Rain
  288. //#define AMBIENCE_SNOW // Snow
  289. //#define AMBIENCE_FOG // Fog
  290.  
  291. #if defined AMBIENCE_FOG // Fog Customization (if enabled)
  292. new const FOG_DENSITY[] = "0.0018" // Density
  293. new const FOG_COLOR[] = "128 128 128" // Color: Red Green Blue
  294. #endif
  295.  
  296. // Sky Names (randomly chosen if more than one)
  297. new const skynames[][] = { "space" }
  298.  
  299. // Uncomment if you don't want the sky to be changed
  300. //#define DONT_CHANGE_SKY
  301.  
  302. // Lightning Lights Cycle
  303. new const lights_thunder1[][] = { "i" ,"j", "k", "l", "m", "n", "o", "n", "m", "l", "k", "j", "i", "h", "g", "f", "e", "d", "c", "b", "a"}
  304. new const lights_thunder2[][] = { "k", "l", "m", "l", "k", "j", "i", "h", "g", "f", "e", "d", "c", "b", "a", "a", "b", "c", "d", "e", "d", "c", "b", "a"}
  305. new const lights_thunder3[][] = { "b", "c", "d", "e", "f", "e", "d", "c", "i" ,"j", "k", "l", "m", "l", "k", "j", "i", "h", "g", "f", "e", "d", "c", "b", "a"}
  306.  
  307. // Decal List for Zombie Bloodstains/Footsteps
  308. new const zombie_decals[] = { 99, 107, 108, 184, 185, 186, 187, 188, 189 }
  309.  
  310. // Knockback Power values for weapons
  311. // Note: negative values will disable knockback power for the weapon
  312. new const Float:kb_weapon_power[] =
  313. {
  314. -1.0, // ---
  315. 2.4, // P228
  316. -1.0, // ---
  317. 6.5, // SCOUT
  318. -1.0, // ---
  319. 8.0, // XM1014
  320. -1.0, // ---
  321. 2.3, // MAC10
  322. 5.0, // AUG
  323. -1.0, // ---
  324. 2.4, // ELITE
  325. 2.0, // FIVESEVEN
  326. 2.4, // UMP45
  327. 5.3, // SG550
  328. 5.5, // GALIL
  329. 5.5, // FAMAS
  330. 2.2, // USP
  331. 2.0, // GLOCK18
  332. 10.0, // AWP
  333. 2.5, // MP5NAVY
  334. 5.2, // M249
  335. 8.0, // M3
  336. 5.0, // M4A1
  337. 2.4, // TMP
  338. 6.5, // G3SG1
  339. -1.0, // ---
  340. 5.3, // DEAGLE
  341. 5.0, // SG552
  342. 6.0, // AK47
  343. -1.0, // ---
  344. 2.0 // P90
  345. }
  346.  
  347. // Dynamic Stuff Limiters (increase if needed)
  348. const MAX_EXTRA_ITEMS = 30
  349. const MAX_ZOMBIE_CLASSSES = 20
  350. const MAX_HUMAN_CLASSSES = 20
  351. const MAX_CSDM_SPAWNS = 128
  352. const MAX_STATS_SAVED = 64
  353. const MAX_MODELS_NEMESIS = 10
  354. const MAX_MODELS_SURVIVOR = 10
  355. const MAX_MODELS_HUMAN = 20
  356. const MAX_MODELS_ADM_HUMAN = 10
  357. const MAX_MODELS_ADM_ZOMBIE = 10
  358.  
  359. // Objective entites and anything that would affect plugin gameplay
  360. new const g_objective_ents[][] = { "func_bomb_target", "info_bomb_target", "info_vip_start", "func_vip_safetyzone", "func_escapezone", "hostage_entity",
  361. "monster_scientist", "func_hostage_rescue", "info_hostage_rescue", "env_fog", "env_rain", "env_snow", "item_longjump", "func_vehicle" }
  362.  
  363. // ***************************************************************
  364. // *** If you experience many SVC_BAD kicks, try the following ***
  365. // ***************************************************************
  366. // 1. Increase the delay between model changes here: (e.g. set it to 0.5)
  367. const Float:MODELCHANGE_DELAY = 0.2
  368. // 2. If the above doesn't help, uncomment the following line: (experimental!)
  369. //#define HANDLE_MODELS_ON_SEPARATE_ENT
  370.  
  371. // Alternate: This makes the plugin set the model index serverside offset
  372. // for accurate hitboxes and might also help with svc_bad (untested)
  373. // Note: Make sure your models don't have messed up hitboxes, otherwise
  374. // this setting may cause your server insane cpu usage and LAG!
  375. //#define SET_MODELINDEX_OFFSET
  376.  
  377. // ---------------------------------------------------------------
  378. // ------------------ Customization ends here!! ------------------
  379. // ---------------------------------------------------------------
  380.  
  381. /*================================================================================
  382. [Offsets and Constants]
  383. =================================================================================*/
  384.  
  385. // Plugin Version
  386. new const PLUGIN_VERSION[] = "2.2"
  387.  
  388. // Task offsets
  389. enum (+= 100)
  390. {
  391. TASK_MODEL = 2000,
  392. TASK_TEAM,
  393. TASK_SPAWN,
  394. TASK_BLOOD,
  395. TASK_NVISION,
  396. TASK_FLASH,
  397. TASK_CHARGE,
  398. TASK_SHOWHUD,
  399. TASK_NADES,
  400. TASK_MAKEZOMBIE,
  401. TASK_WELCOMEMSG,
  402. TASK_THUNDER_PRE,
  403. TASK_THUNDER,
  404. TASK_AMBIENCESOUNDS,
  405. TASK_LIGHTING,
  406. TASK_COMBO
  407. }
  408.  
  409. // IDs inside tasks
  410. #define ID_MODEL (taskid - TASK_MODEL)
  411. #define ID_TEAM (taskid - TASK_TEAM)
  412. #define ID_SPAWN (taskid - TASK_SPAWN)
  413. #define ID_BLOOD (taskid - TASK_BLOOD)
  414. #define ID_NVISION (taskid - TASK_NVISION)
  415. #define ID_FLASH (taskid - TASK_FLASH)
  416. #define ID_CHARGE (taskid - TASK_CHARGE)
  417. #define ID_SHOWHUD (taskid - TASK_SHOWHUD)
  418.  
  419. // Flare and flame tasks
  420. #define FLARE_ENTITY args[0]
  421. #define FLARE_DURATION args[1]
  422. #define FLARE_R args[2]
  423. #define FLARE_G args[3]
  424. #define FLARE_B args[4]
  425. #define FLAME_DURATION args[0]
  426.  
  427. // For player list menu handlers
  428. #define PL_STARTID g_menu_data[id][0]
  429. #define PL_ACTION g_menu_data[id][1]
  430. #define PL_SELECTION (g_menu_data[id][0]+key+1)
  431.  
  432. // For weapon buy menu handlers
  433. #define WPN_STARTID g_menu_data[id][2]
  434. #define WPN_MAXIDS (sizeof g_primary_items)
  435. #define WPN_SELECTION (g_menu_data[id][2]+key)
  436. #define WPN_AUTO_ON g_menu_data[id][3]
  437. #define WPN_AUTO_PRI g_menu_data[id][4]
  438. #define WPN_AUTO_SEC g_menu_data[id][5]
  439.  
  440. // For extra items menu handlers
  441. #define EXTRAS_STARTID g_menu_data[id][6]
  442. #define EXTRAS_SELECTION (g_menu_data[id][6]+key)
  443. #define EXTRAS_CUSTOM_STARTID (4+sizeof g_extra_names)
  444.  
  445. // For zombie class menu handlers
  446. #define ZCLASSES_STARTID g_menu_data[id][7]
  447. #define ZCLASSES_SELECTION (g_menu_data[id][7]+key)
  448.  
  449. // For human class menu handlers
  450. #define HCLASSES_STARTID g_menu_data[id][8]
  451. #define HCLASSES_SELECTION (g_menu_data[id][8]+key)
  452.  
  453. // Menu selections
  454. const MENU_KEY_AUTOSELECT = 7
  455. const MENU_KEY_BACK = 7
  456. const MENU_KEY_NEXT = 8
  457. const MENU_KEY_EXIT = 9
  458.  
  459. // Hard coded extra items
  460. enum
  461. {
  462. EXTRA_NVISION = 0,
  463. EXTRA_ANTIDOTE,
  464. EXTRA_MADNESS,
  465. EXTRA_INFBOMB,
  466. EXTRA_WEAPONS_STARTID
  467. }
  468.  
  469. // Game modes
  470. enum
  471. {
  472. MODE_NONE = 0,
  473. MODE_INFECTION,
  474. MODE_NEMESIS,
  475. MODE_SURVIVOR,
  476. MODE_SWARM,
  477. MODE_MULTI,
  478. MODE_PLAGUE,
  479. MODE_ARMAGEDON
  480. }
  481.  
  482. // ZP Teams
  483. enum
  484. {
  485. ZP_TEAM_ANY = 0,
  486. ZP_TEAM_ZOMBIE,
  487. ZP_TEAM_HUMAN
  488. }
  489.  
  490. // Zombie classes
  491. const ZCLASS_NONE = -1
  492.  
  493. // Human classes
  494. const HCLASS_NONE = -1
  495.  
  496. // HUD messages
  497. const Float:HUD_EVENT_X = -1.0
  498. const Float:HUD_EVENT_Y = 0.17
  499. const Float:HUD_INFECT_X = 0.05
  500. const Float:HUD_INFECT_Y = 0.45
  501. const Float:HUD_SPECT_X = 0.6
  502. const Float:HUD_SPECT_Y = 0.17
  503. const Float:HUD_STATS_X = 0.02
  504. const Float:HUD_STATS_Y = 0.05
  505.  
  506. // CS Offsets (win32)
  507. const OFFSET_CSTEAMS = 114
  508. const OFFSET_CSMONEY = 115
  509. const OFFSET_NVGOGGLES = 129
  510. const OFFSET_ZOOMTYPE = 363
  511. const OFFSET_CSDEATHS = 444
  512. const OFFSET_AWM_AMMO = 377
  513. const OFFSET_SCOUT_AMMO = 378
  514. const OFFSET_PARA_AMMO = 379
  515. const OFFSET_FAMAS_AMMO = 380
  516. const OFFSET_M3_AMMO = 381
  517. const OFFSET_USP_AMMO = 382
  518. const OFFSET_FIVESEVEN_AMMO = 383
  519. const OFFSET_DEAGLE_AMMO = 384
  520. const OFFSET_P228_AMMO = 385
  521. const OFFSET_GLOCK_AMMO = 386
  522. const OFFSET_FLASH_AMMO = 387
  523. const OFFSET_HE_AMMO = 388
  524. const OFFSET_SMOKE_AMMO = 389
  525. const OFFSET_C4_AMMO = 390
  526. const OFFSET_CLIPAMMO = 51
  527. const OFFSET_MODELINDEX = 491 // by Orangutanz
  528.  
  529. const OFFSET_LINUX = 5 // offsets 5 higher in Linux builds
  530. const OFFSET_LINUX_WEAPONS = 4 // weapon offsets are only 4 steps higher on Linux
  531.  
  532. // CS Teams
  533. enum
  534. {
  535. CS_TEAM_UNASSIGNED = 0,
  536. CS_TEAM_T,
  537. CS_TEAM_CT,
  538. CS_TEAM_SPECTATOR
  539. }
  540. new const TEAMNAMES[][] = { "UNASSIGNED", "TERRORIST", "CT", "SPECTATOR" }
  541.  
  542. // Some constants
  543. const HIDE_MONEY = (1<<5|1<<3)
  544. const ATTRIB_BOMB = (1<<1)
  545. const UNIT_SECOND = (1<<12)
  546. const DMG_HEGRENADE = (1<<24)
  547. const CS_NO_ZOOM = 0x5A
  548. const HAS_NVGOGGLES = (1<<0)
  549. const IMPULSE_FLASHLIGHT = 100
  550. const USE_USING = 2
  551. const USE_STOPPED = 0
  552. const STEPTIME_SILENT = 999
  553. const BREAK_GLASS = 0x01
  554. const FFADE_IN = 0x0000
  555. const PEV_SPEC_TARGET = pev_iuser2
  556.  
  557. // Max BP ammo for weapons
  558. new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120,
  559. 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
  560.  
  561. // Max Clip for weapons
  562. new const MAXCLIP[] = { -1, 13, -1, 10, -1, 7, -1, 30, 30, -1, 30, 20, 25, 30, 35, 25, 12, 20,
  563. 10, 30, 100, 8, 30, 30, 20, -1, 7, 30, 30, -1, 50 }
  564.  
  565. // Amount of ammo to give when buying additional clips for weapons
  566. new const BUYAMMO[] = { -1, 13, -1, 30, -1, 8, -1, 12, 30, -1, 30, 50, 12, 30, 30, 30, 12, 30,
  567. 10, 30, 30, 8, 30, 30, 30, -1, 7, 30, 30, -1, 50 }
  568.  
  569. // Ammo IDs for weapons
  570. new const AMMOID[] = { -1, 9, -1, 2, 12, 5, 14, 6, 4, 13, 10, 7, 6, 4, 4, 4, 6, 10,
  571. 1, 10, 3, 5, 4, 10, 2, 11, 8, 4, 2, -1, 7 }
  572.  
  573. // Weapon IDs for ammo types
  574. new const AMMOWEAPON[] = { 0, CSW_AWP, CSW_SCOUT, CSW_M249, CSW_AUG, CSW_XM1014, CSW_MAC10, CSW_FIVESEVEN, CSW_DEAGLE,
  575. CSW_P228, CSW_ELITE, CSW_FLASHBANG, CSW_HEGRENADE, CSW_SMOKEGRENADE, CSW_C4 }
  576.  
  577. // Ammo Offsets for weapons
  578. new const AMMOOFFSET[] = { -1, OFFSET_P228_AMMO, -1, OFFSET_SCOUT_AMMO, OFFSET_HE_AMMO, OFFSET_M3_AMMO, OFFSET_C4_AMMO,
  579. OFFSET_USP_AMMO, OFFSET_FAMAS_AMMO, OFFSET_SMOKE_AMMO, OFFSET_GLOCK_AMMO, OFFSET_FIVESEVEN_AMMO,
  580. OFFSET_USP_AMMO, OFFSET_FAMAS_AMMO, OFFSET_FAMAS_AMMO, OFFSET_FAMAS_AMMO, OFFSET_USP_AMMO,
  581. OFFSET_GLOCK_AMMO, OFFSET_AWM_AMMO, OFFSET_GLOCK_AMMO, OFFSET_PARA_AMMO, OFFSET_M3_AMMO,
  582. OFFSET_FAMAS_AMMO, OFFSET_GLOCK_AMMO, OFFSET_SCOUT_AMMO, OFFSET_FLASH_AMMO, OFFSET_DEAGLE_AMMO,
  583. OFFSET_FAMAS_AMMO, OFFSET_SCOUT_AMMO, -1, OFFSET_FIVESEVEN_AMMO }
  584.  
  585. // Primary and Secondary Weapon Names
  586. new const WEAPONNAMES[][] = { "", "P228 Compact", "", "Schmidt Scout", "", "XM1014 M4", "", "Ingram MAC-10", "Steyr AUG A1",
  587. "", "Dual Elite Berettas", "FiveseveN", "UMP 45", "SG-550 Auto-Sniper", "IMI Galil", "Famas",
  588. "USP .45 ACP Tactical", "Glock 18C", "AWP Magnum Sniper", "MP5 Navy", "M249 Para Machinegun",
  589. "M3 Super 90", "M4A1 Carbine", "Schmidt TMP", "G3SG1 Auto-Sniper", "", "Desert Eagle .50 AE",
  590. "SG-552 Commando", "AK-47 Kalashnikov", "", "ES P90" }
  591.  
  592. // CS sounds
  593. new const sound_flashlight[] = "items/flashlight1.wav"
  594. new const sound_buyammo[] = "items/9mmclip1.wav"
  595. new const sound_armorhit[] = "player/bhit_helmet-1.wav"
  596.  
  597. // Explosion radius for custom grenades
  598. const Float:NADE_EXPLOSION_RADIUS = 240.0
  599.  
  600. // pev_ field used to store additional ammo on weapons
  601. const PEV_ADDITIONAL_AMMO = pev_iuser1
  602.  
  603. // pev_ field used to store custom nade types and their values
  604. const PEV_NADE_TYPE = pev_flTimeStepSound
  605. const NADE_TYPE_INFECTION = 1111
  606. const NADE_TYPE_NAPALM = 2222
  607. const NADE_TYPE_FROST = 3333
  608. const NADE_TYPE_FLARE = 4444
  609. const NADE_TYPE_CAMPO = 5555 // es el nuevo tipo de grenade que vamos a crear, es decir el campo
  610. const PEV_FLARE_COLOR = pev_punchangle
  611.  
  612. // Weapon bitsums
  613. const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
  614. const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
  615.  
  616. // Allowed weapons for zombies (added grenades/bomb for sub-plugin support, since they shouldn't be getting them aynway)
  617. const ZOMBIE_ALLOWED_WEAPONS_BITSUM = (1<<CSW_KNIFE)|(1<<CSW_HEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_C4)
  618.  
  619. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  620. // Classnames for separate model entities
  621. new const MODEL_ENT_CLASSNAME[] = "player_model"
  622. new const WEAPON_ENT_CLASSNAME[] = "weapon_model"
  623. #endif
  624.  
  625. // Menu keys
  626. const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
  627.  
  628. /*================================================================================
  629. [Global Variables]
  630. =================================================================================*/
  631.  
  632. // Stupid compiler
  633. #pragma unused g_models_targettime
  634.  
  635. // human and zombie upgrades names
  636. new const g_upgrades_names[2][5][] =
  637. {
  638. { "Daño", "Salud", "Speed", "Gravity", "Armor" }, // HUMANS
  639. { "Daño", "Salud", "Speed", "Gravity", "" } // ZOMBIES
  640. }
  641.  
  642. // Human and zombie max skills
  643. new const g_upgrade_max[][] =
  644. {
  645. { 45, 25, 25, 15, 25 }, // HUMANS
  646. { 45, 40, 35, 15, 0 } // ZOMBIES
  647. }
  648.  
  649. // Upgrades here!
  650. #define upgrade_cost(%1) (%1 * 2) + 1 // cost of upgrades
  651. #define H_DAMAGE(%1) (%1 + 4) * 0.2 // upgrade human damage
  652. #define H_SALUD(%1) (%1 * 30) // upgrade human health
  653. #define H_SPEED(%1) (%1 * 10) // upgrade human speed
  654. #define H_GRAVITY(%1) ((%1 * 0.005) * 2) // upgrade human gravity
  655. #define H_ARMOR(%1) (%1 * 20) // upgrade human armor
  656. #define Z_DAMAGE(%1) (%1 * 3)
  657. #define Z_SALUD(%1) (%1 * 40000) // upgrade zombie health
  658. #define Z_SPEED(%1) (%1 * 5) // upgrade zombie speed
  659. #define Z_GRAVITY(%1) ((%1 * 0.005) * 2) // upgrade zombie gravity
  660.  
  661. // creamos variables multidimensionales
  662. new g_points[33][2] // human and zombie points
  663. new g_usedpoints[33][2] // human and zombie points used
  664. new g_skill_points[33][2][5] // upgrade data
  665.  
  666. enum // Player state
  667. {
  668. OFFLINE, // Player offline
  669. ONLINE // Player online
  670. }
  671.  
  672. enum _:g_cm
  673. {
  674. Combos, //Cantidades de combos
  675. Msj[33], // Mensajes que va dependiendo del combo
  676. Rojo, // esto no creo q sea nesesario que lo explique
  677. Verde, // ""
  678. Azul, // ""
  679. Multiplicado // Multiplica el combo obtenido
  680. }
  681. new const Combo[][g_cm] =
  682. {
  683. { 0, "Bien!", 255, 255, 255, 2 },
  684. { 25, "Muy Bien!", 0, 255, 255, 3 },
  685. { 60, "Demasiado Bien!", 0, 255, 255, 5 },
  686. { 127, "Excelente", 255, 255, 0, 6 },
  687. { 200, "Increible", 255, 255, 0, 7 },
  688. { 345, "Genial", 255, 0, 255, 8 },
  689. { 400, "Espectacular!", 0, 255, 0, 9 },
  690. { 475, "Impresionante!!", 0, 0, 255, 10 },
  691. { 565, "Sorprendente!!!", 255, 0, 0, 11 },
  692. { 687, "¡¡¡¡¡Alucinante!!!", 173, 217, 166, 12 },
  693. { 788, "¡¡¡¡¡GODLIKE!!!!!", 255, 128, 64, 13 },
  694. { 1200, "¡¡¡¡¡¡¡VARGAS!!!!!!!", 255, 128, 255, 14 },
  695. { 1500, "ggwp", 128, 128, 192, 13 },
  696. { 99999999999, "", 255, 255, 255, 0 } // Si van a tratar de poner mas traten de que este ultimo sea muyo mayor q los demas que sea imposible llegar a este sino se les bugea todavia nose por que pasa eso
  697.  
  698. }
  699.  
  700. enum _:g_cmh
  701. {
  702. Combosh, //Cantidades de combos
  703. Msjh[33], // Mensajes que va dependiendo del combo
  704. Rojoh, // esto no creo q sea nesesario que lo explique
  705. Verdeh, // ""
  706. Azulh, // ""
  707. Multiplicado // Multiplica el combo obtenido
  708. }
  709. new const Comboh[][g_cmh] =
  710. {
  711. { 0, "Cuquita", 255, 255, 255, 2 },
  712. { 25, "Pajero", 0, 255, 255, 3 },
  713. { 60, "Fumon", 0, 255, 255, 4 },
  714. { 127, "Periquero", 255, 255, 0, 5 },
  715. { 200, "Casi Negro", 255, 255, 0, 6 },
  716. { 345, "Negro Violador!", 255, 0, 255, 7 },
  717. { 450, "Marihuanero!!!", 255, 0, 255, 8 },
  718. { 646, "Negro Fumon!!!", 128, 64, 64, 9 },
  719. { 720, "¡¡¡Nigga!!!", 0, 128, 128, 10 },
  720. { 940, "¡¡¡¡Maricon!!!!", 255, 128, 192, 11 },
  721. { 1200, "¡¡¡¡¡Anal Sex!!!!!", 255, 128, 64, 12 },
  722. { 1500, "¡!¡!¡Mardita Bruja!¡!¡!", 128, 128, 255, 13 },
  723. { 1760, "|||--Coje Perras--|||", 128, 128, 128, 14 },
  724. { 2500, "Yisus", 255, 255, 0, 14 },
  725. { 99999999999, "", 255, 255, 255, 0 } // Si van a tratar de poner mas traten de que este ultimo sea muyo mayor q los demas que sea imposible llegar a este sino se les bugea todavia nose por que pasa eso
  726.  
  727. }
  728.  
  729. #define TAG "[Party]"
  730. #define ID_HUD (taskid - TASK_HUD)
  731.  
  732. enum (+= 77)
  733. {
  734. TASK_HUD = 777,
  735. TASK_ACEPT
  736. }
  737.  
  738. enum
  739. {
  740. NONE = -1,
  741. Master,
  742. Start_Amount
  743. }
  744.  
  745. enum _:pdata
  746. {
  747. In_Party,
  748. Position,
  749. Amount_In_Party,
  750. Block_Party,
  751. UserName[32]
  752. }
  753.  
  754. enum _:DataCallBack
  755. {
  756. MASTER,
  757. USER
  758. }
  759.  
  760. new g_PartyData[33][pdata], Array:Party_Ids[33], g_MenuCallback[DataCallBack], g_MsgSayText
  761. new cvar_time_acept, cvar_max_players, cvar_allow_bots
  762.  
  763. new const g_sombretos_modes[][] =
  764. {
  765. "models/hats/hat1.mdl",
  766. "models/hats/hat2.mdl",
  767. "models/hats/hat3.mdl",
  768. "models/hats/hat4.mdl",
  769. "models/hats/hat5.mdl"
  770. }
  771.  
  772. // Player vars
  773. new g_level[33] // niveles
  774. new g_reset[33] // resetsitos
  775. new g_grandreset[33] // grandresesitos
  776. new g_ganancia[33] // admin x3 x6 x9 x12
  777. new g_combo[33] // combo
  778. new g_MsgSync3 // mensaje combo
  779. new g_damage[33] // daño para level combo
  780. new g_total[33] // daño total del combo
  781. new g_playername[33][32] // Player name
  782. new g_password[33][24]
  783. new g_estado[33]
  784. new Registrado[33]
  785. new BadPassword[33]
  786. new const SaveData[] = "Data"
  787. new g_sombrero[33]
  788. new g_sombrero_ent[33]
  789. new g_matados[33]
  790. new g_matadosz[33]
  791. new g_infectados[33]
  792. new g_zombie[33] // is zombie
  793. new g_nemesis[33] // is nemesis
  794. new g_armagedon[33] // is armagedon
  795. new g_survivor[33] // is surivor
  796. new g_firstzombie[33] // is the first zombie
  797. new g_lastzombie[33] // is last zombie
  798. new g_lasthuman[33] // is last human
  799. new g_frozen[33] // is frozen (can't move)
  800. new g_nodamage[33] // has spawn protection/zombie madness
  801. new g_respawn_as_zombie[33] // should respawn as zombie
  802. new g_nvision[33] // has night vision
  803. new g_nvisionenabled[33] // has night vision turned on
  804. new g_zombieclass[33] // zombie class
  805. new g_zombieclassnext[33] // zombie class for next infection
  806. new g_humanclass[33]
  807. new g_humanclassnext[33]
  808. new g_flashlight[33] // has custom flashlight turned on
  809. new g_flashbattery[33] = { 100, ... } // custom flashlight battery
  810. new g_currentweapon[33] // current weapon the player is holding
  811. new g_canbuy[33] // is allowed to buy a new weapon through the menu
  812. new g_ammopacks[33] // ammo pack count
  813. new g_damagedealt[33] // damage dealt to zombies (used to calculate ammo packs reward)
  814. new g_restorevel[33], Float:g_velocity[33][3] // Pain Shock Free vars
  815. new Float:g_lastleaptime[33] // time leap was last used
  816. new Float:g_lastflashtime[33] // time flashlight was last turned on/off
  817. new g_switchingteam[33] // is switching team
  818. new g_playermodel[33][32] // current model's short name [player][model]
  819. new g_menu_data[33][9] // data for various menus
  820. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  821. new g_ent_playermodel[33] // player model entity
  822. new g_ent_weaponmodel[33] // weapon model entity
  823. #endif
  824.  
  825. // Game vars
  826. new g_pluginenabled // ZP plugin enabled
  827. new g_newround // new round starting
  828. new g_endround // round ended
  829. new g_nemround // nemesis round
  830. new g_armagedonround // armagedon round
  831. new g_survround // survivor round
  832. new g_swarmround // swarm round
  833. new g_plagueround // plague round
  834. new g_lastmode // last played mode
  835. new g_scorezombies, g_scorehumans // team scores
  836. new g_spawnCount // available spawn points counter
  837. new Float:g_spawns[MAX_CSDM_SPAWNS][3] // spawn points data
  838. new g_lights_i // lightning current lights counter
  839. new Float:g_models_targettime // for adding delays between Model Change messages
  840. new Float:g_teams_targettime // for adding delays between Team Change messages
  841. new g_MsgSync, g_MsgSync2 // message sync objects
  842. new g_trailSpr, g_exploSpr, g_flameSpr, g_smokeSpr, g_glassSpr // grenade sprites
  843. new g_thunder1Spr, g_thunder2Spr // lvlup
  844. new g_modname[32] // for formating the mod name
  845. new g_freezetime // whether it's freeze time
  846. new g_maxplayers // max players counter
  847. new g_czero // whether we are running on a CZ server
  848. new g_hamczbots // whether ham forwards are registered for CZ bots
  849. new g_fwSpawn // spawn forward handle
  850. new g_infbombcounter // to limit buying infection bombs
  851.  
  852. // Precached model indexes
  853. new g_modelindex_nemesis[MAX_MODELS_NEMESIS]
  854. new g_modelindex_survivor[MAX_MODELS_SURVIVOR]
  855. new g_modelindex_admin[MAX_MODELS_ADM_HUMAN]
  856. new g_modelindex_admin_zombie[MAX_MODELS_ADM_ZOMBIE]
  857.  
  858. // Some forward handlers
  859. new g_fwRoundStart, g_fwRoundEnd, g_fwUserInfected_pre, g_fwUserInfected_post,
  860. g_fwUserHumanized_pre, g_fwUserHumanized_post, g_fwExtraItemSelected, g_fwDummyResult
  861.  
  862. // Temporary Database vars (used to restore players stats in case they get disconnected)
  863. new db_name[MAX_STATS_SAVED][32] // player name
  864. new db_ammopacks[MAX_STATS_SAVED] // ammo pack count
  865. new db_zombieclass[MAX_STATS_SAVED] // zombie class
  866. new db_humanclass[MAX_STATS_SAVED]
  867. new db_slot_i // additional saved slots counter (should start on maxplayers+1)
  868.  
  869. // Extra Items vars
  870. new g_extraitem_name[MAX_EXTRA_ITEMS][32] // caption
  871. new g_extraitem_cost[MAX_EXTRA_ITEMS] // cost
  872. new g_extraitem_team[MAX_EXTRA_ITEMS] // team
  873. new g_extraitem_i // loaded extra items counter
  874.  
  875. // Zombie Classes vars
  876. new g_zclass_name[MAX_ZOMBIE_CLASSSES][32] // name
  877. new g_zclass_info[MAX_ZOMBIE_CLASSSES][32] // description
  878. new g_zclass_model[MAX_ZOMBIE_CLASSSES][32] // player model
  879. new g_zclass_modelindex[MAX_ZOMBIE_CLASSSES] // model index
  880. new g_zclass_clawmodel[MAX_ZOMBIE_CLASSSES][32] // claw model
  881. new g_zclass_hp[MAX_ZOMBIE_CLASSSES] // health
  882. new g_zclass_spd[MAX_ZOMBIE_CLASSSES] // speed
  883. new Float:g_zclass_grav[MAX_ZOMBIE_CLASSSES] // gravity
  884. new Float:g_zclass_kb[MAX_ZOMBIE_CLASSSES] // knockback
  885. new g_zclass_lvl[MAX_ZOMBIE_CLASSSES]
  886. new g_zclass_i // loaded zombie classes counter
  887.  
  888.  
  889. // Human Classes vars
  890. new g_hclass_name[MAX_HUMAN_CLASSSES][32] // name
  891. new g_hclass_info[MAX_HUMAN_CLASSSES][32] // description
  892. new g_hclass_model[MAX_HUMAN_CLASSSES][32] // player model
  893. new g_hclass_modelindex[MAX_HUMAN_CLASSSES] // model index
  894. new g_hclass_clawmodel[MAX_HUMAN_CLASSSES][32] // claw model
  895. new g_hclass_hp[MAX_HUMAN_CLASSSES] // health
  896. new g_hclass_spd[MAX_HUMAN_CLASSSES] // speed
  897. new Float:g_hclass_grav[MAX_HUMAN_CLASSSES] // gravity
  898. new g_hclass_lvl[MAX_HUMAN_CLASSSES] // level
  899. new g_hclass_ar[MAX_HUMAN_CLASSSES] // armadura
  900. new g_hclass_i // loaded human classes counter
  901.  
  902. // Message IDs vars
  903. new g_msgScoreInfo, g_msgNVGToggle, g_msgScoreAttrib, g_msgAmmoPickup, g_msgScreenFade,
  904. g_msgDeathMsg, g_msgSetFOV, g_msgFlashlight, g_msgFlashBat, g_msgTeamInfo, g_msgDamage,
  905. g_msgHideWeapon, g_msgCrosshair, g_msgSayText, g_msgScreenShake, g_msgCurWeapon
  906.  
  907. // CVAR pointers
  908. new cvar_lighting, cvar_zombiefov, cvar_plague, cvar_plaguechance, cvar_zombiefirsthp,
  909. cvar_removemoney, cvar_thunder, cvar_zombiebonushp, cvar_nemhp, cvar_nem, cvar_surv,
  910. cvar_nemchance, cvar_deathmatch, cvar_nemglow, cvar_cnvg, cvar_hitzones,
  911. cvar_nemgravity, cvar_flashsize, cvar_ammodamage, cvar_zombiearmor, cvar_survpainfree,
  912. cvar_nempainfree, cvar_nemspd, cvar_survchance, cvar_survhp, cvar_survspd,
  913. cvar_swarmchance, cvar_flashdrain, cvar_zombiebleeding, cvar_removedoors, cvar_cflash,
  914. cvar_randspawn, cvar_multi, cvar_multichance, cvar_infammo, cvar_swarm, cvar_ammoinfect,
  915. cvar_toggle, cvar_knockbackpower, cvar_freezeduration, cvar_triggered, cvar_flashcharge,
  916. cvar_firegrenades, cvar_frostgrenades, cvar_survgravity, cvar_logcommands, cvar_survglow,
  917. cvar_spawnprotection, cvar_nvgsize, cvar_flareduration, cvar_zclasses,
  918. cvar_extraitems, cvar_showactivity, cvar_humanlasthp, cvar_nemignorefrags, cvar_warmup,
  919. cvar_flashdist, cvar_flarecolor, cvar_survignorefrags, cvar_fireduration, cvar_firedamage,
  920. cvar_flaregrenades, cvar_knockbackducking, cvar_knockbackdamage, cvar_knockbackzvel,
  921. cvar_multiratio, cvar_flaresize, cvar_spawndelay, cvar_extraantidote, cvar_extramadness,
  922. cvar_extraweapons, cvar_extranvision, cvar_nvggive, cvar_preventconsecutive, cvar_botquota,
  923. cvar_buycustom, cvar_zombiepainfree, cvar_fireslowdown, cvar_survbasehp, cvar_survaura,
  924. cvar_nemignoreammo, cvar_survignoreammo, cvar_nemaura, cvar_extrainfbomb, cvar_knockback,
  925. cvar_fragsinfect, cvar_fragskill, cvar_zombiesilent, cvar_removedropped,
  926. cvar_plagueratio, cvar_blocksuicide, cvar_knockbackdist, cvar_nemdamage, cvar_leapzombies,
  927. cvar_leapzombiesforce, cvar_leapzombiesheight, cvar_leapzombiescooldown, cvar_leapnemesis,
  928. cvar_leapnemesisforce, cvar_leapnemesisheight, cvar_leapnemesiscooldown, cvar_leapsurvivor,
  929. cvar_leapsurvivorforce, cvar_leapsurvivorheight, cvar_nemminplayers, cvar_survminplayers,
  930. cvar_respawnonsuicide, cvar_respawnafterlast, cvar_leapsurvivorcooldown, cvar_statssave,
  931. cvar_swarmminplayers, cvar_multiminplayers, cvar_plagueminplayers, cvar_adminmodelshuman,
  932. cvar_adminmodelszombie, cvar_nembasehp, cvar_blockpushables, cvar_respawnworldspawnkill,
  933. cvar_madnessduration, cvar_plaguenemnum, cvar_plaguenemhpmulti, cvar_plaguesurvhpmulti,
  934. cvar_survweapon, cvar_plaguesurvnum, cvar_infectionscreenfade, cvar_infectionscreenshake,
  935. cvar_infectionsparkle, cvar_infectiontracers, cvar_infectionparticles, cvar_infbomblimit, cvar_bubblepush,
  936. cvar_hudicons, cvar_flashshowall, cvar_armagedonratio, cvar_armagedon, cvar_armagedonchance, cvar_armagedonminplayers, cvar_armagedonhpsurvi, cvar_armagedonhpneme,
  937. cvar_nvgcolor[3], cvar_nemnvgcolor[3], cvar_humnvgcolor[3], cvar_flashcolor[3]
  938.  
  939. /*================================================================================
  940. [Natives, Precache and Init]
  941. =================================================================================*/
  942.  
  943. public plugin_natives()
  944. {
  945. // Player specific natives
  946. register_native("zp_get_user_zombie", "native_get_user_zombie", 1)
  947. register_native("zp_get_user_nemesis", "native_get_user_nemesis", 1)
  948. register_native("zp_get_user_armagedon", "native_get_user_armagedon", 1)
  949. register_native("zp_get_user_survivor", "native_get_user_survivor", 1)
  950. register_native("zp_get_user_first_zombie", "native_get_user_first_zombie", 1)
  951. register_native("zp_get_user_last_zombie", "native_get_user_last_zombie", 1)
  952. register_native("zp_get_user_last_human", "native_get_user_last_human", 1)
  953. register_native("zp_get_user_zombie_class", "native_get_user_zombie_class", 1)
  954. register_native("zp_set_user_zombie_class", "native_set_user_zombie_class", 1)
  955. register_native("zp_get_user_human_class", "native_get_user_human_class", 1)
  956. register_native("zp_set_user_human_class", "native_set_user_human_class", 1)
  957. register_native("zp_get_user_ammo_packs", "native_get_user_ammo_packs", 1)
  958. register_native("zp_get_user_level", "native_get_user_level", 1)
  959. register_native("zp_get_user_levels", "native_get_user_levels", 1) //registramos las natives
  960. register_native("zp_set_user_levels", "native_set_user_levels", 1) //registramos las natives
  961. register_native("zp_set_user_ammo_packs", "native_set_user_ammo_packs", 1)
  962. register_native("zp_get_zombie_maxhealth", "native_get_zombie_maxhealth", 1)
  963. register_native("zp_get_user_batteries", "native_get_user_batteries", 1)
  964. register_native("zp_set_user_batteries", "native_set_user_batteries", 1)
  965. register_native("zp_infect_user", "native_infect_user", 1)
  966. register_native("zp_disinfect_user", "native_disinfect_user", 1)
  967. register_native("zp_respawn_user", "native_respawn_user", 1)
  968.  
  969. // Round natives
  970. register_native("zp_has_round_started", "native_has_round_started", 1)
  971. register_native("zp_is_nemesis_round", "native_is_nemesis_round", 1)
  972. register_native("zp_is_armagedon_round", "native_is_armagedon_round", 1)
  973. register_native("zp_is_survivor_round", "native_is_survivor_round", 1)
  974. register_native("zp_is_swarm_round", "native_is_swarm_round", 1)
  975. register_native("zp_is_plague_round", "native_is_plague_round", 1)
  976.  
  977. // External additions natives
  978. register_native("zp_register_extra_item", "native_register_extra_item", 1)
  979. register_native("zp_register_zombie_class", "native_register_zombie_class", 1)
  980. register_native("zp_register_human_class", "native_register_human_class", 1)
  981.  
  982. // Load up the hard coded extra items
  983. native_register_extra_item2("nvision", g_extra_costs2[0], ZP_TEAM_HUMAN)
  984. native_register_extra_item2("antidote", g_extra_costs2[1], ZP_TEAM_ZOMBIE)
  985. native_register_extra_item2("madness", g_extra_costs2[2], ZP_TEAM_ZOMBIE)
  986. native_register_extra_item2("infbomb", g_extra_costs2[3], ZP_TEAM_ZOMBIE)
  987. for (new i = 0; i < sizeof g_extra_names; i++) // weapons
  988. native_register_extra_item2(g_extra_names[i], g_extra_costs[i], ZP_TEAM_HUMAN)
  989. }
  990.  
  991. public plugin_precache()
  992. {
  993. // To switch plugin on/off
  994. register_concmd("zp_toggle", "cmd_toggle", ACCESS_FLAG2, "<1/0> - Enable/Disable Zombie Plague (will restart the current map)")
  995. cvar_toggle = register_cvar("zp_on", "1")
  996.  
  997. // Plugin disabled?
  998. if (!get_pcvar_num(cvar_toggle)) return;
  999.  
  1000. new i, playermodel[100]
  1001.  
  1002. // Custom player models
  1003. for (i = 0; i < sizeof model_nemesis; i++)
  1004. {
  1005. formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_nemesis[i], model_nemesis[i])
  1006. g_modelindex_nemesis[i] = engfunc(EngFunc_PrecacheModel, playermodel)
  1007. }
  1008. for (i = 0; i < sizeof model_survivor; i++)
  1009. {
  1010. formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_survivor[i], model_survivor[i])
  1011. g_modelindex_survivor[i] = engfunc(EngFunc_PrecacheModel, playermodel)
  1012. }
  1013. //for (i = 0; i < sizeof model_human; i++)
  1014. {
  1015. // formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_human[i], model_human[i])
  1016. // g_modelindex_human[i] = engfunc(EngFunc_PrecacheModel, playermodel)
  1017. }
  1018. for (i = 0; i < sizeof model_admin; i++)
  1019. {
  1020. formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_admin[i], model_admin[i])
  1021. g_modelindex_admin[i] = engfunc(EngFunc_PrecacheModel, playermodel)
  1022. }
  1023. for (i = 0; i < sizeof model_admin_zombie; i++)
  1024. {
  1025. formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_admin_zombie[i], model_admin_zombie[i])
  1026. g_modelindex_admin_zombie[i] = engfunc(EngFunc_PrecacheModel, playermodel)
  1027. }
  1028.  
  1029. {
  1030. static i
  1031.  
  1032. for (i = 0; i < sizeof g_sombretos_modes; i++)
  1033. precache_model(g_sombretos_modes[i])
  1034. }
  1035.  
  1036.  
  1037. // Custom weapon models
  1038. engfunc(EngFunc_PrecacheModel, model_vknife_nemesis)
  1039. engfunc(EngFunc_PrecacheModel, model_vm249_survivor)
  1040. engfunc(EngFunc_PrecacheModel, model_grenade_infect)
  1041. engfunc(EngFunc_PrecacheModel, model_grenade_fire)
  1042. engfunc(EngFunc_PrecacheModel, model_grenade_frost)
  1043. engfunc(EngFunc_PrecacheModel, model_grenade_flare)
  1044. engfunc(EngFunc_PrecacheModel, model_akdestruction_human) // Precacheamos
  1045. engfunc(EngFunc_PrecacheModel, model_akdestruction_human1) // Precacheamos
  1046. engfunc(EngFunc_PrecacheModel, model_ultimate_human) // Precacheamos
  1047. engfunc(EngFunc_PrecacheModel, model_ultimate_human1) // Precacheamos
  1048. engfunc(EngFunc_PrecacheModel, model_atomic_human) // Precacheamos
  1049. engfunc(EngFunc_PrecacheModel, model_atomic_human1) // Precacheamos
  1050. engfunc(EngFunc_PrecacheModel, model_masive_human) // Precacheamos
  1051. engfunc(EngFunc_PrecacheModel, model_masive_human1) // Precacheamos
  1052. engfunc(EngFunc_PrecacheModel, model_navi_human) // Precacheamos
  1053. engfunc(EngFunc_PrecacheModel, model_navi_human1) // Precacheamos
  1054. engfunc(EngFunc_PrecacheModel, model_overpower_human) // Precacheamos
  1055. engfunc(EngFunc_PrecacheModel, model_overpower_human1) // Precacheamos
  1056. engfunc(EngFunc_PrecacheModel, model_stfu_human) // Precacheamos
  1057. engfunc(EngFunc_PrecacheModel, model_stfu_human1) // Precacheamos
  1058. engfunc(EngFunc_PrecacheModel, model_rlp_human) // Precacheamos
  1059. engfunc(EngFunc_PrecacheModel, model_rlp_human1) // Precacheamos
  1060. engfunc(EngFunc_PrecacheModel, model_m4_human) // Precacheamos
  1061. engfunc(EngFunc_PrecacheModel, model_m4_human1) // Precacheamos
  1062. engfunc(EngFunc_PrecacheModel, model_barret_human) // Precacheamos
  1063. engfunc(EngFunc_PrecacheModel, model_barret_human1) // Precacheamos
  1064. engfunc(EngFunc_PrecacheModel, model_devil_human) // Precacheamos
  1065. engfunc(EngFunc_PrecacheModel, model_devil_human1) // Precacheamos
  1066. engfunc(EngFunc_PrecacheModel, model_rampage_human) // Precacheamos
  1067. engfunc(EngFunc_PrecacheModel, model_rampage_human1) // Precacheamos
  1068. engfunc(EngFunc_PrecacheModel, model_supermide_human) // Precacheamos
  1069. engfunc(EngFunc_PrecacheModel, model_supermide_human1) // Precacheamos
  1070. engfunc(EngFunc_PrecacheModel, model_farger_human) // Precacheamos
  1071. engfunc(EngFunc_PrecacheModel, model_farger_human1) // Precacheamos
  1072. engfunc(EngFunc_PrecacheModel, model_storm_human) // Precacheamos
  1073. engfunc(EngFunc_PrecacheModel, model_storm_human1) // Precacheamos
  1074. engfunc(EngFunc_PrecacheModel, model_adge_human) // Precacheamos
  1075. engfunc(EngFunc_PrecacheModel, model_adge_human1) // Precacheamos
  1076. engfunc(EngFunc_PrecacheModel, model_ultra_human) // Precacheamos
  1077. engfunc(EngFunc_PrecacheModel, model_ultra_human1) // Precacheamos
  1078. engfunc(EngFunc_PrecacheModel, model_nule_human) // Precacheamos
  1079. engfunc(EngFunc_PrecacheModel, model_nule_human1) // Precacheamos
  1080. engfunc(EngFunc_PrecacheModel, model_super_human) // Precacheamos
  1081. engfunc(EngFunc_PrecacheModel, model_super_human1) // Precacheamos
  1082. engfunc(EngFunc_PrecacheModel, model_ultrak_human) // Precacheamos
  1083. engfunc(EngFunc_PrecacheModel, model_ultrak_human1) // Precacheamos
  1084. engfunc(EngFunc_PrecacheModel, model_raampage_human) // Precacheamos
  1085. engfunc(EngFunc_PrecacheModel, model_raampage_human1) // Precacheamos
  1086. engfunc(EngFunc_PrecacheModel, model_grenade) // precacheamos el model "v_".
  1087. engfunc(EngFunc_PrecacheModel, model) // precacheamos el model de la burbuja.
  1088. engfunc(EngFunc_PrecacheModel, w_model) // precacheamos el model "w_".
  1089. engfunc(EngFunc_PrecacheModel, model_nemesis2)
  1090.  
  1091. // Custom sounds
  1092. for (i = 0; i < sizeof sound_win_zombies; i++)
  1093. engfunc(EngFunc_PrecacheSound, sound_win_zombies[i])
  1094. for (i = 0; i < sizeof Subes; i++)
  1095. engfunc(EngFunc_PrecacheSound, Subes[i])
  1096. for (i = 0; i < sizeof Bajas; i++)
  1097. engfunc(EngFunc_PrecacheSound, Bajas[i])
  1098. for (i = 0; i < sizeof model_nemesis3; i++)
  1099. engfunc(EngFunc_PrecacheSound, model_nemesis3[i])
  1100. for (i = 0; i < sizeof model_nemesis4; i++)
  1101. engfunc(EngFunc_PrecacheSound, model_nemesis4[i])
  1102. for (i = 0; i < sizeof model_nemesis5; i++)
  1103. engfunc(EngFunc_PrecacheSound, model_nemesis5[i])
  1104. for (i = 0; i < sizeof model_nemesis6; i++)
  1105. engfunc(EngFunc_PrecacheSound, model_nemesis6[i])
  1106. for (i = 0; i < sizeof HoraLoca; i++)
  1107. engfunc(EngFunc_PrecacheSound, HoraLoca[i])
  1108. for (i = 0; i < sizeof sound_win_humans; i++)
  1109. engfunc(EngFunc_PrecacheSound, sound_win_humans[i])
  1110. for (i = 0; i < sizeof sound_win_no_one; i++)
  1111. engfunc(EngFunc_PrecacheSound, sound_win_no_one[i])
  1112. for (i = 0; i < sizeof zombie_infect; i++)
  1113. engfunc(EngFunc_PrecacheSound, zombie_infect[i])
  1114. for (i = 0; i < sizeof zombie_pain; i++)
  1115. engfunc(EngFunc_PrecacheSound, zombie_pain[i])
  1116. for (i = 0; i < sizeof nemesis_pain; i++)
  1117. engfunc(EngFunc_PrecacheSound, nemesis_pain[i])
  1118. for (i = 0; i < sizeof zombie_die; i++)
  1119. engfunc(EngFunc_PrecacheSound, zombie_die[i])
  1120. for (i = 0; i < sizeof zombie_fall; i++)
  1121. engfunc(EngFunc_PrecacheSound, zombie_fall[i])
  1122. for (i = 0; i < sizeof zombie_miss_slash; i++)
  1123. engfunc(EngFunc_PrecacheSound, zombie_miss_slash[i])
  1124. for (i = 0; i < sizeof zombie_miss_wall; i++)
  1125. engfunc(EngFunc_PrecacheSound, zombie_miss_wall[i])
  1126. for (i = 0; i < sizeof zombie_hit_normal; i++)
  1127. engfunc(EngFunc_PrecacheSound, zombie_hit_normal[i])
  1128. for (i = 0; i < sizeof zombie_hit_stab; i++)
  1129. engfunc(EngFunc_PrecacheSound, zombie_hit_stab[i])
  1130. for (i = 0; i < sizeof zombie_idle; i++)
  1131. engfunc(EngFunc_PrecacheSound, zombie_idle[i])
  1132. for (i = 0; i < sizeof zombie_idle_last; i++)
  1133. engfunc(EngFunc_PrecacheSound, zombie_idle_last[i])
  1134. for (i = 0; i < sizeof zombie_madness; i++)
  1135. engfunc(EngFunc_PrecacheSound, zombie_madness[i])
  1136. for (i = 0; i < sizeof sound_nemesis; i++)
  1137. engfunc(EngFunc_PrecacheSound, sound_nemesis[i])
  1138. for (i = 0; i < sizeof sound_survivor; i++)
  1139. engfunc(EngFunc_PrecacheSound, sound_survivor[i])
  1140. for (i = 0; i < sizeof sound_swarm; i++)
  1141. engfunc(EngFunc_PrecacheSound, sound_swarm[i])
  1142. for (i = 0; i < sizeof sound_multi; i++)
  1143. engfunc(EngFunc_PrecacheSound, sound_multi[i])
  1144. for (i = 0; i < sizeof sound_plague; i++)
  1145. engfunc(EngFunc_PrecacheSound, sound_plague[i])
  1146. for (i = 0; i < sizeof grenade_infect; i++)
  1147. engfunc(EngFunc_PrecacheSound, grenade_infect[i])
  1148. for (i = 0; i < sizeof grenade_infect_player; i++)
  1149. engfunc(EngFunc_PrecacheSound, grenade_infect_player[i])
  1150. for (i = 0; i < sizeof grenade_fire; i++)
  1151. engfunc(EngFunc_PrecacheSound, grenade_fire[i])
  1152. for (i = 0; i < sizeof grenade_fire_player; i++)
  1153. engfunc(EngFunc_PrecacheSound, grenade_fire_player[i])
  1154. for (i = 0; i < sizeof grenade_frost; i++)
  1155. engfunc(EngFunc_PrecacheSound, grenade_frost[i])
  1156. for (i = 0; i < sizeof grenade_frost_player; i++)
  1157. engfunc(EngFunc_PrecacheSound, grenade_frost_player[i])
  1158. for (i = 0; i < sizeof grenade_frost_break; i++)
  1159. engfunc(EngFunc_PrecacheSound, grenade_frost_break[i])
  1160. for (i = 0; i < sizeof grenade_flare; i++)
  1161. engfunc(EngFunc_PrecacheSound, grenade_flare[i])
  1162. for (i = 0; i < sizeof sound_antidote; i++)
  1163. engfunc(EngFunc_PrecacheSound, sound_antidote[i])
  1164. for (i = 0; i < sizeof sound_thunder; i++)
  1165. engfunc(EngFunc_PrecacheSound, sound_thunder[i])
  1166. #if defined AMBIENCE_SOUNDS
  1167. for (i = 0; i < sizeof sound_ambience1; i++)
  1168. {
  1169. if (equal(sound_ambience1[i][strlen(sound_ambience1[i])-4], ".mp3"))
  1170. {
  1171. formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience1[i])
  1172. engfunc(EngFunc_PrecacheGeneric, playermodel)
  1173. }
  1174. else
  1175. {
  1176. engfunc(EngFunc_PrecacheSound, sound_ambience1[i])
  1177. }
  1178. }
  1179. for (i = 0; i < sizeof sound_ambience2; i++)
  1180. {
  1181. if (equal(sound_ambience2[i][strlen(sound_ambience2[i])-4], ".mp3"))
  1182. {
  1183. formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience2[i])
  1184. engfunc(EngFunc_PrecacheGeneric, playermodel)
  1185. }
  1186. else
  1187. {
  1188. engfunc(EngFunc_PrecacheSound, sound_ambience2[i])
  1189. }
  1190. }
  1191. for (i = 0; i < sizeof sound_ambience3; i++)
  1192. {
  1193. if (equal(sound_ambience3[i][strlen(sound_ambience3[i])-4], ".mp3"))
  1194. {
  1195. formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience3[i])
  1196. engfunc(EngFunc_PrecacheGeneric, playermodel)
  1197. }
  1198. else
  1199. {
  1200. engfunc(EngFunc_PrecacheSound, sound_ambience3[i])
  1201. }
  1202. }
  1203. for (i = 0; i < sizeof sound_ambience4; i++)
  1204. {
  1205. if (equal(sound_ambience4[i][strlen(sound_ambience4[i])-4], ".mp3"))
  1206. {
  1207. formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience4[i])
  1208. engfunc(EngFunc_PrecacheGeneric, playermodel)
  1209. }
  1210. else
  1211. {
  1212. engfunc(EngFunc_PrecacheSound, sound_ambience4[i])
  1213. }
  1214. }
  1215. for (i = 0; i < sizeof sound_ambience5; i++)
  1216. {
  1217. if (equal(sound_ambience5[i][strlen(sound_ambience5[i])-4], ".mp3"))
  1218. {
  1219. formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience5[i])
  1220. engfunc(EngFunc_PrecacheGeneric, playermodel)
  1221. }
  1222. else
  1223. {
  1224. engfunc(EngFunc_PrecacheSound, sound_ambience5[i])
  1225. }
  1226. }
  1227. #endif
  1228.  
  1229. // CS sounds (just in case)
  1230. engfunc(EngFunc_PrecacheSound, sound_flashlight)
  1231. engfunc(EngFunc_PrecacheSound, sound_buyammo)
  1232. engfunc(EngFunc_PrecacheSound, sound_armorhit)
  1233.  
  1234. // Custom models/sprites for grenades
  1235. g_trailSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_trail)
  1236. g_exploSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_ring)
  1237. g_flameSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_fire)
  1238. g_smokeSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_smoke)
  1239. g_glassSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_glass)
  1240. g_thunder1Spr = engfunc(EngFunc_PrecacheModel, sprite_thunder)
  1241. g_thunder2Spr = engfunc(EngFunc_PrecacheModel, sprite_thunder2)
  1242.  
  1243. new ent
  1244.  
  1245. // Fake Hostage (to force round ending)
  1246. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "hostage_entity"))
  1247. if (pev_valid(ent))
  1248. {
  1249. engfunc(EngFunc_SetOrigin, ent, Float:{8192.0 ,8192.0 ,8192.0})
  1250. dllfunc(DLLFunc_Spawn, ent)
  1251. }
  1252.  
  1253. #if defined AMBIENCE_FOG
  1254. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_fog"))
  1255. if (pev_valid(ent))
  1256. {
  1257. fm_set_kvd(ent, "density", FOG_DENSITY, "env_fog")
  1258. fm_set_kvd(ent, "rendercolor", FOG_COLOR, "env_fog")
  1259. }
  1260. #endif
  1261.  
  1262. #if defined AMBIENCE_RAIN
  1263. engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_rain"))
  1264. #endif
  1265.  
  1266. #if defined AMBIENCE_SNOW
  1267. engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_snow"))
  1268. #endif
  1269.  
  1270. // Prevent some entities from spawning
  1271. g_fwSpawn = register_forward(FM_Spawn, "fw_Spawn")
  1272. }
  1273.  
  1274. public plugin_init()
  1275. {
  1276. // Register plugin call
  1277. register_plugin("Zombie Plague", PLUGIN_VERSION, "MeRcyLeZZ")
  1278.  
  1279. // Plugin disabled?
  1280. if (!g_pluginenabled) return;
  1281.  
  1282. // No zombie classes?
  1283. if (!g_zclass_i) set_fail_state("No zombie classes loaded!")
  1284.  
  1285. // No human classes?
  1286. if (!g_hclass_i) set_fail_state("No human classes loaded!")
  1287.  
  1288. // Language files
  1289. register_dictionary("zombie_plague.txt")
  1290.  
  1291. // Events
  1292. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  1293. register_logevent("logevent_round_start",2, "1=Round_Start")
  1294. register_logevent("logevent_round_end", 2, "1=Round_End")
  1295. #if defined AMBIENCE_SOUNDS
  1296. register_event("30", "event_intermission", "a")
  1297. #endif
  1298. register_event("CurWeapon", "event_cur_weapon", "b", "1=1")
  1299. register_event("35", "event_weapon_anim", "b")
  1300.  
  1301. register_clcmd("BUBBLEBOMB", "give_item_bubble") // podemos llamar a la bomba. console_cmd(id, "BUBBLEBOMB")
  1302. register_event("CurWeapon", "hook_curwpn", "be", "1=1", "2!29");
  1303. cvar_bubblepush = register_cvar("zp_bubble_push", "2.0") // es la cvar, que al tocar al campo nos retira de el.
  1304. register_touch(entclas, "player", "entity_touch") // nose bien que es, por lo que entiendo llamamos a la entidad que rechaza los zm.
  1305.  
  1306. // Forwards
  1307. RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
  1308. RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  1309. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  1310. RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack")
  1311. RegisterHam(Ham_Use, "func_tank", "fw_UseStationary")
  1312. RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary")
  1313. RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary")
  1314. RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary")
  1315. RegisterHam(Ham_Use, "func_pushable", "fw_UsePushable")
  1316. RegisterHam(Ham_Touch, "weaponbox", "fw_TouchWeapon")
  1317. RegisterHam(Ham_Touch, "armoury_entity", "fw_TouchWeapon")
  1318. RegisterHam(Ham_Touch, "weapon_shield", "fw_TouchWeapon")
  1319. RegisterHam(Ham_AddPlayerItem, "player", "fw_AddPlayerItem")
  1320. register_forward(FM_ClientKill, "fw_ClientKill")
  1321. register_forward(FM_EmitSound, "fw_EmitSound")
  1322. #if !defined HANDLE_MODELS_ON_SEPARATE_ENT
  1323. register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")
  1324. register_forward(FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged")
  1325. #endif
  1326. register_forward(FM_GetGameDescription, "fw_GetGameDescription")
  1327. register_forward(FM_CmdStart, "fw_CmdStart")
  1328. register_forward(FM_SetModel, "fw_SetModel")
  1329. RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
  1330. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
  1331. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink_Post", 1)
  1332. unregister_forward(FM_Spawn, g_fwSpawn)
  1333.  
  1334. // Client commands
  1335. register_clcmd("say zpmenu", "clcmd_saymenu")
  1336. register_clcmd("say /zpmenu", "clcmd_saymenu")
  1337. register_clcmd("say unstuck", "clcmd_sayunstuck")
  1338. register_clcmd("say /unstuck", "clcmd_sayunstuck")
  1339. register_clcmd("nightvision", "clcmd_nightvision")
  1340. register_clcmd("drop", "clcmd_drop")
  1341. register_clcmd("buyammo1", "clcmd_buyammo")
  1342. register_clcmd("buyammo2", "clcmd_buyammo")
  1343. register_clcmd("chooseteam", "clcmd_changeteam")
  1344. register_clcmd("jointeam", "clcmd_jointeam")
  1345. register_clcmd("Crear_Password", "clcmd_register")
  1346. register_clcmd("Loguear_Password", "clcmd_login")
  1347. register_clcmd("say /party", "cmdParty")
  1348. register_clcmd("say_team", "cmdSayTeam")
  1349. register_clcmd("say", "HookSay")
  1350. register_clcmd("say_team", "HookSayTeam")
  1351. register_clcmd("say /yo", "Datos");
  1352.  
  1353. // Menus
  1354. register_menu("Buy Menu 1", KEYSMENU, "menu_buy1")
  1355. register_menu("Buy Menu 2", KEYSMENU, "menu_buy2")
  1356. register_menu("Zombie Class Menu", KEYSMENU, "menu_zclass")
  1357. register_menu("Human Class Menu", KEYSMENU, "menu_hclass")
  1358. register_menu("Game Menu", KEYSMENU, "menu_game")
  1359. register_menu("Extra Items", KEYSMENU, "menu_extras")
  1360. register_menu("Admin Menu", KEYSMENU, "menu_admin")
  1361. register_menu("Player List Menu", KEYSMENU, "menu_player_list")
  1362. register_menu("Menu Reset", KEYSMENU, "menu_reset")
  1363. register_menu("Menu Grand Reset", KEYSMENU, "menu_grand_reset")
  1364. register_menu("Habilidades", KEYSMENU, "menu_upgrade_handler")
  1365. register_menu("Menu Register", KEYSMENU, "menu_registro")
  1366. register_menu("Datos", KEYSMENU, "HandMenu");
  1367.  
  1368. // Admin commands
  1369. register_concmd("zp_zombie", "cmd_zombie", ACCESS_FLAG, "<target> - Turn someone into a Zombie")
  1370. register_concmd("zp_human", "cmd_human", ACCESS_FLAG, "<target> - Turn someone back to Human")
  1371. register_concmd("zp_nemesis", "cmd_nemesis", ACCESS_FLAG, "<target> - Turn someone into a Nemesis")
  1372. register_concmd("zp_survivor", "cmd_survivor", ACCESS_FLAG, "<target> - Turn someone into a Survivor")
  1373. register_concmd("zp_respawn", "cmd_respawn", ACCESS_FLAG, "<target> - Respawn someone")
  1374. register_concmd("zp_swarm", "cmd_swarm", ACCESS_FLAG, " - Start Swarm Mode")
  1375. register_concmd("zp_multi", "cmd_multi", ACCESS_FLAG, " - Start Multi Infection")
  1376. register_concmd("zp_plague", "cmd_plague", ACCESS_FLAG, " - Start Plague Mode")
  1377. register_concmd("zp_armagedon", "cmd_armagedon", ACCESS_FLAG, " - Start Mode Armagedon")
  1378.  
  1379. // Message IDs
  1380. g_msgScoreInfo = get_user_msgid("ScoreInfo")
  1381. g_msgTeamInfo = get_user_msgid("TeamInfo")
  1382. g_msgDeathMsg = get_user_msgid("DeathMsg")
  1383. g_msgScoreAttrib = get_user_msgid("ScoreAttrib")
  1384. g_msgSetFOV = get_user_msgid("SetFOV")
  1385. g_msgScreenFade = get_user_msgid("ScreenFade")
  1386. g_msgScreenShake = get_user_msgid("ScreenShake")
  1387. g_msgNVGToggle = get_user_msgid("NVGToggle")
  1388. g_msgFlashlight = get_user_msgid("Flashlight")
  1389. g_msgFlashBat = get_user_msgid("FlashBat")
  1390. g_msgAmmoPickup = get_user_msgid("AmmoPickup")
  1391. g_msgDamage = get_user_msgid("Damage")
  1392. g_msgHideWeapon = get_user_msgid("HideWeapon")
  1393. g_msgCrosshair = get_user_msgid("Crosshair")
  1394. g_msgSayText = get_user_msgid("SayText")
  1395. g_msgCurWeapon = get_user_msgid("CurWeapon")
  1396. g_MsgSayText = get_user_msgid("SayText")
  1397. g_MenuCallback[MASTER] = menu_makecallback("check_master")
  1398. g_MenuCallback[USER] = menu_makecallback("check_user")
  1399.  
  1400. // Message hooks
  1401. register_message(g_msgCurWeapon, "message_cur_weapon")
  1402. register_message(get_user_msgid("AmmoX"), "message_ammo_x")
  1403. register_message(get_user_msgid("Money"), "message_money")
  1404. register_message(get_user_msgid("Health"), "message_health")
  1405. register_message(g_msgFlashBat, "message_flashbat")
  1406. register_message(g_msgScreenFade, "message_screenfade")
  1407. register_message(g_msgNVGToggle, "message_nvgtoggle")
  1408. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  1409. register_message(get_user_msgid("ClCorpse"), "message_clcorpse")
  1410. #endif
  1411. register_message(get_user_msgid("WeapPickup"), "message_weappickup")
  1412. register_message(g_msgAmmoPickup, "message_ammopickup")
  1413. register_message(get_user_msgid("Scenario"), "message_scenario")
  1414. register_message(get_user_msgid("HostagePos"), "message_hostagepos")
  1415. register_message(get_user_msgid("TextMsg"), "message_textmsg")
  1416. register_message(get_user_msgid("SendAudio"), "message_sendaudio")
  1417. register_message(get_user_msgid("TeamScore"), "message_teamscore")
  1418. register_message(g_msgTeamInfo, "message_teaminfo")
  1419. register_message(get_user_msgid("ShowMenu"), "oldmenu_handle")
  1420.  
  1421. // CVARS - General Purpose
  1422. cvar_warmup = register_cvar("zp_delay", "13")
  1423. cvar_lighting = register_cvar("zp_lighting", "m")
  1424. cvar_thunder = register_cvar("zp_thunderclap", "0")
  1425. cvar_triggered = register_cvar("zp_triggered_lights", "1")
  1426. cvar_removedoors = register_cvar("zp_remove_doors", "0")
  1427. cvar_blockpushables = register_cvar("zp_blockuse_pushables", "1")
  1428. cvar_blocksuicide = register_cvar("zp_block_suicide", "1")
  1429. cvar_deathmatch = register_cvar("zp_deathmatch", "2")
  1430. cvar_spawndelay = register_cvar("zp_spawn_delay", "1")
  1431. cvar_spawnprotection = register_cvar("zp_spawn_protection", "1")
  1432. cvar_respawnonsuicide = register_cvar("zp_respawn_on_suicide", "1")
  1433. cvar_respawnafterlast = register_cvar("zp_respawn_after_last_human", "1")
  1434. cvar_respawnworldspawnkill = register_cvar("zp_respawn_on_worldspawn_kill", "1")
  1435. cvar_randspawn = register_cvar("zp_random_spawn", "1")
  1436. cvar_removedropped = register_cvar("zp_remove_dropped", "1")
  1437. cvar_removemoney = register_cvar("zp_remove_money", "1")
  1438. cvar_buycustom = register_cvar("zp_buy_custom", "1")
  1439. cvar_adminmodelshuman = register_cvar("zp_admin_models_human", "0")
  1440. cvar_adminmodelszombie = register_cvar("zp_admin_models_zombie", "0")
  1441. cvar_zclasses = register_cvar("zp_zombie_classes", "1")
  1442. cvar_statssave = register_cvar("zp_stats_save", "1")
  1443. cvar_preventconsecutive = register_cvar("zp_prevent_consecutive_modes", "1")
  1444. cvar_time_acept = register_cvar("party_time_acept","15")
  1445. cvar_max_players = register_cvar("party_max_players","4")
  1446. cvar_allow_bots = register_cvar("party_allow_bots","1")
  1447.  
  1448. // CVARS - Extra Items
  1449. cvar_extraitems = register_cvar("zp_extra_items", "1")
  1450. cvar_extraweapons = register_cvar("zp_extra_weapons", "1")
  1451. cvar_extranvision = register_cvar("zp_extra_nvision", "1")
  1452. cvar_extraantidote = register_cvar("zp_extra_antidote", "1")
  1453. cvar_extramadness = register_cvar("zp_extra_madness", "1")
  1454. cvar_madnessduration = register_cvar("zp_extra_madness_duration", "5.0")
  1455. cvar_extrainfbomb = register_cvar("zp_extra_infbomb", "1")
  1456. cvar_infbomblimit = register_cvar("zp_extra_infbomb_limit", "1")
  1457.  
  1458. // CVARS - Flashlight and Nightvision
  1459. cvar_nvggive = register_cvar("zp_nvg_give", "2")
  1460. cvar_cnvg = register_cvar("zp_nvg_custom", "1")
  1461. cvar_nvgsize = register_cvar("zp_nvg_size", "40")
  1462. cvar_nvgcolor[0] = register_cvar("zp_nvg_color_R", "1")
  1463. cvar_nvgcolor[1] = register_cvar("zp_nvg_color_G", "1")
  1464. cvar_nvgcolor[2] = register_cvar("zp_nvg_color_B", "1")
  1465. cvar_humnvgcolor[0] = register_cvar("zp_nvg_hum_color_R", "1")
  1466. cvar_humnvgcolor[1] = register_cvar("zp_nvg_hum_color_G", "1")
  1467. cvar_humnvgcolor[2] = register_cvar("zp_nvg_hum_color_B", "1")
  1468. cvar_nemnvgcolor[0] = register_cvar("zp_nvg_nem_color_R", "1")
  1469. cvar_nemnvgcolor[1] = register_cvar("zp_nvg_nem_color_G", "1")
  1470. cvar_nemnvgcolor[2] = register_cvar("zp_nvg_nem_color_B", "1")
  1471. cvar_cflash = register_cvar("zp_flash_custom", "0")
  1472. cvar_flashsize = register_cvar("zp_flash_size", "10")
  1473. cvar_flashdrain = register_cvar("zp_flash_drain", "1")
  1474. cvar_flashcharge = register_cvar("zp_flash_charge", "5")
  1475. cvar_flashdist = register_cvar("zp_flash_distance", "1000")
  1476. cvar_flashcolor[0] = register_cvar("zp_flash_color_R", "100")
  1477. cvar_flashcolor[1] = register_cvar("zp_flash_color_G", "100")
  1478. cvar_flashcolor[2] = register_cvar("zp_flash_color_B", "100")
  1479. cvar_flashshowall = register_cvar("zp_flash_show_all", "0")
  1480.  
  1481. // CVARS - Knockback
  1482. cvar_knockback = register_cvar("zp_knockback", "0")
  1483. cvar_knockbackdamage = register_cvar("zp_knockback_damage", "1")
  1484. cvar_knockbackpower = register_cvar("zp_knockback_power", "1")
  1485. cvar_knockbackzvel = register_cvar("zp_knockback_zvel", "0")
  1486. cvar_knockbackducking = register_cvar("zp_knockback_ducking", "0.25")
  1487. cvar_knockbackdist = register_cvar("zp_knockback_distance", "500")
  1488.  
  1489. // CVARS - Leap
  1490. cvar_leapzombies = register_cvar("zp_leap_zombies", "0")
  1491. cvar_leapzombiesforce = register_cvar("zp_leap_zombies_force", "500")
  1492. cvar_leapzombiesheight = register_cvar("zp_leap_zombies_height", "300")
  1493. cvar_leapzombiescooldown = register_cvar("zp_leap_zombies_cooldown", "5.0")
  1494. cvar_leapnemesis = register_cvar("zp_leap_nemesis", "1")
  1495. cvar_leapnemesisforce = register_cvar("zp_leap_nemesis_force", "500")
  1496. cvar_leapnemesisheight = register_cvar("zp_leap_nemesis_height", "300")
  1497. cvar_leapnemesiscooldown = register_cvar("zp_leap_nemesis_cooldown", "5.0")
  1498. cvar_leapsurvivor = register_cvar("zp_leap_survivor", "0")
  1499. cvar_leapsurvivorforce = register_cvar("zp_leap_survivor_force", "500")
  1500. cvar_leapsurvivorheight = register_cvar("zp_leap_survivor_height", "300")
  1501. cvar_leapsurvivorcooldown = register_cvar("zp_leap_survivor_cooldown", "5.0")
  1502.  
  1503. // CVARS - Humans
  1504. cvar_infammo = register_cvar("zp_human_unlimited_ammo", "1")
  1505. cvar_ammodamage = register_cvar("zp_human_damage_reward", "200")
  1506. cvar_fragskill = register_cvar("zp_human_frags_for_kill", "1")
  1507.  
  1508. // CVARS - Custom Grenades
  1509. cvar_firegrenades = register_cvar("zp_fire_grenades", "1")
  1510. cvar_fireduration = register_cvar("zp_fire_duration", "10")
  1511. cvar_firedamage = register_cvar("zp_fire_damage", "5")
  1512. cvar_fireslowdown = register_cvar("zp_fire_slowdown", "0.5")
  1513. cvar_frostgrenades = register_cvar("zp_frost_grenades", "1")
  1514. cvar_freezeduration = register_cvar("zp_frost_duration", "3")
  1515. cvar_flaregrenades = register_cvar("zp_flare_grenades","1")
  1516. cvar_flareduration = register_cvar("zp_flare_duration", "60")
  1517. cvar_flaresize = register_cvar("zp_flare_size", "25")
  1518. cvar_flarecolor = register_cvar("zp_flare_color", "0")
  1519.  
  1520. // CVARS - Zombies
  1521. cvar_zombiefirsthp = register_cvar("zp_zombie_first_hp", "2.0")
  1522. cvar_zombiearmor = register_cvar("zp_zombie_armor", "0.75")
  1523. cvar_hitzones = register_cvar("zp_zombie_hitzones", "0")
  1524. cvar_zombiebonushp = register_cvar("zp_zombie_infect_health", "100")
  1525. cvar_zombiefov = register_cvar("zp_zombie_fov", "110")
  1526. cvar_zombiesilent = register_cvar("zp_zombie_silent", "1")
  1527. cvar_zombiepainfree = register_cvar("zp_zombie_painfree", "2")
  1528. cvar_zombiebleeding = register_cvar("zp_zombie_bleeding", "1")
  1529. cvar_ammoinfect = register_cvar("zp_zombie_infect_reward", "40")
  1530. cvar_fragsinfect = register_cvar("zp_zombie_frags_for_infect", "1")
  1531.  
  1532. // CVARS - Special Effects
  1533. cvar_infectionscreenfade = register_cvar("zp_infection_screenfade", "1")
  1534. cvar_infectionscreenshake = register_cvar("zp_infection_screenshake", "1")
  1535. cvar_infectionsparkle = register_cvar("zp_infection_sparkle", "1")
  1536. cvar_infectiontracers = register_cvar("zp_infection_tracers", "1")
  1537. cvar_infectionparticles = register_cvar("zp_infection_particles", "1")
  1538. cvar_hudicons = register_cvar("zp_hud_icons", "1")
  1539.  
  1540. // CVARS - Nemesis
  1541. cvar_nem = register_cvar("zp_nem_enabled", "1")
  1542. cvar_nemchance = register_cvar("zp_nem_chance", "20")
  1543. cvar_nemminplayers = register_cvar("zp_nem_min_players", "0")
  1544. cvar_nemhp = register_cvar("zp_nem_health", "40000")
  1545. cvar_nembasehp = register_cvar("zp_nem_base_health", "0")
  1546. cvar_nemspd = register_cvar("zp_nem_speed", "330")
  1547. cvar_nemgravity = register_cvar("zp_nem_gravity", "0.5")
  1548. cvar_nemdamage = register_cvar("zp_nem_damage", "250")
  1549. cvar_nemglow = register_cvar("zp_nem_glow", "0")
  1550. cvar_nemaura = register_cvar("zp_nem_aura", "10")
  1551. cvar_nempainfree = register_cvar("zp_nem_painfree", "0")
  1552. cvar_nemignorefrags = register_cvar("zp_nem_ignore_frags", "0")
  1553. cvar_nemignoreammo = register_cvar("zp_nem_ignore_rewards", "0")
  1554.  
  1555. // CVARS - Survivor
  1556. cvar_surv = register_cvar("zp_surv_enabled", "1")
  1557. cvar_survchance = register_cvar("zp_surv_chance", "20")
  1558. cvar_survminplayers = register_cvar("zp_surv_min_players", "0")
  1559. cvar_survhp = register_cvar("zp_surv_health", "7000")
  1560. cvar_survbasehp = register_cvar("zp_surv_base_health", "0")
  1561. cvar_survspd = register_cvar("zp_surv_speed", "420")
  1562. cvar_survgravity = register_cvar("zp_surv_gravity", "1.25")
  1563. cvar_survglow = register_cvar("zp_surv_glow", "1")
  1564. cvar_survaura = register_cvar("zp_surv_aura", "1")
  1565. cvar_survpainfree = register_cvar("zp_surv_painfree", "1")
  1566. cvar_survignorefrags = register_cvar("zp_surv_ignore_frags", "0")
  1567. cvar_survignoreammo = register_cvar("zp_surv_ignore_rewards", "0")
  1568. cvar_survweapon = register_cvar("zp_surv_weapon", "weapon_m249")
  1569.  
  1570. // CVARS - Swarm Mode
  1571. cvar_swarm = register_cvar("zp_swarm_enabled", "1")
  1572. cvar_swarmchance = register_cvar("zp_swarm_chance", "20")
  1573. cvar_swarmminplayers = register_cvar("zp_swarm_min_players", "0")
  1574.  
  1575. // CVARS - Armagedon Mode
  1576. cvar_armagedon = register_cvar("zp_armagedon_enabled", "1")
  1577. cvar_armagedonchance = register_cvar("zp_armagedon_chance", "15")
  1578. cvar_armagedonminplayers = register_cvar("zp_armagedon_min_players", "4")
  1579. cvar_armagedonhpsurvi = register_cvar("zp_armagedon_survihp", "0.5")
  1580. cvar_armagedonhpneme = register_cvar("zp_armagedon_nemehp", "0.1")
  1581. cvar_armagedonratio = register_cvar("zp_armagedon_ratio", "0.15")
  1582.  
  1583. // CVARS - Multi Infection
  1584. cvar_multi = register_cvar("zp_multi_enabled", "1")
  1585. cvar_multichance = register_cvar("zp_multi_chance", "10")
  1586. cvar_multiminplayers = register_cvar("zp_multi_min_players", "0")
  1587. cvar_multiratio = register_cvar("zp_multi_ratio", "0.35")
  1588.  
  1589. // CVARS - Plague Mode
  1590. cvar_plague = register_cvar("zp_plague_enabled", "1")
  1591. cvar_plaguechance = register_cvar("zp_plague_chance", "30")
  1592. cvar_plagueminplayers = register_cvar("zp_plague_min_players", "0")
  1593. cvar_plagueratio = register_cvar("zp_plague_ratio", "0.5")
  1594. cvar_plaguenemnum = register_cvar("zp_plague_nem_number", "1")
  1595. cvar_plaguenemhpmulti = register_cvar("zp_plague_nem_hp_multi", "0.5")
  1596. cvar_plaguesurvnum = register_cvar("zp_plague_surv_number", "1")
  1597. cvar_plaguesurvhpmulti = register_cvar("zp_plague_surv_hp_multi", "0.5")
  1598.  
  1599. // CVARS - Others
  1600. cvar_logcommands = register_cvar("zp_logcommands", "1")
  1601. cvar_showactivity = get_cvar_pointer("amx_show_activity")
  1602. cvar_botquota = get_cvar_pointer("bot_quota")
  1603. register_cvar("zp_version", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
  1604. set_cvar_string("zp_version", PLUGIN_VERSION)
  1605.  
  1606. // Custom Forwards
  1607. g_fwRoundStart = CreateMultiForward("zp_round_started", ET_IGNORE, FP_CELL, FP_CELL)
  1608. g_fwRoundEnd = CreateMultiForward("zp_round_ended", ET_IGNORE, FP_CELL)
  1609. g_fwUserInfected_pre = CreateMultiForward("zp_user_infected_pre", ET_IGNORE, FP_CELL, FP_CELL)
  1610. g_fwUserInfected_post = CreateMultiForward("zp_user_infected_post", ET_IGNORE, FP_CELL, FP_CELL)
  1611. g_fwUserHumanized_pre = CreateMultiForward("zp_user_humanized_pre", ET_IGNORE, FP_CELL)
  1612. g_fwUserHumanized_post = CreateMultiForward("zp_user_humanized_post", ET_IGNORE, FP_CELL)
  1613. g_fwExtraItemSelected = CreateMultiForward("zp_extra_item_selected", ET_IGNORE, FP_CELL, FP_CELL)
  1614.  
  1615. // Collect random spawn points
  1616. load_spawns()
  1617.  
  1618. #if !defined DONT_CHANGE_SKY
  1619. // Set a random skybox
  1620. set_cvar_string("sv_skyname", skynames[random_num(0, sizeof skynames - 1)])
  1621. #endif
  1622.  
  1623. // Disable sky lighting so it doesn't mess up our custom lighting
  1624. set_cvar_num("sv_skycolor_r", 0)
  1625. set_cvar_num("sv_skycolor_g", 0)
  1626. set_cvar_num("sv_skycolor_b", 0)
  1627.  
  1628. // Create the HUD Sync Objects
  1629. g_MsgSync = CreateHudSyncObj()
  1630. g_MsgSync2 = CreateHudSyncObj()
  1631. g_MsgSync3 = CreateHudSyncObj()
  1632.  
  1633. // Format mod name
  1634. formatex(g_modname, sizeof g_modname - 1, "Zombie Plague|Guar| %s", PLUGIN_VERSION)
  1635.  
  1636. // Get Max Players
  1637. g_maxplayers = get_maxplayers()
  1638.  
  1639. // Reserved saving slots starts on maxplayers+1
  1640. db_slot_i = g_maxplayers+1
  1641.  
  1642. // Check if it's a CZ server
  1643. new mymod[6]
  1644. get_modname(mymod, sizeof mymod - 1)
  1645. if (equal(mymod, "czero")) g_czero = 1
  1646.  
  1647. // Lighting task
  1648. set_task(5.0, "lighting_effects", TASK_LIGHTING, _, _, "b")
  1649.  
  1650. // Call Round Start
  1651. set_task(1.0, "event_round_start")
  1652. }
  1653.  
  1654. public plugin_cfg()
  1655. {
  1656.  
  1657. for(new i = 1; i <= get_maxplayers();i++)
  1658. Party_Ids[i] = ArrayCreate(1, 1)
  1659.  
  1660. // Get configs dir
  1661. new cfgdir[32]
  1662. get_configsdir(cfgdir, sizeof cfgdir - 1);
  1663.  
  1664. // Execute config file (zombieplague.cfg)
  1665. server_cmd("exec %s/zombieplague.cfg", cfgdir)
  1666. }
  1667.  
  1668. /*================================================================================
  1669. [Main Events]
  1670. =================================================================================*/
  1671.  
  1672. // Event Round Start
  1673. public event_round_start()
  1674. {
  1675. set_task(5.0,"happyhour")
  1676. // Remove any tasks bound to custom nades (since they're removed at roundstart)
  1677. remove_task(TASK_NADES)
  1678.  
  1679. // Remove doors/lights?
  1680. set_task(0.2, "remove_stuff")
  1681.  
  1682. // New round starting
  1683. g_newround = true
  1684. g_endround = false
  1685. g_survround = false
  1686. g_nemround = false
  1687. g_armagedonround = false
  1688. g_swarmround = false
  1689. g_plagueround = false
  1690.  
  1691. // Reset bought infection bombs counter
  1692. g_infbombcounter = 0
  1693.  
  1694. // Freezetime begins
  1695. g_freezetime = true
  1696.  
  1697. // Show welcome message and T-Virus notice
  1698. remove_task(TASK_WELCOMEMSG)
  1699. set_task(2.0, "welcome_msg", TASK_WELCOMEMSG)
  1700.  
  1701. // Set a new "Make Zombie Task"
  1702. remove_task(TASK_MAKEZOMBIE)
  1703. set_task(2.0+random_float(get_pcvar_float(cvar_warmup), get_pcvar_float(cvar_warmup)+3.0), "make_zombie_task", TASK_MAKEZOMBIE)
  1704. }
  1705.  
  1706. // Log Event Round Start
  1707. public logevent_round_start()
  1708. {
  1709. // Freezetime ends
  1710. g_freezetime = false
  1711. }
  1712.  
  1713. // Log Event Round End
  1714. public logevent_round_end()
  1715. {
  1716. // Ganancia admin
  1717. for(new id=1; id<=get_maxplayers();id++)
  1718. {
  1719. if (is_user_admin(id))
  1720. {
  1721. static flags; flags = get_user_flags(id)
  1722. for (new i = 0; i < sizeof(admganancia); i++)
  1723. {
  1724. if (flags & admganancia[i][Admin])
  1725. {
  1726. g_ganancia[id] = admganancia[i][Ganancia]
  1727. break;
  1728. }
  1729. }
  1730. }
  1731. }
  1732.  
  1733. // Prevent this from getting called twice when restarting (bugfix)
  1734. static Float:lastendtime
  1735. if (get_gametime() - lastendtime < 0.5) return;
  1736. lastendtime = get_gametime()
  1737.  
  1738. // Temporarily save player stats?
  1739. if (get_pcvar_num(cvar_statssave))
  1740. {
  1741. static id, team
  1742. for (id = 1; id <= g_maxplayers; id++)
  1743. {
  1744. // Not connected
  1745. if (!is_user_connected(id))
  1746. continue;
  1747.  
  1748. team = fm_get_user_team(id)
  1749.  
  1750. // Not playing
  1751. if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
  1752. continue;
  1753.  
  1754. save_stats(id)
  1755. }
  1756. }
  1757.  
  1758. // Round ended
  1759. g_endround = true
  1760.  
  1761. // Stop old tasks (if any)
  1762. remove_task(TASK_WELCOMEMSG)
  1763. remove_task(TASK_MAKEZOMBIE)
  1764.  
  1765. #if defined AMBIENCE_SOUNDS
  1766. // Stop ambience sounds
  1767. remove_task(TASK_AMBIENCESOUNDS)
  1768. ambience_sound_stop()
  1769. #endif
  1770.  
  1771. // Balance the teams
  1772. set_task(0.1, "balance_teams")
  1773.  
  1774. // Show HUD notice, play win sound, update team scores...
  1775. if (!fnGetZombies())
  1776. {
  1777. // Human team wins
  1778. set_hudmessage(0, 0, 200, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
  1779. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_HUMAN")
  1780.  
  1781. // Play win sound and increase score
  1782. PlaySound(sound_win_humans[random_num(0, sizeof sound_win_humans -1)])
  1783. g_scorehumans++
  1784.  
  1785. // Round end forward
  1786. ExecuteForward(g_fwRoundEnd, g_fwDummyResult, 2);
  1787. }
  1788. else if (!fnGetHumans())
  1789. {
  1790. // Zombie team wins
  1791. set_hudmessage(200, 0, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
  1792. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_ZOMBIE")
  1793.  
  1794. // Play win sound and increase score
  1795. PlaySound(sound_win_zombies[random_num(0, sizeof sound_win_zombies -1)])
  1796. g_scorezombies++
  1797.  
  1798. // Round end forward
  1799. ExecuteForward(g_fwRoundEnd, g_fwDummyResult, 1);
  1800. }
  1801. else
  1802. {
  1803. // No one wins
  1804. set_hudmessage(0, 200, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
  1805. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_NO_ONE")
  1806. PlaySound(sound_win_no_one[random_num(0, sizeof sound_win_no_one -1)])
  1807.  
  1808. // Round end forward
  1809. ExecuteForward(g_fwRoundEnd, g_fwDummyResult, 0);
  1810. }
  1811. }
  1812.  
  1813. #if defined AMBIENCE_SOUNDS
  1814. // Event Map Ended
  1815. public event_intermission()
  1816. {
  1817. // Remove ambience sounds task
  1818. remove_task(TASK_AMBIENCESOUNDS)
  1819. }
  1820. #endif
  1821.  
  1822. // Current Weapon Event
  1823. public event_cur_weapon(id)
  1824. {
  1825. // Not alive
  1826. if (!is_user_alive(id))
  1827. return;
  1828.  
  1829. // Zombie not holding an allowed weapon for some reason
  1830. if (g_zombie[id] && !((1<<read_data(2)) & ZOMBIE_ALLOWED_WEAPONS_BITSUM))
  1831. {
  1832. // Switch to knife
  1833. engclient_cmd(id, "weapon_knife")
  1834.  
  1835. // Update the HUD and let other plugins know
  1836. emessage_begin(MSG_ONE, g_msgCurWeapon, _, id)
  1837. ewrite_byte(1) // active
  1838. ewrite_byte(CSW_KNIFE) // weapon
  1839. ewrite_byte(MAXCLIP[CSW_KNIFE]) // clip
  1840. emessage_end()
  1841. }
  1842. }
  1843.  
  1844. // Weapon Animation Event
  1845. public event_weapon_anim()
  1846. {
  1847. // Because of a weird bug within the AMXX event system, we need to
  1848. // hook this message to prevent some weird behavior when calling
  1849. // engclient_cmd(id, "weapon_knife") in the CurWeapon Event forward.
  1850. // http://forums.alliedmods.net/showthread.php?t=85161&page=2
  1851. }
  1852.  
  1853. /*================================================================================
  1854. [Main Forwards]
  1855. =================================================================================*/
  1856.  
  1857. // Client joins the game
  1858. public client_putinserver(id)
  1859. {
  1860. g_level[id] = 0
  1861. g_ganancia[id] = 1
  1862.  
  1863. if (is_user_admin(id))
  1864. {
  1865. static flags; flags = get_user_flags(id)
  1866. for (new i = 0; i < sizeof(admganancia); i++)
  1867. {
  1868. if (flags & admganancia[i][Admin])
  1869. {
  1870. g_ganancia[id] = admganancia[i][Ganancia]
  1871. break;
  1872. }
  1873. }
  1874. }
  1875.  
  1876. Registrado[id] = 0
  1877. BadPassword[id] = 0
  1878. g_matados[id] = 0
  1879. g_matadosz[id] = 0
  1880. g_infectados[id] = 0
  1881.  
  1882. // Set player name
  1883. get_user_name(id, g_playername[id], charsmax(g_playername[]))
  1884.  
  1885. // Plugin disabled?
  1886. if (!g_pluginenabled) return;
  1887.  
  1888. // Set player state
  1889. g_estado[id] = OFFLINE
  1890.  
  1891. // Initialize player vars
  1892. reset_vars(id, 1)
  1893.  
  1894. // Load player stats?
  1895. if (get_pcvar_num(cvar_statssave)) load_stats(id)
  1896.  
  1897. // Set some tasks for humans only
  1898. if (!is_user_bot(id))
  1899. {
  1900. // Set the custom HUD display task
  1901. set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b")
  1902.  
  1903. // Disable minmodels for clients to see zombies properly
  1904. set_task(5.0, "disable_minmodels", id)
  1905. }
  1906. else
  1907. {
  1908. // CZ bots seem to use a different "classtype" for player entities
  1909. // (or something like that) which needs to be hooked separately
  1910. if (!g_hamczbots && cvar_botquota)
  1911. {
  1912. // Set a task to let the private data initialize
  1913. set_task(0.1, "register_ham_czbots", id)
  1914. }
  1915. }
  1916. }
  1917.  
  1918. // Client disconnect
  1919. public client_disconnect(id)
  1920. {
  1921. if(g_PartyData[id][In_Party])
  1922. g_PartyData[id][Position] ? g_PartyData[id][Amount_In_Party] == 2 ? destoy_party(id) : remove_party_user(id) : destoy_party(id)
  1923. g_PartyData[id][UserName][0] = 0
  1924. g_PartyData[id][Block_Party] = false
  1925. del_sombrero(id)
  1926. // Plugin disabled?
  1927. if (!g_pluginenabled) return;
  1928.  
  1929. // Check that we still have both humans and zombies to keep the round going
  1930. if (is_user_alive(id)) check_round(id)
  1931.  
  1932. // Temporarily save player stats?
  1933. if (get_pcvar_num(cvar_statssave)) save_stats(id)
  1934.  
  1935. // Remove previous tasks
  1936. remove_task(id+TASK_TEAM)
  1937. remove_task(id+TASK_MODEL)
  1938. remove_task(id+TASK_FLASH)
  1939. remove_task(id+TASK_CHARGE)
  1940. remove_task(id+TASK_SPAWN)
  1941. remove_task(id+TASK_BLOOD)
  1942. remove_task(id+TASK_NVISION)
  1943. remove_task(id+TASK_SHOWHUD)
  1944. remove_task(id+TASK_COMBO)
  1945.  
  1946. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  1947. // Remove custom model entities
  1948. fm_remove_model_ents(id)
  1949. #endif
  1950.  
  1951. // Last Zombie Check
  1952. set_task(0.1, "fnCheckLastZombie")
  1953.  
  1954. // Save player stats
  1955. if (!is_user_bot(id))
  1956. Save(id)
  1957. }
  1958.  
  1959. // Entity Spawn Forward
  1960. public fw_Spawn(entity)
  1961. {
  1962. // Invalid entity
  1963. if (!pev_valid(entity)) return FMRES_IGNORED;
  1964.  
  1965. // Get classname
  1966. new classname[32]
  1967. pev(entity, pev_classname, classname, sizeof classname - 1)
  1968.  
  1969. // Check whether it needs to be removed
  1970. for (new i = 0; i < sizeof g_objective_ents; i++)
  1971. {
  1972. if (equal(classname, g_objective_ents[i]))
  1973. {
  1974. engfunc(EngFunc_RemoveEntity, entity)
  1975. return FMRES_SUPERCEDE;
  1976. }
  1977. }
  1978.  
  1979. return FMRES_IGNORED;
  1980. }
  1981.  
  1982. // Ham Player Spawn Post Forward
  1983. public fw_PlayerSpawn_Post(id)
  1984. {
  1985. // Not alive or didn't join a team yet
  1986. if (!is_user_alive(id) || !fm_get_user_team(id))
  1987. return;
  1988. g_akdestruction[id] = false
  1989. g_ultimate[id] = false
  1990. g_atomic[id] = false
  1991. g_masive[id] = false
  1992. g_navi[id] = false
  1993. g_power[id] = false
  1994. g_stfu[id] = false
  1995. g_rlp[id] = false
  1996. g_m4[id] = false
  1997. g_barret[id] = false
  1998. g_devil[id] = false
  1999. g_rampage[id] = false
  2000. g_supermide[id] = false
  2001. g_farger[id] = false
  2002. g_storm[id] = false
  2003. g_adge[id] = false
  2004. g_ultra[id] = false
  2005. g_nule[id] = false
  2006. g_super[id] = false
  2007. g_ultrak[id] = false
  2008. g_raampage[id] = false
  2009. set_sombrero(id)
  2010. strip_user_weapons(id);
  2011. set_task(0.5, "dar_cuchillo", id);
  2012.  
  2013. // Remove previous tasks
  2014. remove_task(id+TASK_SPAWN)
  2015. remove_task(id+TASK_TEAM)
  2016. remove_task(id+TASK_MODEL)
  2017. remove_task(id+TASK_BLOOD)
  2018.  
  2019. // Spawn randomly?
  2020. if (get_pcvar_num(cvar_randspawn)) do_random_spawn(id)
  2021.  
  2022. // Hide money?
  2023. if (get_pcvar_num(cvar_removemoney))
  2024. set_task(0.2, "task_hide_money", id+TASK_SPAWN)
  2025.  
  2026. // Respawn player if he dies because of a worldspawn kill?
  2027. if (get_pcvar_num(cvar_respawnworldspawnkill))
  2028. set_task(2.0, "respawn_player", id+TASK_SPAWN)
  2029.  
  2030. // Spawn as zombie?
  2031. if (g_respawn_as_zombie[id] && !g_newround)
  2032. {
  2033. reset_vars(id, 0) // reset player vars
  2034. zombieme(id, 0, 0, 0) // make him zombie right away
  2035. return;
  2036. }
  2037.  
  2038. // Reset player vars
  2039. reset_vars(id, 0)
  2040.  
  2041. // Set selected human class
  2042. g_humanclass[id] = g_humanclassnext[id]
  2043. if (g_humanclass[id] == HCLASS_NONE) g_humanclass[id] = 0
  2044.  
  2045. // Set health and gravity
  2046. fm_set_user_health(id, g_hclass_hp[g_humanclass[id]] + H_SALUD(g_skill_points[id][0][1]))
  2047. set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]] - H_GRAVITY(g_skill_points[id][0][3]))
  2048. set_user_armor(id, g_hclass_ar[g_humanclass[id]] + H_ARMOR(g_skill_points[id][0][4]))
  2049.  
  2050. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  2051.  
  2052. // Set the right model
  2053. if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
  2054. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[random_num(0, sizeof model_admin -1)])
  2055. else
  2056. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
  2057.  
  2058. // Set model on player model entity
  2059. fm_set_playermodel_ent(id)
  2060.  
  2061. // Remove glow on player model entity
  2062. fm_set_rendering(g_ent_playermodel[id])
  2063.  
  2064. #else
  2065.  
  2066. // Set the right model, after checking that we don't already have it
  2067. static currentmodel[32], already_has_model, i, iRand
  2068. already_has_model = false
  2069.  
  2070. // Get current model and compare it with current one
  2071. fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
  2072.  
  2073. if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
  2074. {
  2075. for (i = 0; i < sizeof model_admin; i++)
  2076. if (equal(model_admin[i], currentmodel)) already_has_model = true
  2077.  
  2078. if (!already_has_model)
  2079. {
  2080. iRand = random_num(0, sizeof model_admin -1)
  2081. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[iRand])
  2082. #if defined SET_MODELINDEX_OFFSET
  2083. fm_set_user_model_index(id, g_modelindex_admin[iRand])
  2084. #endif
  2085. }
  2086. }
  2087. else
  2088. {
  2089. if (equal(g_hclass_model[g_humanclass[id]], currentmodel)) already_has_model = true;
  2090.  
  2091. if (!already_has_model)
  2092. {
  2093. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
  2094. #if defined SET_MODELINDEX_OFFSET
  2095. fm_set_user_model_index(id, g_hclass_modelindex[g_humanclass[id]])
  2096. #endif
  2097. }
  2098. }
  2099.  
  2100. // Need to change the model?
  2101. if (!already_has_model)
  2102. {
  2103. // An additional delay is offset at round start
  2104. // since SVC_BAD is more likely to be triggered there
  2105. if (g_newround)
  2106. set_task(5.0*MODELCHANGE_DELAY, "fm_user_model_update", id+TASK_MODEL)
  2107. else
  2108. fm_user_model_update(id+TASK_MODEL)
  2109. }
  2110.  
  2111. // Remove glow
  2112. fm_set_rendering(id)
  2113.  
  2114. #endif
  2115.  
  2116. // Bots stuff
  2117. if (is_user_bot(id))
  2118. {
  2119. // Turn off NVG for bots
  2120. fm_set_bot_nvg(id, 0)
  2121.  
  2122. // Automatically buy extra items/weapons after first zombie is chosen
  2123. if (get_pcvar_num(cvar_extraitems))
  2124. {
  2125. if (g_newround) set_task(10.0+get_pcvar_float(cvar_warmup), "bot_buy_extras", id+TASK_SPAWN)
  2126. else set_task(10.0, "bot_buy_extras", id+TASK_SPAWN)
  2127. }
  2128. }
  2129.  
  2130. // Show custom buy menu?
  2131. show_menu_eleccion(id)
  2132.  
  2133. // Get spawn protection time
  2134. static Float:sptime
  2135. sptime = get_pcvar_float(cvar_spawnprotection)
  2136.  
  2137. // Enable spawn protection for humans spawning mid-round
  2138. if (!g_newround && sptime > 0.0)
  2139. {
  2140. // Dont take any damage
  2141. g_nodamage[id] = true
  2142.  
  2143. // Make temporarily invisible
  2144. set_pev(id, pev_effects, pev(id, pev_effects) | EF_NODRAW)
  2145.  
  2146. // Set task to remove it
  2147. set_task(sptime, "remove_spawn_protection", id+TASK_SPAWN)
  2148. }
  2149.  
  2150. // Last Zombie Check
  2151. set_task(0.1, "fnCheckLastZombie")
  2152. }
  2153.  
  2154. public zp_user_infected_post(id, infector)
  2155. {
  2156. g_infectados[infector]++
  2157. }
  2158.  
  2159. // Ham Player Killed Forward
  2160. public fw_PlayerKilled(victim, attacker, shouldgib)
  2161. {
  2162. static name[33]; get_user_name(attacker, name, charsmax(name));
  2163. // Last Zombie Check
  2164. set_task(0.1, "fnCheckLastZombie")
  2165.  
  2166. // Enable dead players nightvision
  2167. set_task(0.2, "spec_nvision", victim)
  2168.  
  2169. if (!g_zombie[attacker] && g_zombie[victim])
  2170. {
  2171. g_matados[attacker]++
  2172. }
  2173. else if(g_zombie[attacker] && !g_zombie[victim])
  2174. {
  2175. g_matadosz[attacker]++
  2176. }
  2177.  
  2178. if(!g_zombie[attacker] && g_nemesis[victim])
  2179. {
  2180. if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
  2181. {
  2182. g_points[attacker][0]+= 12
  2183. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 12^x01 puntos Humanos por ser ^x04 ADMIN x12^x01 y matar un^x03 Nemesis", name)
  2184. }
  2185. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
  2186. {
  2187. g_points[attacker][0]+= 24
  2188. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 24^x01 puntos Humanos por ser ^x04 ADMIN x12^x01 y matar un^x03 Nemesis^x01 en ^x04 HORA LOCA", name)
  2189. }
  2190. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
  2191. {
  2192. g_points[attacker][0]+= 9
  2193. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 9^x01 puntos Humanos por ser ^x04 ADMIN x9^x01 y matar un^x03 Nemesis", name)
  2194. }
  2195. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
  2196. {
  2197. g_points[attacker][0]+= 18
  2198. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 18^x01 puntos Humanos por ser ^x04 ADMIN x9^x01 y matar un^x03 Nemesis^x01 en ^x04 HORA LOCA", name)
  2199. }
  2200. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
  2201. {
  2202. g_points[attacker][0]+= 6
  2203. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 6^x01 puntos Humanos por ser ^x04 ADMIN x6^x01 y matar un^x03 Nemesis", name)
  2204. }
  2205. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
  2206. {
  2207. g_points[attacker][0]+= 12
  2208. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 12^x01 puntos Humanos por ser ^x04 ADMIN x6^x01 y matar un^x03 Nemesis^x01 en ^x04 HORA LOCA", name)
  2209. }
  2210. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
  2211. {
  2212. g_points[attacker][0]+= 3
  2213. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 3^x01 puntos Humanos por ser ^x04 ADMIN x3^x01 y matar un^x03 Nemesis", name)
  2214. }
  2215. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
  2216. {
  2217. g_points[attacker][0]+= 6
  2218. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 6^x01 puntos Humanos por ser ^x04 ADMIN x3^x01 y matar un^x03 Nemesis^x01 en ^x04 HORA LOCA", name)
  2219. }
  2220. else if (g_happytime)
  2221. {
  2222. g_points[attacker][0]+= 2
  2223. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 2^x01 puntos Humanos por matar un^x03 Nemesis^x01 en ^x04 HORA LOCA", name)
  2224. }
  2225. else
  2226. {
  2227. g_points[attacker][0]++
  2228. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 1^x01 punto Humano por matar un^x03 Nemesis", name)
  2229. }
  2230. }
  2231.  
  2232. if(g_zombie[attacker] && g_survivor[victim])
  2233. {
  2234. if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
  2235. {
  2236. g_points[attacker][1] += 12
  2237. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 12^x01 puntos Zombie por ser ^x04 ADMIN x12^x01 y matar un^x03 Survivor", name)
  2238. }
  2239. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
  2240. {
  2241. g_points[attacker][1]+= 24
  2242. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 24^x01 puntos Zombie por ser ^x04 ADMIN x12^x01 y matar un^x03 Survivor^x01 en ^x04 HORA LOCA", name)
  2243. }
  2244. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
  2245. {
  2246. g_points[attacker][1]+= 9
  2247. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 9^x01 puntos Zombie por ser ^x04 ADMIN x9^x01 y matar un^x03 Survivor", name)
  2248. }
  2249. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
  2250. {
  2251. g_points[attacker][1]+= 18
  2252. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 18^x01 puntos Zombie por ser ^x04 ADMIN x9^x01 y matar un^x03 Survivor^x01 en ^x04 HORA LOCA", name)
  2253. }
  2254. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
  2255. {
  2256. g_points[attacker][1]+= 6
  2257. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 6^x01 puntos Zombie por ser ^x04 ADMIN x6^x01 y matar un^x03 Survivor", name)
  2258. }
  2259. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
  2260. {
  2261. g_points[attacker][1]+= 12
  2262. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 12^x01 puntos Zombie por ser ^x04 ADMIN x6^x01 y matar un^x03 Survivor^x01 en ^x04 HORA LOCA", name)
  2263. }
  2264. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
  2265. {
  2266. g_points[attacker][1]+= 3
  2267. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 3^x01 puntos Zombie por ser ^x04 ADMIN x3^x01 y matar un^x03 Survivor", name)
  2268. }
  2269. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
  2270. {
  2271. g_points[attacker][1]+= 6
  2272. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 6^x01 puntos Zombie por ser ^x04 ADMIN x3^x01 y matar un^x03 Survivor^x01 en ^x04 HORA LOCA", name)
  2273. }
  2274. else if (g_happytime)
  2275. {
  2276. g_points[attacker][1]+= 2
  2277. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 2^x01 puntos Zombie por matar un^x03 Survivor^x01 en ^x04 HORA LOCA", name)
  2278. }
  2279. else
  2280. {
  2281. g_points[attacker][1]++
  2282. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 ha ganado^x03 1^x01 punto Zombie por matar un^x03 Survivor", name)
  2283. }
  2284. }
  2285.  
  2286. // Get nightvision give setting
  2287. static nvggive
  2288. nvggive = get_pcvar_num(cvar_nvggive)
  2289.  
  2290. // Disable nightvision when killed (bugfix)
  2291. if (nvggive == 0 && g_nvision[victim])
  2292. {
  2293. if (g_nvisionenabled[victim] && !get_pcvar_num(cvar_cnvg)) set_user_gnvision(victim, 0)
  2294. g_nvision[victim] = false
  2295. g_nvisionenabled[victim] = false
  2296. }
  2297.  
  2298. // Turn off nightvision when killed (bugfix)
  2299. if (nvggive == 2 && g_nvision[victim] && g_nvisionenabled[victim])
  2300. {
  2301. if (!get_pcvar_num(cvar_cnvg)) set_user_gnvision(victim, 0)
  2302. g_nvisionenabled[victim] = false
  2303. }
  2304.  
  2305. // Stop bleeding/burning when killed
  2306. if (g_zombie[victim])
  2307. remove_task(victim+TASK_BLOOD)
  2308.  
  2309. // Nemesis explodes!
  2310. if (g_nemesis[victim])
  2311. SetHamParamInteger(3, 2)
  2312.  
  2313. // Get deathmatch mode status and whether the player killed himself
  2314. static deathmatch, selfkill
  2315. deathmatch = get_pcvar_num(cvar_deathmatch)
  2316. selfkill = (victim == attacker || !is_user_connected(attacker)) ? true : false
  2317.  
  2318. // Respawn if deathmatch is enabled
  2319. if (deathmatch)
  2320. {
  2321. // Respawn on suicide?
  2322. if (selfkill && !get_pcvar_num(cvar_respawnonsuicide))
  2323. return;
  2324.  
  2325. // Respawn if only the last human is left?
  2326. if (!get_pcvar_num(cvar_respawnafterlast) && fnGetHumans() == 1)
  2327. return;
  2328.  
  2329. // Respawn as zombie?
  2330. if (deathmatch == 2 || (deathmatch == 3 && random_num(0, 1)) || (deathmatch == 4 && fnGetZombies() < fnGetAlive()/2))
  2331. g_respawn_as_zombie[victim] = true
  2332.  
  2333. // Set the respawn task
  2334. set_task(get_pcvar_float(cvar_spawndelay), "respawn_player", victim+TASK_SPAWN)
  2335. }
  2336.  
  2337. // Killed by a non-player entity or self killed
  2338. if (selfkill) return;
  2339.  
  2340. // Ignore Nemesis/Survivor Frags?
  2341. if ((g_nemesis[attacker] && get_pcvar_num(cvar_nemignorefrags)) || (g_survivor[attacker] && get_pcvar_num(cvar_survignorefrags)))
  2342. RemoveFrags(attacker, victim)
  2343.  
  2344. // Zombie/nemesis killed human, reward ammo packs
  2345. if (g_zombie[attacker] && (!g_nemesis[attacker] || !get_pcvar_num(cvar_nemignoreammo)))
  2346. update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0)
  2347.  
  2348. // Get frag rewards for humans and zombies
  2349. static fragskill, fragsinfect
  2350. fragskill = get_pcvar_num(cvar_fragskill)
  2351. fragsinfect = get_pcvar_num(cvar_fragsinfect)
  2352.  
  2353. // Human killed zombie, add up the extra frags for kill
  2354. if (!g_zombie[attacker] && fragskill > 1)
  2355. UpdateFrags(attacker, victim, fragskill-1, 0, 0)
  2356.  
  2357. // Zombie killed human, add up the extra frags for kill
  2358. if (g_zombie[attacker] && fragsinfect > 1)
  2359. UpdateFrags(attacker, victim, fragsinfect-1, 0, 0)
  2360. }
  2361.  
  2362. // Ham Take Damage Forward (inflictor = weapon)
  2363. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
  2364. {
  2365. // Non-player damage or self damage
  2366. if (victim == attacker || !is_user_connected(attacker))
  2367. return HAM_IGNORED;
  2368.  
  2369. // New round starting or round ended
  2370. if (g_newround || g_endround)
  2371. return HAM_SUPERCEDE;
  2372.  
  2373. // Victim shouldn't take damage or victim is frozen
  2374. if( g_nodamage[ victim ] || g_frozen[ attacker ] )
  2375. return HAM_SUPERCEDE;
  2376.  
  2377. // Prevent friendly fire
  2378. if (g_zombie[attacker] == g_zombie[victim])
  2379. return HAM_SUPERCEDE;
  2380.  
  2381. // Attacker is human...
  2382. if (!g_zombie[attacker])
  2383. {
  2384. if (g_akdestruction[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2385. {
  2386. SetHamParamFloat(4, damage *= 3.0)
  2387. }
  2388. else if (g_ultimate[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2389. {
  2390. SetHamParamFloat(4, damage *= 3.5)
  2391. }
  2392. else if (g_atomic[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2393. {
  2394. SetHamParamFloat(4, damage *= 4.0)
  2395. }
  2396. else if (g_masive[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2397. {
  2398. SetHamParamFloat(4, damage *= 5.0)
  2399. }
  2400. else if (g_navi[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2401. {
  2402. SetHamParamFloat(4, damage *= 5.5)
  2403. }
  2404. else if (g_power[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2405. {
  2406. SetHamParamFloat(4,damage *= 7.0)
  2407. }
  2408. else if (g_stfu[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2409. {
  2410. SetHamParamFloat(4, damage *= 7.5)
  2411. }
  2412. else if (g_rlp[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2413. {
  2414. SetHamParamFloat(4, damage *= 8.0)
  2415. }
  2416. else if (g_m4[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2417. {
  2418. SetHamParamFloat(4, damage *= 8.5)
  2419. }
  2420. else if (g_barret[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2421. {
  2422. SetHamParamFloat(4, damage *= 9.0)
  2423. }
  2424. else if (g_devil[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2425. {
  2426. SetHamParamFloat(4, damage *= 9.5)
  2427. }
  2428. else if (g_rampage[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2429. {
  2430. SetHamParamFloat(4, damage *= 10.0)
  2431. }
  2432. else if (g_supermide[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2433. {
  2434. SetHamParamFloat(4, damage *= 10.5)
  2435. }
  2436. else if (g_farger[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2437. {
  2438. SetHamParamFloat(4, damage *= 11.0)
  2439. }
  2440. else if (g_storm[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2441. {
  2442. SetHamParamFloat(4, damage *= 12.0)
  2443. }
  2444. else if (g_adge[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2445. {
  2446. SetHamParamFloat(4, damage *= 13.0)
  2447. }
  2448. else if (g_ultra[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2449. {
  2450. SetHamParamFloat(4, damage *= 14.0)
  2451. }
  2452. else if (g_nule[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2453. {
  2454. SetHamParamFloat(4, damage *= 15.0)
  2455. }
  2456. else if (g_super[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2457. {
  2458. SetHamParamFloat(4, damage *= 17.0)
  2459. }
  2460. else if (g_ultrak[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2461. {
  2462. SetHamParamFloat(4, damage *= 20.0)
  2463. }
  2464. else if (g_raampage[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2465. {
  2466. SetHamParamFloat(4, damage *= 25.0)
  2467. }
  2468.  
  2469. // Armor multiplier for the final damage on normal zombies
  2470. if (!g_nemesis[victim])
  2471. {
  2472. damage *= H_DAMAGE(g_skill_points[attacker][0][0])
  2473. SetHamParamFloat(4, damage)
  2474. }
  2475.  
  2476. // Reward ammo packs
  2477. if (!g_survivor[attacker] || !get_pcvar_num(cvar_survignoreammo))
  2478. {
  2479. // Store damage dealt
  2480. g_damagedealt[attacker] += floatround(damage)
  2481. g_damage[attacker] += floatround(damage)
  2482. g_total[attacker] += floatround(damage)
  2483. remove_task(attacker+TASK_COMBO)
  2484.  
  2485. // Get damage required to get an ammo pack
  2486. static ammodamage
  2487. ammodamage = get_pcvar_num(cvar_ammodamage)
  2488.  
  2489. // Reward ammo packs for every [ammo damage] dealt
  2490. while (g_damagedealt[attacker] >= (ammodamage / (g_happytime + 1)) )
  2491. {
  2492. if(g_PartyData[attacker][In_Party])
  2493. {
  2494. new Players[32], user
  2495. get_party_index(attacker, Players)
  2496.  
  2497. for(new i; i < g_PartyData[attacker][Amount_In_Party]; i++) {
  2498. user = Players[i]
  2499. if (!g_zombie[user])
  2500. {
  2501. update_ap(user, g_ganancia[attacker]/g_PartyData[attacker][Amount_In_Party] +1, 0)
  2502. }
  2503. }
  2504. g_damagedealt[attacker] -= ammodamage
  2505. }
  2506. else
  2507. {
  2508. update_ap(attacker, g_ganancia[attacker], 0)
  2509. g_damagedealt[attacker] -= ammodamage
  2510. }
  2511. }
  2512. while (g_damage[attacker] >= 200)
  2513. {
  2514. g_combo[attacker] ++
  2515. g_damage[attacker] -= 200
  2516. }
  2517. while (g_damage[attacker] >= 100 && g_happytime)
  2518. {
  2519. g_combo[attacker] ++
  2520. g_damage[attacker] -= 100
  2521. }
  2522. for(new i = 0 ; i < sizeof Combo ; i++)
  2523. {
  2524. if (g_combo[attacker] >= Combo[i][Combos])
  2525. {
  2526. if (!g_happytime)
  2527. {
  2528. set_hudmessage(Combo[i][Rojo], Combo[i][Verde], Combo[i][Azul], -1.0, 0.27, 1, 4.5, 4.5, 0.01, 0.01)
  2529. ShowSyncHudMsg(attacker, g_MsgSync3, "[Combo Level: %d]^n[Tipo: %s]^n[Daño Almacenado: %d]", g_combo[attacker], Combo[i][Msj], g_total[attacker])
  2530. }
  2531. else
  2532. {
  2533. set_hudmessage(Comboh[i][Rojo], Comboh[i][Verde], Comboh[i][Azul], -1.0, 0.27, 1, 4.5, 4.5, 0.01, 0.01)
  2534. ShowSyncHudMsg(attacker, g_MsgSync3, "[Combo Loco Level: %d]^n[Tipo: %s]^n[Daño Almacenado: %d]", g_combo[attacker], Comboh[i][Msjh], g_total[attacker])
  2535. }
  2536. }
  2537. }
  2538. set_task(4.0, "Combo_Terminado", attacker+TASK_COMBO)
  2539. }
  2540.  
  2541. return HAM_IGNORED;
  2542. }
  2543.  
  2544. // Attacker is zombie...
  2545. if (g_zombie[attacker] && !g_survivor[victim])
  2546. {
  2547. SetHamParamFloat(4, damage + Z_DAMAGE(g_skill_points[attacker][1][0]))
  2548. }
  2549. // Prevent infection by HE grenade (bugfix)
  2550. if (damage_type & DMG_HEGRENADE)
  2551. return HAM_SUPERCEDE;
  2552.  
  2553. // Nemesis?
  2554. if (g_nemesis[attacker])
  2555. {
  2556. // Set nemesis damage
  2557. SetHamParamFloat(4, get_pcvar_float(cvar_nemdamage))
  2558. return HAM_IGNORED;
  2559. }
  2560.  
  2561. // Last human or swarm round or plague round
  2562. if (g_swarmround || g_plagueround || fnGetHumans() == 1)
  2563. return HAM_IGNORED; // human is killed
  2564.  
  2565. // Does human armor need to be reduced before infecting?
  2566. if (g_hclass_ar[g_humanclass[attacker]])
  2567. {
  2568. // Get victim armor
  2569. static Float:armor
  2570. pev(victim, pev_armorvalue, armor)
  2571.  
  2572. // Block the attack if he has some
  2573. if (armor > 0.0)
  2574. {
  2575. engfunc(EngFunc_EmitSound, victim, CHAN_BODY, sound_armorhit, 1.0, ATTN_NORM, 0, PITCH_NORM)
  2576. set_pev(victim, pev_armorvalue, floatmax(0.0, armor - damage-Z_DAMAGE(g_skill_points[attacker][1][0])))
  2577. return HAM_SUPERCEDE;
  2578. }
  2579. }
  2580.  
  2581. // Infection allowed
  2582. SendDeathMsg(attacker, victim) // send death notice
  2583. FixDeadAttrib(victim) // fix the "dead" attrib on scoreboard
  2584. UpdateFrags(attacker, victim, get_pcvar_num(cvar_fragsinfect), 1, 1) // add corresponding frags and deaths
  2585.  
  2586. zombieme(victim, attacker, 0, 0) // turn into zombie
  2587. update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0) // ammo packs given to zombie for infection
  2588. fm_set_user_health(attacker, pev(attacker, pev_health)+get_pcvar_num(cvar_zombiebonushp)) // attacker gets bonus HP for the infection
  2589.  
  2590. return HAM_SUPERCEDE;
  2591. }
  2592.  
  2593. // Ham Trace Attack Forward
  2594. public fw_TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type)
  2595. {
  2596. // Non-player damage or self damage
  2597. if (victim == attacker || !is_user_connected(attacker))
  2598. return HAM_IGNORED;
  2599.  
  2600. // New round starting or round ended
  2601. if (g_newround || g_endround)
  2602. return HAM_SUPERCEDE;
  2603.  
  2604. // Victim shouldn't take damage or victim is frozen
  2605. if( g_nodamage[ victim ] || g_frozen[ attacker ] )
  2606. return HAM_SUPERCEDE;
  2607.  
  2608. // Prevent friendly fire
  2609. if (g_zombie[attacker] == g_zombie[victim])
  2610. return HAM_SUPERCEDE;
  2611.  
  2612. // Victim isn't a normal zombie
  2613. if (!g_zombie[victim] || g_nemesis[victim])
  2614. return HAM_IGNORED;
  2615.  
  2616. // Get custom hitzones setting
  2617. static hitzones
  2618. hitzones = get_pcvar_num(cvar_hitzones)
  2619.  
  2620. // Check if we hit an allowed one
  2621. if (hitzones && !(hitzones & (1<<get_tr2(tracehandle, TR_iHitgroup))))
  2622. return HAM_SUPERCEDE;
  2623.  
  2624. // Knockback disabled or not bullet damage
  2625. if (!(damage_type & DMG_BULLET) || !get_pcvar_num(cvar_knockback))
  2626. return HAM_IGNORED;
  2627.  
  2628. // Get victim flags and knockback while ducking setting
  2629. static victimflags, Float:knockduck
  2630. victimflags = pev(victim, pev_flags)
  2631. knockduck = get_pcvar_float(cvar_knockbackducking)
  2632.  
  2633. // Zombie is ducking on ground
  2634. if (knockduck == 0.0 && (victimflags & FL_DUCKING) && (victimflags & FL_ONGROUND))
  2635. return HAM_IGNORED;
  2636.  
  2637. // Get distance between players
  2638. static Float:origin1F[3], Float:origin2F[3]
  2639. pev(victim, pev_origin, origin1F)
  2640. pev(attacker, pev_origin, origin2F)
  2641.  
  2642. // Max distance exceeded
  2643. if (get_distance_f(origin1F, origin2F) > get_pcvar_float(cvar_knockbackdist))
  2644. return HAM_IGNORED;
  2645.  
  2646. // Get victim's velocity
  2647. static Float:velocity[3]
  2648. pev(victim, pev_velocity, velocity)
  2649.  
  2650. // Use damage on knockback calculation
  2651. if (get_pcvar_num(cvar_knockbackdamage))
  2652. xs_vec_mul_scalar(direction, damage, direction)
  2653.  
  2654. // Use weapon power on knockback calculation
  2655. if (kb_weapon_power[g_currentweapon[attacker]] > 0.0 && get_pcvar_num(cvar_knockbackpower))
  2656. xs_vec_mul_scalar(direction, kb_weapon_power[g_currentweapon[attacker]], direction)
  2657.  
  2658. // Apply ducking knockback multiplier
  2659. if ((victimflags & FL_DUCKING) && (victimflags & FL_ONGROUND))
  2660. xs_vec_mul_scalar(direction, knockduck, direction)
  2661.  
  2662. // Apply zombie class knockback multiplier
  2663. xs_vec_mul_scalar(direction, g_zclass_kb[g_zombieclass[victim]], direction)
  2664.  
  2665. // Add up the new vector
  2666. xs_vec_add(velocity, direction, direction)
  2667.  
  2668. // Should knockback also affect vertical velocity?
  2669. if (!get_pcvar_num(cvar_knockbackzvel))
  2670. direction[2] = velocity[2]
  2671.  
  2672. // Set the knockback'd victim's velocity
  2673. set_pev(victim, pev_velocity, direction)
  2674.  
  2675. return HAM_IGNORED;
  2676. }
  2677.  
  2678. // Ham Use Stationary Gun Forward
  2679. public fw_UseStationary(entity, caller, activator, use_type)
  2680. {
  2681. // Not a player
  2682. if (!is_user_connected(caller))
  2683. return HAM_IGNORED;
  2684.  
  2685. // Prevent zombies from using stationary guns
  2686. if (use_type == USE_USING && g_zombie[caller])
  2687. return HAM_SUPERCEDE;
  2688.  
  2689. // Someone stopped using a stationary gun
  2690. if (use_type == USE_STOPPED)
  2691. set_task(0.1, "replace_models", caller) // replace weapon models (bugfix)
  2692.  
  2693. return HAM_IGNORED;
  2694. }
  2695.  
  2696. // Ham Use Pushable Forward
  2697. public fw_UsePushable()
  2698. {
  2699. // Prevent speed bug with pushables?
  2700. if (get_pcvar_num(cvar_blockpushables))
  2701. return HAM_SUPERCEDE;
  2702.  
  2703. return HAM_IGNORED;
  2704. }
  2705.  
  2706. // Ham Weapon Touch Forward
  2707. public fw_TouchWeapon(weapon, id)
  2708. {
  2709. // Not a player
  2710. if (!is_user_connected(id))
  2711. return HAM_IGNORED;
  2712.  
  2713. // Dont pickup weapons if zombie or survivor (+PODBot MM fix)
  2714. if (g_zombie[id] || (g_survivor[id] && !is_user_bot(id)))
  2715. return HAM_SUPERCEDE;
  2716.  
  2717. return HAM_IGNORED;
  2718. }
  2719.  
  2720. // Ham Weapon Pickup Forward
  2721. public fw_AddPlayerItem(id, weapon_ent)
  2722. {
  2723. // Retrieve our custom extra ammo from the weapon
  2724. static extra_ammo
  2725. extra_ammo = pev(weapon_ent, PEV_ADDITIONAL_AMMO)
  2726.  
  2727. // If present, add to player's bpammo (dont exceed max capacity though)
  2728. if (extra_ammo)
  2729. {
  2730. static wname[32], weapon
  2731. pev(weapon_ent, pev_classname, wname, sizeof wname - 1)
  2732. weapon = get_weaponid(wname)
  2733.  
  2734. fm_set_user_bpammo(id, weapon, min(fm_get_user_bpammo(id, weapon)+extra_ammo, MAXBPAMMO[weapon]))
  2735. set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, 0)
  2736. }
  2737. }
  2738.  
  2739. // Client Kill Forward
  2740. public fw_ClientKill()
  2741. {
  2742. // Prevent players from killing themselves?
  2743. if (get_pcvar_num(cvar_blocksuicide))
  2744. return FMRES_SUPERCEDE;
  2745.  
  2746. return FMRES_IGNORED;
  2747. }
  2748.  
  2749. // Emit Sound Forward
  2750. public fw_EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch)
  2751. {
  2752. // Replace these sounds for zombies only
  2753. if (!is_user_connected(id) || !g_zombie[id])
  2754. return FMRES_IGNORED;
  2755.  
  2756. // Zombie being hit
  2757. if (equal(sample[7], "bhit", 4))
  2758. {
  2759. if (g_nemesis[id])
  2760. engfunc(EngFunc_EmitSound, id, channel, nemesis_pain[random_num(0, sizeof nemesis_pain - 1)], volume, attn, flags, pitch)
  2761. else
  2762. engfunc(EngFunc_EmitSound, id, channel, zombie_pain[random_num(0, sizeof zombie_pain - 1)], volume, attn, flags, pitch)
  2763. return FMRES_SUPERCEDE;
  2764. }
  2765.  
  2766. // Zombie attacks with knife
  2767. if (equal(sample[8], "kni", 3))
  2768. {
  2769. if (equal(sample[14], "sla", 3)) // slash
  2770. {
  2771. engfunc(EngFunc_EmitSound, id, channel, zombie_miss_slash[random_num(0, sizeof zombie_miss_slash - 1)], volume, attn, flags, pitch)
  2772. return FMRES_SUPERCEDE;
  2773. }
  2774. if (equal(sample[14], "hit", 3))
  2775. {
  2776. if (sample[17] == 'w') // wall
  2777. {
  2778. engfunc(EngFunc_EmitSound, id, channel, zombie_miss_wall[random_num(0, sizeof zombie_miss_wall - 1)], volume, attn, flags, pitch)
  2779. return FMRES_SUPERCEDE;
  2780. }
  2781. else // hit
  2782. {
  2783. engfunc(EngFunc_EmitSound, id, channel, zombie_hit_normal[random_num(0, sizeof zombie_hit_normal - 1)], volume, attn, flags, pitch)
  2784. return FMRES_SUPERCEDE;
  2785. }
  2786. }
  2787. if (equal(sample[14], "sta", 3)) // stab
  2788. {
  2789. engfunc(EngFunc_EmitSound, id, channel, zombie_hit_stab[random_num(0, sizeof zombie_hit_stab - 1)], volume, attn, flags, pitch)
  2790. return FMRES_SUPERCEDE;
  2791. }
  2792. }
  2793.  
  2794. // Zombie dies
  2795. if (equal(sample[7], "die", 3) || equal(sample[7], "dea", 3))
  2796. {
  2797. engfunc(EngFunc_EmitSound, id, channel, zombie_die[random_num(0, sizeof zombie_die - 1)], volume, attn, flags, pitch)
  2798. return FMRES_SUPERCEDE;
  2799. }
  2800.  
  2801. // Zombie falls off
  2802. if (equal(sample[10], "fall", 4))
  2803. {
  2804. engfunc(EngFunc_EmitSound, id, channel, zombie_fall[random_num(0, sizeof zombie_fall - 1)], volume, attn, flags, pitch)
  2805. return FMRES_SUPERCEDE;
  2806. }
  2807.  
  2808. return FMRES_IGNORED;
  2809. }
  2810.  
  2811. #if !defined HANDLE_MODELS_ON_SEPARATE_ENT
  2812. // Forward Set ClientKey Value -prevent CS from changing player models-
  2813. public fw_SetClientKeyValue(id, const infobuffer[], const key[])
  2814. {
  2815. // Block CS model changes
  2816. if (equal(key, "model"))
  2817. return FMRES_SUPERCEDE;
  2818.  
  2819. return FMRES_IGNORED;
  2820. }
  2821.  
  2822. // Forward Client User Info Changed -prevent players from changing models-
  2823. public fw_ClientUserInfoChanged(id)
  2824. {
  2825. // Get current model
  2826. static currentmodel[32]
  2827. fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
  2828.  
  2829. // If they're different, set model again
  2830. if (!equal(currentmodel, g_playermodel[id]) && !task_exists(id+TASK_MODEL))
  2831. fm_set_user_model(id+TASK_MODEL)
  2832. }
  2833. #endif
  2834.  
  2835. // Forward Get Game Description
  2836. public fw_GetGameDescription()
  2837. {
  2838. // Return the mod name so it can be easily identified
  2839. forward_return(FMV_STRING, g_modname)
  2840.  
  2841. return FMRES_SUPERCEDE;
  2842. }
  2843.  
  2844. // Forward CmdStart
  2845. public fw_CmdStart(id, handle)
  2846. {
  2847. // Check if it's a flashlight impulse
  2848. if (get_uc(handle, UC_Impulse) != IMPULSE_FLASHLIGHT)
  2849. return;
  2850.  
  2851. // Not alive
  2852. if (!is_user_alive(id))
  2853. return;
  2854.  
  2855. // Block it for zombies, survivor (and override it for humans when custom flashlight is on)
  2856. if (g_zombie[id] || g_survivor[id] || (!g_zombie[id] && get_pcvar_num(cvar_cflash)))
  2857. {
  2858. // Human's custom flashlight should be turned on instead
  2859. if (!g_zombie[id] && !g_survivor[id] && get_gametime() - g_lastflashtime[id] > 1.1)
  2860. {
  2861. // Prevent turning the flashlight on/off too quickly (bugfix)
  2862. g_lastflashtime[id] = get_gametime()
  2863.  
  2864. // Turn custom flashlight on/off
  2865. g_flashlight[id] = !(g_flashlight[id])
  2866.  
  2867. // Set the flashlight charge task
  2868. remove_task(id+TASK_CHARGE)
  2869. set_task(1.0, "flashlight_charge", id+TASK_CHARGE, _, _, "b")
  2870.  
  2871. // Update flashlight status on the HUD
  2872. message_begin(MSG_ONE, g_msgFlashlight, _, id)
  2873. write_byte(g_flashlight[id]) // toggle
  2874. write_byte(g_flashbattery[id]) // battery
  2875. message_end()
  2876.  
  2877. // Turn off original flashlight if active
  2878. set_pev(id, pev_effects, pev(id, pev_effects) & ~EF_DIMLIGHT)
  2879.  
  2880. // Play flashlight toggle sound
  2881. engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_flashlight, 1.0, ATTN_NORM, 0, PITCH_NORM)
  2882.  
  2883. // Finally call our custom flashlight task
  2884. remove_task(id+TASK_FLASH)
  2885. set_task(0.1, "set_user_flashlight", id+TASK_FLASH, _, _, "b")
  2886. }
  2887.  
  2888. // Block the impulse
  2889. set_uc(handle, UC_Impulse, 0)
  2890. }
  2891. }
  2892.  
  2893. // Forward Set Model
  2894. public fw_SetModel(entity, const model[])
  2895. {
  2896. // Get remove dropped weapons setting
  2897. static Float:removeweapons
  2898. removeweapons = get_pcvar_float(cvar_removedropped)
  2899.  
  2900. // Remove weapons?
  2901. if (removeweapons > 0.0)
  2902. {
  2903. // Get entity's classname
  2904. static class[10]
  2905. pev(entity, pev_classname, class, sizeof class - 1)
  2906.  
  2907. // Check if it's a weapon box
  2908. if (equal(class, "weaponbox"))
  2909. {
  2910. // They get automatically removed when thinking
  2911. set_pev(entity, pev_nextthink, get_gametime() + removeweapons)
  2912. return;
  2913. }
  2914. }
  2915.  
  2916. // Get damage time of grenade
  2917. static Float:dmgtime
  2918. pev(entity, pev_dmgtime, dmgtime)
  2919.  
  2920. // Grenade not yet thrown
  2921. if (dmgtime == 0.0)
  2922. return;
  2923.  
  2924. if (equal(model[7], "w_he", 4))
  2925. {
  2926. if (g_zombie[pev(entity, pev_owner)]) // [ZOMBIE] - Infection Grenade
  2927. {
  2928. // Give it a glow
  2929. fm_set_rendering(entity, kRenderFxGlowShell, 0, 200, 0, kRenderNormal, 16);
  2930.  
  2931. // And a colored trail
  2932. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  2933. write_byte(TE_BEAMFOLLOW) // TE id
  2934. write_short(entity) // entity
  2935. write_short(g_trailSpr) // sprite
  2936. write_byte(10) // life
  2937. write_byte(10) // width
  2938. write_byte(0) // r
  2939. write_byte(200) // g
  2940. write_byte(0) // b
  2941. write_byte(200) // brightness
  2942. message_end()
  2943.  
  2944. // Set grenade type on the thrown grenade entity
  2945. set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_INFECTION)
  2946. }
  2947. else if (get_pcvar_num(cvar_firegrenades)) // [HUMAN] - Fire Grenade
  2948. {
  2949. // Give it a glow
  2950. fm_set_rendering(entity, kRenderFxGlowShell, 200, 0, 0, kRenderNormal, 16);
  2951.  
  2952. // And a colored trail
  2953. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  2954. write_byte(TE_BEAMFOLLOW) // TE id
  2955. write_short(entity) // entity
  2956. write_short(g_trailSpr) // sprite
  2957. write_byte(10) // life
  2958. write_byte(10) // width
  2959. write_byte(200) // r
  2960. write_byte(0) // g
  2961. write_byte(0) // b
  2962. write_byte(200) // brightness
  2963. message_end()
  2964.  
  2965. // Set grenade type on the thrown grenade entity
  2966. set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_NAPALM)
  2967. }
  2968. }
  2969. else if (equal(model[7], "w_fl", 4) && get_pcvar_num(cvar_frostgrenades)) // Frost Grenade
  2970. {
  2971. // Give it a glow
  2972. fm_set_rendering(entity, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 16);
  2973.  
  2974. // And a colored trail
  2975. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  2976. write_byte(TE_BEAMFOLLOW) // TE id
  2977. write_short(entity) // entity
  2978. write_short(g_trailSpr) // sprite
  2979. write_byte(10) // life
  2980. write_byte(10) // width
  2981. write_byte(0) // r
  2982. write_byte(100) // g
  2983. write_byte(200) // b
  2984. write_byte(200) // brightness
  2985. message_end()
  2986.  
  2987. // Set grenade type on the thrown grenade entity
  2988. set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FROST)
  2989. }
  2990. else if (equal(model[7], "w_sm", 4) && get_pcvar_num(cvar_flaregrenades)) // aca especifica en que granada entraran, por ejemplo: Hegren, Flash, Smokegren / con una cvar de activacion o desactivacion
  2991. {
  2992. if(!g_zombie[pev(entity, pev_owner)] && g_bubble_bomb[pev(entity, pev_owner)]) // aca determinamos que la bomba es solo para humanos.
  2993. {
  2994. fm_set_rendering(entity, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 16) // aca determinamos el color de glow de la granada.
  2995. message_begin(MSG_BROADCAST, SVC_TEMPENTITY) // ni idea.
  2996. write_byte(TE_BEAMFOLLOW) // aca determinamos que es un trail la entidad
  2997. write_short(entity) // declaramos que es una entidad
  2998. write_short(g_trailSpr) // el sprite correspondiente al trail.
  2999. write_byte(10) // life. ( nose que es )
  3000. write_byte(10) // width: esto quiere decir el ancho del trail
  3001. write_byte(255) // red: color rojo
  3002. write_byte(255) // green: color verde
  3003. write_byte(255) // blue: color azul
  3004. write_byte(500) // brightness: brillo
  3005. message_end()
  3006.  
  3007. set_pev(entity, pev_flTimeStepSound, NADE_TYPE_CAMPO) // tipo de bomba ( NADE_TYPE_CAMPO )
  3008.  
  3009. entity_set_model(entity, w_model) // llamamos al model de la granada en el piso "w_".
  3010. }
  3011. else
  3012. {
  3013. // Make the flare color
  3014. static rgb[3]
  3015. switch (get_pcvar_num(cvar_flarecolor))
  3016. {
  3017. case 0: // white
  3018. {
  3019. rgb[0] = 255 // red: rojo
  3020. rgb[1] = 255 // green: verde
  3021. rgb[2] = 255 // blue: azul
  3022. }
  3023. case 1: // red
  3024. {
  3025. rgb[0] = random_num(50,255) // rer: rojo con un random_num, eso quiere decir que saldra desde el 50 al 255
  3026. rgb[1] = 0 // green: verde
  3027. rgb[2] = 0 // blue: azul
  3028. }
  3029. case 2: // green
  3030. {
  3031. rgb[0] = 0 // red: rojo
  3032. rgb[1] = random_num(50,255) // green: verde con un random_num, eso quiere decir que saldra desde el 50 al 255
  3033. rgb[2] = 0 // blue: azul
  3034. }
  3035. case 3: // blue
  3036. {
  3037. rgb[0] = 0 // red: rojo
  3038. rgb[1] = 0 // green: verde
  3039. rgb[2] = random_num(50,255) // blue: azul con un random_num, eso quiere decir que saldra desde el 50 al 255
  3040. }
  3041. case 4: // random (all colors): quiere decir que pueden salir varios colores por que los combina
  3042. {
  3043. rgb[0] = random_num(50,200) // red: rojo con un random_num, eso quiere decir que saldra desde el 50 al 255
  3044. rgb[1] = random_num(50,200) // green: verde con un random_num, eso quiere decir que saldra desde el 50 al 255
  3045. rgb[2] = random_num(50,200) // blue: azul con un random_num, eso quiere decir que saldra desde el 50 al 255
  3046. }
  3047. case 5: // random (r,g,b): al azar entre rojo, verde, azul
  3048. {
  3049. switch (random_num(1, 3))
  3050. {
  3051. case 1: // red
  3052. {
  3053. rgb[0] = random_num(50,255) // red: rojo con un random_num, eso quiere decir que saldra desde el 50 al 255
  3054. rgb[1] = 0 // green: verde
  3055. rgb[2] = 0 // blue: azul
  3056. }
  3057. case 2: // green
  3058. {
  3059. rgb[0] = 0 // red: rojo
  3060. rgb[1] = random_num(50,255) // green: verde con un random_num, eso quiere decir que saldra desde el 50 al 255
  3061. rgb[2] = 0 // blue: azul
  3062. }
  3063. case 3: // blue
  3064. {
  3065. rgb[0] = 0 // red: rojo
  3066. rgb[1] = 0 // green: verde
  3067. rgb[2] = random_num(50,255) // blue: azul con un random_num, eso quiere decir que saldra desde el 50 al 255
  3068. }
  3069. }
  3070. }
  3071. }
  3072.  
  3073. // Give it a glow / toma el glow color, si la bomba fuese de color rojo, el glow de la grana sera rojo...
  3074. fm_set_rendering(entity, kRenderFxGlowShell, rgb[0], rgb[1], rgb[2], kRenderNormal, 16);
  3075.  
  3076. // And a colored trail / le damos un trail
  3077. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  3078. write_byte(TE_BEAMFOLLOW) // entidad del trail
  3079. write_short(entity) // decimos que es una entidad
  3080. write_short(g_trailSpr) // sprite correspondiente al trail
  3081. write_byte(10) // life ( nose que es )
  3082. write_byte(10) // width: ancho del trail
  3083. write_byte(rgb[0]) // red: rojo -- depende de que color sea la bomba (rgb[0] = 1)
  3084. write_byte(rgb[1]) // green: verde -- depende de que color sea la bomba (rgb[1] = 2)
  3085. write_byte(rgb[2]) // blue: azul -- depende de que color sea la bomba (rgb[2] = 3)
  3086. write_byte(200) // brightness: brillo del trail
  3087. message_end() // terminamos la entidad
  3088.  
  3089. // Set grenade type on the thrown grenade entity
  3090. set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FLARE) // tipo de granada ( flare bomb )
  3091.  
  3092. // Set flare color on the thrown grenade entity
  3093. set_pev(entity, PEV_FLARE_COLOR, rgb) // Establecer color bengala en la entidad granada lanzada
  3094. }
  3095. }
  3096. }
  3097. // Ham Grenade Think Forward
  3098. public fw_ThinkGrenade(entity)
  3099. {
  3100. // Invalid entity
  3101. if (!pev_valid(entity)) return FMRES_IGNORED;
  3102.  
  3103. // Get damage time of grenade
  3104. static Float:dmgtime
  3105. pev(entity, pev_dmgtime, dmgtime)
  3106.  
  3107. // Check if it's time to go off
  3108. if (dmgtime > get_gametime())
  3109. return HAM_IGNORED;
  3110.  
  3111. // Check if it's one of our custom nades
  3112. switch (pev(entity, PEV_NADE_TYPE))
  3113. {
  3114. case NADE_TYPE_INFECTION: // Infection Bomb
  3115. {
  3116. infection_explode(entity)
  3117. }
  3118. case NADE_TYPE_NAPALM: // Napalm Grenade
  3119. {
  3120. fire_explode(entity)
  3121. }
  3122. case NADE_TYPE_FROST: // Frost Grenade
  3123. {
  3124. frost_explode(entity)
  3125. }
  3126. case NADE_TYPE_CAMPO:
  3127. {
  3128. bubble_explode(entity)
  3129. return HAM_SUPERCEDE;
  3130. }
  3131. case NADE_TYPE_FLARE: // Flare
  3132. {
  3133. // Light up when it's stopped on ground
  3134. if ((pev(entity, pev_flags) & FL_ONGROUND) && fm_get_speed(entity) < 10)
  3135. {
  3136. // Flare sound
  3137. engfunc(EngFunc_EmitSound, entity, CHAN_WEAPON, grenade_flare[random_num(0, sizeof grenade_flare - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  3138.  
  3139. // Our task params
  3140. static params[5]
  3141. params[0] = entity // entity id
  3142. params[1] = get_pcvar_num(cvar_flareduration)/5 // duration
  3143.  
  3144. // Retrieve flare color from entity
  3145. pev(entity, PEV_FLARE_COLOR, params[2]) // params[2] r - params[3] g - params[4] b
  3146.  
  3147. // Call our lighting task
  3148. set_task(0.1, "flare_lighting", TASK_NADES, params, sizeof params)
  3149. }
  3150. else
  3151. {
  3152. // Delay the explosion until we hit ground
  3153. set_pev(entity, pev_dmgtime, get_gametime() + 0.5)
  3154. return HAM_IGNORED;
  3155. }
  3156. }
  3157. default: return HAM_IGNORED;
  3158. }
  3159.  
  3160. return HAM_SUPERCEDE;
  3161. }
  3162.  
  3163. // Forward Player PreThink
  3164. public fw_PlayerPreThink(id)
  3165. {
  3166. // Not alive
  3167. if (!is_user_alive(id))
  3168. return;
  3169.  
  3170. // Silent footsteps for zombies?
  3171. if (g_zombie[id] && !g_nemesis[id] && get_pcvar_num(cvar_zombiesilent))
  3172. set_pev(id, pev_flTimeStepSound, STEPTIME_SILENT)
  3173.  
  3174. // Set Player MaxSpeed
  3175. if (g_frozen[id])
  3176. {
  3177. set_pev(id, pev_velocity, Float:{0.0,0.0,0.0}) // stop motion
  3178. set_pev(id, pev_maxspeed, 1.0) // prevent from moving
  3179. }
  3180. else if (!g_freezetime)
  3181. {
  3182. if (g_zombie[id])
  3183. {
  3184. if (g_nemesis[id])
  3185. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_nemspd))
  3186. else
  3187. set_pev(id, pev_maxspeed, float(g_zclass_spd[g_zombieclass[id]] + Z_SPEED(g_skill_points[id][1][2])))
  3188. }
  3189. else
  3190. {
  3191. if (g_survivor[id])
  3192. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_survspd))
  3193. else
  3194. set_pev(id, pev_maxspeed, float(g_hclass_spd[g_humanclass[id]] + H_SPEED(g_skill_points[id][0][2])))
  3195. }
  3196. }
  3197.  
  3198. // Should Leap?
  3199. if (allowed_leap(id))
  3200. {
  3201. // Get force and height cvars
  3202. static force, height, Float:velocity[3]
  3203. force = g_survivor[id] ? get_pcvar_num(cvar_leapsurvivorforce) : g_nemesis[id] ? get_pcvar_num(cvar_leapnemesisforce) : get_pcvar_num(cvar_leapzombiesforce)
  3204. height = g_survivor[id] ? get_pcvar_num(cvar_leapsurvivorheight) : g_nemesis[id] ? get_pcvar_num(cvar_leapnemesisheight) : get_pcvar_num(cvar_leapzombiesheight)
  3205.  
  3206. // Make velocity vector
  3207. velocity_by_aim(id, force, velocity)
  3208.  
  3209. // Set custom height
  3210. velocity[2] = float(height)
  3211.  
  3212. // Apply the new velocity
  3213. set_pev(id, pev_velocity, velocity)
  3214.  
  3215. // Set the current leap time
  3216. g_lastleaptime[id] = get_gametime()
  3217. }
  3218.  
  3219. // Should be Pain Shock Free?
  3220. if (allowed_painshockfree(id))
  3221. {
  3222. // Remember his velocity
  3223. pev(id, pev_velocity, g_velocity[id])
  3224. g_restorevel[id] = true
  3225. }
  3226. }
  3227.  
  3228. // Forward Player PreThink Post
  3229. public fw_PlayerPreThink_Post(id)
  3230. {
  3231. // Pain Shock Free: need to restore velocity?
  3232. if (!g_restorevel[id])
  3233. return FMRES_IGNORED;
  3234.  
  3235. g_restorevel[id] = false
  3236.  
  3237. // Not alive
  3238. if (!is_user_alive(id))
  3239. return FMRES_IGNORED;
  3240.  
  3241. // Driving a vehicle
  3242. if (pev(id, pev_flags) & FL_ONTRAIN)
  3243. return FMRES_IGNORED;
  3244.  
  3245. // NOTE: within DLL PlayerPreThink Jump() function is called;
  3246. // there is a conveyor velocity addiction we should care of
  3247. static groundent
  3248. groundent = pev(id, pev_groundentity)
  3249.  
  3250. if (pev_valid(groundent) && (pev(groundent, pev_flags) & FL_CONVEYOR))
  3251. {
  3252. // Add pev_basevelocity to our stored velocity
  3253. static Float:tempvel[3]
  3254. pev(id, pev_basevelocity, tempvel)
  3255. xs_vec_add(g_velocity[id], tempvel, g_velocity[id])
  3256. }
  3257.  
  3258. // Restore previous velocity
  3259. set_pev(id, pev_velocity, g_velocity[id])
  3260. return FMRES_HANDLED;
  3261. }
  3262.  
  3263. /*================================================================================
  3264. [Client Commands]
  3265. =================================================================================*/
  3266.  
  3267. // Say "/zpmenu"
  3268. public clcmd_saymenu(id)
  3269. {
  3270. show_menu_game(id) // show game menu
  3271. }
  3272.  
  3273. // Say "/unstuck"
  3274. public clcmd_sayunstuck(id)
  3275. {
  3276. menu_game(id, 3) // try to get unstuck
  3277. }
  3278.  
  3279. // Nightvision toggle
  3280. public clcmd_nightvision(id)
  3281. {
  3282. if (g_nvision[id])
  3283. {
  3284. // Enable-disable
  3285. g_nvisionenabled[id] = !(g_nvisionenabled[id])
  3286.  
  3287. // Custom nvg?
  3288. if (get_pcvar_num(cvar_cnvg))
  3289. {
  3290. remove_task(id+TASK_NVISION);
  3291. set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
  3292. }
  3293. else
  3294. set_user_gnvision(id, g_nvisionenabled[id])
  3295. }
  3296.  
  3297. return PLUGIN_HANDLED;
  3298. }
  3299.  
  3300. // Weapon Drop
  3301. public clcmd_drop(id)
  3302. {
  3303. // Survivor should stick with M249
  3304. if (g_survivor[id])
  3305. return PLUGIN_HANDLED;
  3306.  
  3307. return PLUGIN_CONTINUE;
  3308. }
  3309.  
  3310. // Buy BP Ammo
  3311. public clcmd_buyammo(id)
  3312. {
  3313. // Not alive or infinite ammo setting enabled
  3314. if (get_pcvar_num(cvar_infammo) || !is_user_alive(id))
  3315. return PLUGIN_HANDLED;
  3316.  
  3317. // Not human
  3318. if (g_zombie[id])
  3319. {
  3320. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_HUMAN_ONLY")
  3321. return PLUGIN_HANDLED;
  3322. }
  3323.  
  3324. // Not enough ammo packs
  3325. if (g_ammopacks[id] < 1)
  3326. {
  3327. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "NOT_ENOUGH_AMMO")
  3328. return PLUGIN_HANDLED;
  3329. }
  3330.  
  3331. // Get user weapons
  3332. static weapons[32], num, i, currentammo, weaponid, refilled
  3333. num = 0 // reset passed weapons count (bugfix)
  3334. refilled = false
  3335. get_user_weapons(id, weapons, num)
  3336.  
  3337. // Loop through them and give the right ammo type
  3338. for (i = 0; i < num; i++)
  3339. {
  3340. // Prevents re-indexing the array
  3341. weaponid = weapons[i]
  3342.  
  3343. // Primary and secondary only
  3344. if (MAXBPAMMO[weaponid] > 2)
  3345. {
  3346. // Get current ammo of the weapon
  3347. currentammo = fm_get_user_bpammo(id, weaponid)
  3348.  
  3349. // Check if we are close to the BP ammo limit
  3350. if (currentammo < MAXBPAMMO[weaponid]-BUYAMMO[weaponid])
  3351. {
  3352. // Flash ammo in hud
  3353. message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
  3354. write_byte(AMMOID[weaponid]) // ammo id
  3355. write_byte(BUYAMMO[weaponid]) // ammo amount
  3356. message_end()
  3357.  
  3358. // Increase BP ammo
  3359. fm_set_user_bpammo(id, weaponid, currentammo + BUYAMMO[weaponid])
  3360.  
  3361. refilled = true
  3362. }
  3363. else if (currentammo < MAXBPAMMO[weaponid])
  3364. {
  3365. // Flash ammo in hud
  3366. message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
  3367. write_byte(AMMOID[weaponid]) // ammo id
  3368. write_byte(MAXBPAMMO[weaponid]-currentammo) // ammo amount
  3369. message_end()
  3370.  
  3371. // Reached the limit
  3372. fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
  3373.  
  3374. refilled = true
  3375. }
  3376. }
  3377. }
  3378.  
  3379. // Weapons already have full ammo
  3380. if (!refilled) return PLUGIN_HANDLED;
  3381.  
  3382. // Deduce ammo packs, play clip purchase sound, and notify the player
  3383. update_ap(id, -1, 0)
  3384. engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  3385. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "AMMO_BOUGHT")
  3386.  
  3387. return PLUGIN_HANDLED;
  3388. }
  3389.  
  3390. // Block Team Change
  3391. public clcmd_changeteam(id)
  3392. {
  3393. static team
  3394. team = fm_get_user_team(id)
  3395.  
  3396. if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
  3397. return PLUGIN_CONTINUE;
  3398.  
  3399. if (g_estado[id] != ONLINE)
  3400. return PLUGIN_CONTINUE;
  3401.  
  3402. show_menu_game(id)
  3403. return PLUGIN_HANDLED;
  3404. }
  3405.  
  3406. // Block changeteam
  3407. public clcmd_jointeam(id)
  3408. {
  3409. if(g_estado[id] == ONLINE)
  3410. return PLUGIN_CONTINUE;
  3411.  
  3412. show_menu_registro(id)
  3413. return PLUGIN_HANDLED;
  3414. }
  3415.  
  3416.  
  3417. /*================================================================================
  3418. [Menus]
  3419. =================================================================================*/
  3420.  
  3421. // Game Menu
  3422. show_menu_game(id)
  3423. {
  3424. static menu[200], len
  3425. len = 0
  3426.  
  3427. // Title
  3428. len += formatex(menu[len], sizeof menu - 1 - len, "\y%s^n^n", g_modname)
  3429.  
  3430. // 1. Buy weapons
  3431. if (get_pcvar_num(cvar_buycustom))
  3432. len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\w %L^n", id, "MENU_BUY")
  3433. else
  3434. len += formatex(menu[len], sizeof menu - 1 - len, "\d1. %L^n", id, "MENU_BUY")
  3435.  
  3436. // 2. Extra items
  3437. if (!g_survivor[id] && !g_nemesis[id] && get_pcvar_num(cvar_extraitems) && is_user_alive(id))
  3438. len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\w %L^n", id, "MENU_EXTRABUY")
  3439. else
  3440. len += formatex(menu[len], sizeof menu - 1 - len, "\d2. %L^n", id, "MENU_EXTRABUY")
  3441.  
  3442. // 3. Zombie class || Human class
  3443. if (g_zombie[id])
  3444. len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w %L^n", id,"MENU_ZCLASS")
  3445. else
  3446. len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w %L^n", id,"MENU_HCLASS")
  3447.  
  3448. // 4. Unstuck
  3449. if (is_user_alive(id))
  3450. len += formatex(menu[len], sizeof menu - 1 - len, "\r4.\w %L^n", id, "MENU_UNSTUCK")
  3451. else
  3452. len += formatex(menu[len], sizeof menu - 1 - len, "\d4. %L^n", id, "MENU_UNSTUCK")
  3453.  
  3454. // 5. Help and join spec
  3455. len += formatex(menu[len], sizeof menu - 1 - len, "\r5.\w %L^n", id, "MENU_SPECTATOR")
  3456.  
  3457. // 6. Reset
  3458. len += formatex(menu[len], charsmax(menu) - len, "^n\r6.\r Configuracion^n")
  3459.  
  3460. // 8. Habilidades
  3461. len += formatex(menu[len], sizeof menu - 1 - len, "\r7.\w Habilidades^n^n")
  3462.  
  3463. // 9. Admin menu
  3464. if (get_user_flags(id) & ACCESS_FLAG)
  3465. len += formatex(menu[len], sizeof menu - 1 - len, "\r9.\w %L", id, "MENU_ADMIN")
  3466. else
  3467. len += formatex(menu[len], sizeof menu - 1 - len, "\d9. %L", id, "MENU_ADMIN")
  3468.  
  3469. // 0. Exit
  3470. len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
  3471.  
  3472. show_menu(id, KEYSMENU, menu, -1, "Game Menu")
  3473. }
  3474.  
  3475. // Buy Menu 1
  3476. public show_menu_buy1(taskid)
  3477. {
  3478. // Get player id
  3479. static id
  3480. (taskid > g_maxplayers) ? (id = ID_SPAWN) : (id = taskid);
  3481.  
  3482. // Zombies or survivors get no guns
  3483. if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
  3484. return;
  3485.  
  3486. // Bots pick their weapons randomly
  3487. if (is_user_bot(id))
  3488. {
  3489. buy_primary_weapon(id, random_num(0, sizeof g_primary_items - 1))
  3490. menu_buy2(id, random_num(0, sizeof g_secondary_items - 1))
  3491. return;
  3492. }
  3493.  
  3494. // Automatic selection enabled for player and menu called on spawn event
  3495. if (WPN_AUTO_ON && taskid > g_maxplayers)
  3496. {
  3497. buy_primary_weapon(id, WPN_AUTO_PRI)
  3498. menu_buy2(id, WPN_AUTO_SEC)
  3499. return;
  3500. }
  3501.  
  3502. static menu[999], len, weap
  3503. len = 0
  3504.  
  3505. // Title
  3506. len += formatex(menu[len], sizeof menu - 1 - len, "\y%L \r[%d-%d]^n^n", id, "MENU_BUY1_TITLE", WPN_STARTID+1, min(WPN_STARTID+7, WPN_MAXIDS))
  3507.  
  3508. // 1-7. Weapon List
  3509. for (weap = WPN_STARTID; weap < min(WPN_STARTID+7, WPN_MAXIDS); weap++)
  3510. if (g_level[id] >= lvlarmas[weap] && g_reset[id] >= resetarmas[weap])
  3511. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", weap-WPN_STARTID+1, ArmasName[weap])
  3512. else
  3513. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\d %s\d (\rLevel %d\d) (\rReset %d\d)^n", weap-WPN_STARTID+1, ArmasName[weap], lvlarmas[weap], resetarmas[weap])
  3514.  
  3515. // 8. Auto Select
  3516. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r8.\w %L \y[%L]", id, "MENU_AUTOSELECT", id, (WPN_AUTO_ON) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  3517.  
  3518. // 9. Next/Back - 0. Exit
  3519. len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r9.\w %L/%L^n^n\r0.\w %L", id, "MENU_NEXT", id, "MENU_BACK", id, "MENU_EXIT")
  3520.  
  3521. show_menu(id, KEYSMENU, menu, -1, "Buy Menu 1")
  3522. }
  3523.  
  3524. // Buy Menu 2
  3525. show_menu_buy2(id)
  3526. {
  3527. static menu[250], len, weap
  3528. len = 0
  3529.  
  3530. // Title
  3531. len += formatex(menu[len], sizeof menu - 1 - len, "\y%L^n", id, "MENU_BUY2_TITLE")
  3532.  
  3533. // 1-6. Weapon List
  3534. for (weap = 0; weap < sizeof g_secondary_items; weap++)
  3535. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r%d.\w %s", weap+1, WEAPONNAMES[get_weaponid(g_secondary_items[weap])])
  3536.  
  3537. // 8. Auto Select
  3538. len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r8.\w %L \y[%L]", id, "MENU_AUTOSELECT", id, (WPN_AUTO_ON) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  3539.  
  3540. // 0. Exit
  3541. len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
  3542.  
  3543. show_menu(id, KEYSMENU, menu, -1, "Buy Menu 2")
  3544. }
  3545.  
  3546. // Extra Items Menu
  3547. show_menu_extras(id)
  3548. {
  3549. static menu[400], len, item
  3550. len = 0
  3551.  
  3552. // Title
  3553. len += formatex(menu[len], sizeof menu - 1 - len, "\y%L [%L] \r[%d-%d]^n^n", id, "MENU_EXTRA_TITLE", id, (g_zombie[id]) ? "CLASS_ZOMBIE" : "CLASS_HUMAN", EXTRAS_STARTID+1, min(EXTRAS_STARTID+7, g_extraitem_i))
  3554.  
  3555. // 1-7. Item List
  3556. for (item = EXTRAS_STARTID; item < min(EXTRAS_STARTID+7, g_extraitem_i); item++)
  3557. {
  3558. // Unavailable item
  3559. if ((g_zombie[id] && g_extraitem_team[item] == ZP_TEAM_HUMAN) || (!g_zombie[id] && g_extraitem_team[item] == ZP_TEAM_ZOMBIE) || (item == EXTRA_NVISION && !get_pcvar_num(cvar_extranvision)) || (item == EXTRA_ANTIDOTE && !get_pcvar_num(cvar_extraantidote)) || (item == EXTRA_MADNESS && !get_pcvar_num(cvar_extramadness)) || (item == EXTRA_INFBOMB && !get_pcvar_num(cvar_extrainfbomb)) || (item >= 4 && item <= EXTRAS_CUSTOM_STARTID-1 && !get_pcvar_num(cvar_extraweapons)))
  3560. {
  3561. // Check if it's one of the hardcoded items and set the correct caption
  3562. switch (item)
  3563. {
  3564. case EXTRA_NVISION: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA1")
  3565. case EXTRA_ANTIDOTE: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA2")
  3566. case EXTRA_MADNESS: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA3")
  3567. case EXTRA_INFBOMB: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA4")
  3568. default: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s", item-EXTRAS_STARTID+1, g_extraitem_name[item])
  3569. }
  3570. // Item Cost
  3571. len += formatex(menu[len], sizeof menu - 1 - len, " %d Ammopacks^n", g_extraitem_cost[item] * g_level[id])
  3572. }
  3573. else
  3574. {
  3575. // Check if it's one of the hardcoded items and set the correct caption
  3576. switch (item)
  3577. {
  3578. case EXTRA_NVISION: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA1")
  3579. case EXTRA_ANTIDOTE: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA2")
  3580. case EXTRA_MADNESS: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA3")
  3581. case EXTRA_INFBOMB: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA4")
  3582. default: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s", item-EXTRAS_STARTID+1, g_extraitem_name[item])
  3583. }
  3584. // Item Cost
  3585. len += formatex(menu[len], sizeof menu - 1 - len, " %d Ammopacks^n", g_extraitem_cost[item] * g_level[id])
  3586. }
  3587. }
  3588.  
  3589. // 8. Back - 9. Next - 0. Exit
  3590. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r8.\w %L^n\r9.\w %L^n^n\r0.\w %L", id, "MENU_BACK", id, "MENU_NEXT", id, "MENU_EXIT")
  3591.  
  3592. show_menu(id, KEYSMENU, menu, -1, "Extra Items")
  3593. }
  3594.  
  3595. // Zombie Class Menu
  3596. public show_menu_zclass(id)
  3597. {
  3598. // Player disconnected
  3599. if (!is_user_connected(id))
  3600. return;
  3601.  
  3602. // Bots pick their zombie class randomly
  3603. if (is_user_bot(id))
  3604. {
  3605. g_zombieclassnext[id] = random_num(0, g_zclass_i - 1)
  3606. return;
  3607. }
  3608.  
  3609. static menu[999], len, class
  3610. len = 0
  3611.  
  3612. // Title
  3613. len += formatex(menu[len], sizeof menu - 1 - len, "\y%L \r[%d-%d]^n^n", id, "MENU_ZCLASS_TITLE", ZCLASSES_STARTID+1, min(ZCLASSES_STARTID+6, g_zclass_i))
  3614.  
  3615. // 1-7. Class List
  3616. for (class = ZCLASSES_STARTID; class < min(ZCLASSES_STARTID+6, g_zclass_i); class++)
  3617. {
  3618. if (g_level[id] >= g_zclass_lvl[class])
  3619. {
  3620. if (class == g_zombieclassnext[id])
  3621. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s %s^n", class-ZCLASSES_STARTID+1, g_zclass_name[class], g_zclass_info[class])
  3622. else
  3623. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s\y %s^n", class-ZCLASSES_STARTID+1, g_zclass_name[class], g_zclass_info[class])
  3624. }
  3625. else
  3626. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\d %s %s\r (Level: %d)^n", class-ZCLASSES_STARTID+1, g_zclass_name[class], g_zclass_info[class], g_zclass_lvl[class])
  3627. }
  3628.  
  3629. // 8. Back - 9. Next - 0. Exit
  3630. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r8.\w %L^n\r9.\w %L^n^n\r0.\w %L", id, "MENU_BACK", id, "MENU_NEXT", id, "MENU_EXIT")
  3631.  
  3632. show_menu(id, KEYSMENU, menu, -1, "Zombie Class Menu")
  3633. }
  3634.  
  3635. // Human Class Menu
  3636. public show_menu_hclass(id)
  3637. {
  3638. // Player disconnected
  3639. if (!is_user_connected(id))
  3640. return;
  3641.  
  3642. // Bots pick their zombie class randomly
  3643. if (is_user_bot(id))
  3644. {
  3645. g_humanclassnext[id] = random_num(0, g_hclass_i - 1)
  3646. return;
  3647. }
  3648.  
  3649. static menu[999], len, class
  3650. len = 0
  3651.  
  3652. // Title
  3653. len += formatex(menu[len], sizeof menu - 1 - len, "\y%L \r[%d-%d]^n^n", id, "MENU_HCLASS_TITLE", HCLASSES_STARTID+1, min(HCLASSES_STARTID+6, g_hclass_i))
  3654.  
  3655. // 1-7. Class List
  3656. for (class = HCLASSES_STARTID; class < min(HCLASSES_STARTID+6, g_hclass_i); class++)
  3657. {
  3658. if (g_level[id] >= g_hclass_lvl[class])
  3659. {
  3660. if (class == g_humanclassnext[id])
  3661. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s %s^n", class-HCLASSES_STARTID+1, g_hclass_name[class], g_hclass_info[class])
  3662. else
  3663. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s\y %s^n", class-HCLASSES_STARTID+1, g_hclass_name[class], g_hclass_info[class])
  3664. }
  3665. else
  3666. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\d %s %s\r (Level: %d)^n", class-HCLASSES_STARTID+1, g_hclass_name[class], g_hclass_info[class], g_hclass_lvl[class])
  3667. }
  3668.  
  3669. // 8. Back - 9. Next - 0. Exit
  3670. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r8.\w %L^n\r9.\w %L^n^n\r0.\w %L", id, "MENU_BACK", id, "MENU_NEXT", id, "MENU_EXIT")
  3671.  
  3672. show_menu(id, KEYSMENU, menu, -1, "Human Class Menu")
  3673. }
  3674.  
  3675. // Help Menu
  3676. public show_menu_info(id)
  3677. {
  3678. // Player disconnected
  3679. if (!is_user_connected(id))
  3680. return;
  3681.  
  3682. static menu[150]
  3683.  
  3684. formatex(menu, sizeof menu - 1, "\y%L^n^n\r1.\w %L^n\r2.\w %L^n\r3.\w %L^n\r4.\w %L^n^n\r0.\w %L", id, "MENU_INFO_TITLE", id, "MENU_INFO1", id,"MENU_INFO2", id,"MENU_INFO3", id,"MENU_INFO4", id, "MENU_EXIT")
  3685. show_menu(id, KEYSMENU, menu, -1, "Mod Info")
  3686. }
  3687.  
  3688. // Reset Menu
  3689. public show_menu_reset(id)
  3690. {
  3691. static menu[800], len, lvl
  3692. lvl = 1000 - g_level[id]
  3693. len = 0
  3694.  
  3695. len += formatex(menu[len], charsmax(menu) - len, "\y%L^n^n\r- \rRequisitos^n\y- Nivel:\w1000^n\r- Beneficios:^n\y- Humanos: \wVida, Daño y Amadura^n\y- Zombie: \wVida y Velocidad^n^n", id, "MENU_RESET_TITLE") // otra vez lo del lang
  3696.  
  3697. if (g_level[id] >= 1000)
  3698. len += formatex(menu[len], charsmax(menu) - len, "\r1.\w Resetear Personaje^n^n^n^n")
  3699.  
  3700. else
  3701. len += formatex(menu[len], charsmax(menu) - len, "\r1.\d Resetear Personaje - Te Faltan %d levels^n^n^n^n", lvl)
  3702.  
  3703.  
  3704. len += formatex(menu[len], charsmax(menu) - len, "\r0.\w %L", id, "MENU_EXIT")
  3705.  
  3706.  
  3707. show_menu(id, KEYSMENU, menu, -1, "Menu Reset")
  3708. }
  3709.  
  3710.  
  3711. // Admin Menu
  3712. show_menu_admin(id)
  3713. {
  3714. static menu[250], len
  3715. len = 0
  3716.  
  3717. // Title
  3718. len += formatex(menu[len], sizeof menu - 1 - len, "\y%L^n^n", id, "MENU_ADMIN_TITLE")
  3719.  
  3720. // 1. Zombiefy/Humanize command
  3721. if (!g_endround && !task_exists(TASK_WELCOMEMSG) && !g_swarmround && !g_nemround && !g_survround && !g_plagueround)
  3722. len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\w %L^n", id, "MENU_ADMIN1")
  3723. else
  3724. len += formatex(menu[len], sizeof menu - 1 - len, "\d1. %L^n", id, "MENU_ADMIN1")
  3725. // 2. Nemesis command
  3726. if (g_newround && !g_endround && get_pcvar_num(cvar_nem) && !task_exists(TASK_WELCOMEMSG))
  3727. len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\w %L^n", id, "MENU_ADMIN2")
  3728. else
  3729. len += formatex(menu[len], sizeof menu - 1 - len, "\d2. %L^n", id, "MENU_ADMIN2")
  3730.  
  3731. // 3. Survivor command
  3732. if (g_newround && !g_endround && get_pcvar_num(cvar_surv) && !task_exists(TASK_WELCOMEMSG))
  3733. len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w %L^n", id, "MENU_ADMIN3")
  3734. else
  3735. len += formatex(menu[len], sizeof menu - 1 - len, "\d3. %L^n", id, "MENU_ADMIN3")
  3736.  
  3737. // 4. Respawn command
  3738. if (!g_endround && !g_survround && !g_swarmround && !g_nemround && !g_plagueround)
  3739. len += formatex(menu[len], sizeof menu - 1 - len, "\r4.\w %L^n", id, "MENU_ADMIN4")
  3740. else
  3741. len += formatex(menu[len], sizeof menu - 1 - len, "\d4. %L^n", id, "MENU_ADMIN4")
  3742.  
  3743. // 5. Swarm mode command
  3744. if (allowed_swarm())
  3745. len += formatex(menu[len], sizeof menu - 1 - len, "\r5.\w %L^n", id, "MENU_ADMIN5")
  3746. else
  3747. len += formatex(menu[len], sizeof menu - 1 - len, "\d5. %L^n", id, "MENU_ADMIN5")
  3748.  
  3749. // 6. Multi infection command
  3750. if (allowed_multi())
  3751. len += formatex(menu[len], sizeof menu - 1 - len, "\r6.\w %L^n", id, "MENU_ADMIN6")
  3752. else
  3753. len += formatex(menu[len], sizeof menu - 1 - len, "\d6. %L^n", id, "MENU_ADMIN6")
  3754.  
  3755. // 7. Plague mode command
  3756. if (allowed_plague())
  3757. len += formatex(menu[len], sizeof menu - 1 - len, "\r7.\w %L^n", id, "MENU_ADMIN7")
  3758. else
  3759. len += formatex(menu[len], sizeof menu - 1 - len, "\d7. %L^n", id, "MENU_ADMIN7")
  3760.  
  3761. // 8. Armagedon mode command
  3762. if (allowed_swarm())
  3763. len += formatex(menu[len], sizeof menu - 1 - len, "\r8.\w %L^n", id, "MENU_ADMIN8")
  3764. else
  3765. len += formatex(menu[len], sizeof menu - 1 - len, "\d8. %L^n", id, "MENU_ADMIN8")
  3766.  
  3767. // 0. Exit
  3768. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r0.\w %L", id, "MENU_EXIT")
  3769.  
  3770. show_menu(id, KEYSMENU, menu, -1, "Admin Menu")
  3771. }
  3772.  
  3773. // Player List Menu
  3774. show_menu_player_list(id)
  3775. {
  3776. static menu[400], len, player, name[32]
  3777. len = 0
  3778.  
  3779. // Title
  3780. switch (PL_ACTION)
  3781. {
  3782. case 0: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN1")
  3783. case 1: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN2")
  3784. case 2: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN3")
  3785. case 3: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN4")
  3786. }
  3787. len += formatex(menu[len], sizeof menu - 1 - len, "\r[%d-%d]^n^n", PL_STARTID+1, min(PL_STARTID+7, g_maxplayers))
  3788.  
  3789. // 1-7. player list
  3790. for (player = PL_STARTID+1; player <= min(PL_STARTID+7, g_maxplayers); player++)
  3791. {
  3792. if (is_user_connected(player)) // check if it's connected
  3793. {
  3794. // Get player's name
  3795. get_user_name(player, name, sizeof name - 1)
  3796.  
  3797. // Format text depending on the action to take
  3798. switch (PL_ACTION)
  3799. {
  3800. case 0:
  3801. {
  3802. if (g_zombie[player])
  3803. {
  3804. if (allowed_human(player))
  3805. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s \r[%L]^n", player-PL_STARTID, name, id, "CLASS_ZOMBIE")
  3806. else
  3807. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s [%L]^n", player-PL_STARTID, name, id, "CLASS_ZOMBIE")
  3808. }
  3809. else
  3810. {
  3811. if (allowed_zombie(player))
  3812. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s \y[%L]^n", player-PL_STARTID, name, id, "CLASS_HUMAN")
  3813. else
  3814. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s [%L]^n", player-PL_STARTID, name, id, "CLASS_HUMAN")
  3815. }
  3816. }
  3817. case 1:
  3818. {
  3819. if (allowed_nemesis(player))
  3820. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", player-PL_STARTID, name)
  3821. else
  3822. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s^n", player-PL_STARTID, name)
  3823. }
  3824. case 2:
  3825. {
  3826. if (allowed_survivor(player))
  3827. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", player-PL_STARTID, name)
  3828. else
  3829. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s^n", player-PL_STARTID, name)
  3830. }
  3831. case 3:
  3832. {
  3833. if (allowed_respawn(player))
  3834. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", player-PL_STARTID, name)
  3835. else
  3836. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s^n", player-PL_STARTID, name)
  3837. }
  3838. }
  3839. }
  3840. else
  3841. {
  3842. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. -----^n", player-PL_STARTID)
  3843. }
  3844. }
  3845.  
  3846. // 8. Back - 9. Next - 0. Exit
  3847. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r8.\w %L^n\r9.\w %L^n^n\r0.\w %L", id, "MENU_BACK", id, "MENU_NEXT", id, "MENU_EXIT")
  3848.  
  3849. show_menu(id, KEYSMENU, menu, -1, "Player List Menu")
  3850. }
  3851.  
  3852. public show_menu_registro(id)
  3853. {
  3854. static menu[999], szData[512], len; len = 0
  3855.  
  3856. // Title
  3857. len += formatex(menu[len], sizeof menu - 1 - len, "\w|===================\y||\r|Guar|\y||\w==================|^n \r|Guar| \wZombie plague + Levels Editado por\y --\rSm0kE\y--\w^n|===================\y||\r|Guar|\y||\w==================|^n^n")
  3858.  
  3859. if (fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  3860. len += formatex(menu[len], sizeof menu - 1 - len, "\r-\y Bienvenido\w %s^n^n\yTu nombre ya esta en uso.^nPulsa\w Loguearse\y para entrar a jugar.^n^n", g_playername[id])
  3861. else
  3862. len += formatex(menu[len], sizeof menu - 1 - len, "\r-\y Bienvenido\w %s^n^n\yTu nombre no esta en uso.^nPulsa\w Registrarse\y para entrar a jugar.^n^n", g_playername[id])
  3863.  
  3864. // Option n°1
  3865. if (!fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  3866. len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\w Registrarse^n")
  3867. else
  3868. len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\d Registrarse^n")
  3869.  
  3870. // Option n°2
  3871. if (fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  3872. len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\w Loguearse^n")
  3873. else
  3874. len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\d Loguearse^n")
  3875.  
  3876. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r0.\w Salir")
  3877.  
  3878. show_menu(id, KEYSMENU, menu, -1, "Menu Register")
  3879. }
  3880.  
  3881. /*================================================================================
  3882. [Menu Handlers]
  3883. =================================================================================*/
  3884.  
  3885. // Game Menu
  3886. public menu_game(id, key)
  3887. {
  3888. switch (key)
  3889. {
  3890. case 0: // Buy Weapons
  3891. {
  3892. // Custom buy menus enabled?
  3893. if (get_pcvar_num(cvar_buycustom))
  3894. {
  3895. // Disable the remember selection setting
  3896. WPN_AUTO_ON = 0
  3897. zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"BUY_ENABLED")
  3898.  
  3899. // Show menu if player hasn't yet bought anything
  3900. if (g_canbuy[id]) show_menu_eleccion(id)
  3901. }
  3902. else
  3903. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  3904. }
  3905. case 1: // Extra Items
  3906. {
  3907. // Extra items enabled?
  3908. if (get_pcvar_num(cvar_extraitems))
  3909. {
  3910. // Check whether the player is able to buy anything
  3911. if (is_user_alive(id) && !g_survivor[id] && !g_nemesis[id])
  3912. show_menu_extras(id)
  3913. else
  3914. zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT")
  3915. }
  3916. else
  3917. zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT_EXTRAS")
  3918. }
  3919. case 2: // Zombie Classes || Human Classes
  3920. {
  3921. // Zombie classes enabled?
  3922. if (g_zombie[id])
  3923. show_menu_zclass(id)
  3924. else
  3925. show_menu_hclass(id)
  3926. }
  3927. case 3: // Unstuck
  3928. {
  3929. // Check if player is stuck
  3930. if (is_user_alive(id) && is_player_stuck(id))
  3931. {
  3932. // Spawn randomly / get back to base
  3933. if (get_pcvar_num(cvar_randspawn))
  3934. do_random_spawn(id)
  3935. else
  3936. dllfunc(DLLFunc_Spawn, id)
  3937. }
  3938. else
  3939. zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT_STUCK")
  3940. }
  3941. case 4: // Join Spectator
  3942. {
  3943. // If alive
  3944. if (is_user_alive(id))
  3945. {
  3946. // Check that we still have both humans and zombies to keep the round going
  3947. check_round(id)
  3948.  
  3949. // Kill him before he switches team
  3950. dllfunc(DLLFunc_ClientKill, id)
  3951. }
  3952.  
  3953. // Temporarily save player stats?
  3954. if (get_pcvar_num(cvar_statssave)) save_stats(id)
  3955.  
  3956. // Remove previous tasks
  3957. remove_task(id+TASK_TEAM)
  3958. remove_task(id+TASK_MODEL)
  3959. remove_task(id+TASK_FLASH)
  3960. remove_task(id+TASK_CHARGE)
  3961. remove_task(id+TASK_SPAWN)
  3962. remove_task(id+TASK_BLOOD)
  3963.  
  3964. fm_set_user_team(id, CS_TEAM_SPECTATOR)
  3965. fm_user_team_update(id)
  3966. }
  3967. case 5: menu_usuario(id);
  3968. case 6: menu_upgrade(id);
  3969. case 8:
  3970. {
  3971. if (get_user_flags(id) & ACCESS_FLAG)
  3972. show_menu_admin(id)
  3973. else
  3974. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_ACCESS")
  3975. }
  3976. }
  3977.  
  3978. return PLUGIN_HANDLED;
  3979. }
  3980.  
  3981. // Buy Menu 1
  3982. public menu_buy1(id, key)
  3983. {
  3984. // Zombies or survivors get no guns
  3985. if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
  3986. return PLUGIN_HANDLED;
  3987.  
  3988. // Special keys / weapon list exceeded
  3989. if (key >= MENU_KEY_AUTOSELECT || WPN_SELECTION >= WPN_MAXIDS)
  3990. {
  3991. switch (key)
  3992. {
  3993. case MENU_KEY_AUTOSELECT: // toggle auto select
  3994. {
  3995. WPN_AUTO_ON = 1 - WPN_AUTO_ON
  3996. }
  3997. case MENU_KEY_NEXT: // next/back
  3998. {
  3999. if (WPN_STARTID+7 < WPN_MAXIDS)
  4000. WPN_STARTID += 7
  4001. else
  4002. WPN_STARTID = 0
  4003. }
  4004. case MENU_KEY_EXIT: // exit
  4005. {
  4006. return PLUGIN_HANDLED;
  4007. }
  4008. }
  4009.  
  4010. // Show buy menu again
  4011. show_menu_buy1(id)
  4012. return PLUGIN_HANDLED;
  4013. }
  4014.  
  4015. if(g_level[id] >= lvlarmas[WPN_SELECTION] && g_reset[id] >= resetarmas[WPN_SELECTION])
  4016. {
  4017. // Store selected weapon id
  4018. WPN_AUTO_PRI = WPN_SELECTION
  4019.  
  4020. // Buy primary weapon
  4021. buy_primary_weapon(id, WPN_AUTO_PRI)
  4022.  
  4023. // Show pistols menu
  4024. show_menu_buy2(id)
  4025. }
  4026. else
  4027. show_menu_buy1(id)
  4028.  
  4029. return PLUGIN_HANDLED;
  4030. }
  4031.  
  4032. // Buy Primary Weapon
  4033. buy_primary_weapon(id, selection)
  4034. {
  4035. // Drop previous weapons
  4036. drop_weapons(id, 1)
  4037. drop_weapons(id, 2)
  4038.  
  4039. // Strip off from weapons
  4040. fm_strip_user_weapons(id)
  4041. fm_give_item(id, "weapon_knife")
  4042.  
  4043. // Get weapon index
  4044. static weaponid
  4045. weaponid = get_weaponid(g_primary_items[selection])
  4046.  
  4047. // Give the new weapon
  4048. fm_give_item(id, g_primary_items[selection])
  4049. fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
  4050.  
  4051. // Weapons bought
  4052. g_canbuy[id] = 0
  4053.  
  4054. }
  4055.  
  4056. // Buy Menu 2
  4057. public menu_buy2(id, key)
  4058. {
  4059. // Zombies or survivors get no guns
  4060. if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
  4061. return PLUGIN_HANDLED;
  4062.  
  4063. // Special keys / weapon list exceeded
  4064. if (key >= sizeof g_secondary_items)
  4065. {
  4066. // Toggle autoselect
  4067. if (key == MENU_KEY_AUTOSELECT)
  4068. WPN_AUTO_ON = 1 - WPN_AUTO_ON
  4069.  
  4070. // Reshow menu unless user exited
  4071. if (key != MENU_KEY_EXIT)
  4072. show_menu_buy2(id)
  4073.  
  4074. return PLUGIN_HANDLED;
  4075. }
  4076.  
  4077. // Store selected weapon
  4078. WPN_AUTO_SEC = key
  4079.  
  4080. // Drop secondary gun again, in case we picked another (bugfix)
  4081. drop_weapons(id, 2)
  4082.  
  4083. // Get weapon index
  4084. static weaponid
  4085. weaponid = get_weaponid(g_secondary_items[key])
  4086.  
  4087. // Give the new weapon with full ammo
  4088. fm_give_item(id, g_secondary_items[key])
  4089. fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
  4090.  
  4091. show_menu_granades(id)
  4092. if (g_humanclassnext[id] == HCLASS_NONE)
  4093. set_task(2.0, "show_menu_hclass", id)
  4094.  
  4095. return PLUGIN_HANDLED;
  4096. }
  4097.  
  4098. // Extra Items Menu
  4099. public menu_extras(id, key)
  4100. {
  4101. // Nemesis or Survivor shouldnt get extra items
  4102. if (g_survivor[id] || g_nemesis[id] || !is_user_alive(id))
  4103. {
  4104. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4105. return PLUGIN_HANDLED;
  4106. }
  4107.  
  4108. // Special keys / items list exceeded
  4109. if (key >= MENU_KEY_BACK || EXTRAS_SELECTION >= g_extraitem_i)
  4110. {
  4111. switch (key)
  4112. {
  4113. case MENU_KEY_BACK: // back
  4114. {
  4115. if (EXTRAS_STARTID-7 >= 0) EXTRAS_STARTID -= 7
  4116. }
  4117. case MENU_KEY_NEXT: // next
  4118. {
  4119. if (EXTRAS_STARTID+7 < g_extraitem_i) EXTRAS_STARTID += 7
  4120. }
  4121. case MENU_KEY_EXIT: // exit
  4122. {
  4123. return PLUGIN_HANDLED;
  4124. }
  4125. }
  4126.  
  4127. // Show extra items menu again
  4128. show_menu_extras(id)
  4129. return PLUGIN_HANDLED;
  4130. }
  4131.  
  4132. // Try to buy the item
  4133. buy_extra_item(id, EXTRAS_SELECTION);
  4134.  
  4135. return PLUGIN_HANDLED;
  4136. }
  4137.  
  4138. // Buy Extra Item
  4139. buy_extra_item(id, itemid)
  4140. {
  4141. // Check for human only items
  4142. if (g_zombie[id] && g_extraitem_team[itemid] == ZP_TEAM_HUMAN)
  4143. {
  4144. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_HUMAN_ONLY")
  4145. return;
  4146. }
  4147.  
  4148. // Check for zombie only items
  4149. if (!g_zombie[id] && g_extraitem_team[itemid] == ZP_TEAM_ZOMBIE)
  4150. {
  4151. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_ZOMBIE_ONLY")
  4152. return;
  4153. }
  4154.  
  4155. // Check for unavailable items
  4156. if ((itemid == EXTRA_NVISION && !get_pcvar_num(cvar_extranvision)) || (itemid == EXTRA_ANTIDOTE && !get_pcvar_num(cvar_extraantidote)) || (itemid == EXTRA_MADNESS && !get_pcvar_num(cvar_extramadness)) || (itemid == EXTRA_INFBOMB && (!get_pcvar_num(cvar_extrainfbomb) || g_infbombcounter >= get_pcvar_num(cvar_infbomblimit))) || (itemid >= EXTRA_WEAPONS_STARTID && itemid <= EXTRAS_CUSTOM_STARTID-1 && !get_pcvar_num(cvar_extraweapons)))
  4157. {
  4158. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4159. return;
  4160. }
  4161.  
  4162. // Check for hard coded items with special conditions
  4163. if ((itemid == EXTRA_ANTIDOTE && (g_endround || g_swarmround || g_nemround || g_survround || g_plagueround || fnGetZombies() <= 1 || (get_pcvar_num(cvar_deathmatch) && !get_pcvar_num(cvar_respawnafterlast) && fnGetHumans() == 1))) || (itemid == EXTRA_MADNESS && g_nodamage[id]) || (itemid == EXTRA_INFBOMB && (g_endround || g_swarmround || g_nemround || g_survround || g_plagueround)))
  4164. {
  4165. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_CANTUSE")
  4166. return;
  4167. }
  4168.  
  4169. // Check that we have enough ammo packs
  4170. if (g_ammopacks[id] < g_extraitem_cost[itemid] * g_level[id])
  4171. {
  4172. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "NOT_ENOUGH_AMMO")
  4173. return;
  4174. }
  4175.  
  4176. // Deduce item cost
  4177. update_ap(id, 0 - g_extraitem_cost[itemid] * g_level[id], 0)
  4178.  
  4179. // Check which kind of item we're buying
  4180. switch (itemid)
  4181. {
  4182. case EXTRA_NVISION: // Night Vision
  4183. {
  4184. if (!is_user_bot(id))
  4185. {
  4186. g_nvision[id] = true
  4187. g_nvisionenabled[id] = true
  4188.  
  4189. // Custom nvg?
  4190. if (get_pcvar_num(cvar_cnvg))
  4191. {
  4192. remove_task(id+TASK_NVISION)
  4193. set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
  4194. }
  4195. else
  4196. set_user_gnvision(id, 1)
  4197. }
  4198. else
  4199. fm_set_bot_nvg(id, 1)
  4200. }
  4201. case EXTRA_ANTIDOTE: // Antidote
  4202. {
  4203. humanme(id, 0)
  4204. }
  4205. case EXTRA_MADNESS: // Zombie Madness
  4206. {
  4207. g_nodamage[id] = true
  4208. zombie_aura(id+TASK_BLOOD)
  4209. engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_madness[random_num(0, sizeof zombie_madness - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  4210. set_task(get_pcvar_float(cvar_madnessduration), "madness_over", id+TASK_BLOOD)
  4211. }
  4212. case EXTRA_INFBOMB: // Infection Bomb
  4213. {
  4214. // Increase infection bomb purchase count for this round
  4215. g_infbombcounter++
  4216.  
  4217. // Already own one
  4218. if (user_has_weapon(id, CSW_HEGRENADE))
  4219. {
  4220. // Increase BP ammo on it instead
  4221. fm_set_user_bpammo(id, CSW_HEGRENADE, fm_get_user_bpammo(id, CSW_HEGRENADE) + 1)
  4222.  
  4223. // Flash ammo in hud
  4224. message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
  4225. write_byte(AMMOID[CSW_HEGRENADE]) // ammo id
  4226. write_byte(1) // ammo amount
  4227. message_end()
  4228.  
  4229. // Play clip purchase sound
  4230. engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  4231.  
  4232. return; // stop here
  4233. }
  4234.  
  4235. // Give weapon to the player
  4236. fm_give_item(id, "weapon_hegrenade")
  4237. }
  4238. case EXTRA_WEAPONS_STARTID .. EXTRAS_CUSTOM_STARTID-1: // Weapons
  4239. {
  4240. // Get weapon index
  4241. static weaponid
  4242. weaponid = get_weaponid(g_extra_items[itemid-4])
  4243.  
  4244. // If we are giving a primary/secondary weapon
  4245. if (MAXBPAMMO[weaponid] > 2)
  4246. {
  4247. // Make user drop the previous one
  4248. if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
  4249. drop_weapons(id, 1)
  4250. else
  4251. drop_weapons(id, 2)
  4252.  
  4253. // Give full BP ammo for the new one
  4254. fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
  4255. }
  4256. // If we are giving a grenade which the user already owns
  4257. else if (user_has_weapon(id, weaponid))
  4258. {
  4259. // Increase BP ammo on it instead
  4260. fm_set_user_bpammo(id, weaponid, fm_get_user_bpammo(id, weaponid) + 1)
  4261.  
  4262. // Flash ammo in hud
  4263. message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
  4264. write_byte(AMMOID[weaponid]) // ammo id
  4265. write_byte(1) // ammo amount
  4266. message_end()
  4267.  
  4268. // Play clip purchase sound
  4269. engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  4270.  
  4271. return; // stop here
  4272. }
  4273.  
  4274. // Give weapon to the player
  4275. fm_give_item(id, g_extra_items[itemid-4])
  4276. }
  4277. default: // Custom additions
  4278. {
  4279. // Item selected forward
  4280. ExecuteForward(g_fwExtraItemSelected, g_fwDummyResult, id, itemid);
  4281. }
  4282. }
  4283. }
  4284.  
  4285. // Zombie Class Menu
  4286. public menu_zclass(id, key)
  4287. {
  4288. // Special keys / items list exceeded
  4289. if (key >= MENU_KEY_BACK || ZCLASSES_SELECTION >= g_zclass_i)
  4290. {
  4291. switch (key)
  4292. {
  4293. case MENU_KEY_BACK: // back
  4294. {
  4295. if (ZCLASSES_STARTID-6 >= 0) ZCLASSES_STARTID -= 6
  4296. }
  4297. case MENU_KEY_NEXT: // next
  4298. {
  4299. if (ZCLASSES_STARTID+6 < g_zclass_i) ZCLASSES_STARTID += 6
  4300. }
  4301. case MENU_KEY_EXIT: // exit
  4302. {
  4303. return PLUGIN_HANDLED;
  4304. }
  4305. }
  4306.  
  4307. // Show extra items menu again
  4308. show_menu_zclass(id)
  4309. return PLUGIN_HANDLED;
  4310. }
  4311.  
  4312. if (g_level[id] >= g_zclass_lvl[ZCLASSES_SELECTION])
  4313. {
  4314. // Store selection for the next infection
  4315. g_zombieclassnext[id] = ZCLASSES_SELECTION;
  4316.  
  4317. // Show selected zombie class info and stats
  4318. zp_colored_print(id, "^x04[ZP]^x01 %L: %s", id, "ZOMBIE_SELECT", g_zclass_name[g_zombieclassnext[id]])
  4319. zp_colored_print(id, "^x04[ZP]^x01 %L: %d %L: %d %L: %d %L: %d%%", id, "ZOMBIE_ATTRIB1", g_zclass_hp[g_zombieclassnext[id]], id, "ZOMBIE_ATTRIB2", g_zclass_spd[g_zombieclassnext[id]],
  4320. id, "ZOMBIE_ATTRIB3", floatround(g_zclass_grav[g_zombieclassnext[id]]*800), id, "ZOMBIE_ATTRIB4", floatround(g_zclass_kb[g_zombieclassnext[id]]*100))
  4321. }
  4322. else
  4323. {
  4324. zp_colored_print(id, "^x04[ZP]^x01 No tenes Nivel suficiente para elegir esta Clase de Zombie. [Nivel Requerido: %d]", g_zclass_lvl[ZCLASSES_SELECTION])
  4325. return PLUGIN_HANDLED;
  4326. }
  4327.  
  4328. return PLUGIN_HANDLED;
  4329. }
  4330.  
  4331. // Human Class Menu
  4332. public menu_hclass(id, key)
  4333. {
  4334. // Special keys / items list exceeded
  4335. if (key >= MENU_KEY_BACK || HCLASSES_SELECTION >= g_hclass_i)
  4336. {
  4337. switch (key)
  4338. {
  4339. case MENU_KEY_BACK: // back
  4340. {
  4341. if (HCLASSES_STARTID-6 >= 0) HCLASSES_STARTID -= 6
  4342. }
  4343. case MENU_KEY_NEXT: // next
  4344. {
  4345. if (HCLASSES_STARTID+6 < g_hclass_i) HCLASSES_STARTID += 6
  4346. }
  4347. case MENU_KEY_EXIT: // exit
  4348. {
  4349. return PLUGIN_HANDLED;
  4350. }
  4351. }
  4352.  
  4353. // Show extra items menu again
  4354. show_menu_hclass(id)
  4355. return PLUGIN_HANDLED;
  4356. }
  4357.  
  4358. if (g_level[id] >= g_hclass_lvl[HCLASSES_SELECTION])
  4359. {
  4360. // Store selection for the next infection
  4361. g_humanclassnext[id] = HCLASSES_SELECTION;
  4362.  
  4363. // Show selected zombie class info and stats
  4364. zp_colored_print(id, "^x04[ZP]^x01 %L: %s", id, "HUMAN_SELECT", g_hclass_name[g_humanclassnext[id]])
  4365. zp_colored_print(id, "^x04[ZP]^x01 %L: %d %L: %d %L: %d", id, "HUMAN_ATTRIB1", g_hclass_hp[g_humanclassnext[id]], id, "HUMAN_ATTRIB2", g_hclass_spd[g_humanclassnext[id]],
  4366. id, "HUMAN_ATTRIB3", floatround(g_hclass_grav[g_humanclassnext[id]]*800))
  4367. }
  4368. else
  4369. {
  4370. zp_colored_print(id, "^x04[ZP]^x01 No tenes Nivel suficiente para elegir esta Clase de Humano. [Nivel Requerido: %d]", g_hclass_lvl[HCLASSES_SELECTION])
  4371. return PLUGIN_HANDLED;
  4372. }
  4373.  
  4374. return PLUGIN_HANDLED;
  4375. }
  4376.  
  4377. // Info Menu
  4378. public menu_info(id, key)
  4379. {
  4380. static motd[1000], len
  4381. len = 0
  4382.  
  4383. switch (key)
  4384. {
  4385. case 0: // General
  4386. {
  4387. static weather, lights[2]
  4388. weather = 0
  4389.  
  4390. // Get light style
  4391. get_pcvar_string(cvar_lighting, lights, sizeof lights - 1)
  4392. strtolower(lights)
  4393.  
  4394. len += formatex(motd[len], sizeof motd - 1 - len, "%L ", id, "MOTD_INFO11", "Zombie Plague", PLUGIN_VERSION, "MeRcyLeZZ")
  4395. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO12")
  4396. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_A")
  4397.  
  4398. #if defined AMBIENCE_FOG
  4399. len += formatex(motd[len], sizeof motd - 1 - len, (weather < 1) ? " %L" : ". %L", id, "MOTD_FOG")
  4400. weather++
  4401. #endif
  4402. #if defined AMBIENCE_RAIN
  4403. len += formatex(motd[len], sizeof motd - 1 - len, (weather < 1) ? " %L" : ". %L", id, "MOTD_RAIN")
  4404. weather++
  4405. #endif
  4406. #if defined AMBIENCE_SNOW
  4407. len += formatex(motd[len], sizeof motd - 1 - len, (weather < 1) ? " %L" : ". %L", id, "MOTD_SNOW")
  4408. weather++
  4409. #endif
  4410. if (weather < 1) len += formatex(motd[len], sizeof motd - 1 - len, " %L", id, "MOTD_DISABLED")
  4411.  
  4412. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_B", lights)
  4413. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_C", id, get_pcvar_num(cvar_triggered) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4414. if (lights[0] == 'a' && get_pcvar_num(cvar_thunder)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_D", get_pcvar_num(cvar_thunder))
  4415. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_E", id, get_pcvar_num(cvar_removedoors) > 0 ? get_pcvar_num(cvar_removedoors) > 1 ? "MOTD_DOORS" : "MOTD_ROTATING" : "MOTD_ENABLED")
  4416. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_F", id, get_pcvar_num(cvar_deathmatch) > 0 ? get_pcvar_num(cvar_deathmatch) > 1 ? get_pcvar_num(cvar_deathmatch) > 2 ? "MOTD_ENABLED" : "MOTD_DM_ZOMBIE" : "MOTD_DM_HUMAN" : "MOTD_DISABLED")
  4417. if (get_pcvar_num(cvar_deathmatch)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_G", get_pcvar_num(cvar_spawnprotection))
  4418. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_H", id, get_pcvar_num(cvar_randspawn) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4419. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_I", id, get_pcvar_num(cvar_extraitems) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4420. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_J", id, get_pcvar_num(cvar_zclasses) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4421. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_K", id, get_pcvar_num(cvar_cnvg) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4422. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_L", id, get_pcvar_num(cvar_cflash) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4423.  
  4424. show_motd(id, motd)
  4425. }
  4426. case 1: // Humans
  4427. {
  4428. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2")
  4429. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_A", g_hclass_hp[0])
  4430. if (get_pcvar_num(cvar_humanlasthp) > 0) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_B", get_pcvar_num(cvar_humanlasthp))
  4431. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_C", g_hclass_spd[0])
  4432. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_D", floatround(g_hclass_grav[0]*800))
  4433. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_E", id, get_pcvar_num(cvar_infammo) > 0 ? get_pcvar_num(cvar_infammo) > 1 ? "MOTD_AMMO_CLIP" : "MOTD_AMMO_BP" : "MOTD_LIMITED")
  4434. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_F", get_pcvar_num(cvar_ammodamage))
  4435. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_G", id, get_pcvar_num(cvar_firegrenades) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4436. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_H", id, get_pcvar_num(cvar_frostgrenades) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4437. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_I", id, get_pcvar_num(cvar_flaregrenades) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4438. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_J", id, get_pcvar_num(cvar_knockback) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4439.  
  4440. show_motd(id, motd)
  4441. }
  4442. case 2: // Zombies
  4443. {
  4444. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3")
  4445. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_A", g_zclass_hp[0])
  4446. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_B", floatround(g_zclass_hp[0]*get_pcvar_float(cvar_zombiefirsthp)))
  4447. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_C", floatround(get_pcvar_float(cvar_zombiearmor)*100))
  4448. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_D", g_zclass_spd[0])
  4449. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_E", floatround(g_zclass_grav[0]*800))
  4450. if (get_pcvar_num(cvar_zombiebonushp)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_F", get_pcvar_num(cvar_zombiebonushp))
  4451. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_G", id, get_pcvar_num(cvar_zombiepainfree) > 0 ? get_pcvar_num(cvar_zombiepainfree) > 1 ? "MOTD_LASTZOMBIE" : "MOTD_ENABLED" : "MOTD_DISABLED")
  4452. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_H", id, get_pcvar_num(cvar_zombiebleeding) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4453. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_I", get_pcvar_num(cvar_ammoinfect))
  4454.  
  4455. show_motd(id, motd)
  4456. }
  4457. case 3: // Gameplay Modes
  4458. {
  4459. static nemhp[5], survhp[5]
  4460.  
  4461. // Get nemesis and survivor health
  4462. num_to_str(get_pcvar_num(cvar_nemhp), nemhp, sizeof nemhp - 1)
  4463. num_to_str(get_pcvar_num(cvar_survhp), survhp, sizeof survhp - 1)
  4464.  
  4465. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4")
  4466. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_A", id, get_pcvar_num(cvar_nem) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4467. if (get_pcvar_num(cvar_nem)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_B", get_pcvar_num(cvar_nemchance))
  4468. if (get_pcvar_num(cvar_nem)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_C", get_pcvar_num(cvar_nemhp) > 0 ? nemhp : "[Auto]")
  4469. if (get_pcvar_num(cvar_nem)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_D", get_pcvar_num(cvar_nemspd))
  4470. if (get_pcvar_num(cvar_nem)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_E", floatround(get_pcvar_float(cvar_nemgravity)*800))
  4471. if (get_pcvar_num(cvar_nem)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_F", id, get_pcvar_num(cvar_leapnemesis) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4472. if (get_pcvar_num(cvar_nem)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_G", id, get_pcvar_num(cvar_nempainfree) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4473. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_H", id, get_pcvar_num(cvar_surv) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4474. if (get_pcvar_num(cvar_surv)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_I", get_pcvar_num(cvar_survchance))
  4475. if (get_pcvar_num(cvar_surv)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_J", get_pcvar_num(cvar_survhp) > 0 ? survhp : "[Auto]")
  4476. if (get_pcvar_num(cvar_surv)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_K", get_pcvar_num(cvar_survspd))
  4477. if (get_pcvar_num(cvar_surv)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_L", floatround(get_pcvar_float(cvar_survgravity)*800))
  4478. if (get_pcvar_num(cvar_surv)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_M", id, get_pcvar_num(cvar_leapsurvivor) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4479. if (get_pcvar_num(cvar_surv)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_N", id, get_pcvar_num(cvar_survpainfree) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4480. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_O", id, get_pcvar_num(cvar_swarm) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4481. if (get_pcvar_num(cvar_swarm)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_P", get_pcvar_num(cvar_swarmchance))
  4482. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_Q", id, get_pcvar_num(cvar_multi) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4483. if (get_pcvar_num(cvar_multi)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_R", get_pcvar_num(cvar_multichance))
  4484. if (get_pcvar_num(cvar_multi)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_S", floatround(get_pcvar_float(cvar_multiratio)*100))
  4485. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_T", id, get_pcvar_num(cvar_plague) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4486. if (get_pcvar_num(cvar_plague)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_U", get_pcvar_num(cvar_plaguechance))
  4487. if (get_pcvar_num(cvar_plague)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_V", floatround(get_pcvar_float(cvar_plagueratio)*100))
  4488.  
  4489. show_motd(id, motd)
  4490. }
  4491. default: return PLUGIN_HANDLED;
  4492. }
  4493.  
  4494. // Show help menu again if user wishes to read another topic
  4495. set_task(0.2, "show_menu_info", id);
  4496.  
  4497. return PLUGIN_HANDLED;
  4498. }
  4499.  
  4500. // Admin Menu
  4501. public menu_admin(id, key)
  4502. {
  4503. switch (key)
  4504. {
  4505. case 0: // Zombiefy/Humanize command
  4506. {
  4507. if (g_endround || g_swarmround || g_nemround || g_survround || g_plagueround || task_exists(TASK_WELCOMEMSG))
  4508. {
  4509. // Not available
  4510. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4511. show_menu_admin(id)
  4512. }
  4513. else
  4514. {
  4515. // Show player list for admin to pick a target
  4516. PL_ACTION = key
  4517. show_menu_player_list(id)
  4518. }
  4519. }
  4520. case 1: // Nemesis command
  4521. {
  4522. if (g_endround || !g_newround || !get_pcvar_num(cvar_nem) || task_exists(TASK_WELCOMEMSG))
  4523. {
  4524. // Not available
  4525. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4526. show_menu_admin(id)
  4527. }
  4528. else
  4529. {
  4530. // Show player list for admin to pick a target
  4531. PL_ACTION = key
  4532. show_menu_player_list(id)
  4533. }
  4534. }
  4535. case 2: // Survivor command
  4536. {
  4537. if (g_endround || !g_newround || !get_pcvar_num(cvar_surv) || task_exists(TASK_WELCOMEMSG))
  4538. {
  4539. // Not available
  4540. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4541. show_menu_admin(id)
  4542. }
  4543. else
  4544. {
  4545. // Show player list for admin to pick a target
  4546. PL_ACTION = key
  4547. show_menu_player_list(id)
  4548. }
  4549. }
  4550. case 3: // Respawn command
  4551. {
  4552. if (g_endround || g_survround || g_swarmround || g_nemround || g_plagueround)
  4553. {
  4554. // Not available
  4555. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4556. show_menu_admin(id)
  4557. }
  4558. else
  4559. {
  4560. // Show player list for admin to pick a target
  4561. PL_ACTION = key
  4562. show_menu_player_list(id)
  4563. }
  4564. }
  4565. case 4: // Swarm Mode command
  4566. {
  4567. if (allowed_swarm())
  4568. command_swarm(id)
  4569. else
  4570. client_print(id, print_chat, "[ZP-ES] %L", id, "CMD_NOT")
  4571.  
  4572. show_menu_admin(id)
  4573. }
  4574. case 5: // Multiple Infection command
  4575. {
  4576. if (allowed_multi())
  4577. command_multi(id)
  4578. else
  4579. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4580.  
  4581. show_menu_admin(id)
  4582. }
  4583. case 6: // Plague Mode command
  4584. {
  4585. if (allowed_plague())
  4586. command_plague(id)
  4587. else
  4588. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4589.  
  4590. show_menu_admin(id)
  4591. }
  4592. case 7: // Armagedon Mode command
  4593. {
  4594. if (allowed_swarm())
  4595. command_armagedon(id)
  4596. else
  4597. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4598.  
  4599. show_menu_admin(id)
  4600. }
  4601. }
  4602.  
  4603.  
  4604. return PLUGIN_HANDLED;
  4605. }
  4606.  
  4607. // Player List Menu
  4608. public menu_player_list(id, key)
  4609. {
  4610. switch (key)
  4611. {
  4612. case MENU_KEY_BACK: // back
  4613. {
  4614. if (PL_STARTID-7 >= 0) PL_STARTID -= 7
  4615. }
  4616. case MENU_KEY_NEXT: // next
  4617. {
  4618. if (PL_STARTID+7 < g_maxplayers) PL_STARTID += 7
  4619. }
  4620. case MENU_KEY_EXIT: // go back to admin menu
  4621. {
  4622. show_menu_admin(id);
  4623. return PLUGIN_HANDLED
  4624. }
  4625. default: // perform action on player
  4626. {
  4627. // Make sure it's connected
  4628. if (is_user_connected(PL_SELECTION))
  4629. {
  4630. // Perform the right action if allowed
  4631. switch (PL_ACTION)
  4632. {
  4633. case 0:
  4634. {
  4635. if (g_zombie[PL_SELECTION])
  4636. {
  4637. if (allowed_human(PL_SELECTION))
  4638. command_human(id, PL_SELECTION)
  4639. else
  4640. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4641. }
  4642. else
  4643. {
  4644. if (allowed_zombie(PL_SELECTION))
  4645. command_zombie(id, PL_SELECTION)
  4646. else
  4647. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4648. }
  4649. }
  4650. case 1:
  4651. {
  4652. if (allowed_nemesis(PL_SELECTION))
  4653. command_nemesis(id, PL_SELECTION)
  4654. else
  4655. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4656. }
  4657. case 2:
  4658. {
  4659. if (allowed_survivor(PL_SELECTION))
  4660. command_survivor(id, PL_SELECTION)
  4661. else
  4662. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4663. }
  4664. case 3:
  4665. {
  4666. if (allowed_respawn(PL_SELECTION))
  4667. command_respawn(id, PL_SELECTION)
  4668. else
  4669. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4670. }
  4671. }
  4672. }
  4673. else
  4674. {
  4675. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4676. }
  4677. }
  4678. }
  4679.  
  4680. show_menu_player_list(id)
  4681. return PLUGIN_HANDLED;
  4682. }
  4683.  
  4684. // Player register menu
  4685. public menu_registro(id, key)
  4686. {
  4687. static szData[512]
  4688.  
  4689. switch (key)
  4690. {
  4691. case 0:
  4692. {
  4693. if (!fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  4694. {
  4695. client_cmd(id, "messagemode Crear_Password")
  4696. set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
  4697. ShowSyncHudMsg(id, g_MsgSync3, "Ingresa una nueva password^nPulse ESC para salir")
  4698. }
  4699. else
  4700. {
  4701. zp_colored_print(id, "^x04[ZP]^x01 No puedes elegir esta opcion.")
  4702. show_menu_registro(id)
  4703. }
  4704. }
  4705. case 1:
  4706. {
  4707. if (fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  4708. {
  4709. client_cmd(id, "messagemode Loguear_Password")
  4710. set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
  4711. ShowSyncHudMsg(id, g_MsgSync3, "Ingresa tu password^nPulse ESC para salir")
  4712. }
  4713. else
  4714. {
  4715. zp_colored_print(id, "^x04[ZP]^x01 No puedes elegir esta opcion.")
  4716. show_menu_registro(id)
  4717. }
  4718. }
  4719. }
  4720.  
  4721. return PLUGIN_HANDLED;
  4722. }
  4723.  
  4724. /*================================================================================
  4725. [Admin Commands]
  4726. =================================================================================*/
  4727.  
  4728. // zp_toggle [1/0]
  4729. public cmd_toggle(id, level, cid)
  4730. {
  4731. // Check for access flag
  4732. if (!cmd_access(id, level, cid, 2))
  4733. return PLUGIN_HANDLED;
  4734.  
  4735. // Retrieve arguments
  4736. new arg[2]
  4737. read_argv(1, arg, sizeof arg - 1)
  4738.  
  4739. // Mod already enabled/disabled
  4740. if (str_to_num(arg) == g_pluginenabled)
  4741. return PLUGIN_HANDLED;
  4742.  
  4743. // Set the toggle cvar
  4744. set_pcvar_num(cvar_toggle, str_to_num(arg))
  4745.  
  4746. // Retrieve map name
  4747. new mapname[32]
  4748. get_mapname(mapname, sizeof mapname - 1)
  4749.  
  4750. // Restart current map
  4751. server_cmd("changelevel %s", mapname)
  4752.  
  4753. return PLUGIN_HANDLED;
  4754. }
  4755.  
  4756. // zp_zombie [target]
  4757. public cmd_zombie(id, level, cid)
  4758. {
  4759. // Check for access flag
  4760. if (!cmd_access(id, level, cid, 2))
  4761. return PLUGIN_HANDLED;
  4762.  
  4763. // Retrieve arguments
  4764. static arg[32], player
  4765. read_argv(1, arg, sizeof arg - 1)
  4766. player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
  4767.  
  4768. // Invalid target
  4769. if (!player) return PLUGIN_HANDLED;
  4770.  
  4771. // Target not allowed to be zombie
  4772. if (!allowed_zombie(player))
  4773. {
  4774. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4775. return PLUGIN_HANDLED
  4776. }
  4777.  
  4778. command_zombie(id, player)
  4779.  
  4780. return PLUGIN_HANDLED;
  4781. }
  4782.  
  4783. // zp_human [target]
  4784. public cmd_human(id, level, cid)
  4785. {
  4786. // Check for access flag
  4787. if (!cmd_access(id, level, cid, 2))
  4788. return PLUGIN_HANDLED;
  4789.  
  4790. // Retrieve arguments
  4791. static arg[32], player
  4792. read_argv(1, arg, sizeof arg - 1)
  4793. player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
  4794.  
  4795. // Invalid target
  4796. if (!player) return PLUGIN_HANDLED;
  4797.  
  4798. // Target not allowed to be human
  4799. if (!allowed_human(player))
  4800. {
  4801. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4802. return PLUGIN_HANDLED;
  4803. }
  4804.  
  4805. command_human(id, player)
  4806.  
  4807. return PLUGIN_HANDLED;
  4808. }
  4809.  
  4810. // zp_survivor [target]
  4811. public cmd_survivor(id, level, cid)
  4812. {
  4813. // Check for access flag
  4814. if (!cmd_access(id, level, cid, 2))
  4815. return PLUGIN_HANDLED;
  4816.  
  4817. // Retrieve arguments
  4818. static arg[32], player
  4819. read_argv(1, arg, sizeof arg - 1)
  4820. player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
  4821.  
  4822. // Invalid target
  4823. if (!player) return PLUGIN_HANDLED;
  4824.  
  4825. // Target not allowed to be survivor
  4826. if (!allowed_survivor(player))
  4827. {
  4828. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4829. return PLUGIN_HANDLED;
  4830. }
  4831.  
  4832. command_survivor(id, player)
  4833.  
  4834. return PLUGIN_HANDLED;
  4835. }
  4836.  
  4837. // zp_nemesis [target]
  4838. public cmd_nemesis(id, level, cid)
  4839. {
  4840. // Check for access flag
  4841. if (!cmd_access(id, level, cid, 2))
  4842. return PLUGIN_HANDLED;
  4843.  
  4844. // Retrieve arguments
  4845. static arg[32], player
  4846. read_argv(1, arg, sizeof arg - 1)
  4847. player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
  4848.  
  4849. // Invalid target
  4850. if (!player) return PLUGIN_HANDLED;
  4851.  
  4852. // Target not allowed to be nemesis
  4853. if (!allowed_nemesis(player))
  4854. {
  4855. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4856. return PLUGIN_HANDLED;
  4857. }
  4858.  
  4859. command_nemesis(id, player)
  4860.  
  4861. return PLUGIN_HANDLED;
  4862. }
  4863.  
  4864. // zp_respawn [target]
  4865. public cmd_respawn(id, level, cid)
  4866. {
  4867. // Check for access flag
  4868. if (!cmd_access(id, level, cid, 2))
  4869. return PLUGIN_HANDLED;
  4870.  
  4871. // Retrieve arguments
  4872. static arg[32], player
  4873. read_argv(1, arg, sizeof arg - 1)
  4874. player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
  4875.  
  4876. // Invalid target
  4877. if (!player) return PLUGIN_HANDLED;
  4878.  
  4879. // Target not allowed to be respawned
  4880. if (!allowed_respawn(player))
  4881. {
  4882. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4883. return PLUGIN_HANDLED;
  4884. }
  4885.  
  4886. command_respawn(id, player)
  4887.  
  4888. return PLUGIN_HANDLED;
  4889. }
  4890.  
  4891. // zp_swarm
  4892. public cmd_swarm(id, level, cid)
  4893. {
  4894. // Check for access flag
  4895. if (!cmd_access(id, level, cid, 1))
  4896. return PLUGIN_HANDLED;
  4897.  
  4898. // Swarm mode not allowed
  4899. if (!allowed_swarm())
  4900. {
  4901. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4902. return PLUGIN_HANDLED;
  4903. }
  4904.  
  4905. command_swarm(id)
  4906.  
  4907. return PLUGIN_HANDLED;
  4908. }
  4909.  
  4910. // zp_armagedon
  4911. public cmd_armagedon(id, level, cid)
  4912. {
  4913. // Check for access flag
  4914. if (!cmd_access(id, level, cid, 1))
  4915. return PLUGIN_HANDLED;
  4916.  
  4917. // Swarm mode not allowed
  4918. if (!allowed_swarm())
  4919. {
  4920. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4921. return PLUGIN_HANDLED;
  4922. }
  4923.  
  4924. command_armagedon(id)
  4925.  
  4926. return PLUGIN_HANDLED;
  4927. }
  4928.  
  4929. // zp_multi
  4930. public cmd_multi(id, level, cid)
  4931. {
  4932. // Check for access flag
  4933. if (!cmd_access(id, level, cid, 1))
  4934. return PLUGIN_HANDLED;
  4935.  
  4936. // Multi infection mode not allowed
  4937. if (!allowed_multi())
  4938. {
  4939. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4940. return PLUGIN_HANDLED;
  4941. }
  4942.  
  4943. command_multi(id)
  4944.  
  4945. return PLUGIN_HANDLED;
  4946. }
  4947.  
  4948. // zp_plague
  4949. public cmd_plague(id, level, cid)
  4950. {
  4951. // Check for access flag
  4952. if (!cmd_access(id, level, cid, 1))
  4953. return PLUGIN_HANDLED;
  4954.  
  4955. // Plague mode not allowed
  4956. if (!allowed_plague())
  4957. {
  4958. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4959. return PLUGIN_HANDLED;
  4960. }
  4961.  
  4962. command_plague(id)
  4963.  
  4964. return PLUGIN_HANDLED;
  4965. }
  4966.  
  4967. /*================================================================================
  4968. [Message Hooks]
  4969. =================================================================================*/
  4970.  
  4971. // Current Weapon info
  4972. public message_cur_weapon(msg_id, msg_dest, msg_entity)
  4973. {
  4974. // Player not alive or not an active weapon
  4975. if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
  4976. return;
  4977.  
  4978. // Get weapon id
  4979. static weapon
  4980. weapon = get_msg_arg_int(2)
  4981.  
  4982. // Store weapon id for reference
  4983. g_currentweapon[msg_entity] = weapon
  4984.  
  4985. // Replace weapon models with custom ones
  4986. replace_models(msg_entity)
  4987.  
  4988. // Unlimited Clip Ammo?
  4989. if (MAXBPAMMO[weapon] > 2 && (g_survivor[msg_entity] || get_pcvar_num(cvar_infammo) > 1))
  4990. {
  4991. // Refill when it's running out
  4992. if (get_msg_arg_int(3) < 7)
  4993. {
  4994. // Get weapon entity
  4995. static wname[32], weapon_ent
  4996. get_weaponname(weapon, wname, sizeof wname - 1)
  4997. weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
  4998.  
  4999. // Max out clip ammo
  5000. fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
  5001. }
  5002.  
  5003. // HUD should show full clip all the time
  5004. set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon])
  5005. }
  5006. }
  5007.  
  5008. // BP Ammo update
  5009. public message_ammo_x(msg_id, msg_dest, msg_entity)
  5010. {
  5011. // Get ammo type
  5012. static type
  5013. type = get_msg_arg_int(1)
  5014.  
  5015. // Unknown ammo type
  5016. if (type >= sizeof AMMOWEAPON) return;
  5017.  
  5018. // Get weapon id
  5019. static weapon
  5020. weapon = AMMOWEAPON[type]
  5021.  
  5022. // Primary and secondary only
  5023. if (MAXBPAMMO[weapon] > 2)
  5024. {
  5025. // Get ammo amount
  5026. static amount
  5027. amount = get_msg_arg_int(2)
  5028.  
  5029. // Unlimited BP Ammo?
  5030. if (g_survivor[msg_entity] || get_pcvar_num(cvar_infammo))
  5031. {
  5032. if (amount < MAXBPAMMO[weapon])
  5033. {
  5034. fm_set_user_bpammo(msg_entity, weapon, MAXBPAMMO[weapon])
  5035. set_msg_arg_int(2, get_msg_argtype(2), MAXBPAMMO[weapon])
  5036. }
  5037. }
  5038. // Bots automatically buy ammo when needed
  5039. else if (!g_zombie[msg_entity] && !g_survivor[msg_entity] && g_ammopacks[msg_entity] > 0 && amount <= BUYAMMO[weapon] && is_user_bot(msg_entity))
  5040. clcmd_buyammo(msg_entity);
  5041. }
  5042. }
  5043.  
  5044. // Take off player's money
  5045. public message_money(msg_id, msg_dest, msg_entity)
  5046. {
  5047. // Remove money setting enabled?
  5048. if (!get_pcvar_num(cvar_removemoney))
  5049. return PLUGIN_CONTINUE;
  5050.  
  5051. set_pdata_int(msg_entity, OFFSET_CSMONEY, 0, OFFSET_LINUX)
  5052. return PLUGIN_HANDLED;
  5053. }
  5054.  
  5055. // Fix for the HL engine bug when HP is multiples of 256
  5056. public message_health(msg_id, msg_dest, msg_entity)
  5057. {
  5058. // Get player's health
  5059. static health
  5060. health = get_msg_arg_int(1)
  5061.  
  5062. // Don't bother
  5063. if (health < 256) return;
  5064.  
  5065. // Check if we need to fix it
  5066. if (health % 256 == 0)
  5067. fm_set_user_health(msg_entity, pev(msg_entity, pev_health)+1)
  5068.  
  5069. // HUD can only show as much as 255 hp
  5070. set_msg_arg_int(1, get_msg_argtype(1), 255)
  5071. }
  5072.  
  5073. // Block flashlight battery messages when it's not available, or if custom flashlight is enabled instead
  5074. public message_flashbat(msg_id, msg_dest, msg_entity)
  5075. {
  5076. if (g_zombie[msg_entity] || g_survivor[msg_entity] || get_pcvar_num(cvar_cflash) || !is_user_alive(msg_entity))
  5077. return PLUGIN_HANDLED;
  5078.  
  5079. return PLUGIN_CONTINUE;
  5080. }
  5081.  
  5082. // Flashbangs should only affect zombies
  5083. public message_screenfade(msg_id, msg_dest, msg_entity)
  5084. {
  5085. if (get_msg_arg_int(4) != 255 || get_msg_arg_int(5) != 255 || get_msg_arg_int(6) != 255 || get_msg_arg_int(7) < 200)
  5086. return PLUGIN_CONTINUE;
  5087.  
  5088. // Nemesis shouldn't be FBed
  5089. if (g_zombie[msg_entity] && !g_nemesis[msg_entity])
  5090. {
  5091. // Set flash color to nighvision's
  5092. set_msg_arg_int(4, get_msg_argtype(4), get_pcvar_num(cvar_nvgcolor[0]))
  5093. set_msg_arg_int(5, get_msg_argtype(5), get_pcvar_num(cvar_nvgcolor[1]))
  5094. set_msg_arg_int(6, get_msg_argtype(6), get_pcvar_num(cvar_nvgcolor[2]))
  5095. return PLUGIN_CONTINUE;
  5096. }
  5097.  
  5098. return PLUGIN_HANDLED;
  5099. }
  5100.  
  5101. // Prevent spectators' nightvision from being turned off when switching targets, etc.
  5102. public message_nvgtoggle(msg_id, msg_dest, msg_entity)
  5103. {
  5104. return PLUGIN_HANDLED;
  5105. }
  5106.  
  5107. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  5108. // Set correct model on player corpses
  5109. public message_clcorpse()
  5110. {
  5111. set_msg_arg_string(1, g_playermodel[get_msg_arg_int(12)])
  5112. }
  5113. #endif
  5114.  
  5115. // Prevent zombies from seeing any weapon pickup icon
  5116. public message_weappickup(msg_id, msg_dest, msg_entity)
  5117. {
  5118. if (g_zombie[msg_entity])
  5119. return PLUGIN_HANDLED;
  5120.  
  5121. return PLUGIN_CONTINUE;
  5122. }
  5123.  
  5124. // Prevent zombies from seeing any ammo pickup icon
  5125. public message_ammopickup(msg_id, msg_dest, msg_entity)
  5126. {
  5127. if (g_zombie[msg_entity])
  5128. return PLUGIN_HANDLED;
  5129.  
  5130. return PLUGIN_CONTINUE;
  5131. }
  5132.  
  5133. // Block hostage HUD display
  5134. public message_scenario()
  5135. {
  5136. if (get_msg_args() > 1)
  5137. {
  5138. static sprite[8]
  5139. get_msg_arg_string(2, sprite, sizeof sprite - 1)
  5140.  
  5141. if (equal(sprite, "hostage"))
  5142. return PLUGIN_HANDLED;
  5143. }
  5144.  
  5145. return PLUGIN_CONTINUE;
  5146. }
  5147.  
  5148. // Block hostages from appearing on radar
  5149. public message_hostagepos()
  5150. {
  5151. return PLUGIN_HANDLED;
  5152. }
  5153.  
  5154. // Block some text messages
  5155. public message_textmsg()
  5156. {
  5157. static textmsg[22]
  5158. get_msg_arg_string(2, textmsg, sizeof textmsg - 1);
  5159.  
  5160. // Game restarting, reset scores and call round end to balance the teams
  5161. if (equal(textmsg, "#Game_will_restart_in"))
  5162. {
  5163. g_scorehumans = 0
  5164. g_scorezombies = 0
  5165. logevent_round_end()
  5166. }
  5167. // Block round end related messages
  5168. else if (equal(textmsg, "#Hostages_Not_Rescued") || equal(textmsg, "#Round_Draw") || equal(textmsg, "#Terrorists_Win") || equal(textmsg, "#CTs_Win"))
  5169. {
  5170. return PLUGIN_HANDLED;
  5171. }
  5172.  
  5173. return PLUGIN_CONTINUE;
  5174. }
  5175.  
  5176. // Block CS round win audio messages, since we're playing our own instead
  5177. public message_sendaudio()
  5178. {
  5179. static audio[17]
  5180. get_msg_arg_string(2, audio, sizeof audio - 1)
  5181.  
  5182. if(equal(audio[7], "terwin") || equal(audio[7], "ctwin") || equal(audio[7], "rounddraw"))
  5183. return PLUGIN_HANDLED;
  5184.  
  5185. return PLUGIN_CONTINUE;
  5186. }
  5187.  
  5188. // Send actual team scores (T = zombies // CT = humans)
  5189. public message_teamscore()
  5190. {
  5191. static team[2]
  5192. get_msg_arg_string(1, team, sizeof team - 1)
  5193.  
  5194. switch (team[0])
  5195. {
  5196. // CT
  5197. case 'C': set_msg_arg_int(2, get_msg_argtype(2), g_scorehumans)
  5198. // Terrorist
  5199. case 'T': set_msg_arg_int(2, get_msg_argtype(2), g_scorezombies)
  5200. }
  5201. }
  5202.  
  5203. // Team Switch (or player joining a team for first time)
  5204. public message_teaminfo(msg_id, msg_dest)
  5205. {
  5206. // Only hook global messages
  5207. if (msg_dest != MSG_ALL && msg_dest != MSG_BROADCAST) return;
  5208.  
  5209. // Get player id
  5210. static id
  5211. id = get_msg_arg_int(1)
  5212.  
  5213. // Don't pick up our own TeamInfo messages for this player (bugfix)
  5214. if (g_switchingteam[id]) return;
  5215.  
  5216. // Enable spectators' nightvision if not spawning right away
  5217. set_task(0.2, "spec_nvision", id)
  5218.  
  5219. // Round didn't start yet, nothing to worry about
  5220. if (g_newround) return;
  5221.  
  5222. // Get his new team
  5223. static team[2]
  5224. get_msg_arg_string(2, team, sizeof team - 1)
  5225.  
  5226. switch (team[0])
  5227. {
  5228. case 'C': // CT
  5229. {
  5230. if (g_survround && fnGetHumans()) // survivor alive --> switch to T and spawn as zombie
  5231. {
  5232. g_respawn_as_zombie[id] = true;
  5233. remove_task(id+TASK_TEAM)
  5234. fm_set_user_team(id, CS_TEAM_T)
  5235. set_msg_arg_string(2, "TERRORIST")
  5236. }
  5237. else if (!fnGetZombies()) // no zombies alive --> switch to T and spawn as zombie
  5238. {
  5239. g_respawn_as_zombie[id] = true;
  5240. remove_task(id+TASK_TEAM)
  5241. fm_set_user_team(id, CS_TEAM_T)
  5242. set_msg_arg_string(2, "TERRORIST")
  5243. }
  5244. }
  5245. case 'T': // Terrorist
  5246. {
  5247. if ((g_swarmround || g_survround) && fnGetHumans()) // survivor alive or swarm round w/ humans --> spawn as zombie
  5248. {
  5249. g_respawn_as_zombie[id] = true;
  5250. }
  5251. else if (fnGetZombies()) // zombies alive --> switch to CT
  5252. {
  5253. remove_task(id+TASK_TEAM)
  5254. fm_set_user_team(id, CS_TEAM_CT)
  5255. set_msg_arg_string(2, "CT")
  5256. }
  5257. }
  5258. }
  5259. }
  5260.  
  5261. /*================================================================================
  5262. [Main Functions]
  5263. =================================================================================*/
  5264.  
  5265. // Make Zombie Task
  5266. public make_zombie_task()
  5267. {
  5268. // Call make a zombie with no specific mode
  5269. make_a_zombie(MODE_NONE, 0)
  5270. }
  5271.  
  5272. // Make a Zombie Function
  5273. make_a_zombie(mode, id)
  5274. {
  5275. // Get alive players count
  5276. static iPlayersnum
  5277. iPlayersnum = fnGetAlive()
  5278.  
  5279. // Not enough players, come back later!
  5280. if (iPlayersnum < 1)
  5281. {
  5282. set_task(10.0, "make_zombie_task", TASK_MAKEZOMBIE)
  5283. return;
  5284. }
  5285.  
  5286. #if defined AMBIENCE_SOUNDS
  5287. // Stop ambience sounds and restart the task
  5288. client_cmd(0, "mp3 stop; stopsound")
  5289. remove_task(TASK_AMBIENCESOUNDS)
  5290. set_task(0.5, "ambience_sound_effects", TASK_AMBIENCESOUNDS, _, _, "b")
  5291. #endif
  5292.  
  5293. // Get prevent consecutive modes setting
  5294. static preventconsecutive
  5295. preventconsecutive = get_pcvar_num(cvar_preventconsecutive)
  5296.  
  5297. // Round starting
  5298. g_newround = false
  5299. g_survround = false
  5300. g_nemround = false
  5301. g_swarmround = false
  5302. g_plagueround = false
  5303.  
  5304. // Set up some common vars
  5305. static forward_id, name[32], iZombies, iMaxZombies
  5306.  
  5307. if ((mode == MODE_NONE && random_num(1, get_pcvar_num(cvar_survchance)) == get_pcvar_num(cvar_surv)) || mode == MODE_SURVIVOR)
  5308. {
  5309. // Survivor Mode
  5310. g_survround = true
  5311. g_lastmode = MODE_SURVIVOR
  5312.  
  5313. // Choose player randomly?
  5314. if (mode == MODE_NONE)
  5315. id = fnGetRandomAlive(random_num(1, iPlayersnum))
  5316.  
  5317. // Remember id for calling our forward later
  5318. forward_id = id
  5319.  
  5320. // Turn player into a survivor
  5321. humanme(id, 1)
  5322.  
  5323. // Turn the remaining players into zombies
  5324. for (id = 1; id <= g_maxplayers; id++)
  5325. {
  5326. // Not alive
  5327. if (!is_user_alive(id))
  5328. continue;
  5329.  
  5330. // Survivor or already a zombie
  5331. if (g_survivor[id] || g_zombie[id])
  5332. continue;
  5333.  
  5334. // Turn into a zombie
  5335. zombieme(id, 0, 0, 1)
  5336. }
  5337.  
  5338. // Play survivor sound
  5339. PlaySound(sound_survivor[random_num(0, sizeof sound_survivor -1)]);
  5340.  
  5341. // Get player's name
  5342. get_user_name(forward_id, name, sizeof name - 1)
  5343.  
  5344. // Show Survivor HUD notice
  5345. set_hudmessage(20, 20, 255, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5346. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SURVIVOR", name)
  5347.  
  5348. // Round start forward
  5349. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_SURVIVOR, forward_id);
  5350. }
  5351. else if ((mode == MODE_NONE && (!preventconsecutive || g_lastmode != MODE_ARMAGEDON) && random_num(1, get_pcvar_num(cvar_armagedonchance)) == get_pcvar_num(cvar_armagedon) && floatround((iPlayersnum-2)*get_pcvar_float(cvar_armagedonratio), floatround_ceil) >= 1 && iPlayersnum >= get_pcvar_num(cvar_armagedonminplayers)) || mode == MODE_ARMAGEDON)
  5352. {
  5353. //Armagedon Mode
  5354. g_plagueround = true
  5355. g_armagedonround = true
  5356.  
  5357. new Float:Time // Creamos un Float con el Nombre 'Time'
  5358. Time = 10.0 // Le asignamos al Float 'Time' 10 Segundos
  5359.  
  5360. // Creamos el Efecto (ScreenFade)
  5361. message_begin(MSG_BROADCAST, g_msgScreenFade) // Open The Function
  5362. write_short((1<<12)*4) // Duration
  5363. write_short(floatround((1<<12)*(Time+2.2))) // Hold Time
  5364. write_short(0x0001) // Fade Type
  5365. write_byte(0) // Color Red
  5366. write_byte(0) // Color Green
  5367. write_byte(0) // Color Blue
  5368. write_byte(255) // Alpha: 255 = Se oscurece toda la Pantalla
  5369. message_end() // Close The Funcion
  5370.  
  5371. set_task(2.0, "Notice_One") // Creamos un Task para dar la Noticia
  5372. set_task(Time, "EffectModeEnd", id) // Creamos un Task para poder sacar el ScreenFade de a poco y no de golpe.
  5373.  
  5374. // Aca sige todo tu modo...
  5375. // NOTA: Acuerdense de no poner el: set_hudmessage al final del Modo.
  5376.  
  5377. // Turn someone into a Survivor
  5378. id = fnGetRandomAlive(random_num(1, iPlayersnum))
  5379. humanme(id, 1)
  5380.  
  5381. // heal Svruivor
  5382. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpsurvi)))
  5383.  
  5384. // Turn someone into a Nemesis (not the survivor!)
  5385. while (g_survivor[id]) id = fnGetRandomAlive(random_num(1, iPlayersnum));
  5386. zombieme(id, 0, 1, 0)
  5387.  
  5388. // heal Nem
  5389. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpneme)))
  5390.  
  5391. // iMaxZombies is rounded up, in case there aren't enough players
  5392. iMaxZombies = floatround((iPlayersnum-2)*get_pcvar_float(cvar_plagueratio), floatround_ceil)
  5393. iZombies = 0
  5394.  
  5395. // Randomly turn iMaxZombies players into zombies
  5396. while (iZombies < iMaxZombies)
  5397. {
  5398. if (id < g_maxplayers)
  5399. id++
  5400. else
  5401. id = 1
  5402.  
  5403. // Dead or already a zombie or survivor
  5404. if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
  5405. continue;
  5406.  
  5407. // Random chance
  5408. if (random_num(0, 1))
  5409. {
  5410. // Turn into a nemesis
  5411. zombieme(id, 0, 1, 0)
  5412. iZombies++
  5413.  
  5414. // Apply nemesis health multiplier
  5415. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpneme)))
  5416.  
  5417. }
  5418. }
  5419.  
  5420. // Turn the rest of players into humans
  5421. for (id = 1; id <= g_maxplayers; id++)
  5422. {
  5423. // Only those of them who arent zombies or survivor
  5424. if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
  5425. continue
  5426.  
  5427. // Remove previous tasks and make them survivors
  5428. remove_task(id+TASK_TEAM)
  5429. humanme(id, 1)
  5430.  
  5431. // Apply survivor health multiplier
  5432. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpsurvi)))
  5433.  
  5434. /* Switch to CT
  5435. if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
  5436. {
  5437. fm_set_user_team(id, CS_TEAM_CT)
  5438. set_task(0.1+g_teams_i, "fm_set_user_team_msg", id+TASK_TEAM)
  5439. g_teams_i += 0.1; // increase teams task counter
  5440. }*/
  5441. }
  5442.  
  5443. // Play plague sound
  5444. PlaySound(sound_plague[random_num(0, sizeof sound_plague -1)]);
  5445.  
  5446. // Show Plague HUD notice
  5447. set_hudmessage(0, 50, 200, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5448. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_ARMAGEDON")
  5449.  
  5450. // Round start forward
  5451. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_ARMAGEDON, 0);
  5452. }
  5453. else if ((mode == MODE_NONE && (!preventconsecutive || g_lastmode != MODE_SWARM) && random_num(1, get_pcvar_num(cvar_swarmchance)) == get_pcvar_num(cvar_swarm) && iPlayersnum >= get_pcvar_num(cvar_swarmminplayers)) || mode == MODE_SWARM)
  5454. {
  5455. // Swarm Mode
  5456. g_swarmround = true
  5457. g_lastmode = MODE_SWARM
  5458.  
  5459. // Turn every T into a zombie
  5460. for (id = 1; id <= g_maxplayers; id++)
  5461. {
  5462. // Not alive
  5463. if (!is_user_alive(id))
  5464. continue;
  5465.  
  5466. // Not a Terrorist
  5467. if (fm_get_user_team(id) != CS_TEAM_T)
  5468. continue;
  5469.  
  5470. // Turn into a zombie
  5471. zombieme(id, 0, 0, 1)
  5472. }
  5473.  
  5474. // Play swarm sound
  5475. PlaySound(sound_swarm[random_num(0, sizeof sound_swarm -1)]);
  5476.  
  5477. // Show Swarm HUD notice
  5478. set_hudmessage(20, 255, 20, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5479. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SWARM")
  5480.  
  5481. // Round start forward
  5482. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_SWARM, 0);
  5483. }
  5484. else if ((mode == MODE_NONE && (!preventconsecutive || g_lastmode != MODE_MULTI) && random_num(1, get_pcvar_num(cvar_multichance)) == get_pcvar_num(cvar_multi) && floatround(iPlayersnum*get_pcvar_float(cvar_multiratio), floatround_ceil) >= 2 && floatround(iPlayersnum*get_pcvar_float(cvar_multiratio), floatround_ceil) < iPlayersnum && iPlayersnum >= get_pcvar_num(cvar_multiminplayers)) || mode == MODE_MULTI)
  5485. {
  5486. // Multi Infection Mode
  5487. g_lastmode = MODE_MULTI
  5488.  
  5489. // iMaxZombies is rounded up, in case there aren't enough players
  5490. iMaxZombies = floatround(iPlayersnum*get_pcvar_float(cvar_multiratio), floatround_ceil)
  5491. iZombies = 0
  5492.  
  5493. // Randomly turn iMaxZombies players into zombies
  5494. while (iZombies < iMaxZombies)
  5495. {
  5496. // Keep looping through all players
  5497. if (++id > g_maxplayers) id = 1
  5498.  
  5499. // Dead or already a zombie
  5500. if (!is_user_alive(id) || g_zombie[id])
  5501. continue;
  5502.  
  5503. // Random chance
  5504. if (random_num(0, 1))
  5505. {
  5506. // Turn into a zombie
  5507. zombieme(id, 0, 0, 1)
  5508. iZombies++
  5509. }
  5510. }
  5511.  
  5512. // Turn the remaining players into humans
  5513. for (id = 1; id <= g_maxplayers; id++)
  5514. {
  5515. // Only those of them who aren't zombies
  5516. if (!is_user_alive(id) || g_zombie[id])
  5517. continue
  5518.  
  5519. // Remove previous tasks
  5520. remove_task(id+TASK_TEAM)
  5521.  
  5522. // Switch to CT
  5523. if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
  5524. {
  5525. fm_set_user_team(id, CS_TEAM_CT)
  5526. fm_user_team_update(id)
  5527. }
  5528. }
  5529.  
  5530. // Play multi infection sound
  5531. PlaySound(sound_multi[random_num(0, sizeof sound_multi -1)]);
  5532.  
  5533. // Show Multi Infection HUD notice
  5534. set_hudmessage(200, 50, 0, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5535. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_MULTI")
  5536.  
  5537. // Round start forward
  5538. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_MULTI, 0);
  5539. }
  5540. else if ((mode == MODE_NONE && (!preventconsecutive || g_lastmode != MODE_PLAGUE) && random_num(1, get_pcvar_num(cvar_plaguechance)) == get_pcvar_num(cvar_plague) && floatround((iPlayersnum-(get_pcvar_num(cvar_plaguenemnum)+get_pcvar_num(cvar_plaguesurvnum)))*get_pcvar_float(cvar_plagueratio), floatround_ceil) >= 1
  5541. && iPlayersnum-(get_pcvar_num(cvar_plaguesurvnum)+get_pcvar_num(cvar_plaguenemnum)+floatround((iPlayersnum-(get_pcvar_num(cvar_plaguenemnum)+get_pcvar_num(cvar_plaguesurvnum)))*get_pcvar_float(cvar_plagueratio), floatround_ceil)) >= 1 && iPlayersnum >= get_pcvar_num(cvar_plagueminplayers)) || mode == MODE_PLAGUE)
  5542. {
  5543. // Plague Mode
  5544. g_plagueround = true
  5545. g_lastmode = MODE_PLAGUE
  5546.  
  5547. // Turn specified amount of players into Survivors
  5548. static iSurvivors, iMaxSurvivors
  5549. iMaxSurvivors = get_pcvar_num(cvar_plaguesurvnum)
  5550. iSurvivors = 0
  5551.  
  5552. while (iSurvivors < iMaxSurvivors)
  5553. {
  5554. // Choose random guy
  5555. id = fnGetRandomAlive(random_num(1, iPlayersnum))
  5556.  
  5557. // Already a survivor?
  5558. if (g_survivor[id])
  5559. continue;
  5560.  
  5561. // If not, turn him into one
  5562. humanme(id, 1)
  5563. iSurvivors++
  5564.  
  5565. // Apply survivor health multiplier
  5566. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_plaguesurvhpmulti)))
  5567. }
  5568.  
  5569. // Turn specified amount of players into Nemesis
  5570. static iNemesis, iMaxNemesis
  5571. iMaxNemesis = get_pcvar_num(cvar_plaguenemnum)
  5572. iNemesis = 0
  5573.  
  5574. while (iNemesis < iMaxNemesis)
  5575. {
  5576. // Choose random guy
  5577. id = fnGetRandomAlive(random_num(1, iPlayersnum))
  5578.  
  5579. // Already a survivor or nemesis?
  5580. if (g_survivor[id] || g_nemesis[id])
  5581. continue;
  5582.  
  5583. // If not, turn him into one
  5584. zombieme(id, 0, 1, 0)
  5585. iNemesis++
  5586.  
  5587. // Apply nemesis health multiplier
  5588. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_plaguenemhpmulti)))
  5589. }
  5590.  
  5591. // iMaxZombies is rounded up, in case there aren't enough players
  5592. iMaxZombies = floatround((iPlayersnum-(get_pcvar_num(cvar_plaguenemnum)+get_pcvar_num(cvar_plaguesurvnum)))*get_pcvar_float(cvar_plagueratio), floatround_ceil)
  5593. iZombies = 0
  5594.  
  5595. // Randomly turn iMaxZombies players into zombies
  5596. while (iZombies < iMaxZombies)
  5597. {
  5598. // Keep looping through all players
  5599. if (++id > g_maxplayers) id = 1
  5600.  
  5601. // Dead or already a zombie or survivor
  5602. if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
  5603. continue;
  5604.  
  5605. // Random chance
  5606. if (random_num(0, 1))
  5607. {
  5608. // Turn into a zombie
  5609. zombieme(id, 0, 0, 1)
  5610. iZombies++
  5611. }
  5612. }
  5613.  
  5614. // Turn the remaining players into humans
  5615. for (id = 1; id <= g_maxplayers; id++)
  5616. {
  5617. // Only those of them who arent zombies or survivor
  5618. if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
  5619. continue;
  5620.  
  5621. // Remove previous tasks
  5622. remove_task(id+TASK_TEAM)
  5623.  
  5624. // Switch to CT
  5625. if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
  5626. {
  5627. fm_set_user_team(id, CS_TEAM_CT)
  5628. fm_user_team_update(id)
  5629. }
  5630. }
  5631.  
  5632. // Play plague sound
  5633. PlaySound(sound_plague[random_num(0, sizeof sound_plague -1)]);
  5634.  
  5635. // Show Plague HUD notice
  5636. set_hudmessage(0, 50, 200, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5637. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_PLAGUE")
  5638.  
  5639. // Round start forward
  5640. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_PLAGUE, 0);
  5641. }
  5642. else
  5643. {
  5644. // Single Infection Mode or Nemesis Mode
  5645.  
  5646. // Choose player randomly?
  5647. if (mode == MODE_NONE)
  5648. id = fnGetRandomAlive(random_num(1, iPlayersnum))
  5649.  
  5650. // Remember id for calling our forward later
  5651. forward_id = id
  5652.  
  5653. if ((mode == MODE_NONE && (!preventconsecutive || g_lastmode != MODE_NEMESIS) && random_num(1, get_pcvar_num(cvar_nemchance)) == get_pcvar_num(cvar_nem) && iPlayersnum >= get_pcvar_num(cvar_nemminplayers)) || mode == MODE_NEMESIS)
  5654. {
  5655. // Nemesis Mode
  5656. g_nemround = true
  5657. g_lastmode = MODE_NEMESIS
  5658.  
  5659. // Turn player into nemesis
  5660. zombieme(id, 0, 1, 0)
  5661. }
  5662. else
  5663. {
  5664. // Single Infection Mode
  5665. g_lastmode = MODE_INFECTION
  5666.  
  5667. // Turn player into the first zombie
  5668. zombieme(id, 0, 0, 0)
  5669. }
  5670.  
  5671. // Remaining players should be humans (CTs)
  5672. for (id = 1; id <= g_maxplayers; id++)
  5673. {
  5674. // Not alive
  5675. if (!is_user_alive(id))
  5676. continue;
  5677.  
  5678. // First zombie/nemesis
  5679. if (g_zombie[id])
  5680. continue;
  5681.  
  5682. // Remove previous tasks
  5683. remove_task(id+TASK_TEAM)
  5684.  
  5685. // Switch to CT
  5686. if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
  5687. {
  5688. fm_set_user_team(id, CS_TEAM_CT)
  5689. fm_user_team_update(id)
  5690. }
  5691. }
  5692.  
  5693. if (g_nemround)
  5694. {
  5695. // Play Nemesis sound
  5696. PlaySound(sound_nemesis[random_num(0, sizeof sound_nemesis -1)]);
  5697.  
  5698. // Get player's name
  5699. get_user_name(forward_id, name, sizeof name - 1)
  5700.  
  5701. // Show Nemesis HUD notice
  5702. set_hudmessage(255, 20, 20, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5703. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_NEMESIS", name)
  5704.  
  5705. // Round start forward
  5706. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_NEMESIS, forward_id);
  5707. }
  5708. else
  5709. {
  5710. // Get player's name
  5711. get_user_name(forward_id, name, sizeof name - 1)
  5712.  
  5713. // Show First Zombie HUD notice
  5714. set_hudmessage(255, 0, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 5.0, 1.0, 1.0, -1)
  5715. ShowSyncHudMsg(0, g_MsgSync, "%L",LANG_PLAYER, "NOTICE_FIRST", name)
  5716.  
  5717. // Round start forward
  5718. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_INFECTION, forward_id);
  5719. }
  5720. }
  5721.  
  5722. // Last Zombie Check
  5723. set_task(0.1, "fnCheckLastZombie")
  5724. }
  5725.  
  5726.  
  5727. // Zombie Me Function (player id, infector, turn into a nemesis, special mode)
  5728. zombieme(id, infector, nemesis, specialmode)
  5729. {
  5730. // Pre user infect forward
  5731. ExecuteForward(g_fwUserInfected_pre, g_fwDummyResult, id, infector)
  5732.  
  5733. // Show zombie class menu if they haven't chosen any (e.g. just connected)
  5734. if (g_zombieclass[id] == ZCLASS_NONE && get_pcvar_num(cvar_zclasses))
  5735. set_task(2.0, "show_menu_zclass", id)
  5736.  
  5737. // Set selected zombie class
  5738. g_zombieclass[id] = g_zombieclassnext[id]
  5739. // If no class selected yet, use the first (default) one
  5740. if (g_zombieclass[id] == ZCLASS_NONE) g_zombieclass[id] = 0
  5741.  
  5742. // Way to go...
  5743. g_zombie[id] = true
  5744. g_survivor[id] = false
  5745.  
  5746. // Set zombie attributes based on the mode
  5747. if (!specialmode)
  5748. {
  5749. if (nemesis)
  5750. {
  5751. // Nemesis
  5752. g_nemesis[id] = true
  5753.  
  5754. // Get nemesis health setting
  5755. static nemhealth, nembasehealth
  5756. nemhealth = get_pcvar_num(cvar_nemhp)
  5757. nembasehealth = get_pcvar_num(cvar_nembasehp)
  5758.  
  5759. // Set health [0 = auto]
  5760. if (nemhealth == 0)
  5761. {
  5762. if (nembasehealth == 0)
  5763. fm_set_user_health(id, g_zclass_hp[0]*fnGetAlive())
  5764. else
  5765. fm_set_user_health(id, nembasehealth*fnGetAlive())
  5766. }
  5767. else
  5768. fm_set_user_health(id, nemhealth)
  5769.  
  5770. // Set gravity
  5771. set_pev(id, pev_gravity, get_pcvar_float(cvar_nemgravity))
  5772. }
  5773. else if (fnGetZombies() == 1)
  5774. {
  5775. // First zombie
  5776. g_firstzombie[id] = true
  5777.  
  5778. // Set health and gravity
  5779. fm_set_user_health(id, floatround(g_zclass_hp[g_zombieclass[id]]*get_pcvar_float(cvar_zombiefirsthp) + Z_SALUD(g_skill_points[id][1][1])))
  5780. set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]] - Z_GRAVITY(g_skill_points[id][1][3]))
  5781.  
  5782. // Infection sound
  5783. engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_infect[random_num(0, sizeof zombie_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  5784. }
  5785. else
  5786. {
  5787. // Infected by someone
  5788.  
  5789. // Set health and gravity
  5790. fm_set_user_health(id, g_zclass_hp[g_zombieclass[id]] + Z_SALUD(g_skill_points[id][1][1]))
  5791. set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]] - Z_GRAVITY(g_skill_points[id][1][3]))
  5792.  
  5793. // Infection sound
  5794. engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_infect[random_num(0, sizeof zombie_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  5795.  
  5796. // Get player's name
  5797. static name[32]
  5798. get_user_name(id, name, sizeof name - 1)
  5799.  
  5800. // Show Infection HUD notice
  5801. set_hudmessage(255, 0, 0, HUD_INFECT_X, HUD_INFECT_Y, 0, 0.0, 5.0, 1.0, 1.0, -1)
  5802.  
  5803. if (infector) // infected by someone?
  5804. {
  5805. static name2[32]
  5806. get_user_name(infector, name2, sizeof name2 - 1)
  5807. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_INFECT2", name, name2)
  5808. }
  5809. else ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_INFECT", name)
  5810. }
  5811. }
  5812. else
  5813. {
  5814. // Survivor/multi infection/swarm/plague/infection grenade
  5815.  
  5816. // Set health and gravity
  5817. fm_set_user_health(id, g_zclass_hp[g_zombieclass[id]] + Z_SALUD(g_skill_points[id][1][1]))
  5818. set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]] - Z_GRAVITY(g_skill_points[id][1][3]))
  5819. }
  5820.  
  5821. // Remove previous tasks
  5822. remove_task(id+TASK_TEAM)
  5823. remove_task(id+TASK_MODEL)
  5824. remove_task(id+TASK_BLOOD)
  5825.  
  5826. // Switch to T
  5827. if (fm_get_user_team(id) != CS_TEAM_T) // need to change team?
  5828. {
  5829. fm_set_user_team(id, CS_TEAM_T)
  5830. fm_user_team_update(id)
  5831. }
  5832.  
  5833. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  5834.  
  5835. // Set the right model
  5836. if (g_nemesis[id])
  5837. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_nemesis[random_num(0, sizeof model_nemesis -1)])
  5838. else
  5839. {
  5840. if (get_pcvar_num(cvar_adminmodelszombie) && get_user_flags(id) & ACCESS_FLAG3)
  5841. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin_zombie[random_num(0, sizeof model_admin_zombie -1)])
  5842. else
  5843. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_zclass_model[g_zombieclass[id]])
  5844. }
  5845.  
  5846. // Set model on player model entity
  5847. fm_set_playermodel_ent(id)
  5848.  
  5849. // Nemesis glow / remove glow on player model entity
  5850. if (g_nemesis[id] && get_pcvar_num(cvar_nemglow))
  5851. fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 25)
  5852. else
  5853. fm_set_rendering(g_ent_playermodel[id])
  5854.  
  5855. #else
  5856.  
  5857. // Set the right model, after checking that we don't already have it
  5858. static currentmodel[32], already_has_model, i, iRand
  5859. already_has_model = false
  5860.  
  5861. // Get current model and compare it with current one
  5862. fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
  5863.  
  5864. if (g_nemesis[id])
  5865. {
  5866. for (i = 0; i < sizeof model_nemesis; i++)
  5867. if (equal(model_nemesis[i], currentmodel)) already_has_model = true;
  5868.  
  5869. if (!already_has_model)
  5870. {
  5871. iRand = random_num(0, sizeof model_nemesis -1)
  5872. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_nemesis[iRand])
  5873. #if defined SET_MODELINDEX_OFFSET
  5874. fm_set_user_model_index(id, g_modelindex_nemesis[iRand])
  5875. #endif
  5876. }
  5877. }
  5878. else
  5879. {
  5880. if (get_pcvar_num(cvar_adminmodelszombie) && get_user_flags(id) & ACCESS_FLAG3)
  5881. {
  5882. for (i = 0; i < sizeof model_admin_zombie; i++)
  5883. if (equal(model_admin_zombie[i], currentmodel)) already_has_model = true;
  5884.  
  5885. if (!already_has_model)
  5886. {
  5887. iRand = random_num(0, sizeof model_admin_zombie -1)
  5888. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin_zombie[iRand])
  5889. #if defined SET_MODELINDEX_OFFSET
  5890. fm_set_user_model_index(id, g_modelindex_admin_zombie[iRand])
  5891. #endif
  5892. }
  5893. }
  5894. else
  5895. {
  5896. if (equal(g_zclass_model[g_zombieclass[id]], currentmodel)) already_has_model = true;
  5897.  
  5898. if (!already_has_model)
  5899. {
  5900. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_zclass_model[g_zombieclass[id]])
  5901. #if defined SET_MODELINDEX_OFFSET
  5902. fm_set_user_model_index(id, g_zclass_modelindex[g_zombieclass[id]])
  5903. #endif
  5904. }
  5905. }
  5906. }
  5907.  
  5908. // Need to change the model?
  5909. if (!already_has_model)
  5910. {
  5911. // An additional delay is offset at round start
  5912. // since SVC_BAD is more likely to be triggered there
  5913. if (g_newround)
  5914. set_task(5.0*MODELCHANGE_DELAY, "fm_user_model_update", id+TASK_MODEL)
  5915. else
  5916. fm_user_model_update(id+TASK_MODEL)
  5917. }
  5918.  
  5919. // Nemesis glow / remove glow
  5920. if (g_nemesis[id] && get_pcvar_num(cvar_nemglow))
  5921. fm_set_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 25)
  5922. else
  5923. fm_set_rendering(id)
  5924.  
  5925. #endif
  5926.  
  5927. // Remove any zoom (bugfix)
  5928. fm_remove_user_zoom(id)
  5929.  
  5930. // Remove armor
  5931. set_pev(id, pev_armorvalue, 0.0)
  5932.  
  5933. // Drop weapons when infected
  5934. drop_weapons(id, 1)
  5935. drop_weapons(id, 2)
  5936.  
  5937. // Strip zombies from guns and give them a knife
  5938. fm_strip_user_weapons(id)
  5939. fm_give_item(id, "weapon_knife")
  5940.  
  5941. // Fancy effects
  5942. infection_effects(id)
  5943.  
  5944. // Nemesis aura task
  5945. if (g_nemesis[id] && get_pcvar_num(cvar_nemaura))
  5946. zombie_aura(id+TASK_BLOOD)
  5947.  
  5948. // Get nightvision give setting
  5949. static nvggive
  5950. nvggive = get_pcvar_num(cvar_nvggive)
  5951.  
  5952. // Give Zombies Night Vision?
  5953. if (nvggive)
  5954. {
  5955. if (!is_user_bot(id))
  5956. {
  5957. g_nvision[id] = true
  5958.  
  5959. // Turn on Night Vision automatically?
  5960. if (nvggive == 1)
  5961. {
  5962. g_nvisionenabled[id] = true
  5963.  
  5964. // Custom nvg?
  5965. if (get_pcvar_num(cvar_cnvg))
  5966. {
  5967. remove_task(id+TASK_NVISION)
  5968. set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
  5969. }
  5970. else
  5971. set_user_gnvision(id, 1)
  5972. }
  5973. // Turn off nightvision when infected (bugfix)
  5974. else if (g_nvisionenabled[id])
  5975. {
  5976. if (!get_pcvar_num(cvar_cnvg)) set_user_gnvision(id, 0)
  5977. g_nvisionenabled[id] = false
  5978. }
  5979. }
  5980. else
  5981. fm_set_bot_nvg(id, 1); // turn on NVG for bots
  5982. }
  5983. // Disable nightvision when infected (bugfix)
  5984. else if (g_nvision[id])
  5985. {
  5986. if (g_nvisionenabled[id] && !get_pcvar_num(cvar_cnvg)) set_user_gnvision(id, 0)
  5987. g_nvision[id] = false
  5988. g_nvisionenabled[id] = false
  5989. }
  5990.  
  5991. // Get FOV setting
  5992. static fov
  5993. fov = get_pcvar_num(cvar_zombiefov)
  5994.  
  5995. // Set custom FOV?
  5996. if (fov != 90 && fov != 0)
  5997. {
  5998. message_begin(MSG_ONE, g_msgSetFOV, _, id)
  5999. write_byte(fov) // angle
  6000. message_end()
  6001. }
  6002.  
  6003. // Call the bloody task
  6004. if (!g_nemesis[id] && get_pcvar_num(cvar_zombiebleeding))
  6005. set_task(0.7, "make_blood", id+TASK_BLOOD, _, _, "b")
  6006.  
  6007. // Idle sounds task
  6008. if (!g_nemesis[id])
  6009. set_task(random_float(50.0, 70.0), "zombie_play_idle", id+TASK_BLOOD, _, _, "b")
  6010.  
  6011. // Turn off zombie's flashlight
  6012. turn_off_flashlight(id)
  6013.  
  6014. // Remove survivor's aura (bugfix)
  6015. set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_BRIGHTLIGHT)
  6016.  
  6017. // Remove spawn protection (bugfix)
  6018. g_nodamage[id] = false
  6019. set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_NODRAW)
  6020.  
  6021. // Post user infect forward
  6022. ExecuteForward(g_fwUserInfected_post, g_fwDummyResult, id, infector)
  6023.  
  6024. // Last Zombie Check
  6025. set_task(0.1, "fnCheckLastZombie")
  6026. }
  6027.  
  6028. // Function Human Me (player id, turn into a survivor)
  6029. humanme(id, survivor)
  6030. {
  6031. // Pre user humanize forward
  6032. ExecuteForward(g_fwUserHumanized_pre, g_fwDummyResult, id)
  6033.  
  6034. // Set selected human class
  6035. g_humanclass[id] = g_humanclassnext[id]
  6036.  
  6037. // If no class selected yet, use the first (default) one
  6038. if (g_humanclass[id] == HCLASS_NONE) g_humanclass[id] = 0
  6039.  
  6040. // Reset some vars
  6041. g_zombie[id] = false
  6042. g_nemesis[id] = false
  6043. g_firstzombie[id] = false
  6044. g_nodamage[id] = false
  6045. g_canbuy[id] = true
  6046. g_nvision[id] = false
  6047. g_nvisionenabled[id] = false
  6048.  
  6049. // Set human attributes based on the mode
  6050. if (survivor)
  6051. {
  6052. // Survivor
  6053. g_survivor[id] = true
  6054.  
  6055. // Get survivor health setting
  6056. static survhealth, survbasehealth
  6057. survhealth = get_pcvar_num(cvar_survhp)
  6058. survbasehealth = get_pcvar_num(cvar_survbasehp)
  6059.  
  6060. // Set Health [0 = auto]
  6061. if (survhealth == 0)
  6062. {
  6063. if (survbasehealth == 0)
  6064. fm_set_user_health(id, g_hclass_hp[0]*fnGetAlive())
  6065. else
  6066. fm_set_user_health(id, survbasehealth*fnGetAlive())
  6067. }
  6068. else
  6069. fm_set_user_health(id, survhealth)
  6070.  
  6071. // Set Gravity
  6072. set_pev(id, pev_gravity, get_pcvar_float(cvar_survgravity))
  6073.  
  6074. // Get survivor's weapon setting
  6075. static survweapon[32]
  6076. get_pcvar_string(cvar_survweapon, survweapon, sizeof survweapon - 1)
  6077.  
  6078. // Strip survivor from weapons and give him his own
  6079. fm_strip_user_weapons(id)
  6080. fm_give_item(id, "weapon_knife")
  6081. fm_give_item(id, survweapon)
  6082.  
  6083. // Turn off his flashlight
  6084. turn_off_flashlight(id)
  6085.  
  6086. // Give the survivor a bright light
  6087. if (get_pcvar_num(cvar_survaura)) set_pev(id, pev_effects, pev(id, pev_effects) | EF_BRIGHTLIGHT)
  6088.  
  6089. // Survivor bots will also need nightvision to see in the dark
  6090. if (is_user_bot(id)) fm_set_bot_nvg(id, 1);
  6091. }
  6092. else
  6093. {
  6094. // Human taking an antidote
  6095.  
  6096. // Set health
  6097. fm_set_user_health(id, g_hclass_hp[g_humanclass[id]] + H_SALUD(g_skill_points[id][0][1]))
  6098. set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]] - H_GRAVITY(g_skill_points[id][0][3]))
  6099. set_user_armor(id, g_hclass_ar[g_humanclass[id]] + H_ARMOR(g_skill_points[id][0][4]))
  6100.  
  6101. // Set gravity, unless frozen
  6102. if (!g_frozen[id]) set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]] - H_GRAVITY(g_skill_points[id][0][3]))
  6103.  
  6104. // Strip off from weapons
  6105. fm_strip_user_weapons(id)
  6106. fm_give_item(id, "weapon_knife")
  6107.  
  6108. // Show custom buy menu?
  6109. show_menu_eleccion(id)
  6110.  
  6111. // Antidote sound
  6112. engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_antidote[random_num(0, sizeof sound_antidote - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  6113.  
  6114. // Get player's name
  6115. static name[32]
  6116. get_user_name(id, name, sizeof name - 1)
  6117.  
  6118. // Show Antidote HUD notice
  6119. set_hudmessage(0, 0, 255, HUD_INFECT_X, HUD_INFECT_Y, 0, 0.0, 5.0, 1.0, 1.0, -1)
  6120. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_ANTIDOTE", name)
  6121. }
  6122.  
  6123. // Remove previous tasks
  6124. remove_task(id+TASK_TEAM)
  6125. remove_task(id+TASK_MODEL)
  6126. remove_task(id+TASK_BLOOD)
  6127.  
  6128. // Switch to CT
  6129. if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
  6130. {
  6131. fm_set_user_team(id, CS_TEAM_CT)
  6132. fm_user_team_update(id)
  6133. }
  6134.  
  6135. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  6136.  
  6137. // Set the right model
  6138. if (g_survivor[id])
  6139. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_survivor[random_num(0, sizeof model_survivor -1)])
  6140. else
  6141. {
  6142. if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
  6143. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[random_num(0, sizeof model_admin -1)])
  6144. else
  6145. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
  6146. }
  6147.  
  6148. // Set model on player model entity
  6149. fm_set_playermodel_ent(id)
  6150.  
  6151. // Set survivor glow / remove glow, unless frozen
  6152. if (g_survivor[id] && get_pcvar_num(cvar_survglow))
  6153. fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25)
  6154. else if (!g_frozen[id])
  6155. fm_set_rendering(g_ent_playermodel[id])
  6156.  
  6157. #else
  6158.  
  6159. // Set the right model, after checking that we don't already have it
  6160. static currentmodel[32], already_has_model, i, iRand
  6161. already_has_model = false;
  6162.  
  6163. // Get current model and compare it with current one
  6164. fm_get_user_model(id, currentmodel, sizeof currentmodel - 1);
  6165.  
  6166. if (g_survivor[id])
  6167. {
  6168. for (i = 0; i < sizeof model_survivor; i++)
  6169. if (equal(model_survivor[i], currentmodel)) already_has_model = true;
  6170.  
  6171. if (!already_has_model)
  6172. {
  6173. iRand = random_num(0, sizeof model_survivor -1)
  6174. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_survivor[iRand])
  6175. #if defined SET_MODELINDEX_OFFSET
  6176. fm_set_user_model_index(id, g_modelindex_survivor[iRand])
  6177. #endif
  6178. }
  6179. }
  6180. else
  6181. {
  6182. if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
  6183. {
  6184. for (i = 0; i < sizeof model_admin; i++)
  6185. if (equal(model_admin[i], currentmodel)) already_has_model = true;
  6186.  
  6187. if (!already_has_model)
  6188. {
  6189. iRand = random_num(0, sizeof model_admin -1)
  6190. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[iRand])
  6191. #if defined SET_MODELINDEX_OFFSET
  6192. fm_set_user_model_index(id, g_modelindex_admin[iRand])
  6193. #endif
  6194. }
  6195. }
  6196. else
  6197. {
  6198. if (equal(g_hclass_model[g_humanclass[id]], currentmodel)) already_has_model = true;
  6199.  
  6200. if (!already_has_model)
  6201. {
  6202. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
  6203. #if defined SET_MODELINDEX_OFFSET
  6204. fm_set_user_model_index(id, g_hclass_modelindex[g_humanclass[id]])
  6205. #endif
  6206. }
  6207. }
  6208. }
  6209.  
  6210. // Need to change the model?
  6211. if (!already_has_model)
  6212. {
  6213. // An additional delay is offset at round start
  6214. // since SVC_BAD is more likely to be triggered there
  6215. if (g_newround)
  6216. set_task(5.0*MODELCHANGE_DELAY, "fm_user_model_update", id+TASK_MODEL)
  6217. else
  6218. fm_user_model_update(id+TASK_MODEL)
  6219. }
  6220.  
  6221. // Set survivor glow / remove glow, unless frozen
  6222. if (g_survivor[id] && get_pcvar_num(cvar_survglow))
  6223. fm_set_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25)
  6224. else if (!g_frozen[id])
  6225. fm_set_rendering(id)
  6226.  
  6227. #endif
  6228.  
  6229. // Get FOV setting
  6230. static fov
  6231. fov = get_pcvar_num(cvar_zombiefov)
  6232.  
  6233. // Restore FOV?
  6234. if (fov != 90 && fov != 0)
  6235. {
  6236. message_begin(MSG_ONE, g_msgSetFOV, _, id)
  6237. write_byte(90) // angle
  6238. message_end()
  6239. }
  6240.  
  6241. // Disable nightvision
  6242. if (is_user_bot(id)) fm_set_bot_nvg(id, 0)
  6243. else if (!get_pcvar_num(cvar_cnvg)) set_user_gnvision(id, 0)
  6244.  
  6245. // Post user humanize forward
  6246. ExecuteForward(g_fwUserHumanized_post, g_fwDummyResult, id)
  6247.  
  6248. // Last Zombie Check
  6249. set_task(0.1, "fnCheckLastZombie")
  6250. }
  6251.  
  6252. // Hook say
  6253. public HookSay(id)
  6254. {
  6255. static message[190]
  6256. read_args(message, charsmax(message))
  6257. remove_quotes(message)
  6258.  
  6259. if (is_user_alive(id))
  6260. zp_colored_print(0, "^x04[-Level %d] [-Reset %d] [-GReset %d]^x03 %s^x01 : %s", g_level[id], g_reset[id], g_grandreset[id], g_playername[id], message)
  6261. else
  6262. zp_colored_print(0, "^x04[Muerto]^x03 %s^x01 : %s", g_playername[id], message)
  6263.  
  6264. return PLUGIN_HANDLED;
  6265. }
  6266.  
  6267. // Hook say team
  6268. public HookSayTeam(id)
  6269. {
  6270. static message[190]
  6271. read_args(message, charsmax(message))
  6272. remove_quotes(message)
  6273.  
  6274. static Team; Team = fm_get_user_team(id)
  6275.  
  6276. if (Team == CS_TEAM_SPECTATOR || CS_TEAM_UNASSIGNED)
  6277. zp_colored_print(0, "^x04[Espectador]^x03 %s^x01 : %s", g_playername[id], message)
  6278. else if (Team == CS_TEAM_CT)
  6279. zp_colored_print(0, "^x04[Humanos]^x03 %s^x01 : %s", g_playername[id], message)
  6280. else if (Team == CS_TEAM_T)
  6281. zp_colored_print(0, "^x04[Zombies]^x03 %s^x01 : %s", g_playername[id], message)
  6282.  
  6283. return PLUGIN_HANDLED;
  6284. }
  6285.  
  6286. // load pass
  6287. public clcmd_login(id)
  6288. {
  6289. static Password[24], szData[512]
  6290.  
  6291. read_args(Password, charsmax(Password))
  6292. remove_quotes(Password)
  6293. trim(Password)
  6294.  
  6295. fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData))
  6296. parse(szData, g_password[id], charsmax(g_password[]))
  6297.  
  6298. if(!equali(Password, g_password[id]))
  6299. {
  6300. zp_colored_print(id, "^x04[ZP]^x01 Password incorrecta. Intente nuevamente.")
  6301. client_cmd(id, "messagemode Loguear_Password")
  6302. set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
  6303. ShowSyncHudMsg(id, g_MsgSync3, "Ingresa tu password^nPulse ESC para salir")
  6304. return PLUGIN_HANDLED;
  6305. }
  6306. else
  6307. {
  6308. g_estado[id] = ONLINE
  6309. Load(id)
  6310. zp_colored_print(0, "^x04[ZP]^x03 %s^x01 ha ingresado al servidor.", g_playername[id])
  6311.  
  6312. engclient_cmd(id, "jointeam", "5")
  6313. engclient_cmd(id, "joinclass", "5")
  6314.  
  6315. return PLUGIN_HANDLED;
  6316. }
  6317.  
  6318. return PLUGIN_CONTINUE;
  6319. }
  6320.  
  6321. // register pass
  6322. // Register password
  6323. public clcmd_register(id)
  6324. {
  6325. read_args(g_password[id], charsmax(g_password[]))
  6326. remove_quotes(g_password[id])
  6327. trim(g_password[id])
  6328.  
  6329. if(equal(g_password[id], "") || contain(g_password[id], " ") != -1)
  6330. {
  6331. zp_colored_print(id, "^x04[ZP]^x01 La password debe contener minimo una letra y ningun espacio.")
  6332. client_cmd(id, "messagemode Crear_Password")
  6333. set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
  6334. ShowSyncHudMsg(id, g_MsgSync3, "Ingresa una nueva password^nPulse ESC para salir")
  6335. return PLUGIN_HANDLED;
  6336. }
  6337. else
  6338. {
  6339. get_user_name(id, g_playername[id], charsmax(g_playername[]))
  6340. g_password[id] = g_password[id]
  6341. g_estado[id] = ONLINE
  6342. Save(id)
  6343. Registrado[id] = 1
  6344. zp_colored_print(0, "^x04[ZP]^x03 %s^x01 se ha registrado en el servidor.", g_playername[id])
  6345.  
  6346. engclient_cmd(id, "jointeam", "5")
  6347. engclient_cmd(id, "joinclass", "5")
  6348.  
  6349. return PLUGIN_HANDLED;
  6350. }
  6351.  
  6352. return PLUGIN_CONTINUE;
  6353. }
  6354.  
  6355. Load(id)
  6356. {
  6357. static szData[512], guardapacks[10], guardalevel[10], guardahclas[10], guardazclas[10], guardahpo[10], guardazpo[10], guardahda[10], guardahvi[10], guardahve[10],
  6358. guardahgra[10], guardahar[10], guardazvi[10], guardazda[10], guardazve[10], guardazgra[10], usahu[10], usazo[10], reset[10], greset[10], registrado[10]
  6359.  
  6360. if(!fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  6361. return;
  6362.  
  6363.  
  6364. parse(szData, g_password[id], charsmax(g_password[]), guardapacks, charsmax(guardapacks), guardalevel, charsmax(guardalevel), guardahclas, charsmax(guardahclas), guardazclas, charsmax(guardazclas),
  6365. guardahpo, charsmax(guardahpo), guardazpo, charsmax(guardazpo), guardahda, charsmax(guardahda), guardahvi, charsmax(guardahvi), guardahve, charsmax(guardahve), guardahgra, charsmax(guardahgra),
  6366. guardahar, charsmax(guardahar), guardazda, charsmax(guardazda), guardazvi, charsmax(guardazvi), guardazve, charsmax(guardazve), guardazgra, charsmax(guardazgra), usahu, charsmax(usahu), usazo, charsmax(usazo), reset, charsmax(reset),
  6367. greset, charsmax(greset), registrado, charsmax(registrado))
  6368.  
  6369. g_ammopacks[id] = str_to_num(guardapacks)
  6370. g_level[id] = str_to_num(guardalevel)
  6371. g_humanclassnext[id] = str_to_num(guardahclas)
  6372. g_zombieclassnext[id] = str_to_num(guardazclas)
  6373. g_points[id][0] = str_to_num(guardahpo)
  6374. g_points[id][1] = str_to_num(guardazpo)
  6375. g_skill_points[id][0][0] = str_to_num(guardahda)
  6376. g_skill_points[id][0][1] = str_to_num(guardahvi)
  6377. g_skill_points[id][0][2] = str_to_num(guardahve)
  6378. g_skill_points[id][0][3] = str_to_num(guardahgra)
  6379. g_skill_points[id][0][4] = str_to_num(guardahar)
  6380. g_skill_points[id][1][0] = str_to_num(guardazda)
  6381. g_skill_points[id][1][1] = str_to_num(guardazvi)
  6382. g_skill_points[id][1][2] = str_to_num(guardazve)
  6383. g_skill_points[id][1][3] = str_to_num(guardazgra)
  6384. g_usedpoints[id][0] = str_to_num(usahu)
  6385. g_usedpoints[id][1] = str_to_num(usazo)
  6386. g_reset[id] = str_to_num(reset)
  6387. g_grandreset[id] = str_to_num(greset)
  6388. Registrado[id] = str_to_num(registrado)
  6389. }
  6390.  
  6391. Save(id)
  6392. {
  6393. if (!Registrado[id] || BadPassword[id])
  6394. return PLUGIN_HANDLED;
  6395.  
  6396. static szData[512]
  6397. formatex(szData, charsmax(szData), "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", g_password[id], g_ammopacks[id], g_level[id], g_humanclassnext[id], g_zombieclassnext[id], g_points[id][0], g_points[id][1],
  6398. g_skill_points[id][0][0], g_skill_points[id][0][1], g_skill_points[id][0][2], g_skill_points[id][0][3], g_skill_points[id][0][4], g_skill_points[id][1][0], g_skill_points[id][1][1], g_skill_points[id][1][2], g_skill_points[id][1][3],
  6399. g_usedpoints[id][0], g_usedpoints[id][1], g_reset[id], g_grandreset[id], Registrado[id])
  6400. fvault_set_data(SaveData, g_playername[id], szData)
  6401. return PLUGIN_CONTINUE;
  6402. }
  6403.  
  6404. // Player info changed?
  6405. public FWClientUserInfoChanged(id, buffer)
  6406. {
  6407. if(!is_user_connected(id))
  6408. return FMRES_IGNORED;
  6409.  
  6410. static NickName[32], NickOld[32]; get_user_name(id, NickOld, 31)
  6411. engfunc(EngFunc_InfoKeyValue, buffer, "name", NickName, 31)
  6412.  
  6413. if(equal( NickName, NickOld))
  6414. return FMRES_IGNORED;
  6415.  
  6416. engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", NickOld)
  6417.  
  6418. client_cmd(id, "name ^"%s^"; setinfo name ^"%s^"", NickOld, NickOld)
  6419.  
  6420. return FMRES_SUPERCEDE;
  6421. }
  6422.  
  6423. /*================================================================================
  6424. [Other Functions and Tasks]
  6425. =================================================================================*/
  6426.  
  6427. // Register Ham Forwards for CZ bots
  6428. public register_ham_czbots(id)
  6429. {
  6430. // Make sure it's a CZ bot and it's still connected
  6431. if (g_hamczbots || !get_pcvar_num(cvar_botquota) || !is_user_connected(id) || !is_user_bot(id))
  6432. return;
  6433.  
  6434. RegisterHamFromEntity(Ham_Spawn, id, "fw_PlayerSpawn_Post", 1)
  6435. RegisterHamFromEntity(Ham_Killed, id, "fw_PlayerKilled")
  6436. RegisterHamFromEntity(Ham_TakeDamage, id, "fw_TakeDamage")
  6437. RegisterHamFromEntity(Ham_TraceAttack, id, "fw_TraceAttack")
  6438.  
  6439. // Ham forwards for CZ bots succesfully registered
  6440. g_hamczbots = true
  6441.  
  6442. // If the bot has already spawned, call the forward manually for him
  6443. if (is_user_alive(id)) fw_PlayerSpawn_Post(id)
  6444. }
  6445.  
  6446. // Disable minmodels task
  6447. public disable_minmodels(id)
  6448. {
  6449. if (!is_user_connected(id)) return;
  6450. client_cmd(id, "cl_minmodels 0")
  6451. }
  6452.  
  6453. // Bots automatically buy extra items
  6454. public bot_buy_extras(taskid)
  6455. {
  6456. // Nemesis or Survivor shouldnt get extra items
  6457. if (g_survivor[ID_SPAWN] || g_nemesis[ID_SPAWN] || !is_user_alive(ID_SPAWN))
  6458. return;
  6459.  
  6460. if (!g_zombie[ID_SPAWN]) // human bots
  6461. {
  6462. // Attempt to buy Night Vision
  6463. buy_extra_item(ID_SPAWN, EXTRA_NVISION)
  6464.  
  6465. // Attempt to buy a weapon
  6466. buy_extra_item(ID_SPAWN, random_num(EXTRA_WEAPONS_STARTID, EXTRAS_CUSTOM_STARTID-1))
  6467. }
  6468. else // zombie bots
  6469. {
  6470. // Attempt to buy an Antidote
  6471. buy_extra_item(ID_SPAWN, EXTRA_ANTIDOTE)
  6472. }
  6473. }
  6474.  
  6475. // Balance Teams Task
  6476. public balance_teams()
  6477. {
  6478. // Get users playing
  6479. static iPlayersnum
  6480. iPlayersnum = fnGetPlaying()
  6481.  
  6482. // No players, don't bother
  6483. if (iPlayersnum < 1) return;
  6484.  
  6485. // Split players evenly
  6486. static g_team[33], id, iTerrors, iMaxTerrors, team
  6487. iMaxTerrors = iPlayersnum/2
  6488. iTerrors = 0
  6489.  
  6490. // First, mark everyone as CT
  6491. for (id = 1; id <= g_maxplayers; id++)
  6492. g_team[id] = CS_TEAM_CT
  6493.  
  6494. // Then randomly mark half of the players as Terrorists
  6495. while (iTerrors < iMaxTerrors)
  6496. {
  6497. // Keep looping through all players
  6498. if (++id > g_maxplayers) id = 1
  6499.  
  6500. // Skip if not connected
  6501. if (!is_user_connected(id))
  6502. continue;
  6503.  
  6504. team = fm_get_user_team(id)
  6505.  
  6506. // Skip if not playing
  6507. if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
  6508. continue;
  6509.  
  6510. // Already a Terrorist
  6511. if (g_team[id] == CS_TEAM_T)
  6512. continue;
  6513.  
  6514. // Random chance
  6515. if (random_num(0, 1))
  6516. {
  6517. g_team[id] = CS_TEAM_T
  6518. iTerrors++
  6519. }
  6520. }
  6521.  
  6522. // Set everyone's team for real
  6523. for (id = 1; id <= g_maxplayers; id++)
  6524. {
  6525. // Skip if not connected
  6526. if (!is_user_connected(id))
  6527. continue;
  6528.  
  6529. team = fm_get_user_team(id)
  6530.  
  6531. // Skip if not playing
  6532. if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
  6533. continue;
  6534.  
  6535. // Set team
  6536. remove_task(id+TASK_TEAM)
  6537. fm_set_user_team(id, g_team[id])
  6538. }
  6539. }
  6540.  
  6541. // Welcome Message Task
  6542. public welcome_msg()
  6543. {
  6544. // Show mod info
  6545. zp_colored_print(0, "^x03|||| ^x04%s^x01 ^x03||||", g_modname)
  6546. zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "NOTICE_INFO1")
  6547. if (!get_pcvar_num(cvar_infammo)) zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "NOTICE_INFO2")
  6548.  
  6549. // Show T-virus HUD notice
  6550. set_hudmessage(0, 125, 200, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
  6551. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_VIRUS_FREE")
  6552. }
  6553.  
  6554. // Respawn Player Task
  6555. public respawn_player(taskid)
  6556. {
  6557. // Get player's team
  6558. static team
  6559. team = fm_get_user_team(ID_SPAWN)
  6560.  
  6561. // Respawn on infection rounds only
  6562. if (!g_endround && !g_survround && !g_swarmround && !g_nemround && !g_plagueround && team != CS_TEAM_SPECTATOR && team != CS_TEAM_UNASSIGNED && !is_user_alive(ID_SPAWN))
  6563. {
  6564. // Set proper team before respawning, so that the TeamInfo message that's sent doesn't confuse PODBots
  6565. if (g_respawn_as_zombie[ID_SPAWN])
  6566. fm_set_user_team(ID_SPAWN, CS_TEAM_T)
  6567. else
  6568. fm_set_user_team(ID_SPAWN, CS_TEAM_CT)
  6569.  
  6570. // Respawning a player has never been so easy
  6571. ExecuteHamB(Ham_CS_RoundRespawn, ID_SPAWN)
  6572. }
  6573. }
  6574.  
  6575.  
  6576. // Check Round Task -check that we still have both zombies & humans on a round-
  6577. check_round(leaving_player)
  6578. {
  6579. // Round ended or make_a_zombie task still active
  6580. if (g_endround || task_exists(TASK_MAKEZOMBIE))
  6581. return;
  6582.  
  6583. // Get alive players count
  6584. static iPlayersnum
  6585. iPlayersnum = fnGetAlive()
  6586.  
  6587. // Last alive player, don't bother
  6588. if (iPlayersnum < 2)
  6589. return;
  6590.  
  6591. // Set up some common vars
  6592. static id, name[32]
  6593.  
  6594. // Last zombie disconnecting
  6595. if (g_zombie[leaving_player] && fnGetZombies() == 1)
  6596. {
  6597. // Only one CT left, don't bother
  6598. if (fnGetHumans() == 1 && fnGetCTs() == 1)
  6599. return;
  6600.  
  6601. // Pick a random one to take his place
  6602. while ((id = fnGetRandomAlive(random_num(1, iPlayersnum))) == leaving_player ) {}
  6603.  
  6604. // Show last zombie left notice
  6605. get_user_name(id, name, sizeof name - 1)
  6606. zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "LAST_ZOMBIE_LEFT", name)
  6607.  
  6608. // Turn into a Nemesis or just a zombie?
  6609. if (g_nemesis[leaving_player] && !g_plagueround)
  6610. make_a_zombie(MODE_NEMESIS, id)
  6611. else
  6612. zombieme(id, 0, 0, 0)
  6613. }
  6614.  
  6615. // Last human disconnecting
  6616. else if (!g_zombie[leaving_player] && fnGetHumans() == 1)
  6617. {
  6618. // Only one T left, don't bother
  6619. if (fnGetZombies() == 1 && fnGetTs() == 1)
  6620. return;
  6621.  
  6622. // Pick a random one to take his place
  6623. while ((id = fnGetRandomAlive(random_num(1, iPlayersnum))) == leaving_player ) {}
  6624.  
  6625. // Show last human left notice
  6626. get_user_name(id, name, sizeof name - 1)
  6627. zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "LAST_HUMAN_LEFT", name)
  6628.  
  6629. // Turn into a Survivor or just a human?
  6630. if (g_survivor[leaving_player] && !g_plagueround)
  6631. make_a_zombie(MODE_SURVIVOR, id)
  6632. else
  6633. humanme(id, 0)
  6634. }
  6635. }
  6636.  
  6637. // Lighting Effects Task
  6638. public lighting_effects()
  6639. {
  6640. // Lighting style ["a"-"z"]
  6641. static lights[2]
  6642. get_pcvar_string(cvar_lighting, lights, sizeof lights - 1)
  6643. strtolower(lights)
  6644.  
  6645. // Lighting disabled? ["0"]
  6646. if (lights[0] == '0')
  6647. {
  6648. // Task not needed anymore
  6649. remove_task(TASK_LIGHTING)
  6650. return;
  6651. }
  6652.  
  6653. // Darkest light settings?
  6654. if (lights[0] >= 'a' && lights[0] <= 'd')
  6655. {
  6656. // Get thunderclaps setting
  6657. static Float:thunderclap
  6658. thunderclap = get_pcvar_float(cvar_thunder)
  6659.  
  6660. // Set thunderclap tasks if neccesary
  6661. if (thunderclap > 0.0 && !task_exists(TASK_THUNDER_PRE) && !task_exists(TASK_THUNDER))
  6662. {
  6663. g_lights_i = 0
  6664. switch (random_num(0, 2))
  6665. {
  6666. case 0: set_task(thunderclap, "thunderclap1", TASK_THUNDER_PRE)
  6667. case 1: set_task(thunderclap, "thunderclap2", TASK_THUNDER_PRE)
  6668. case 2: set_task(thunderclap, "thunderclap3", TASK_THUNDER_PRE)
  6669. }
  6670. }
  6671.  
  6672. // Set lighting only when no thunderclaps are going on
  6673. if (!task_exists(TASK_THUNDER)) engfunc(EngFunc_LightStyle, 0, lights)
  6674. }
  6675. else
  6676. {
  6677. // Remove thunderclap tasks
  6678. remove_task(TASK_THUNDER_PRE)
  6679. remove_task(TASK_THUNDER)
  6680.  
  6681. // Set lighting
  6682. engfunc(EngFunc_LightStyle, 0, lights)
  6683. }
  6684. }
  6685.  
  6686. // Thunderclap 1
  6687. public thunderclap1()
  6688. {
  6689. // Play thunder sound
  6690. if (!g_lights_i) PlaySound(sound_thunder[random_num(0, sizeof sound_thunder - 1)])
  6691.  
  6692. // Set lighting
  6693. engfunc(EngFunc_LightStyle, 0, lights_thunder1[g_lights_i])
  6694. g_lights_i++
  6695.  
  6696. // Loop the task until we reach the end of the cycle
  6697. if (g_lights_i >= sizeof lights_thunder1)
  6698. {
  6699. remove_task(TASK_THUNDER)
  6700. lighting_effects()
  6701. }
  6702. else if (!task_exists(TASK_THUNDER))
  6703. set_task(0.1, "thunderclap1", TASK_THUNDER, _, _, "b")
  6704. }
  6705.  
  6706. // Thunderclap 2
  6707. public thunderclap2()
  6708. {
  6709. // Play thunder sound
  6710. if (!g_lights_i) PlaySound(sound_thunder[random_num(0, sizeof sound_thunder - 1)])
  6711.  
  6712. // Set lighting
  6713. engfunc(EngFunc_LightStyle, 0, lights_thunder2[g_lights_i])
  6714. g_lights_i++
  6715.  
  6716. // Loop the task until we reach the end of the cycle
  6717. if (g_lights_i >= sizeof lights_thunder2)
  6718. {
  6719. remove_task(TASK_THUNDER)
  6720. lighting_effects()
  6721. }
  6722. else if (!task_exists(TASK_THUNDER))
  6723. set_task(0.1, "thunderclap2", TASK_THUNDER, _, _, "b")
  6724. }
  6725.  
  6726. // Thunderclap 3
  6727. public thunderclap3()
  6728. {
  6729. // Play thunder sound
  6730. if (!g_lights_i) PlaySound(sound_thunder[random_num(0, sizeof sound_thunder - 1)])
  6731.  
  6732. // Set lighting
  6733. engfunc(EngFunc_LightStyle, 0, lights_thunder3[g_lights_i])
  6734. g_lights_i++
  6735.  
  6736. // Loop the task until we reach the end of the cycle
  6737. if (g_lights_i >= sizeof lights_thunder3)
  6738. {
  6739. remove_task(TASK_THUNDER)
  6740. lighting_effects()
  6741. }
  6742. else if (!task_exists(TASK_THUNDER))
  6743. set_task(0.1, "thunderclap3", TASK_THUNDER, _, _, "b")
  6744. }
  6745.  
  6746. #if defined AMBIENCE_SOUNDS
  6747. // Ambience Sound Effects Task
  6748. public ambience_sound_effects(taskid)
  6749. {
  6750. // Play a random sound depending on the round
  6751. static amb_sound[64], isound, Float:duration
  6752.  
  6753. if (g_nemround) // Nemesis Mode
  6754. {
  6755. isound = random_num(0, sizeof sound_ambience2 - 1)
  6756. copy(amb_sound, sizeof amb_sound -1, sound_ambience2[isound])
  6757. duration = sound_ambience2_duration[isound]
  6758. }
  6759. else if (g_survround) // Survivor Mode
  6760. {
  6761. isound = random_num(0, sizeof sound_ambience3 - 1)
  6762. copy(amb_sound, sizeof amb_sound -1, sound_ambience3[isound])
  6763. duration = sound_ambience3_duration[isound]
  6764. }
  6765. else if (g_swarmround) // Swarm Mode
  6766. {
  6767. isound = random_num(0, sizeof sound_ambience4 - 1)
  6768. copy(amb_sound, sizeof amb_sound -1, sound_ambience4[isound])
  6769. duration = sound_ambience4_duration[isound]
  6770. }
  6771. else if (g_plagueround) // Plague Mode
  6772. {
  6773. isound = random_num(0, sizeof sound_ambience5 - 1)
  6774. copy(amb_sound, sizeof amb_sound -1, sound_ambience5[isound])
  6775. duration = sound_ambience5_duration[isound]
  6776. }
  6777. else // Infection Mode
  6778. {
  6779. isound = random_num(0, sizeof sound_ambience1 - 1)
  6780. copy(amb_sound, sizeof amb_sound -1, sound_ambience1[isound])
  6781. duration = sound_ambience1_duration[isound]
  6782. }
  6783.  
  6784. // Check whether it's a wav or mp3 and play it on clients
  6785. if (equal(amb_sound[strlen(amb_sound)-4], ".mp3"))
  6786. client_cmd(0, "mp3 play ^"sound/%s^"", amb_sound)
  6787. else
  6788. PlaySound(amb_sound)
  6789.  
  6790. // The task should be called again after the sound is done playing
  6791. set_task(duration, "ambience_sound_effects", TASK_AMBIENCESOUNDS)
  6792. }
  6793.  
  6794. // Ambience Sounds Stop Task
  6795. public ambience_sound_stop()
  6796. {
  6797. client_cmd(0, "mp3 stop; stopsound")
  6798. }
  6799. #endif
  6800.  
  6801. // Flashlight Charge Task
  6802. public flashlight_charge(taskid)
  6803. {
  6804. // Custom flashlight disabled or flashlight not available for player
  6805. if (g_zombie[ID_CHARGE] || g_survivor[ID_CHARGE] || !get_pcvar_num(cvar_cflash) || !is_user_alive(ID_CHARGE))
  6806. {
  6807. // Task not needed anymore
  6808. remove_task(taskid);
  6809. return;
  6810. }
  6811.  
  6812. // Drain or charge?
  6813. if (g_flashlight[ID_CHARGE])
  6814. g_flashbattery[ID_CHARGE] -= get_pcvar_num(cvar_flashdrain)
  6815. else
  6816. g_flashbattery[ID_CHARGE] += get_pcvar_num(cvar_flashcharge)
  6817.  
  6818. // Battery fully charged
  6819. if (g_flashbattery[ID_CHARGE] >= 100)
  6820. {
  6821. // Don't exceed 100%
  6822. g_flashbattery[ID_CHARGE] = 100;
  6823.  
  6824. // Update flashlight battery on HUD
  6825. message_begin(MSG_ONE, g_msgFlashBat, _, ID_CHARGE)
  6826. write_byte(g_flashbattery[ID_CHARGE]) // battery
  6827. message_end()
  6828.  
  6829. // Task not needed anymore
  6830. remove_task(taskid);
  6831. return;
  6832. }
  6833.  
  6834. // Battery depleted
  6835. if (g_flashbattery[ID_CHARGE] <= 0)
  6836. {
  6837. // Turn it off
  6838. g_flashlight[ID_CHARGE] = false;
  6839. g_flashbattery[ID_CHARGE] = 0;
  6840.  
  6841. // Update flashlight status on HUD
  6842. message_begin(MSG_ONE, g_msgFlashlight, _, ID_CHARGE)
  6843. write_byte(g_flashlight[ID_CHARGE]) // toggle
  6844. write_byte(g_flashbattery[ID_CHARGE]) // battery
  6845. message_end()
  6846. }
  6847. else
  6848. {
  6849. // Update flashlight battery on HUD
  6850. message_begin(MSG_ONE_UNRELIABLE, g_msgFlashBat, _, ID_CHARGE)
  6851. write_byte(g_flashbattery[ID_CHARGE]) // battery
  6852. message_end()
  6853. }
  6854. }
  6855.  
  6856. // Remove Spawn Protection Task
  6857. public remove_spawn_protection(taskid)
  6858. {
  6859. // Not alive
  6860. if (!is_user_alive(ID_SPAWN))
  6861. return;
  6862.  
  6863. // Remove spawn protection
  6864. g_nodamage[ID_SPAWN] = false;
  6865. set_pev(ID_SPAWN, pev_effects, pev(ID_SPAWN, pev_effects) & ~EF_NODRAW)
  6866. }
  6867.  
  6868. // Task Hide Player's Money
  6869. public task_hide_money(taskid)
  6870. {
  6871. // Not alive
  6872. if (!is_user_alive(ID_SPAWN))
  6873. return;
  6874.  
  6875. // Hide money
  6876. message_begin(MSG_ONE, g_msgHideWeapon, _, ID_SPAWN)
  6877. write_byte(HIDE_MONEY) // what to hide bitsum
  6878. message_end()
  6879.  
  6880. // Hide the HL crosshair that's drawn
  6881. message_begin(MSG_ONE, g_msgCrosshair, _, ID_SPAWN)
  6882. write_byte(0) // toggle
  6883. message_end()
  6884. }
  6885.  
  6886. // Turn Off Game Flashlight
  6887. turn_off_flashlight(id)
  6888. {
  6889. // Check if flashlight is on
  6890. if (pev(id, pev_effects) & EF_DIMLIGHT)
  6891. {
  6892. // Turn it off
  6893. set_pev(id, pev_effects, pev(id, pev_effects) & ~EF_DIMLIGHT)
  6894.  
  6895. // Update HUD
  6896. message_begin(MSG_ONE, g_msgFlashlight, _, id)
  6897. write_byte(0) // toggle
  6898. write_byte(100) // battery
  6899. message_end()
  6900. }
  6901.  
  6902. // Clear any stored flashlight impulse (bugfix)
  6903. set_pev(id, pev_impulse, 0)
  6904. }
  6905.  
  6906. // Infection Grenade Explosion
  6907. infection_explode(ent)
  6908. {
  6909. // Round ended (bugfix)
  6910. if (g_endround) return;
  6911.  
  6912. // Get origin
  6913. static Float:originF[3]
  6914. pev(ent, pev_origin, originF)
  6915.  
  6916. // Make the explosion
  6917. create_blast(originF)
  6918.  
  6919. // Infection nade explode sound
  6920. engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, grenade_infect[random_num(0, sizeof grenade_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  6921.  
  6922. // Get attacker
  6923. static attacker
  6924. attacker = pev(ent, pev_owner)
  6925.  
  6926. // Collisions
  6927. static victim
  6928. victim = -1
  6929.  
  6930. while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
  6931. {
  6932. // Only effect alive non-spawnprotected humans
  6933. if (!is_user_alive(victim) || g_zombie[victim] || g_nodamage[victim])
  6934. continue;
  6935.  
  6936. // Last human is killed
  6937. if (fnGetHumans() == 1)
  6938. {
  6939. ExecuteHamB(Ham_Killed, victim, attacker, 0)
  6940. continue;
  6941. }
  6942.  
  6943. // Infected victim's sound
  6944. engfunc(EngFunc_EmitSound, victim, CHAN_VOICE, grenade_infect_player[random_num(0, sizeof grenade_infect_player - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  6945.  
  6946. SendDeathMsg(attacker, victim) // send death notice
  6947. FixDeadAttrib(victim) // fix the "dead" attrib on scoreboard
  6948. UpdateFrags(attacker, victim, get_pcvar_num(cvar_fragsinfect), 1, 1) // add corresponding frags & deaths
  6949.  
  6950. zombieme(victim, attacker, 0, 1) // turn into zombie
  6951. update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0) // ammo packs given to zombie for infection
  6952. fm_set_user_health(attacker, pev(attacker, pev_health)+get_pcvar_num(cvar_zombiebonushp)) // infection HP bonus
  6953. }
  6954.  
  6955. // Get rid of the grenade
  6956. engfunc(EngFunc_RemoveEntity, ent)
  6957. }
  6958.  
  6959.  
  6960. // Fire Grenade Explosion
  6961. fire_explode(ent)
  6962. {
  6963. // Get origin
  6964. static Float:originF[3]
  6965. pev(ent, pev_origin, originF)
  6966.  
  6967. // Make the explosion
  6968. create_blast2(originF)
  6969.  
  6970. // Fire nade explode sound
  6971. engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, grenade_fire[random_num(0, sizeof grenade_fire - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  6972.  
  6973. // Collisions
  6974. static victim
  6975. victim = -1
  6976.  
  6977. while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
  6978. {
  6979. // Only effect alive zombies
  6980. if (!is_user_alive(victim) || !g_zombie[victim] || g_nodamage[victim])
  6981. continue;
  6982.  
  6983. // Heat icon
  6984. message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim)
  6985. write_byte(0) // damage save
  6986. write_byte(0) // damage take
  6987. write_long(DMG_BURN) // damage type
  6988. write_coord(0) // x
  6989. write_coord(0) // y
  6990. write_coord(0) // z
  6991. message_end()
  6992.  
  6993. // Our task params
  6994. static params[1]
  6995.  
  6996. if (g_nemesis[victim]) // fire duration (nemesis takes less)
  6997. params[0] = get_pcvar_num(cvar_fireduration)
  6998. else
  6999. params[0] = get_pcvar_num(cvar_fireduration)*5
  7000.  
  7001. // Set burning task on victim
  7002. set_task(0.1, "burning_flame", victim+TASK_BLOOD, params, sizeof params)
  7003. }
  7004.  
  7005. // Get rid of the grenade
  7006. engfunc(EngFunc_RemoveEntity, ent)
  7007. }
  7008. // Frost Grenade Explosion
  7009. frost_explode(ent)
  7010. {
  7011. // Get origin
  7012. static Float:originF[3]
  7013. pev(ent, pev_origin, originF)
  7014.  
  7015. // Make the explosion
  7016. create_blast3(originF)
  7017.  
  7018. // Frost nade explode sound
  7019. engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, grenade_frost[random_num(0, sizeof grenade_frost - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7020.  
  7021. // Collisions
  7022. static victim
  7023. victim = -1
  7024.  
  7025. while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
  7026. {
  7027. // Only effect alive unfrozen zombies
  7028. if (!is_user_alive(victim) || !g_zombie[victim] || g_frozen[victim] || g_nodamage[victim])
  7029. continue;
  7030.  
  7031. // Nemesis shouldn't be frozen
  7032. if (g_nemesis[victim])
  7033. {
  7034. // Get player's origin
  7035. static Float:origin2F[3]
  7036. pev(victim, pev_origin, origin2F)
  7037.  
  7038. // Broken glass sound
  7039. engfunc(EngFunc_EmitSound, victim, CHAN_BODY, grenade_frost_break[random_num(0, sizeof grenade_frost_break - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7040.  
  7041. // Glass shatter
  7042. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2F, 0)
  7043. write_byte(TE_BREAKMODEL) // TE id
  7044. engfunc(EngFunc_WriteCoord, origin2F[0]) // x
  7045. engfunc(EngFunc_WriteCoord, origin2F[1]) // y
  7046. engfunc(EngFunc_WriteCoord, origin2F[2]+24.0) // z
  7047. write_coord(16) // size x
  7048. write_coord(16) // size y
  7049. write_coord(16) // size z
  7050. write_coord(random_num(-50, 50)) // velocity x
  7051. write_coord(random_num(-50, 50)) // velocity y
  7052. write_coord(25) // velocity z
  7053. write_byte(10) // random velocity
  7054. write_short(g_glassSpr) // model
  7055. write_byte(10) // count
  7056. write_byte(25) // life
  7057. write_byte(BREAK_GLASS) // flags
  7058. message_end()
  7059.  
  7060. continue;
  7061. }
  7062.  
  7063. // Freeze icon?
  7064. if (get_pcvar_num(cvar_hudicons))
  7065. {
  7066. message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim)
  7067. write_byte(0) // damage save
  7068. write_byte(0) // damage take
  7069. write_long(DMG_DROWN) // damage type - DMG_FREEZE
  7070. write_coord(0) // x
  7071. write_coord(0) // y
  7072. write_coord(0) // z
  7073. message_end()
  7074. }
  7075.  
  7076. // Light blue glow while frozen
  7077. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  7078. fm_set_rendering(g_ent_playermodel[victim], kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
  7079. #else
  7080. fm_set_rendering(victim, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
  7081. #endif
  7082.  
  7083. // Freeze sound
  7084. engfunc(EngFunc_EmitSound, victim, CHAN_BODY, grenade_frost_player[random_num(0, sizeof grenade_frost_player - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7085.  
  7086. // Get freeze duration setting
  7087. static Float:freezeduration
  7088. freezeduration = get_pcvar_float(cvar_freezeduration)
  7089.  
  7090. // Add a blue tint to their screen
  7091. message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, victim)
  7092. write_short(UNIT_SECOND*1) // duration
  7093. write_short(floatround(UNIT_SECOND*freezeduration)) // hold time
  7094. write_short(FFADE_IN) // fade type
  7095. write_byte(0) // red
  7096. write_byte(50) // green
  7097. write_byte(200) // blue
  7098. write_byte(100) // alpha
  7099. message_end()
  7100.  
  7101. // Prevent from jumping
  7102. if (pev(victim, pev_flags) & FL_ONGROUND)
  7103. set_pev(victim, pev_gravity, 999999.9) // set really high
  7104. else
  7105. set_pev(victim, pev_gravity, 0.000001) // no gravity
  7106.  
  7107. // Set a task to remove the freeze
  7108. g_frozen[victim] = true;
  7109. set_task(freezeduration, "remove_freeze", victim)
  7110. }
  7111.  
  7112. // Get rid of the grenade
  7113. engfunc(EngFunc_RemoveEntity, ent)
  7114. }
  7115.  
  7116. // Remove freeze task
  7117. public remove_freeze(id)
  7118. {
  7119. // Not alive or not frozen anymore
  7120. if (!g_frozen[id] || !is_user_alive(id))
  7121. return;
  7122.  
  7123. // Unfreeze
  7124. g_frozen[id] = false;
  7125.  
  7126. // Restore normal gravity
  7127. if (g_zombie[id])
  7128. set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]])
  7129. else
  7130. set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]])
  7131.  
  7132. // Broken glass sound
  7133. engfunc(EngFunc_EmitSound, id, CHAN_BODY, grenade_frost_break[random_num(0, sizeof grenade_frost_break - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7134.  
  7135. // Remove glow
  7136. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  7137. fm_set_rendering(g_ent_playermodel[id])
  7138. #else
  7139. fm_set_rendering(id)
  7140. #endif
  7141.  
  7142. // Get player's origin
  7143. static Float:origin2F[3]
  7144. pev(id, pev_origin, origin2F)
  7145.  
  7146. // Glass shatter
  7147. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2F, 0)
  7148. write_byte(TE_BREAKMODEL) // TE id
  7149. engfunc(EngFunc_WriteCoord, origin2F[0]) // x
  7150. engfunc(EngFunc_WriteCoord, origin2F[1]) // y
  7151. engfunc(EngFunc_WriteCoord, origin2F[2]+24.0) // z
  7152. write_coord(16) // size x
  7153. write_coord(16) // size y
  7154. write_coord(16) // size z
  7155. write_coord(random_num(-50, 50)) // velocity x
  7156. write_coord(random_num(-50, 50)) // velocity y
  7157. write_coord(25) // velocity z
  7158. write_byte(10) // random velocity
  7159. write_short(g_glassSpr) // model
  7160. write_byte(10) // count
  7161. write_byte(25) // life
  7162. write_byte(BREAK_GLASS) // flags
  7163. message_end()
  7164. }
  7165.  
  7166. // Remove Stuff Task
  7167. public remove_stuff()
  7168. {
  7169. static ent, removedoors
  7170. removedoors = get_pcvar_num(cvar_removedoors)
  7171.  
  7172. // Remove rotating doors
  7173. if (removedoors > 0)
  7174. {
  7175. ent = -1;
  7176. while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_door_rotating")) != 0)
  7177. engfunc(EngFunc_SetOrigin, ent, Float:{8192.0 ,8192.0 ,8192.0})
  7178. }
  7179.  
  7180. // Remove all doors
  7181. if (removedoors > 1)
  7182. {
  7183. ent = -1;
  7184. while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_door")) != 0)
  7185. engfunc(EngFunc_SetOrigin, ent, Float:{8192.0 ,8192.0 ,8192.0})
  7186. }
  7187.  
  7188. // Triggered lights
  7189. if (!get_pcvar_num(cvar_triggered))
  7190. {
  7191. ent = -1
  7192. while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "light")) != 0)
  7193. {
  7194. dllfunc(DLLFunc_Use, ent, 0); // turn off the light
  7195. set_pev(ent, pev_targetname, 0) // prevent it from being triggered
  7196. }
  7197. }
  7198. }
  7199.  
  7200. // Set Custom Weapon Models
  7201. public replace_models(id)
  7202. {
  7203. // Not alive
  7204. if (!is_user_alive(id))
  7205. return;
  7206.  
  7207. switch (g_currentweapon[id])
  7208. {
  7209. case CSW_KNIFE: // Custom knife models
  7210. {
  7211. if (g_zombie[id] && !g_newround && !g_endround)
  7212. {
  7213. if (g_nemesis[id]) // Nemesis
  7214. {
  7215. set_pev(id, pev_viewmodel2, model_vknife_nemesis)
  7216. set_pev(id, pev_weaponmodel2, "")
  7217. }
  7218. else // Zombies
  7219. {
  7220. static mdl[100]
  7221. formatex(mdl, sizeof mdl - 1, "models/zombie_plague/%s", g_zclass_clawmodel[g_zombieclass[id]])
  7222. set_pev(id, pev_viewmodel2, mdl)
  7223. set_pev(id, pev_weaponmodel2, "")
  7224. }
  7225. }
  7226. else // Humans
  7227. {
  7228. static mdl[999]
  7229. formatex(mdl, sizeof mdl - 1, "models/zombie_plague/%s", g_hclass_clawmodel[g_humanclass[id]])
  7230. set_pev(id, pev_viewmodel2, mdl)
  7231. set_pev(id, pev_weaponmodel2, "")
  7232. }
  7233. }
  7234. case CSW_M249: // Survivor's M249
  7235. {
  7236. if (g_survivor[id])
  7237. set_pev(id, pev_viewmodel2, model_vm249_survivor)
  7238. }
  7239. case CSW_HEGRENADE: // Infection bomb or fire grenade
  7240. {
  7241. if (g_zombie[id] && !g_newround && !g_endround)
  7242. set_pev(id, pev_viewmodel2, model_grenade_infect)
  7243. else
  7244. set_pev(id, pev_viewmodel2, model_grenade_fire)
  7245. }
  7246. case CSW_FLASHBANG: // Frost grenade
  7247. {
  7248. set_pev(id, pev_viewmodel2, model_grenade_frost)
  7249. }
  7250. case CSW_AK47: // Arma
  7251. {
  7252. if (g_akdestruction[id] == true)
  7253. {
  7254. set_pev(id, pev_viewmodel2, model_akdestruction_human) // Este es para el player que tiene el arma en la mano
  7255. set_pev(id, pev_weaponmodel2, model_akdestruction_human1) // Este es para que los demas vean el modelo del arma que llevas usando´
  7256. }
  7257. else if (g_supermide[id])
  7258. {
  7259. set_pev(id, pev_viewmodel2, model_supermide_human) // Este es para el player que tiene el arma en la mano
  7260. set_pev(id, pev_weaponmodel2, model_supermide_human1)
  7261. }
  7262. }
  7263. case CSW_SG552: // Arma
  7264. {
  7265. if (g_ultimate[id] == true) // Variable
  7266. {
  7267. set_pev(id, pev_viewmodel2, model_ultimate_human) // Este es para el player que tiene el arma en la mano
  7268. set_pev(id, pev_weaponmodel2, model_ultimate_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7269. }
  7270. else if (g_ultrak[id])
  7271. {
  7272. set_pev(id, pev_viewmodel2, model_ultrak_human) // Este es para el player que tiene el arma en la mano
  7273. set_pev(id, pev_weaponmodel2, model_ultrak_human1)
  7274. }
  7275. }
  7276. case CSW_FAMAS: // Arma
  7277. {
  7278. if (g_atomic[id] == true) // Variable
  7279. {
  7280. set_pev(id, pev_viewmodel2, model_atomic_human) // Este es para el player que tiene el arma en la mano
  7281. set_pev(id, pev_weaponmodel2, model_atomic_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7282. }
  7283. else if (g_adge[id])
  7284. {
  7285. set_pev(id, pev_viewmodel2, model_adge_human) // Este es para el player que tiene el arma en la mano
  7286. set_pev(id, pev_weaponmodel2, model_adge_human1)
  7287. }
  7288. }
  7289. case CSW_P90: // Arma
  7290. {
  7291. if (g_masive[id]) // Variable
  7292. {
  7293. set_pev(id, pev_viewmodel2, model_masive_human) // Este es para el player que tiene el arma en la mano
  7294. set_pev(id, pev_weaponmodel2, model_masive_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7295. }
  7296. }
  7297. case CSW_MP5NAVY: // Arma
  7298. {
  7299. if (g_navi[id]) // Variable
  7300. {
  7301. set_pev(id, pev_viewmodel2, model_navi_human) // Este es para el player que tiene el arma en la mano
  7302. set_pev(id, pev_weaponmodel2, model_navi_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7303. }
  7304. }
  7305. case CSW_XM1014: // Arma
  7306. {
  7307. if (g_power[id] == true) // Variable
  7308. {
  7309. set_pev(id, pev_viewmodel2, model_overpower_human) // Este es para el player que tiene el arma en la mano
  7310. set_pev(id, pev_weaponmodel2, model_overpower_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7311. }
  7312. else if (g_ultra[id])
  7313. {
  7314. set_pev(id, pev_viewmodel2, model_ultra_human) // Este es para el player que tiene el arma en la mano
  7315. set_pev(id, pev_weaponmodel2, model_ultra_human1)
  7316. }
  7317. }
  7318. case CSW_G3SG1: // Arma
  7319. {
  7320. if (g_stfu[id] == true) // Variable
  7321. {
  7322. set_pev(id, pev_viewmodel2, model_stfu_human) // Este es para el player que tiene el arma en la mano
  7323. set_pev(id, pev_weaponmodel2, model_stfu_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7324. }
  7325. else if (g_raampage[id])
  7326. {
  7327. set_pev(id, pev_viewmodel2, model_raampage_human) // Este es para el player que tiene el arma en la mano
  7328. set_pev(id, pev_weaponmodel2, model_raampage_human1)
  7329. }
  7330. }
  7331. case CSW_UMP45: // Arma
  7332. {
  7333. if (g_rlp[id]) // Variable
  7334. {
  7335. set_pev(id, pev_viewmodel2, model_rlp_human) // Este es para el player que tiene el arma en la mano
  7336. set_pev(id, pev_weaponmodel2, model_rlp_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7337. }
  7338. }
  7339. case CSW_M4A1: // Arma
  7340. {
  7341. if (g_m4[id] == true) // Variable
  7342. {
  7343. set_pev(id, pev_viewmodel2, model_m4_human) // Este es para el player que tiene el arma en la mano
  7344. set_pev(id, pev_weaponmodel2, model_m4_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7345. }
  7346. else if (g_farger[id])
  7347. {
  7348. set_pev(id, pev_viewmodel2, model_farger_human) // Este es para el player que tiene el arma en la mano
  7349. set_pev(id, pev_weaponmodel2, model_farger_human1)
  7350. }
  7351. }
  7352. case CSW_M3: // Arma
  7353. {
  7354. if (g_barret[id] == true) // Variable
  7355. {
  7356. set_pev(id, pev_viewmodel2, model_barret_human) // Este es para el player que tiene el arma en la mano
  7357. set_pev(id, pev_weaponmodel2, model_barret_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7358. }
  7359. else if (g_super[id])
  7360. {
  7361. set_pev(id, pev_viewmodel2, model_super_human) // Este es para el player que tiene el arma en la mano
  7362. set_pev(id, pev_weaponmodel2, model_super_human1)
  7363. }
  7364. }
  7365. case CSW_GALI: // Arma
  7366. {
  7367. if (g_devil[id] == true) // Variable
  7368. {
  7369. set_pev(id, pev_viewmodel2, model_devil_human) // Este es para el player que tiene el arma en la mano
  7370. set_pev(id, pev_weaponmodel2, model_devil_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7371. }
  7372. else if (g_storm[id])
  7373. {
  7374. set_pev(id, pev_viewmodel2, model_storm_human) // Este es para el player que tiene el arma en la mano
  7375. set_pev(id, pev_weaponmodel2, model_storm_human1)
  7376. }
  7377. }
  7378. case CSW_AUG: // Arma
  7379. {
  7380. if (g_rampage[id] == true) // Variable
  7381. {
  7382. set_pev(id, pev_viewmodel2, model_rampage_human) // Este es para el player que tiene el arma en la mano
  7383. set_pev(id, pev_weaponmodel2, model_rampage_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7384. }
  7385. else if (g_nule[id])
  7386. {
  7387. set_pev(id, pev_viewmodel2, model_nule_human) // Este es para el player que tiene el arma en la mano
  7388. set_pev(id, pev_weaponmodel2, model_nule_human1)
  7389. }
  7390. }
  7391. case CSW_SMOKEGRENADE: // Flare grenade
  7392. {
  7393. set_pev(id, pev_viewmodel2, model_grenade_flare)
  7394. }
  7395. }
  7396.  
  7397. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  7398. fm_set_weaponmodel_ent(id)
  7399. #endif
  7400. }
  7401.  
  7402. // Reset Player Vars
  7403. reset_vars(id, resetall)
  7404. {
  7405. g_zombie[id] = false
  7406. g_nemesis[id] = false
  7407. g_armagedon[id] = false
  7408. g_survivor[id] = false
  7409. g_firstzombie[id] = false
  7410. g_lastzombie[id] = false
  7411. g_lasthuman[id] = false
  7412. g_frozen[id] = false
  7413. g_nodamage[id] = false
  7414. g_respawn_as_zombie[id] = false
  7415. g_nvision[id] = false
  7416. g_nvisionenabled[id] = false
  7417. g_flashlight[id] = false
  7418. g_flashbattery[id] = 100
  7419. g_canbuy[id] = true
  7420.  
  7421. if (resetall)
  7422. {
  7423. g_ammopacks[id] = 0
  7424. g_zombieclass[id] = ZCLASS_NONE
  7425. g_zombieclassnext[id] = ZCLASS_NONE
  7426. g_humanclass[id] = HCLASS_NONE
  7427. g_humanclassnext[id] = HCLASS_NONE
  7428. g_damagedealt[id] = 0
  7429. WPN_AUTO_ON = 0
  7430. }
  7431. }
  7432.  
  7433. // Set spectators nightvision
  7434. public spec_nvision(id)
  7435. {
  7436. // Not connected, playing, or bot
  7437. if (!is_user_connected(id) || is_user_alive(id) || is_user_bot(id))
  7438. return;
  7439.  
  7440. // Give Night Vision?
  7441. if (get_pcvar_num(cvar_nvggive))
  7442. {
  7443. g_nvision[id] = true
  7444.  
  7445. // Turn on Night Vision automatically?
  7446. if (get_pcvar_num(cvar_nvggive) == 1)
  7447. {
  7448. g_nvisionenabled[id] = true
  7449.  
  7450. // Custom nvg?
  7451. if (get_pcvar_num(cvar_cnvg))
  7452. {
  7453. remove_task(id+TASK_NVISION)
  7454. set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
  7455. }
  7456. else set_user_gnvision(id, 1)
  7457. }
  7458. }
  7459. }
  7460.  
  7461. // Show HUD Task
  7462. public ShowHUD(taskid)
  7463. {
  7464. static id
  7465. id = ID_SHOWHUD;
  7466.  
  7467. // Player died?
  7468. if (!is_user_alive(id))
  7469. {
  7470. // Get spectating target
  7471. id = pev(id, PEV_SPEC_TARGET)
  7472.  
  7473. // Target not alive
  7474. if (!is_user_alive(id)) return;
  7475. }
  7476.  
  7477. // Format the classname
  7478. static class[32], red, green, blue
  7479.  
  7480. if (g_zombie[id]) // zombies
  7481. {
  7482. red = 200
  7483. green = 250
  7484. blue = 0
  7485.  
  7486. if (g_nemesis[id])
  7487. formatex(class, sizeof class - 1, "%L", ID_SHOWHUD,"CLASS_NEMESIS")
  7488. else
  7489. copy(class, sizeof class - 1, g_zclass_name[g_zombieclass[id]])
  7490. }
  7491. else // humans
  7492. {
  7493. red = 0
  7494. green = 255
  7495. blue = 0
  7496.  
  7497. if (g_survivor[id])
  7498. formatex(class, sizeof class - 1, "%L", ID_SHOWHUD,"CLASS_SURVIVOR")
  7499. else
  7500. copy(class, sizeof class - 1, g_hclass_name[g_humanclass[id]])
  7501. }
  7502.  
  7503. // Spectating someone else?
  7504. if (id != ID_SHOWHUD)
  7505. {
  7506. static name[32]
  7507. get_user_name(id, name, sizeof name - 1)
  7508.  
  7509. // Show name, health, class, and ammo packs
  7510. set_hudmessage(70, 175, 140, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
  7511. ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "%L %s^nVida: %d^n%L %s^n%L %d^nLevel: %d^nChaleco: %d^nResets: %d^nGran Resets: %d", ID_SHOWHUD, "SPECTATING", name, pev(id, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[id], g_level[id], get_user_armor(id), g_reset[id], g_grandreset[id])
  7512. }
  7513. else
  7514. {
  7515. // Show health, class and ammo packs
  7516. set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, -1.0, -1)
  7517. ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "-[%L: %d] -[%L %s]^n-[%L %d] -[Level: %d/1000]^n-[Chaleco: %d] -[Resets: %d]^n-[Gran Resets: %d]^n-[Zombies Matados %d] -[Humanos Matados %d]^n-[Infectados %d]^n==============================^n-[Cuenta: %s]^n==============================", id, "ZOMBIE_ATTRIB1", pev(ID_SHOWHUD, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1",
  7518. g_ammopacks[ID_SHOWHUD], g_level[id], get_user_armor(id), g_reset[id], g_grandreset[id], g_matados[id], g_matadosz[id], g_infectados[id], g_playername[id])
  7519. }
  7520. }
  7521.  
  7522. // Play idle zombie sounds
  7523. public zombie_play_idle(taskid)
  7524. {
  7525. // Round ended/new one starting
  7526. if (g_endround || g_newround)
  7527. return;
  7528.  
  7529. // Last zombie?
  7530. if (g_lastzombie[ID_BLOOD])
  7531. engfunc(EngFunc_EmitSound, ID_BLOOD, CHAN_VOICE, zombie_idle_last[random_num(0, sizeof zombie_idle_last - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7532. else
  7533. engfunc(EngFunc_EmitSound, ID_BLOOD, CHAN_VOICE, zombie_idle[random_num(0, sizeof zombie_idle - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7534. }
  7535.  
  7536. // Madness Over Task
  7537. public madness_over(taskid)
  7538. {
  7539. g_nodamage[ID_BLOOD] = false
  7540. }
  7541.  
  7542. // Place user at a random spawn
  7543. do_random_spawn(id)
  7544. {
  7545. // No spawns?
  7546. if (!g_spawnCount)
  7547. return;
  7548.  
  7549. // Get whether the player is crouching
  7550. static hull
  7551. hull = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN
  7552.  
  7553. // Choose random spawn to start looping at
  7554. static sp_index, i
  7555. sp_index = random_num(0, g_spawnCount - 1)
  7556.  
  7557. // Try to find a clear spawn
  7558. for (i = sp_index + 1; i != 999; i++)
  7559. {
  7560. // Start over when we reach the end
  7561. if (i >= g_spawnCount) i = 0
  7562.  
  7563. // Free spawn space?
  7564. if (is_hull_vacant(g_spawns[i], hull))
  7565. {
  7566. // Engfunc_SetOrigin is used so ent's mins and maxs get updated instantly
  7567. engfunc(EngFunc_SetOrigin, id, g_spawns[i])
  7568. break;
  7569. }
  7570.  
  7571. // Loop completed, no free space found
  7572. if (i == sp_index) break;
  7573. }
  7574. }
  7575.  
  7576. // Get Zombies -returns alive zombies number-
  7577. fnGetZombies()
  7578. {
  7579. static iZombies, id
  7580. iZombies = 0
  7581.  
  7582. for (id = 1; id <= g_maxplayers; id++)
  7583. {
  7584. if (is_user_alive(id) && g_zombie[id])
  7585. iZombies++
  7586. }
  7587.  
  7588. return iZombies;
  7589. }
  7590. // Get Humans -returns alive humans number-
  7591. fnGetHumans()
  7592. {
  7593. static iHumans, id
  7594. iHumans = 0
  7595.  
  7596. for (id = 1; id <= g_maxplayers; id++)
  7597. {
  7598. if (is_user_alive(id) && !g_zombie[id])
  7599. iHumans++
  7600. }
  7601.  
  7602. return iHumans;
  7603. }
  7604.  
  7605. // Get Alive -returns alive players number-
  7606. fnGetAlive()
  7607. {
  7608. static iAlive, id
  7609. iAlive = 0
  7610.  
  7611. for (id = 1; id <= g_maxplayers; id++)
  7612. {
  7613. if (is_user_alive(id))
  7614. iAlive++
  7615. }
  7616.  
  7617. return iAlive;
  7618. }
  7619. // Get Random Alive -returns index of alive player number n -
  7620. fnGetRandomAlive(n)
  7621. {
  7622. static iAlive, id
  7623. iAlive = 0
  7624.  
  7625. for (id = 1; id <= g_maxplayers; id++)
  7626. {
  7627. if (is_user_alive(id))
  7628. iAlive++
  7629.  
  7630. if (iAlive == n)
  7631. return id;
  7632. }
  7633.  
  7634. return -1;
  7635. }
  7636.  
  7637.  
  7638. // Get Playing -returns number of users playing-
  7639. fnGetPlaying()
  7640. {
  7641. static iPlaying, id, team
  7642. iPlaying = 0
  7643.  
  7644. for (id = 1; id <= g_maxplayers; id++)
  7645. {
  7646. if (is_user_connected(id))
  7647. {
  7648. team = fm_get_user_team(id)
  7649.  
  7650. if (team != CS_TEAM_SPECTATOR && team != CS_TEAM_UNASSIGNED)
  7651. iPlaying++
  7652. }
  7653. }
  7654.  
  7655. return iPlaying;
  7656. }
  7657.  
  7658. // Get CTs -returns number of CTs connected-
  7659. fnGetCTs()
  7660. {
  7661. static iCTs, id
  7662. iCTs = 0
  7663.  
  7664. for (id = 1; id <= g_maxplayers; id++)
  7665. {
  7666. if (is_user_connected(id))
  7667. {
  7668. if (fm_get_user_team(id) == CS_TEAM_CT)
  7669. iCTs++
  7670. }
  7671. }
  7672.  
  7673. return iCTs;
  7674. }
  7675.  
  7676. // Get Ts -returns number of Ts connected-
  7677. fnGetTs()
  7678. {
  7679. static iTs, id
  7680. iTs = 0
  7681.  
  7682. for (id = 1; id <= g_maxplayers; id++)
  7683. {
  7684. if (is_user_connected(id))
  7685. {
  7686. if (fm_get_user_team(id) == CS_TEAM_T)
  7687. iTs++
  7688. }
  7689. }
  7690.  
  7691. return iTs;
  7692. }
  7693.  
  7694. // Last Zombie Check -check for last zombie and set its flag-
  7695. public fnCheckLastZombie()
  7696. {
  7697. static id
  7698. for (id = 1; id <= g_maxplayers; id++)
  7699. {
  7700. // Last zombie
  7701. if (g_zombie[id] && is_user_alive(id) && fnGetZombies() == 1)
  7702. g_lastzombie[id] = true
  7703. else
  7704. g_lastzombie[id] = false
  7705.  
  7706. // Last human
  7707. if (!g_zombie[id] && !g_survivor[id] && is_user_alive(id) && fnGetHumans() == 1)
  7708. {
  7709. // Reward extra hp for last human?
  7710. if (!g_lasthuman[id]) fm_set_user_health(id, g_hclass_hp[g_humanclass[id]] + H_SALUD(g_skill_points[id][0][1]))
  7711. g_lasthuman[id] = true
  7712. }
  7713. else
  7714. g_lasthuman[id] = false
  7715. }
  7716. }
  7717.  
  7718. // Save player's stats into the database
  7719. save_stats(id)
  7720. {
  7721. // Get user name
  7722. static name[32]
  7723. get_user_name(id, name, sizeof name - 1)
  7724.  
  7725. // Check whether there is another record already in that slot
  7726. if (db_name[id][0] && !equal(name, db_name[id]))
  7727. {
  7728. // If DB size is exceeded, write over old records
  7729. if (db_slot_i >= sizeof db_name)
  7730. db_slot_i = g_maxplayers+1
  7731.  
  7732. // Move previous record onto an additional save slot
  7733. copy(db_name[db_slot_i], sizeof db_name[] - 1, db_name[id])
  7734. db_ammopacks[db_slot_i] = db_ammopacks[id]
  7735. db_zombieclass[db_slot_i] = db_zombieclass[id]
  7736. db_slot_i++
  7737. }
  7738.  
  7739. // Now save the current player stats
  7740. copy(db_name[id], sizeof db_name[] - 1, name) // name
  7741. db_ammopacks[id] = g_ammopacks[id] // ammo packs
  7742. db_zombieclass[id] = g_zombieclassnext[id] // zombie class
  7743. db_humanclass[id] = g_humanclassnext[id] // human class
  7744. }
  7745.  
  7746. // Load player's stats from the database (if a record is found)
  7747. load_stats(id)
  7748. {
  7749. // Get user name
  7750. static name[32], i
  7751. get_user_name(id, name, sizeof name - 1)
  7752.  
  7753. // Look for a matching record in the DB
  7754. for (i = 0; i < sizeof db_name; i++)
  7755. {
  7756. if (equal(name, db_name[i]))
  7757. {
  7758. // Bingo!
  7759. g_ammopacks[id] = db_ammopacks[i]
  7760. g_zombieclass[id] = db_zombieclass[i]
  7761. g_zombieclassnext[id] = db_zombieclass[i]
  7762. g_humanclass[id] = db_humanclass[i]
  7763. g_humanclassnext[id] = db_humanclass[i]
  7764. return;
  7765. }
  7766. }
  7767. }
  7768.  
  7769. // Checks if a player should leap
  7770. allowed_leap(id)
  7771. {
  7772. // Leap available for zombies/nemesis/survivor only
  7773. if ((!g_zombie[id] && !g_survivor[id]) || g_frozen[id])
  7774. return false;
  7775.  
  7776. // Nemesis cvar not enabled
  7777. if (g_nemesis[id] && !get_pcvar_num(cvar_leapnemesis))
  7778. return false;
  7779.  
  7780. // Survivor cvar not enabled
  7781. if (g_survivor[id] && !get_pcvar_num(cvar_leapsurvivor))
  7782. return false;
  7783.  
  7784. // Get zombie cvar
  7785. static leapzombies
  7786. leapzombies = get_pcvar_num(cvar_leapzombies)
  7787.  
  7788. // Zombie cvar not enabled
  7789. if (leapzombies == 0 && !g_nemesis[id] && !g_survivor[id])
  7790. return false;
  7791.  
  7792. // Not the first zombie
  7793. if (leapzombies == 2 && !g_nemesis[id] && !g_survivor[id] && !g_firstzombie[id])
  7794. return false;
  7795.  
  7796. // Not the last zombie
  7797. if (leapzombies == 3 && !g_nemesis[id] && !g_survivor[id] && !g_lastzombie[id])
  7798. return false;
  7799.  
  7800. // Get currently pressed buttons
  7801. static buttons
  7802. buttons = pev(id, pev_button)
  7803.  
  7804. // Not doing a longjump (added bot support)
  7805. if ((!(buttons & IN_JUMP) || !(buttons & IN_DUCK)) && !is_user_bot(id))
  7806. return false;
  7807.  
  7808. // Get cooldown cvar
  7809. static Float:cooldown
  7810. cooldown = g_survivor[id] ? get_pcvar_float(cvar_leapsurvivorcooldown) : g_nemesis[id] ? get_pcvar_float(cvar_leapnemesiscooldown) : get_pcvar_float(cvar_leapzombiescooldown)
  7811.  
  7812. // Cooldown not over yet
  7813. if (get_gametime() - g_lastleaptime[id] < cooldown)
  7814. return false;
  7815.  
  7816. // Not on ground or not enough speed
  7817. if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
  7818. return false;
  7819.  
  7820. return true;
  7821. }
  7822.  
  7823. // Checks if a player should be Pain Shock Free
  7824. allowed_painshockfree(id)
  7825. {
  7826.  
  7827. // Pain shock free available for zombies/nemesis/survivor only
  7828. if (!g_zombie[id] && !g_survivor[id])
  7829. return false;
  7830.  
  7831. // Nemesis cvar not enabled
  7832. if (g_nemesis[id] && !get_pcvar_num(cvar_nempainfree))
  7833. return false;
  7834.  
  7835. // Survivor cvar not enabled
  7836. if (g_survivor[id] && !get_pcvar_num(cvar_survpainfree))
  7837. return false;
  7838.  
  7839. // Get zombie cvar
  7840. static zombiepainfree
  7841. zombiepainfree = get_pcvar_num(cvar_zombiepainfree)
  7842.  
  7843. // Zombie cvar not enabled
  7844. if (zombiepainfree == 0 && !g_survivor[id] && !g_nemesis[id])
  7845. return false;
  7846.  
  7847. // Not the last zombie
  7848. if (zombiepainfree == 2 && !g_survivor[id] && !g_nemesis[id] && !g_lastzombie[id])
  7849. return false;
  7850.  
  7851. // Not on ground
  7852. if (!(pev(id, pev_flags) & FL_ONGROUND))
  7853. return false;
  7854.  
  7855. return true;
  7856. }
  7857.  
  7858. // Checks if a player is allowed to be zombie
  7859. allowed_zombie(id)
  7860. {
  7861. if (!is_user_alive(id) || g_zombie[id] || g_swarmround || g_nemround || g_survround || g_plagueround || g_endround || task_exists(TASK_WELCOMEMSG) || (!g_zombie[id] && fnGetHumans() == 1))
  7862. return false
  7863.  
  7864. return true
  7865. }
  7866.  
  7867. // Checks if a player is allowed to be human
  7868. allowed_human(id)
  7869. {
  7870. if (!is_user_alive(id) || !g_zombie[id] || g_swarmround || g_nemround || g_survround || g_plagueround || g_endround || task_exists(TASK_WELCOMEMSG) || (g_zombie[id] && fnGetZombies() == 1))
  7871. return false
  7872.  
  7873. return true
  7874. }
  7875.  
  7876. // Checks if a player is allowed to be survivor
  7877. allowed_survivor(id)
  7878. {
  7879. if (!is_user_alive(id) || !get_pcvar_num(cvar_surv) || g_endround || !g_newround || task_exists(TASK_WELCOMEMSG))
  7880. return false
  7881.  
  7882. return true
  7883. }
  7884.  
  7885. // Checks if a player is allowed to be nemesis
  7886. allowed_nemesis(id)
  7887. {
  7888. if (!is_user_alive(id) || !get_pcvar_num(cvar_nem) || g_endround || !g_newround || task_exists(TASK_WELCOMEMSG))
  7889. return false
  7890.  
  7891. return true
  7892. }
  7893.  
  7894. // Checks if a player is allowed to respawn
  7895. allowed_respawn(id)
  7896. {
  7897. if (!is_user_connected(id) || is_user_alive(id) || g_endround || g_survround || g_swarmround || g_nemround || g_plagueround)
  7898. return false
  7899.  
  7900. return true
  7901. }
  7902.  
  7903. // Checks if swarm mode is allowed
  7904. allowed_swarm()
  7905. {
  7906. if (!get_pcvar_num(cvar_swarm) || g_endround || !g_newround || task_exists(TASK_WELCOMEMSG))
  7907. return false
  7908.  
  7909. return true
  7910. }
  7911.  
  7912. // Checks if multi infection mode is allowed
  7913. allowed_multi()
  7914. {
  7915. if (!get_pcvar_num(cvar_multi) || g_endround || !g_newround || task_exists(TASK_WELCOMEMSG) || floatround(fnGetAlive()*get_pcvar_float(cvar_multiratio), floatround_ceil) < 2)
  7916. return false
  7917.  
  7918. return true
  7919. }
  7920.  
  7921. // Checks if plague mode is allowed
  7922. allowed_plague()
  7923. {
  7924. if (!get_pcvar_num(cvar_plague) || g_endround || !g_newround || task_exists(TASK_WELCOMEMSG) || floatround((fnGetAlive()-2)*get_pcvar_float(cvar_plagueratio), floatround_ceil) < 1)
  7925. return false
  7926.  
  7927. return true
  7928. }
  7929.  
  7930. // Admin Command. zp_zombie
  7931. command_zombie(id, player)
  7932. {
  7933. static name1[32], name2[32]
  7934. get_user_name(id, name1, sizeof name1 - 1)
  7935. get_user_name(player, name2, sizeof name2 - 1)
  7936.  
  7937. // Show activity?
  7938. switch (get_pcvar_num(cvar_showactivity))
  7939. {
  7940. case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_INFECT")
  7941. case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_INFECT")
  7942. }
  7943.  
  7944. // Log to Zombie Plague log file?
  7945. if (get_pcvar_num(cvar_logcommands))
  7946. {
  7947. static logdata[100], authid[32], ip[16]
  7948. get_user_authid(id, authid, sizeof authid - 1)
  7949. get_user_ip(id, ip, sizeof ip - 1, 1)
  7950. formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %s %L (Players: %d/%d)", name1, authid, ip, name2, LANG_SERVER, "CMD_INFECT", fnGetPlaying(), g_maxplayers)
  7951. log_to_file("zombieplague.log", logdata)
  7952. }
  7953.  
  7954. // New round?
  7955. if (g_newround)
  7956. {
  7957. // Set as first zombie
  7958. remove_task(TASK_MAKEZOMBIE)
  7959. make_a_zombie(MODE_INFECTION, player)
  7960. }
  7961. else
  7962. {
  7963. // Just infect
  7964. zombieme(player, 0, 0, 0)
  7965. }
  7966. }
  7967.  
  7968. // Admin Command. zp_human
  7969. command_human(id, player)
  7970. {
  7971. static name1[32], name2[32]
  7972. get_user_name(id, name1, sizeof name1 - 1)
  7973. get_user_name(player, name2, sizeof name2 - 1)
  7974.  
  7975. // Show activity?
  7976. switch (get_pcvar_num(cvar_showactivity))
  7977. {
  7978. case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_DISINFECT")
  7979. case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_DISINFECT")
  7980. }
  7981.  
  7982. // Log to Zombie Plague log file?
  7983. if (get_pcvar_num(cvar_logcommands))
  7984. {
  7985. static logdata[100], authid[32], ip[16]
  7986. get_user_authid(id, authid, sizeof authid - 1)
  7987. get_user_ip(id, ip, sizeof ip - 1, 1)
  7988. formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %s %L (Players: %d/%d)", name1, authid, ip, name2, LANG_SERVER,"CMD_DISINFECT", fnGetPlaying(), g_maxplayers)
  7989. log_to_file("zombieplague.log", logdata)
  7990. }
  7991.  
  7992. // Turn to human
  7993. humanme(player, 0)
  7994. }
  7995.  
  7996. // Admin Command. zp_survivor
  7997. command_survivor(id, player)
  7998. {
  7999. static name1[32], name2[32]
  8000. get_user_name(id, name1, sizeof name1 - 1)
  8001. get_user_name(player, name2, sizeof name2 - 1)
  8002.  
  8003. // Show activity?
  8004. switch (get_pcvar_num(cvar_showactivity))
  8005. {
  8006. case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_SURVIVAL")
  8007. case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_SURVIVAL")
  8008. }
  8009.  
  8010. // Log to Zombie Plague log file?
  8011. if (get_pcvar_num(cvar_logcommands))
  8012. {
  8013. static logdata[100]
  8014. formatex(logdata, sizeof logdata - 1, "ADMIN %s - %s %L (Players: %d/%d)", name1, name2, LANG_SERVER,"CMD_SURVIVAL", fnGetPlaying(), g_maxplayers)
  8015. log_to_file("zombieplague.log", logdata)
  8016. }
  8017.  
  8018. // Turn into a Survivor
  8019. remove_task(TASK_MAKEZOMBIE)
  8020. make_a_zombie(MODE_SURVIVOR, player)
  8021. }
  8022. // Admin Command. zp_nemesis
  8023. command_nemesis(id, player)
  8024. {
  8025. static name1[32], name2[32]
  8026. get_user_name(id, name1, sizeof name1 - 1)
  8027. get_user_name(player, name2, sizeof name2 - 1)
  8028.  
  8029. // Show activity?
  8030. switch (get_pcvar_num(cvar_showactivity))
  8031. {
  8032. case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_NEMESIS")
  8033. case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_NEMESIS")
  8034. }
  8035.  
  8036. // Log to Zombie Plague log file?
  8037. if (get_pcvar_num(cvar_logcommands))
  8038. {
  8039. static logdata[100]
  8040. formatex(logdata, sizeof logdata - 1, "ADMIN %s - %s %L (Players: %d/%d)", name1, name2, LANG_SERVER,"CMD_NEMESIS", fnGetPlaying(), g_maxplayers)
  8041. log_to_file("zombieplague.log", logdata)
  8042. }
  8043.  
  8044. // Turn into a Nemesis
  8045. remove_task(TASK_MAKEZOMBIE)
  8046. make_a_zombie(MODE_NEMESIS, player)
  8047. }
  8048. // Admin Command. zp_respawn
  8049. command_respawn(id, player)
  8050. {
  8051. static name1[32], name2[32]
  8052. get_user_name(id, name1, sizeof name1 - 1)
  8053. get_user_name(player, name2, sizeof name2 - 1)
  8054.  
  8055. // Show activity?
  8056. switch (get_pcvar_num(cvar_showactivity))
  8057. {
  8058. case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_RESPAWN")
  8059. case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_RESPAWN")
  8060. }
  8061.  
  8062. // Log to Zombie Plague log file?
  8063. if (get_pcvar_num(cvar_logcommands))
  8064. {
  8065. static logdata[100]
  8066. formatex(logdata, sizeof logdata - 1, "ADMIN %s - %s %L (Players: %d/%d)", name1, name2, LANG_SERVER, "CMD_RESPAWN", fnGetPlaying(), g_maxplayers)
  8067. log_to_file("zombieplague.log", logdata)
  8068. }
  8069.  
  8070. // Respawn as zombie?
  8071. if ((get_pcvar_num(cvar_deathmatch) == 2) || (get_pcvar_num(cvar_deathmatch) == 3 && random_num(0, 1)))
  8072. g_respawn_as_zombie[player] = true
  8073.  
  8074. respawn_player(player+TASK_SPAWN);
  8075. }
  8076.  
  8077.  
  8078. // Admin Command. zp_swarm
  8079. command_swarm(id)
  8080. {
  8081. static name1[32]
  8082. get_user_name(id, name1, sizeof name1 - 1)
  8083.  
  8084. // Show activity?
  8085. switch (get_pcvar_num(cvar_showactivity))
  8086. {
  8087. case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_SWARM")
  8088. case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_SWARM")
  8089. }
  8090.  
  8091. // Log to Zombie Plague log file?
  8092. if (get_pcvar_num(cvar_logcommands))
  8093. {
  8094. static logdata[100]
  8095. formatex(logdata, sizeof logdata - 1, "ADMIN %s - %L (Players: %d/%d)", name1, LANG_SERVER, "CMD_SWARM", fnGetPlaying(), g_maxplayers)
  8096. log_to_file("zombieplague.log", logdata)
  8097. }
  8098.  
  8099. // Call Swarm Mode
  8100. remove_task(TASK_MAKEZOMBIE)
  8101. make_a_zombie(MODE_SWARM, 0)
  8102. }
  8103. command_armagedon(id)
  8104. {
  8105. static name1[32]
  8106. get_user_name(id, name1, sizeof name1 - 1)
  8107.  
  8108. // Show activity?
  8109. switch (get_pcvar_num(cvar_showactivity))
  8110. {
  8111. case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_ARMAGEDON")
  8112. case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_ARMAGEDON")
  8113. }
  8114.  
  8115. // Log to Zombie Plague log file?
  8116. if (get_pcvar_num(cvar_logcommands))
  8117. {
  8118. static logdata[100], authid[32], ip[16]
  8119. get_user_authid(id, authid, sizeof authid - 1)
  8120. get_user_ip(id, ip, sizeof ip - 1, 1)
  8121. formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %L (Players: %d/%d)", name1, authid, ip, LANG_SERVER, "CMD_ARMAGEDON", fnGetPlaying(), g_maxplayers)
  8122. log_to_file("zombieplague.log", logdata)
  8123. }
  8124.  
  8125. // Call Swarm Mode
  8126. remove_task(TASK_MAKEZOMBIE)
  8127. make_a_zombie(MODE_ARMAGEDON, 0)
  8128. }
  8129.  
  8130. // Admin Command. zp_multi
  8131. command_multi(id)
  8132. {
  8133. static name1[32]
  8134. get_user_name(id, name1, sizeof name1 - 1)
  8135.  
  8136. // Show activity?
  8137. switch (get_pcvar_num(cvar_showactivity))
  8138. {
  8139. case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_MULTI")
  8140. case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_MULTI")
  8141. }
  8142.  
  8143. // Log to Zombie Plague log file?
  8144. if (get_pcvar_num(cvar_logcommands))
  8145. {
  8146. static logdata[100]
  8147. formatex(logdata, sizeof logdata - 1, "ADMIN %s - %L (Players: %d/%d)", name1, LANG_SERVER,"CMD_MULTI", fnGetPlaying(), g_maxplayers)
  8148. log_to_file("zombieplague.log", logdata)
  8149. }
  8150.  
  8151. // Call Multi Infection
  8152. remove_task(TASK_MAKEZOMBIE)
  8153. make_a_zombie(MODE_MULTI, 0)
  8154. }
  8155. // Admin Command. zp_plague
  8156. command_plague(id)
  8157. {
  8158. static name1[32]
  8159. get_user_name(id, name1, sizeof name1 - 1)
  8160.  
  8161. // Show activity?
  8162. switch (get_pcvar_num(cvar_showactivity))
  8163. {
  8164. case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_PLAGUE")
  8165. case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_PLAGUE")
  8166. }
  8167.  
  8168. // Log to Zombie Plague log file?
  8169. if (get_pcvar_num(cvar_logcommands))
  8170. {
  8171. static logdata[100]
  8172. formatex(logdata, sizeof logdata - 1, "ADMIN %s - %L (Players: %d/%d)", name1, LANG_SERVER,"CMD_PLAGUE", fnGetPlaying(), g_maxplayers)
  8173. log_to_file("zombieplague.log", logdata)
  8174. }
  8175.  
  8176. // Call Plague Mode
  8177. remove_task(TASK_MAKEZOMBIE)
  8178. make_a_zombie(MODE_PLAGUE, 0)
  8179. }
  8180.  
  8181. /*================================================================================
  8182. [Custom Natives]
  8183. =================================================================================*/
  8184.  
  8185. // Native: zp_get_user_zombie
  8186. public native_get_user_zombie(id)
  8187. {
  8188. return g_zombie[id];
  8189. }
  8190.  
  8191. // Native: zp_get_user_nemesis
  8192. public native_get_user_nemesis(id)
  8193. {
  8194. return g_nemesis[id];
  8195. }
  8196.  
  8197. // Native: zp_get_user_survivor
  8198. public native_get_user_survivor(id)
  8199. {
  8200. return g_survivor[id];
  8201. }
  8202.  
  8203. public native_get_user_first_zombie(id)
  8204. {
  8205. return g_firstzombie[id];
  8206. }
  8207.  
  8208. // Native: zp_get_user_armagedon
  8209. public native_get_user_armagedon(id)
  8210. {
  8211. return g_armagedon[id];
  8212. }
  8213.  
  8214. // Native: zp_is_armagedon_round
  8215. public native_is_armagedon_round()
  8216. {
  8217. return g_armagedonround;
  8218. }
  8219.  
  8220. // Native: zp_get_user_last_zombie
  8221. public native_get_user_last_zombie(id)
  8222. {
  8223. return g_lastzombie[id];
  8224. }
  8225.  
  8226. // Native: zp_get_user_last_human
  8227. public native_get_user_last_human(id)
  8228. {
  8229. return g_lasthuman[id];
  8230. }
  8231.  
  8232. // Native: zp_get_user_zombie_class
  8233. public native_get_user_zombie_class(id)
  8234. {
  8235. return g_zombieclass[id];
  8236. }
  8237.  
  8238. // Native: zp_set_user_zombie_class
  8239. public native_set_user_zombie_class(id, classid)
  8240. {
  8241. g_zombieclassnext[id] = classid
  8242. }
  8243.  
  8244. // Native: zp_get_user_human_class
  8245. public native_get_user_human_class(id)
  8246. {
  8247. return g_humanclass[id];
  8248. }
  8249.  
  8250. // Native: zp_set_user_human_class
  8251. public native_set_user_human_class(id, classid)
  8252. {
  8253. g_humanclassnext[id] = classid
  8254. }
  8255.  
  8256. // Native: zp_get_user_ammo_packs
  8257. public native_get_user_ammo_packs(id)
  8258. {
  8259. return g_ammopacks[id];
  8260. }
  8261.  
  8262. // Native: zp_get_user_level
  8263. public native_get_user_level(id)
  8264. {
  8265. return g_level[id];
  8266. }
  8267.  
  8268. // Native: zp_get_user_levels
  8269. public native_get_user_levels(id)
  8270. {
  8271. return g_level[id]; //donde dice variable de lvl pongan su variable
  8272. }
  8273.  
  8274. // Native: zp_set_user_levels
  8275. public native_set_user_levels(id, amount)
  8276. {
  8277. return g_level[id] = amount; //donde dice variable de lvl pongan su variable
  8278. }
  8279. // Native: zp_set_user_ammo_packs
  8280. public native_set_user_ammo_packs(id, amount)
  8281. {
  8282. return update_ap(id, 0 - g_ammopacks[id] + amount, 0)
  8283. }
  8284.  
  8285. // Native: zp_get_zombie_maxhealth
  8286. public native_get_zombie_maxhealth(id)
  8287. {
  8288. if (g_zombie[id] && !g_nemesis[id])
  8289. {
  8290. if (g_firstzombie[id])
  8291. return floatround(g_zclass_hp[g_zombieclass[id]]*get_pcvar_float(cvar_zombiefirsthp));
  8292. else
  8293. return g_zclass_hp[g_zombieclass[id]];
  8294. }
  8295. return -1;
  8296. }
  8297.  
  8298. // Native: zp_get_user_batteries
  8299. public native_get_user_batteries(id)
  8300. {
  8301. return g_flashbattery[id];
  8302. }
  8303.  
  8304. // Native: zp_set_user_batteries
  8305. public native_set_user_batteries(id, value)
  8306. {
  8307. g_flashbattery[id] = value;
  8308. }
  8309.  
  8310. // Native: zp_infect_user
  8311. public native_infect_user(id, infector)
  8312. {
  8313. // Not allowed to be zombie or round not started yet
  8314. if (!allowed_zombie(id) || g_newround)
  8315. return 0;
  8316.  
  8317. // Infect
  8318. zombieme(id, infector, 0, 0)
  8319. return 1;
  8320. }
  8321.  
  8322. // Native: zp_disinfect_user
  8323. public native_disinfect_user(id)
  8324. {
  8325. // Not allowed to be human
  8326. if (!allowed_human(id))
  8327. return 0;
  8328.  
  8329. // Turn to human
  8330. humanme(id, 0)
  8331. return 1;
  8332. }
  8333.  
  8334. // Native: zp_respawn_user
  8335. public native_respawn_user(id, team)
  8336. {
  8337. // Respawn not allowed
  8338. if (!allowed_respawn(id))
  8339. return 0;
  8340.  
  8341. // Respawn as zombie?
  8342. g_respawn_as_zombie[id] = (team == ZP_TEAM_ZOMBIE) ? true : false
  8343.  
  8344. // Respawnish!
  8345. respawn_player(id+TASK_SPAWN)
  8346. return 1;
  8347. }
  8348.  
  8349. // Native: zp_has_round_started
  8350. public native_has_round_started()
  8351. {
  8352. return !g_newround;
  8353. }
  8354.  
  8355. // Native: zp_is_nemesis_round
  8356. public native_is_nemesis_round()
  8357. {
  8358. return g_nemround;
  8359. }
  8360.  
  8361. // Native: zp_is_survivor_round
  8362. public native_is_survivor_round()
  8363. {
  8364. return g_survround;
  8365. }
  8366.  
  8367. // Native: zp_is_swarm_round
  8368. public native_is_swarm_round()
  8369. {
  8370. return g_swarmround;
  8371. }
  8372.  
  8373. // Native: zp_is_plague_round
  8374. public native_is_plague_round()
  8375. {
  8376. return g_plagueround;
  8377. }
  8378.  
  8379. // Native: zp_register_extra_item
  8380. public native_register_extra_item(const name[], cost, team)
  8381. {
  8382. // Reached extra items limit
  8383. if (g_extraitem_i >= sizeof g_extraitem_name)
  8384. return -1;
  8385.  
  8386. // Strings passed byref
  8387. param_convert(1)
  8388.  
  8389. // Add the item
  8390. copy(g_extraitem_name[g_extraitem_i], sizeof g_extraitem_name[] - 1, name)
  8391. g_extraitem_cost[g_extraitem_i] = cost
  8392. g_extraitem_team[g_extraitem_i] = team
  8393.  
  8394. // Increase registered items counter
  8395. g_extraitem_i++
  8396.  
  8397. // Return id under which we registered the item
  8398. return g_extraitem_i-1;
  8399. }
  8400.  
  8401. // Function: zp_register_extra_item (to be used within this plugin only)
  8402. native_register_extra_item2(const name[], cost, team)
  8403. {
  8404. // Reached extra items limit
  8405. if (g_extraitem_i >= sizeof g_extraitem_name)
  8406. return;
  8407.  
  8408. // Add the item
  8409. copy(g_extraitem_name[g_extraitem_i], sizeof g_extraitem_name[] - 1, name)
  8410. g_extraitem_cost[g_extraitem_i] = cost
  8411. g_extraitem_team[g_extraitem_i] = team
  8412.  
  8413. // Increase registered items counter
  8414. g_extraitem_i++
  8415. }
  8416. // Native: zp_register_zombie_class
  8417. public native_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback, level)
  8418. {
  8419. // Reached zombie classes limit
  8420. if (g_zclass_i >= sizeof g_zclass_name)
  8421. return -1;
  8422.  
  8423. // Strings passed byref
  8424. param_convert(1)
  8425. param_convert(2)
  8426. param_convert(3)
  8427. param_convert(4)
  8428.  
  8429. // Add the class
  8430. copy(g_zclass_name[g_zclass_i], sizeof g_zclass_name[] - 1, name)
  8431. copy(g_zclass_info[g_zclass_i], sizeof g_zclass_info[] - 1, info)
  8432. copy(g_zclass_model[g_zclass_i], sizeof g_zclass_model[] - 1, model)
  8433. copy(g_zclass_clawmodel[g_zclass_i], sizeof g_zclass_clawmodel[] - 1, clawmodel)
  8434. g_zclass_lvl[g_zclass_i] = level
  8435. g_zclass_hp[g_zclass_i] = hp
  8436. g_zclass_spd[g_zclass_i] = speed
  8437. g_zclass_grav[g_zclass_i] = gravity
  8438. g_zclass_kb[g_zclass_i] = knockback
  8439.  
  8440. // Precache custom models and retrieve the modelindex
  8441. new prec_mdl[100]
  8442. formatex(prec_mdl, sizeof prec_mdl - 1, "models/player/%s/%s.mdl", model, model)
  8443. g_zclass_modelindex[g_zclass_i] = engfunc(EngFunc_PrecacheModel, prec_mdl)
  8444. formatex(prec_mdl, sizeof prec_mdl - 1, "models/zombie_plague/%s", clawmodel)
  8445. engfunc(EngFunc_PrecacheModel, prec_mdl)
  8446.  
  8447. // Increase registered classes counter
  8448. g_zclass_i++
  8449.  
  8450. // Return id under which we registered the class
  8451. return g_zclass_i-1;
  8452. }
  8453.  
  8454. // Native: zp_register_human_class
  8455. public native_register_human_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, level, armadura)
  8456. {
  8457. // Reached human classes limit
  8458. if (g_hclass_i >= sizeof g_hclass_name)
  8459. return -1;
  8460.  
  8461. // Strings passed byref
  8462. param_convert(1)
  8463. param_convert(2)
  8464. param_convert(3)
  8465. param_convert(4)
  8466.  
  8467. // Add the class
  8468. copy(g_hclass_name[g_hclass_i], sizeof g_hclass_name[] - 1, name)
  8469. copy(g_hclass_info[g_hclass_i], sizeof g_hclass_info[] - 1, info)
  8470. copy(g_hclass_model[g_hclass_i], sizeof g_hclass_model[] - 1, model)
  8471. copy(g_hclass_clawmodel[g_hclass_i], sizeof g_hclass_clawmodel[] - 1, clawmodel)
  8472. g_hclass_hp[g_hclass_i] = hp
  8473. g_hclass_spd[g_hclass_i] = speed
  8474. g_hclass_grav[g_hclass_i] = gravity
  8475. g_hclass_lvl[g_hclass_i] = level
  8476. g_hclass_ar[g_hclass_i] = armadura
  8477.  
  8478. // Precache custom models and retrieve the modelindex
  8479. new prec_mdl[100]
  8480. formatex(prec_mdl, sizeof prec_mdl - 1, "models/player/%s/%s.mdl", model, model)
  8481. g_hclass_modelindex[g_zclass_i] = engfunc(EngFunc_PrecacheModel, prec_mdl)
  8482. formatex(prec_mdl, sizeof prec_mdl - 1, "models/zombie_plague/%s", clawmodel)
  8483. engfunc(EngFunc_PrecacheModel, prec_mdl)
  8484.  
  8485. // Increase registered classes counter
  8486. g_hclass_i++
  8487.  
  8488. // Return id under which we registered the class
  8489. return g_hclass_i-1;
  8490. }
  8491.  
  8492. /*================================================================================
  8493. [Custom Messages]
  8494. =================================================================================*/
  8495.  
  8496. // Custom Night Vision
  8497. public set_user_nvision(taskid)
  8498. {
  8499. // Not meant to have nvision or not enabled
  8500. if (!g_nvision[ID_NVISION] || !g_nvisionenabled[ID_NVISION])
  8501. {
  8502. // Task not needed anymore
  8503. remove_task(taskid);
  8504. return;
  8505. }
  8506.  
  8507. // Get player origin and alive status
  8508. static Float:originF[3], alive
  8509. pev(ID_NVISION, pev_origin, originF)
  8510. alive = is_user_alive(ID_NVISION)
  8511.  
  8512. // Nightvision message
  8513. message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, ID_NVISION)
  8514. write_byte(TE_DLIGHT) // TE id
  8515. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8516. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8517. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8518. write_byte(get_pcvar_num(cvar_nvgsize)) // radius
  8519.  
  8520. // Nemesis / Madness / Spectator in nemesis round
  8521. if (g_nemesis[ID_NVISION] || (g_zombie[ID_NVISION] && g_nodamage[ID_NVISION]) || (!alive && g_nemround))
  8522. {
  8523. write_byte(get_pcvar_num(cvar_nemnvgcolor[0])) // r
  8524. write_byte(get_pcvar_num(cvar_nemnvgcolor[1])) // g
  8525. write_byte(get_pcvar_num(cvar_nemnvgcolor[2])) // b
  8526. }
  8527. // Human / Spectator in normal round
  8528. else if (!g_zombie[ID_NVISION] || !alive)
  8529. {
  8530. write_byte(get_pcvar_num(cvar_humnvgcolor[0])) // r
  8531. write_byte(get_pcvar_num(cvar_humnvgcolor[1])) // g
  8532. write_byte(get_pcvar_num(cvar_humnvgcolor[2])) // b
  8533. }
  8534. // Zombie
  8535. else
  8536. {
  8537. write_byte(get_pcvar_num(cvar_nvgcolor[0])) // r
  8538. write_byte(get_pcvar_num(cvar_nvgcolor[1])) // g
  8539. write_byte(get_pcvar_num(cvar_nvgcolor[2])) // b
  8540. }
  8541.  
  8542. write_byte(2) // life
  8543. write_byte(0) // decay rate
  8544. message_end()
  8545. }
  8546.  
  8547. // Game Nightvision
  8548. set_user_gnvision(id, toggle)
  8549. {
  8550. // Toggle NVG message
  8551. message_begin(MSG_ONE, g_msgNVGToggle, _, id)
  8552. write_byte(toggle) // toggle
  8553. message_end()
  8554. }
  8555.  
  8556. // Custom Flashlight
  8557. public set_user_flashlight(taskid)
  8558. {
  8559. // Not meant to have flashlight / not enabled / depleted
  8560. if (!get_pcvar_num(cvar_cflash) || !g_flashlight[ID_FLASH] || g_flashbattery[ID_FLASH] <= 0)
  8561. {
  8562. // Task not needed anymore
  8563. remove_task(taskid);
  8564. return;
  8565. }
  8566.  
  8567. // Disable flashlight if it shouldn't be available
  8568. if (!is_user_alive(ID_FLASH) || g_zombie[ID_FLASH] || g_survivor[ID_FLASH])
  8569. {
  8570. // Turn it off
  8571. g_flashlight[ID_FLASH] = false;
  8572.  
  8573. // Update flashlight HUD
  8574. message_begin(MSG_ONE, g_msgFlashlight, _, ID_FLASH)
  8575. write_byte(0) // toggle
  8576. write_byte(100) // battery
  8577. message_end()
  8578.  
  8579. // Task not needed anymore
  8580. remove_task(taskid);
  8581. return;
  8582. }
  8583.  
  8584. // Get player and aiming origins
  8585. static Float:originF[3], Float:destoriginF[3]
  8586. pev(ID_FLASH, pev_origin, originF)
  8587. fm_get_aim_origin(ID_FLASH, destoriginF)
  8588.  
  8589. // Make sure it's within the max distance
  8590. if (get_distance_f(originF, destoriginF) > get_pcvar_float(cvar_flashdist))
  8591. return;
  8592.  
  8593. // Flashlight
  8594. write_byte(TE_DLIGHT) // TE id
  8595. engfunc(EngFunc_WriteCoord, destoriginF[0]) // x
  8596. engfunc(EngFunc_WriteCoord, destoriginF[1]) // y
  8597. engfunc(EngFunc_WriteCoord, destoriginF[2]) // z
  8598. write_byte(get_pcvar_num(cvar_flashsize)) // radius
  8599. write_byte(get_pcvar_num(cvar_flashcolor[0])) // r
  8600. write_byte(get_pcvar_num(cvar_flashcolor[1])) // g
  8601. write_byte(get_pcvar_num(cvar_flashcolor[2])) // b
  8602. write_byte(3) // life
  8603. write_byte(0) // decay rate
  8604. message_end()
  8605. }
  8606.  
  8607. // Infection special effects
  8608. infection_effects(id)
  8609. {
  8610. // Screen fade?
  8611. if (get_pcvar_num(cvar_infectionscreenfade))
  8612. {
  8613. message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id)
  8614. write_short(UNIT_SECOND*1) // duration
  8615. write_short(UNIT_SECOND*0) // hold time
  8616. write_short(FFADE_IN) // fade type
  8617. write_byte((g_nemesis[id]) ? get_pcvar_num(cvar_nemnvgcolor[0]) : get_pcvar_num(cvar_nvgcolor[0])) // r
  8618. write_byte((g_nemesis[id]) ? get_pcvar_num(cvar_nemnvgcolor[1]) : get_pcvar_num(cvar_nvgcolor[1])) // g
  8619. write_byte((g_nemesis[id]) ? get_pcvar_num(cvar_nemnvgcolor[2]) : get_pcvar_num(cvar_nvgcolor[2])) // b
  8620. write_byte (255) // alpha
  8621. message_end()
  8622. }
  8623.  
  8624. // Screen shake?
  8625. if (get_pcvar_num(cvar_infectionscreenshake))
  8626. {
  8627. message_begin(MSG_ONE_UNRELIABLE, g_msgScreenShake, _, id)
  8628. write_short(UNIT_SECOND*4) // amplitude
  8629. write_short(UNIT_SECOND*2) // duration
  8630. write_short(UNIT_SECOND*10) // frequency
  8631. message_end()
  8632. }
  8633.  
  8634. // Infection icon?
  8635. if (get_pcvar_num(cvar_hudicons))
  8636. {
  8637. message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, id)
  8638. write_byte(0) // damage save
  8639. write_byte(0) // damage take
  8640. write_long(DMG_NERVEGAS) // damage type - DMG_RADIATION
  8641. write_coord(0) // x
  8642. write_coord(0) // y
  8643. write_coord(0) // z
  8644. message_end()
  8645. }
  8646.  
  8647. // Get player origin
  8648. static Float:originF[3]
  8649. pev(id, pev_origin, originF)
  8650.  
  8651. // Tracers?
  8652. if (get_pcvar_num(cvar_infectiontracers))
  8653. {
  8654. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8655. write_byte(TE_IMPLOSION) // TE id
  8656. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8657. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8658. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8659. write_byte(128) // radius
  8660. write_byte(20) // count
  8661. write_byte(3) // duration
  8662. message_end()
  8663. }
  8664.  
  8665. // Particle burst?
  8666. if (get_pcvar_num(cvar_infectionparticles))
  8667. {
  8668. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8669. write_byte(TE_PARTICLEBURST) // TE id
  8670. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8671. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8672. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8673. write_short(50) // radius
  8674. write_byte(70) // color
  8675. write_byte(3) // duration (will be randomized a bit)
  8676. message_end()
  8677. }
  8678.  
  8679. // Light sparkle?
  8680. if (get_pcvar_num(cvar_infectionsparkle))
  8681. {
  8682. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8683. write_byte(TE_DLIGHT) // TE id
  8684. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8685. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8686. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8687. write_byte(20) // radius
  8688. write_byte(get_pcvar_num(cvar_nvgcolor[0])) // r
  8689. write_byte(get_pcvar_num(cvar_nvgcolor[1])) // g
  8690. write_byte(get_pcvar_num(cvar_nvgcolor[2])) // b
  8691. write_byte(2) // life
  8692. write_byte(0) // decay rate
  8693. message_end()
  8694. }
  8695. }
  8696.  
  8697. // Nemesis/madness aura task
  8698. public zombie_aura(taskid)
  8699. {
  8700. // Not nemesis, not in zombie madness
  8701. if (!g_nemesis[ID_BLOOD] && !g_nodamage[ID_BLOOD])
  8702. return;
  8703.  
  8704. // Get player origin
  8705. static Float:originF[3]
  8706. pev(ID_BLOOD, pev_origin, originF)
  8707.  
  8708. // Colored Aura
  8709. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8710. write_byte(TE_DLIGHT) // TE id
  8711. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8712. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8713. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8714. write_byte(20) // radius
  8715. write_byte(get_pcvar_num(cvar_nemnvgcolor[0])) // r
  8716. write_byte(get_pcvar_num(cvar_nemnvgcolor[1])) // g
  8717. write_byte(get_pcvar_num(cvar_nemnvgcolor[2])) // b
  8718. write_byte(2) // life
  8719. write_byte(0) // decay rate
  8720. message_end()
  8721.  
  8722. // Keep sending aura messages
  8723. set_task(0.1, "zombie_aura", taskid)
  8724. }
  8725.  
  8726. // Make zombies leave footsteps and bloodstains on the floor
  8727. public make_blood(taskid)
  8728. {
  8729. // Only bleed when moving on ground
  8730. if (fm_get_speed(ID_BLOOD) < 80 || !(pev(ID_BLOOD, pev_flags) & FL_ONGROUND))
  8731. return;
  8732.  
  8733. // Get user origin
  8734. static Float:originF[3]
  8735. pev(ID_BLOOD, pev_origin, originF);
  8736.  
  8737. // If ducking set a little lower
  8738. if (pev(ID_BLOOD, pev_bInDuck))
  8739. originF[2] -= 18.0
  8740. else
  8741. originF[2] -= 36.0
  8742.  
  8743. // Send the decal message
  8744. engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0)
  8745. write_byte(TE_WORLDDECAL) // TE id
  8746. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8747. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8748. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8749. write_byte(zombie_decals[random_num(0, sizeof zombie_decals - 1)] + (g_czero*12)) // random decal number (offsets +12 for CZ)
  8750. message_end()
  8751. }
  8752.  
  8753. // Flare Lighting
  8754. public flare_lighting(args[5])
  8755. {
  8756. // Unexistant flare entity?
  8757. if (!pev_valid(FLARE_ENTITY))
  8758. return;
  8759.  
  8760. // Flare depleted -clean up the mess-
  8761. if (FLARE_DURATION <= 0)
  8762. {
  8763. engfunc(EngFunc_RemoveEntity, FLARE_ENTITY)
  8764. return;
  8765. }
  8766.  
  8767. // Get origin
  8768. static Float:originF[3]
  8769. pev(FLARE_ENTITY, pev_origin, originF)
  8770.  
  8771. // Lighting
  8772. engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0)
  8773. write_byte(TE_DLIGHT) // TE id
  8774. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8775. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8776. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8777. write_byte(get_pcvar_num(cvar_flaresize)) // radius
  8778. write_byte(FLARE_R) // r
  8779. write_byte(FLARE_G) // g
  8780. write_byte(FLARE_B) // b
  8781. write_byte(51) //life
  8782. write_byte((FLARE_DURATION < 2) ? 3 : 0) //decay rate
  8783. message_end()
  8784.  
  8785. // Sparks
  8786. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8787. write_byte(TE_SPARKS) // TE id
  8788. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8789. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8790. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8791. message_end()
  8792.  
  8793. // Decrease task cycle counter
  8794. FLARE_DURATION -= 1;
  8795.  
  8796. // Keep sending flare messaegs
  8797. set_task(5.0, "flare_lighting", TASK_NADES, args, sizeof args)
  8798. }
  8799.  
  8800. // Burning Flames
  8801. public burning_flame(args[1], taskid)
  8802. {
  8803. // Get player origin and flags
  8804. static Float:originF[3], flags
  8805. pev(ID_BLOOD, pev_origin, originF)
  8806. flags = pev(ID_BLOOD, pev_flags)
  8807.  
  8808. // Madness mode - in water - burning stopped
  8809. if (g_nodamage[ID_BLOOD] || (flags & FL_INWATER) || FLAME_DURATION < 1)
  8810. {
  8811. // Smoke sprite
  8812. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8813. write_byte(TE_SMOKE) // TE id
  8814. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8815. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8816. engfunc(EngFunc_WriteCoord, originF[2]-50.0) // z
  8817. write_short(g_smokeSpr) // sprite
  8818. write_byte(random_num(15, 20)) // scale
  8819. write_byte(random_num(10, 20)) // framerate
  8820. message_end()
  8821.  
  8822. return;
  8823. }
  8824.  
  8825. // Randomly play burning zombie scream sounds (not for nemesis)
  8826. if (!random_num(0, 20) && !g_nemesis[ID_BLOOD])
  8827. engfunc(EngFunc_EmitSound, ID_BLOOD, CHAN_VOICE, grenade_fire_player[random_num(0, sizeof grenade_fire_player - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  8828.  
  8829. // Get fire slow down setting
  8830. static Float:slowdown
  8831. slowdown = get_pcvar_float(cvar_fireslowdown)
  8832.  
  8833. // Fire slow down, unless nemesis
  8834. if (slowdown > 0.0 && !g_nemesis[ID_BLOOD] && (flags & FL_ONGROUND))
  8835. {
  8836. static Float:velocity[3]
  8837. pev(ID_BLOOD, pev_velocity, velocity)
  8838. xs_vec_mul_scalar(velocity, slowdown, velocity)
  8839. set_pev(ID_BLOOD, pev_velocity, velocity)
  8840. }
  8841.  
  8842. // Get health and fire damage setting
  8843. static health, firedamage
  8844. health = pev(ID_BLOOD, pev_health)
  8845. firedamage = get_pcvar_num(cvar_firedamage)
  8846.  
  8847. // Take damage from the fire
  8848. if (health > firedamage)
  8849. fm_set_user_health(ID_BLOOD, health - firedamage)
  8850.  
  8851. // Flame sprite
  8852. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8853. write_byte(TE_SPRITE) // TE id
  8854. engfunc(EngFunc_WriteCoord, originF[0]+random_float(-5.0, 5.0)) // x
  8855. engfunc(EngFunc_WriteCoord, originF[1]+random_float(-5.0, 5.0)) // y
  8856. engfunc(EngFunc_WriteCoord, originF[2]+random_float(-10.0, 10.0)) // z
  8857. write_short(g_flameSpr) // sprite
  8858. write_byte(random_num(5, 10)) // scale
  8859. write_byte(200) // brightness
  8860. message_end()
  8861.  
  8862. // Decrease task cycle counter
  8863. FLAME_DURATION -= 1;
  8864.  
  8865. // Keep sending flame messaegs
  8866. set_task(0.2, "burning_flame", taskid, args, sizeof args)
  8867. }
  8868.  
  8869. // Infection Grenade: Green Blast
  8870. create_blast(const Float:originF[3])
  8871. {
  8872. // Smallest ring
  8873. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8874. write_byte(TE_BEAMCYLINDER) // TE id
  8875. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8876. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8877. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8878. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  8879. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  8880. engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
  8881. write_short(g_exploSpr) // sprite
  8882. write_byte(0) // startframe
  8883. write_byte(0) // framerate
  8884. write_byte(4) // life
  8885. write_byte(60) // width
  8886. write_byte(0) // noise
  8887. write_byte(0) // red
  8888. write_byte(200) // green
  8889. write_byte(0) // blue
  8890. write_byte(200) // brightness
  8891. write_byte(0) // speed
  8892. message_end()
  8893.  
  8894. // Medium ring
  8895. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8896. write_byte(TE_BEAMCYLINDER) // TE id
  8897. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8898. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8899. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8900. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  8901. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  8902. engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  8903. write_short(g_exploSpr) // sprite
  8904. write_byte(0) // startframe
  8905. write_byte(0) // framerate
  8906. write_byte(4) // life
  8907. write_byte(60) // width
  8908. write_byte(0) // noise
  8909. write_byte(0) // red
  8910. write_byte(200) // green
  8911. write_byte(0) // blue
  8912. write_byte(200) // brightness
  8913. write_byte(0) // speed
  8914. message_end()
  8915.  
  8916. // Largest ring
  8917. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8918. write_byte(TE_BEAMCYLINDER) // TE id
  8919. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8920. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8921. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8922. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  8923. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  8924. engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  8925. write_short(g_exploSpr) // sprite
  8926. write_byte(0) // startframe
  8927. write_byte(0) // framerate
  8928. write_byte(4) // life
  8929. write_byte(60) // width
  8930. write_byte(0) // noise
  8931. write_byte(0) // red
  8932. write_byte(200) // green
  8933. write_byte(0) // blue
  8934. write_byte(200) // brightness
  8935. write_byte(0) // speed
  8936. message_end()
  8937. }
  8938.  
  8939. // Fire Grenade: Fire Blast
  8940. create_blast2(const Float:originF[3])
  8941. {
  8942. // Smallest ring
  8943. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8944. write_byte(TE_BEAMCYLINDER) // TE id
  8945. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8946. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8947. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8948. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  8949. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  8950. engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
  8951. write_short(g_exploSpr) // sprite
  8952. write_byte(0) // startframe
  8953. write_byte(0) // framerate
  8954. write_byte(4) // life
  8955. write_byte(60) // width
  8956. write_byte(0) // noise
  8957. write_byte(200) // red
  8958. write_byte(100) // green
  8959. write_byte(0) // blue
  8960. write_byte(200) // brightness
  8961. write_byte(0) // speed
  8962. message_end()
  8963.  
  8964. // Medium ring
  8965. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8966. write_byte(TE_BEAMCYLINDER) // TE id
  8967. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8968. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8969. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8970. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  8971. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  8972. engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  8973. write_short(g_exploSpr) // sprite
  8974. write_byte(0) // startframe
  8975. write_byte(0) // framerate
  8976. write_byte(4) // life
  8977. write_byte(60) // width
  8978. write_byte(0) // noise
  8979. write_byte(200) // red
  8980. write_byte(50) // green
  8981. write_byte(0) // blue
  8982. write_byte(200) // brightness
  8983. write_byte(0) // speed
  8984. message_end()
  8985.  
  8986. // Largest ring
  8987. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8988. write_byte(TE_BEAMCYLINDER) // TE id
  8989. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8990. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8991. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8992. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  8993. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  8994. engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  8995. write_short(g_exploSpr) // sprite
  8996. write_byte(0) // startframe
  8997. write_byte(0) // framerate
  8998. write_byte(4) // life
  8999. write_byte(60) // width
  9000. write_byte(0) // noise
  9001. write_byte(200) // red
  9002. write_byte(0) // green
  9003. write_byte(0) // blue
  9004. write_byte(200) // brightness
  9005. write_byte(0) // speed
  9006. message_end()
  9007. }
  9008.  
  9009. // Frost Grenade: Freeze Blast
  9010. create_blast3(const Float:originF[3])
  9011. {
  9012. // Smallest ring
  9013. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9014. write_byte(TE_BEAMCYLINDER) // TE id
  9015. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9016. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9017. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9018. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9019. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9020. engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
  9021. write_short(g_exploSpr) // sprite
  9022. write_byte(0) // startframe
  9023. write_byte(0) // framerate
  9024. write_byte(4) // life
  9025. write_byte(60) // width
  9026. write_byte(0) // noise
  9027. write_byte(0) // red
  9028. write_byte(100) // green
  9029. write_byte(200) // blue
  9030. write_byte(200) // brightness
  9031. write_byte(0) // speed
  9032. message_end()
  9033.  
  9034. // Medium ring
  9035. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9036. write_byte(TE_BEAMCYLINDER) // TE id
  9037. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9038. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9039. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9040. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9041. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9042. engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  9043. write_short(g_exploSpr) // sprite
  9044. write_byte(0) // startframe
  9045. write_byte(0) // framerate
  9046. write_byte(4) // life
  9047. write_byte(60) // width
  9048. write_byte(0) // noise
  9049. write_byte(0) // red
  9050. write_byte(100) // green
  9051. write_byte(200) // blue
  9052. write_byte(200) // brightness
  9053. write_byte(0) // speed
  9054. message_end()
  9055.  
  9056. // Largest ring
  9057. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9058. write_byte(TE_BEAMCYLINDER) // TE id
  9059. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9060. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9061. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9062. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9063. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9064. engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  9065. write_short(g_exploSpr) // sprite
  9066. write_byte(0) // startframe
  9067. write_byte(0) // framerate
  9068. write_byte(4) // life
  9069. write_byte(60) // width
  9070. write_byte(0) // noise
  9071. write_byte(0) // red
  9072. write_byte(100) // green
  9073. write_byte(200) // blue
  9074. write_byte(200) // brightness
  9075. write_byte(0) // speed
  9076. message_end()
  9077. }
  9078.  
  9079. // Fix Dead Attrib on scoreboard
  9080. FixDeadAttrib(id)
  9081. {
  9082. message_begin(MSG_BROADCAST, g_msgScoreAttrib)
  9083. write_byte(id) // id
  9084. write_byte(0) // attrib
  9085. message_end()
  9086. }
  9087.  
  9088. // Send Death Message for infections
  9089. SendDeathMsg(attacker, victim)
  9090. {
  9091. message_begin(MSG_BROADCAST, g_msgDeathMsg)
  9092. write_byte(attacker) // killer
  9093. write_byte(victim) // victim
  9094. write_byte(1) // headshot flag
  9095. write_string("infection") // killer's weapon
  9096. message_end()
  9097. }
  9098.  
  9099. // Update Player Frags and Deaths
  9100. UpdateFrags(attacker, victim, frags, deaths, scoreboard)
  9101. {
  9102. // Set attacker frags
  9103. set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) + frags))
  9104.  
  9105. // Set victim deaths
  9106. fm_set_user_deaths(victim, fm_get_user_deaths(victim) + deaths)
  9107.  
  9108. // Update scoreboard with attacker and victim info
  9109. if (scoreboard)
  9110. {
  9111. message_begin(MSG_BROADCAST, g_msgScoreInfo)
  9112. write_byte(attacker) // id
  9113. write_short(pev(attacker, pev_frags)) // frags
  9114. write_short(fm_get_user_deaths(attacker)) // deaths
  9115. write_short(0) // class?
  9116. write_short(fm_get_user_team(attacker)) // team
  9117. message_end()
  9118.  
  9119. message_begin(MSG_BROADCAST, g_msgScoreInfo)
  9120. write_byte(victim) // id
  9121. write_short(pev(victim, pev_frags)) // frags
  9122. write_short(fm_get_user_deaths(victim)) // deaths
  9123. write_short(0) // class?
  9124. write_short(fm_get_user_team(victim)) // team
  9125. message_end()
  9126. }
  9127. }
  9128.  
  9129. // Remove Player Frags (when Nemesis/Survivor ignore_frags cvar is enabled)
  9130. RemoveFrags(attacker, victim)
  9131. {
  9132. // Remove attacker frags
  9133. set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) - 1))
  9134.  
  9135. // Remove victim deaths
  9136. fm_set_user_deaths(victim, fm_get_user_deaths(victim) - 1)
  9137. }
  9138.  
  9139.  
  9140. // Plays a sound on clients
  9141. PlaySound(const sound[])
  9142. {
  9143. client_cmd(0, "spk ^"%s^"", sound)
  9144. }
  9145.  
  9146. // Prints a colored message to target (use 0 for everyone), supports ML formatting.
  9147. // Note: I still need to make something like gungame's LANG_PLAYER_C to avoid unintended
  9148. // argument replacement when a function passes -1 (it will be considered a LANG_PLAYER)
  9149. zp_colored_print(target, const message[], any:...)
  9150. {
  9151. static buffer[512], i, argscount
  9152. argscount = numargs()
  9153.  
  9154. // Send to everyone
  9155. if (!target)
  9156. {
  9157. static player
  9158. for (player = 1; player <= g_maxplayers; player++)
  9159. {
  9160. // Not connected
  9161. if (!is_user_connected(player))
  9162. continue;
  9163.  
  9164. // Remember changed arguments
  9165. static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
  9166. changedcount = 0
  9167.  
  9168. // Replace LANG_PLAYER with player id
  9169. for (i = 2; i < argscount; i++)
  9170. {
  9171. if (getarg(i) == LANG_PLAYER)
  9172. {
  9173. setarg(i, 0, player)
  9174. changed[changedcount] = i
  9175. changedcount++
  9176. }
  9177. }
  9178.  
  9179. // Format message for player
  9180. vformat(buffer, sizeof buffer - 1, message, 3)
  9181.  
  9182. // Send it
  9183. message_begin(MSG_ONE, g_msgSayText, _, player)
  9184. write_byte(player)
  9185. write_string(buffer)
  9186. message_end()
  9187.  
  9188. // Replace back player id's with LANG_PLAYER
  9189. for (i = 0; i < changedcount; i++)
  9190. setarg(changed[i], 0, LANG_PLAYER)
  9191. }
  9192. }
  9193.  
  9194. // Send to specific target
  9195. else
  9196. {
  9197. /*
  9198. // Replace LANG_PLAYER with player id
  9199. for (i = 2; i < argscount; i++)
  9200. {
  9201. if (getarg(i) == LANG_PLAYER)
  9202. setarg(i, 0, target)
  9203. }
  9204. */
  9205.  
  9206. // Format message for player
  9207. vformat(buffer, sizeof buffer - 1, message, 3)
  9208.  
  9209. // Send it
  9210. message_begin(MSG_ONE, g_msgSayText, _, target)
  9211. write_byte(target)
  9212. write_string(buffer)
  9213. message_end()
  9214. }
  9215. }
  9216.  
  9217. /*================================================================================
  9218. [Stocks]
  9219. =================================================================================*/
  9220.  
  9221. // Set an entity's key value (from fakemeta_util)
  9222. stock fm_set_kvd(entity, const key[], const value[], const classname[])
  9223. {
  9224. set_kvd(0, KV_ClassName, classname)
  9225. set_kvd(0, KV_KeyName, key)
  9226. set_kvd(0, KV_Value, value)
  9227. set_kvd(0, KV_fHandled, 0)
  9228.  
  9229. dllfunc(DLLFunc_KeyValue, entity, 0)
  9230. }
  9231.  
  9232. // Set entity's rendering type (from fakemeta_util)
  9233. stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
  9234. {
  9235. static Float:color[3]
  9236. color[0] = float(r)
  9237. color[1] = float(g)
  9238. color[2] = float(b)
  9239.  
  9240. set_pev(entity, pev_renderfx, fx)
  9241. set_pev(entity, pev_rendercolor, color)
  9242. set_pev(entity, pev_rendermode, render)
  9243. set_pev(entity, pev_renderamt, float(amount))
  9244. }
  9245.  
  9246. // Get entity's speed (from fakemeta_util)
  9247. stock fm_get_speed(entity)
  9248. {
  9249. static Float:velocity[3]
  9250. pev(entity, pev_velocity, velocity)
  9251.  
  9252. return floatround(vector_length(velocity));
  9253. }
  9254.  
  9255. // Get entity's aim origins (from fakemeta_util)
  9256. stock fm_get_aim_origin(id, Float:origin[3])
  9257. {
  9258. static Float:origin1F[3], Float:origin2F[3]
  9259. pev(id, pev_origin, origin1F)
  9260. pev(id, pev_view_ofs, origin2F)
  9261. xs_vec_add(origin1F, origin2F, origin1F)
  9262.  
  9263. pev(id, pev_v_angle, origin2F);
  9264. engfunc(EngFunc_MakeVectors, origin2F)
  9265. global_get(glb_v_forward, origin2F)
  9266. xs_vec_mul_scalar(origin2F, 9999.0, origin2F)
  9267. xs_vec_add(origin1F, origin2F, origin2F)
  9268.  
  9269. engfunc(EngFunc_TraceLine, origin1F, origin2F, 0, id, 0)
  9270. get_tr2(0, TR_vecEndPos, origin)
  9271. }
  9272.  
  9273. // Find entity by its owner (from fakemeta_util)
  9274. stock fm_find_ent_by_owner(entity, const classname[], owner)
  9275. {
  9276. while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
  9277.  
  9278. return entity;
  9279. }
  9280.  
  9281. // Set player's health (from fakemeta_util)
  9282. stock fm_set_user_health(id, health)
  9283. {
  9284. (health > 0) ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id);
  9285. }
  9286.  
  9287. // Give an item to a player (from fakemeta_util)
  9288. stock fm_give_item(id, const item[])
  9289. {
  9290. static ent
  9291. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
  9292. if (!pev_valid(ent)) return;
  9293.  
  9294. static Float:originF[3]
  9295. pev(id, pev_origin, originF)
  9296. set_pev(ent, pev_origin, originF)
  9297. set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
  9298. dllfunc(DLLFunc_Spawn, ent)
  9299.  
  9300. static save
  9301. save = pev(ent, pev_solid)
  9302. dllfunc(DLLFunc_Touch, ent, id)
  9303. if (pev(ent, pev_solid) != save)
  9304. return;
  9305.  
  9306. engfunc(EngFunc_RemoveEntity, ent)
  9307. }
  9308.  
  9309. // Strip user weapons (from fakemeta_util)
  9310. stock fm_strip_user_weapons(id)
  9311. {
  9312. static ent
  9313. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
  9314. if (!pev_valid(ent)) return;
  9315.  
  9316. dllfunc(DLLFunc_Spawn, ent)
  9317. dllfunc(DLLFunc_Use, ent, id)
  9318. engfunc(EngFunc_RemoveEntity, ent)
  9319. }
  9320.  
  9321. // Collect random spawn points
  9322. stock load_spawns()
  9323. {
  9324. // Check for CSDM spawns of the current map
  9325. new cfgdir[32], mapname[32], filepath[100], linedata[64]
  9326. get_configsdir(cfgdir, sizeof cfgdir - 1)
  9327. get_mapname(mapname, sizeof mapname - 1)
  9328. formatex(filepath, sizeof filepath - 1, "%s/csdm/%s.spawns.cfg", cfgdir, mapname)
  9329.  
  9330. // Load CSDM spawns if present
  9331. if (file_exists(filepath))
  9332. {
  9333. new csdmdata[10][6], file = fopen(filepath,"rt")
  9334.  
  9335. while (file && !feof(file))
  9336. {
  9337. fgets(file, linedata, sizeof linedata - 1)
  9338.  
  9339. // invalid spawn
  9340. if(!linedata[0] || str_count(linedata,' ') < 2) continue;
  9341.  
  9342. // get spawn point data
  9343. parse(linedata,csdmdata[0],5,csdmdata[1],5,csdmdata[2],5,csdmdata[3],5,csdmdata[4],5,csdmdata[5],5,csdmdata[6],5,csdmdata[7],5,csdmdata[8],5,csdmdata[9],5)
  9344.  
  9345. // origin
  9346. g_spawns[g_spawnCount][0] = floatstr(csdmdata[0])
  9347. g_spawns[g_spawnCount][1] = floatstr(csdmdata[1])
  9348. g_spawns[g_spawnCount][2] = floatstr(csdmdata[2])
  9349.  
  9350. // increase spawn count
  9351. g_spawnCount++
  9352. if (g_spawnCount >= sizeof g_spawns) break;
  9353. }
  9354. if (file) fclose(file)
  9355. }
  9356. else
  9357. {
  9358. // if not, collect regular spawns
  9359. collect_spawns_ent("info_player_start")
  9360. collect_spawns_ent("info_player_deathmatch")
  9361. }
  9362. }
  9363.  
  9364. // Collect spawn points from entity origins
  9365. stock collect_spawns_ent(const classname[])
  9366. {
  9367. new ent = -1
  9368.  
  9369. while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", classname)) != 0)
  9370. {
  9371. // get origin
  9372. new Float:originF[3]
  9373. pev(ent, pev_origin, originF)
  9374. g_spawns[g_spawnCount][0] = originF[0]
  9375. g_spawns[g_spawnCount][1] = originF[1]
  9376. g_spawns[g_spawnCount][2] = originF[2]
  9377.  
  9378. // increase spawn count
  9379. g_spawnCount++
  9380. if (g_spawnCount >= sizeof g_spawns) break;
  9381. }
  9382. }
  9383.  
  9384. // Drop primary/secondary weapons
  9385. stock drop_weapons(id, dropwhat)
  9386. {
  9387. // Get user weapons
  9388. static weapons[32], num, i, weaponid
  9389. num = 0 // reset passed weapons count (bugfix)
  9390. get_user_weapons(id, weapons, num)
  9391.  
  9392. // Loop through them and drop primaries or secondaries
  9393. for (i = 0; i < num; i++)
  9394. {
  9395. // Prevent re-indexing the array
  9396. weaponid = weapons[i]
  9397.  
  9398. if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
  9399. {
  9400. // Get the weapon entity
  9401. static wname[32], weapon_ent
  9402. get_weaponname(weaponid, wname, sizeof wname - 1)
  9403. weapon_ent = fm_find_ent_by_owner(-1, wname, id);
  9404.  
  9405. // Hack: store weapon bpammo on PEV_ADDITIONAL_AMMO
  9406. set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, fm_get_user_bpammo(id, weaponid))
  9407.  
  9408. // Player drops the weapon and looses his bpammo
  9409. engclient_cmd(id, "drop", wname)
  9410. fm_set_user_bpammo(id, weaponid, 0)
  9411. }
  9412. }
  9413. }
  9414.  
  9415. // Stock by (probably) Twilight Suzuka -counts number of chars in a string
  9416. stock str_count(const str[], searchchar)
  9417. {
  9418. new count, i
  9419. //count = 0
  9420.  
  9421. for (i = 0; i <= strlen(str); i++)
  9422. {
  9423. if(str[i] == searchchar)
  9424. count++
  9425. }
  9426.  
  9427. return count;
  9428. }
  9429.  
  9430. // Checks if a space is vacant (credits to VEN)
  9431. stock is_hull_vacant(Float:origin[3], hull)
  9432. {
  9433. engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, 0)
  9434.  
  9435. if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen))
  9436. return true;
  9437.  
  9438. return false;
  9439. }
  9440.  
  9441. // Check if a player is stuck (credits to VEN)
  9442. stock is_player_stuck(id)
  9443. {
  9444. static Float:originF[3]
  9445. pev(id, pev_origin, originF)
  9446.  
  9447. engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0)
  9448.  
  9449. if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
  9450. return true;
  9451.  
  9452. return false;
  9453. }
  9454.  
  9455. // Get User BP Ammo
  9456. stock fm_get_user_bpammo(id, weapon)
  9457. {
  9458. return get_pdata_int(id, AMMOOFFSET[weapon], OFFSET_LINUX);
  9459. }
  9460.  
  9461. // Set User BP Ammo
  9462. stock fm_set_user_bpammo(id, weapon, amount)
  9463. {
  9464. set_pdata_int(id, AMMOOFFSET[weapon], amount, OFFSET_LINUX)
  9465. }
  9466.  
  9467. // Set Weapon Clip Ammo
  9468. stock fm_set_weapon_ammo(entity, amount)
  9469. {
  9470. set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS)
  9471. }
  9472.  
  9473. // Get Weapon Clip Ammo
  9474. stock fm_get_weapon_ammo(entity)
  9475. {
  9476. return get_pdata_int(entity, OFFSET_CLIPAMMO, OFFSET_LINUX_WEAPONS);
  9477. }
  9478.  
  9479. // Set User Zoom
  9480. stock fm_remove_user_zoom(id)
  9481. {
  9482. set_pdata_int(id, OFFSET_ZOOMTYPE, CS_NO_ZOOM, OFFSET_LINUX)
  9483. }
  9484.  
  9485. // Get User Deaths
  9486. stock fm_get_user_deaths(id)
  9487. {
  9488. return get_pdata_int(id, OFFSET_CSDEATHS, OFFSET_LINUX);
  9489. }
  9490.  
  9491. // Set User Deaths
  9492. stock fm_set_user_deaths(id, value)
  9493. {
  9494. set_pdata_int(id, OFFSET_CSDEATHS, value, OFFSET_LINUX)
  9495. }
  9496.  
  9497. // Set User NVG for Bots
  9498. stock fm_set_bot_nvg(id, toggle)
  9499. {
  9500. if (toggle)
  9501. {
  9502. g_nvision[id] = true
  9503. set_pdata_int(id, OFFSET_NVGOGGLES, get_pdata_int(id, OFFSET_NVGOGGLES, OFFSET_LINUX) | HAS_NVGOGGLES, OFFSET_LINUX)
  9504. }
  9505. else
  9506. {
  9507. g_nvision[id] = false
  9508. set_pdata_int(id, OFFSET_NVGOGGLES, get_pdata_int(id, OFFSET_NVGOGGLES, OFFSET_LINUX) &~ HAS_NVGOGGLES, OFFSET_LINUX)
  9509. }
  9510. }
  9511.  
  9512. // Get User Team
  9513. stock fm_get_user_team(id)
  9514. {
  9515. return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX);
  9516. }
  9517.  
  9518. // Set a Player's Team
  9519. stock fm_set_user_team(id, team)
  9520. {
  9521. set_pdata_int(id, OFFSET_CSTEAMS, team, OFFSET_LINUX)
  9522. }
  9523.  
  9524. // Update Player's Team on all clients (adding needed delays)
  9525. stock fm_user_team_update(id)
  9526. {
  9527. static Float:current_time
  9528. current_time = get_gametime()
  9529.  
  9530. if (current_time - g_teams_targettime >= 0.1)
  9531. {
  9532. set_task(0.1, "fm_set_user_team_msg", id+TASK_TEAM)
  9533. g_teams_targettime = current_time + 0.1
  9534. }
  9535. else
  9536. {
  9537. set_task(((g_teams_targettime + 0.1) - current_time), "fm_set_user_team_msg", id+TASK_TEAM)
  9538. g_teams_targettime = g_teams_targettime + 0.1
  9539. }
  9540. }
  9541.  
  9542. // Send User Team Message
  9543. public fm_set_user_team_msg(taskid)
  9544. {
  9545. // Beware: this message can now be picked up by other metamod
  9546. // plugins (yeah, that includes AMXX plugins as well)
  9547.  
  9548. // Set the switching team flag
  9549. g_switchingteam[ID_TEAM] = true
  9550.  
  9551. // Tell everyone my new team
  9552. emessage_begin(MSG_ALL, g_msgTeamInfo)
  9553. ewrite_byte(ID_TEAM) // player
  9554. ewrite_string(TEAMNAMES[fm_get_user_team(ID_TEAM)]) // team
  9555. emessage_end()
  9556.  
  9557. // Done switching team
  9558. g_switchingteam[ID_TEAM] = false
  9559. }
  9560.  
  9561. #if defined SET_MODELINDEX_OFFSET
  9562. // Set the precached model index (updates hitboxes server side)
  9563. stock fm_set_user_model_index(id, value)
  9564. {
  9565. set_pdata_int(id, OFFSET_MODELINDEX, value, OFFSET_LINUX)
  9566. }
  9567. #endif
  9568.  
  9569. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  9570. // Set Player Model on Entity
  9571. stock fm_set_playermodel_ent(id)
  9572. {
  9573. // Make original player entity invisible
  9574. // but without hiding shadows or firing effects
  9575. fm_set_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
  9576.  
  9577. // Format model string
  9578. static model[100]
  9579. formatex(model, sizeof model - 1, "models/player/%s/%s.mdl", g_playermodel[id], g_playermodel[id])
  9580.  
  9581. // Set model on entity or make a new one if unexistant
  9582. if (!pev_valid(g_ent_playermodel[id]))
  9583. {
  9584. g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  9585. if (!pev_valid(g_ent_playermodel[id])) return;
  9586.  
  9587. set_pev(g_ent_playermodel[id], pev_classname, MODEL_ENT_CLASSNAME)
  9588. set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
  9589. set_pev(g_ent_playermodel[id], pev_aiment, id)
  9590. set_pev(g_ent_playermodel[id], pev_owner, id)
  9591. }
  9592.  
  9593. engfunc(EngFunc_SetModel, g_ent_playermodel[id], model)
  9594. }
  9595.  
  9596. // Set Weapon Model on Entity
  9597. stock fm_set_weaponmodel_ent(id)
  9598. {
  9599. // Get player's p_ weapon model
  9600. static model[100]
  9601. pev(id, pev_weaponmodel2, model, sizeof model - 1)
  9602.  
  9603. // Set model on entity or make a new one if unexistant
  9604. if (!pev_valid(g_ent_weaponmodel[id]))
  9605. {
  9606. g_ent_weaponmodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  9607. if (!pev_valid(g_ent_weaponmodel[id])) return;
  9608.  
  9609. set_pev(g_ent_weaponmodel[id], pev_classname, WEAPON_ENT_CLASSNAME)
  9610. set_pev(g_ent_weaponmodel[id], pev_movetype, MOVETYPE_FOLLOW)
  9611. set_pev(g_ent_weaponmodel[id], pev_aiment, id)
  9612. set_pev(g_ent_weaponmodel[id], pev_owner, id)
  9613. }
  9614.  
  9615. engfunc(EngFunc_SetModel, g_ent_weaponmodel[id], model)
  9616. }
  9617.  
  9618. // Remove Custom Model Entities
  9619. stock fm_remove_model_ents(id)
  9620. {
  9621. // Remove "playermodel" ent if present
  9622. if (pev_valid(g_ent_playermodel[id]))
  9623. {
  9624. engfunc(EngFunc_RemoveEntity, g_ent_playermodel[id])
  9625. g_ent_playermodel[id] = 0
  9626. }
  9627. // Remove "weaponmodel" ent if present
  9628. if (pev_valid(g_ent_weaponmodel[id]))
  9629. {
  9630. engfunc(EngFunc_RemoveEntity, g_ent_weaponmodel[id])
  9631. g_ent_weaponmodel[id] = 0
  9632. }
  9633. }
  9634. #else
  9635. // Set User Model
  9636. public fm_set_user_model(taskid)
  9637. {
  9638. set_user_info(ID_MODEL, "model", g_playermodel[ID_MODEL])
  9639. }
  9640.  
  9641. // Get User Model -model passed byref-
  9642. stock fm_get_user_model(player, model[], len)
  9643. {
  9644. get_user_info(player, "model", model, len)
  9645. }
  9646.  
  9647. // Update Player's Model on all clients (adding needed delays)
  9648. public fm_user_model_update(taskid)
  9649. {
  9650. static Float:current_time
  9651. current_time = get_gametime()
  9652.  
  9653. if (current_time - g_models_targettime >= MODELCHANGE_DELAY)
  9654. {
  9655. fm_set_user_model(taskid)
  9656. g_models_targettime = current_time
  9657. }
  9658. else
  9659. {
  9660. set_task(((g_models_targettime + MODELCHANGE_DELAY) - current_time), "fm_set_user_model", taskid)
  9661. g_models_targettime = g_models_targettime + MODELCHANGE_DELAY
  9662. }
  9663. }
  9664. #endif
  9665. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  9666. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3082\\ f0\\ fs16 \n\\ par }
  9667. */
  9668. // FORMA DE SPEED! [CON EL "goto"]
  9669. // FORMA DE SPEED! [CON EL "goto"]
  9670. // FORMA DE SPEED! [CON EL "goto"]
  9671. public update_ap(id, amount, check)
  9672. {
  9673. if (check) goto check2 // Lo que hace el "goto" es, si la Funcion esta se llamo desde "check", el Plugin lo que hara, es llamar directamente a "check2".
  9674.  
  9675. // Aca detectamos que si es Nivel Maximo no suba mas.
  9676. if (g_ammopacks[id] + amount > NIVELES[sizeof NIVELES - 1] - 1)
  9677. return PLUGIN_HANDLED
  9678.  
  9679. // Le damos los APs correspondientes.
  9680. g_ammopacks[id] += amount
  9681.  
  9682. // Ya lo dijimos antes ^^.
  9683. check2:
  9684. if(amount < 0)
  9685. {
  9686. if(g_ammopacks[id] < NIVELES[g_level[id] - 1] )
  9687. {
  9688. g_level[id]--
  9689. client_cmd(id, "spk %s", Bajas)
  9690. zp_colored_print(id, "^x04[ZP]^x03 Mierda! Bajastes Al Nivel^x04 %d", g_level[id])
  9691. update_ap(id, -1, 1)
  9692. }
  9693.  
  9694. }
  9695. else
  9696. {
  9697. if(g_ammopacks[id] >= NIVELES[g_level[id]] )
  9698. {
  9699. g_level[id]++
  9700. update_ap(id, 0, 1)
  9701. }
  9702. }
  9703.  
  9704. // cambia el nivel ham
  9705. if (g_level[id] == 50 && g_ammopacks[id] <= 5012)
  9706. {
  9707. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9708. client_cmd(id, "spk %s", Subes)
  9709. effectlevelup(id)
  9710. }
  9711. else if (g_level[id] == 100 && g_ammopacks[id] <= 20012)
  9712. {
  9713. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9714. client_cmd(id, "spk %s", Subes)
  9715. effectlevelup(id)
  9716. }
  9717. else if (g_level[id] == 150 && g_ammopacks[id] <= 45012)
  9718. {
  9719. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9720. client_cmd(id, "spk %s", Subes)
  9721. effectlevelup(id)
  9722. }
  9723. else if (g_level[id] == 200 && g_ammopacks[id] <= 80012)
  9724. {
  9725. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9726. client_cmd(id, "spk %s", Subes)
  9727. effectlevelup(id)
  9728. }
  9729. else if (g_level[id] == 250 && g_ammopacks[id] <= 125012)
  9730. {
  9731. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9732. client_cmd(id, "spk %s", Subes)
  9733. effectlevelup(id)
  9734. }
  9735. else if (g_level[id] == 300 && g_ammopacks[id] <= 180012)
  9736. {
  9737. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9738. client_cmd(id, "spk %s", Subes)
  9739. effectlevelup(id)
  9740. }
  9741. else if (g_level[id] == 350 && g_ammopacks[id] <= 245012)
  9742. {
  9743. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9744. client_cmd(id, "spk %s", Subes)
  9745. effectlevelup(id)
  9746. }
  9747. else if (g_level[id] == 400 && g_ammopacks[id] <= 321614)
  9748. {
  9749. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9750. client_cmd(id, "spk %s", Subes)
  9751. effectlevelup(id)
  9752. }
  9753. else if (g_level[id] == 450 && g_ammopacks[id] <= 406814)
  9754. {
  9755. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9756. client_cmd(id, "spk %s", Subes)
  9757. effectlevelup(id)
  9758. }
  9759. else if (g_level[id] == 500 && g_ammopacks[id] <= 502014)
  9760. {
  9761. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9762. client_cmd(id, "spk %s", Subes)
  9763. effectlevelup(id)
  9764. }
  9765. else if (g_level[id] == 550 && g_ammopacks[id] <= 607214)
  9766. {
  9767. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9768. client_cmd(id, "spk %s", Subes)
  9769. effectlevelup(id)
  9770. }
  9771. else if (g_level[id] == 600 && g_ammopacks[id] <= 724820)
  9772. {
  9773. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9774. client_cmd(id, "spk %s", Subes)
  9775. effectlevelup(id)
  9776. }
  9777. else if (g_level[id] == 650 && g_ammopacks[id] <= 850220)
  9778. {
  9779. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9780. client_cmd(id, "spk %s", Subes)
  9781. effectlevelup(id)
  9782. }
  9783. else if (g_level[id] == 700 && g_ammopacks[id] <= 988430)
  9784. {
  9785. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9786. client_cmd(id, "spk %s", Subes)
  9787. effectlevelup(id)
  9788. }
  9789. else if (g_level[id] == 750 && g_ammopacks[id] <= 1134030)
  9790. {
  9791. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9792. client_cmd(id, "spk %s", Subes)
  9793. effectlevelup(id)
  9794. }
  9795. else if (g_level[id] == 800 && g_ammopacks[id] <= 1289630)
  9796. {
  9797. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9798. client_cmd(id, "spk %s", Subes)
  9799. effectlevelup(id)
  9800. }
  9801. else if (g_level[id] == 850 && g_ammopacks[id] <= 1465484)
  9802. {
  9803. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9804. client_cmd(id, "spk %s", Subes)
  9805. effectlevelup(id)
  9806. }
  9807. else if (g_level[id] == 900 && g_ammopacks[id] <= 1641684)
  9808. {
  9809. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9810. client_cmd(id, "spk %s", Subes)
  9811. effectlevelup(id)
  9812. }
  9813. else if (g_level[id] == 950 && g_ammopacks[id] <= 1824062)
  9814. {
  9815. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9816. client_cmd(id, "spk %s", Subes)
  9817. effectlevelup(id)
  9818. }
  9819. else if (g_level[id] == 1000 && g_ammopacks[id] <= 2020060)
  9820. {
  9821. zp_colored_print(id, "^x04[ZP]^x03 Has llegado al Lvl ^x04 %d", g_level[id])
  9822. client_cmd(id, "spk %s", Subes)
  9823. effectlevelup(id)
  9824. }
  9825. return PLUGIN_HANDLED
  9826. }
  9827.  
  9828. // Menu: Habilidades
  9829. public menu_upgrade(id)
  9830. {
  9831. new menu = menu_create("\yMenu \yHabilidades \wy\y Mejoras", "menu_upgrade_handler")
  9832.  
  9833. menu_additem(menu, "\wHabilidades \rZombies", "1", 0)
  9834. menu_additem(menu, "\wHabilidades \rHumanas", "2", 0)
  9835.  
  9836. menu_setprop(menu, MPROP_EXITNAME, "\rSalir")
  9837. menu_display(id, menu, 0)
  9838. return PLUGIN_HANDLED
  9839. }
  9840.  
  9841. public menu_upgrade_handler(id, menu, item)
  9842. {
  9843. if (item == MENU_EXIT) return PLUGIN_HANDLED
  9844.  
  9845. new data[6], iName[64], access, callback;
  9846. menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback);
  9847.  
  9848. switch (str_to_num(data))
  9849. {
  9850. case 1: menu_zomupgrade(id)
  9851. case 2: menu_humupgrade(id)
  9852. }
  9853.  
  9854. return PLUGIN_HANDLED;
  9855. }
  9856.  
  9857. // Menu: Mejoras de zombie
  9858. public menu_zomupgrade(id)
  9859. {
  9860. new menu[999], num[8], i
  9861.  
  9862. static item[150]
  9863. formatex(item, charsmax(item),"\yHabilidades \rZombies^n^n\yTienes \w%d\y puntos para gastar^nTotal de puntos Gastados \w%d", g_points[id][1],g_usedpoints[id][1])
  9864. new menu2 = menu_create(item, "menu_zomupgrade_handler")
  9865.  
  9866. for (i = 0; i < 4; i++)
  9867. {
  9868. if (g_skill_points[id][1][i] < g_upgrade_max[1][i])
  9869. {
  9870. if (g_points[id][1] >= upgrade_cost(g_skill_points[id][1][i]))
  9871. {
  9872. formatex(menu, charsmax(menu), "\wAumentar \y%s \r(%d punto%s) \w(%d/%d)", g_upgrades_names[1][i], upgrade_cost(g_skill_points[id][1][i]), upgrade_cost(g_skill_points[id][1][i]) == 1 ? "" : "s", g_skill_points[id][1][i], g_upgrade_max[1][i])
  9873. num_to_str(i, num, 7)
  9874. menu_additem(menu2, menu, num)
  9875. }
  9876. else
  9877. {
  9878. formatex(menu, charsmax(menu), "\dAumentar %s (%d punto%s) \r(%d/%d)", g_upgrades_names[1][i], upgrade_cost(g_skill_points[id][1][i]), upgrade_cost(g_skill_points[id][1][i]) == 1 ? "" : "s", g_skill_points[id][1][i], g_upgrade_max[1][i])
  9879. num_to_str(i, num, 7)
  9880. menu_additem(menu2, menu, num)
  9881. }
  9882. }
  9883. else
  9884. {
  9885. formatex(menu, charsmax(menu), "\d%s \d[\r Full \d]" , g_upgrades_names[1][i])
  9886. num_to_str(i, num, 7)
  9887. menu_additem(menu2, menu, num)
  9888. }
  9889. }
  9890.  
  9891. menu_setprop(menu2, MPROP_EXITNAME, "\rSalir")
  9892. menu_display(id, menu2)
  9893. return PLUGIN_HANDLED;
  9894. }
  9895.  
  9896. public menu_zomupgrade_handler(id, menu, item)
  9897. {
  9898. if (item == MENU_EXIT) return PLUGIN_HANDLED;
  9899.  
  9900. new Key, Data[5], Name[33], access, callback
  9901. menu_item_getinfo(menu, item, access, Data, 4, Name, 32, callback)
  9902. Key = str_to_num(Data)
  9903.  
  9904. if (g_skill_points[id][1][Key] < g_upgrade_max[1][Key])
  9905. {
  9906. if (g_points[id][1] >= upgrade_cost(g_skill_points[id][1][Key]))
  9907. {
  9908. g_points[id][1] -= upgrade_cost(g_skill_points[id][1][Key])
  9909. g_usedpoints[id][1] += upgrade_cost(g_skill_points[id][1][Key])
  9910. g_skill_points[id][1][Key]++
  9911. }
  9912. }
  9913.  
  9914. menu_zomupgrade(id)
  9915. return PLUGIN_HANDLED;
  9916. }
  9917.  
  9918. // Menu: Mejoras de humano
  9919. public menu_humupgrade(id)
  9920. {
  9921. new menu[999], num[8], i
  9922.  
  9923. static item[150]
  9924. formatex(item, charsmax(item),"\yHabilidades \rHumanas^n^n\yTienes \w%d\y puntos para gastar^nTotal de puntos Gastados \w%d", g_points[id][0],g_usedpoints[id][0])
  9925. new menu2 = menu_create(item, "menu_humupgrade_handler")
  9926.  
  9927. for (i = 0; i < 5; i++)
  9928. {
  9929. if (g_skill_points[id][0][i] < g_upgrade_max[0][i])
  9930. {
  9931. if (g_points[id][0] >= upgrade_cost(g_skill_points[id][0][i]))
  9932. {
  9933. formatex(menu, charsmax(menu), "\wAumentar \y%s \r(%d punto%s) \w(%d/%d)", g_upgrades_names[0][i], upgrade_cost(g_skill_points[id][0][i]), upgrade_cost(g_skill_points[id][0][i]) == 1 ? "" : "s", g_skill_points[id][0][i], g_upgrade_max[0][i])
  9934. num_to_str(i, num, 7)
  9935. menu_additem(menu2, menu, num)
  9936. }
  9937. else
  9938. {
  9939. formatex(menu, charsmax(menu), "\dAumentar %s (%d punto%s) \r(%d/%d)", g_upgrades_names[0][i], upgrade_cost(g_skill_points[id][0][i]), upgrade_cost(g_skill_points[id][0][i]) == 1 ? "" : "s", g_skill_points[id][0][i], g_upgrade_max[0][i])
  9940. num_to_str(i, num, 7)
  9941. menu_additem(menu2, menu, num)
  9942. }
  9943. }
  9944. else
  9945. {
  9946. formatex(menu, charsmax(menu), "\d%s \d[ \rFull \d]" , g_upgrades_names[0][i])
  9947. num_to_str(i, num, 7)
  9948. menu_additem(menu2, menu, num)
  9949. }
  9950. }
  9951.  
  9952. menu_setprop(menu2, MPROP_EXITNAME, "\rSalir")
  9953. menu_display(id, menu2)
  9954. return PLUGIN_HANDLED;
  9955. }
  9956.  
  9957. public menu_humupgrade_handler(id, menu, item)
  9958. {
  9959. if (item == MENU_EXIT) return PLUGIN_HANDLED;
  9960.  
  9961. new Key, Data[5], Name[33], access, callback
  9962. menu_item_getinfo(menu, item, access, Data, 4, Name, 32, callback)
  9963. Key = str_to_num(Data)
  9964.  
  9965. if (g_skill_points[id][0][Key] < g_upgrade_max[0][Key])
  9966. {
  9967. if (g_points[id][0] >= upgrade_cost(g_skill_points[id][0][Key]))
  9968. {
  9969. g_points[id][0] -= upgrade_cost(g_skill_points[id][0][Key])
  9970. g_usedpoints[id][0] += upgrade_cost(g_skill_points[id][0][Key])
  9971. g_skill_points[id][0][Key]++
  9972. }
  9973. }
  9974.  
  9975. menu_humupgrade(id)
  9976. return PLUGIN_HANDLED;
  9977. }
  9978.  
  9979. // menu reset
  9980. public menu_reset(id, key)
  9981. {
  9982.  
  9983. if (key >= 1)
  9984. {
  9985. if (key != MENU_KEY_EXIT)
  9986. show_menu_reset(id)
  9987.  
  9988. return PLUGIN_HANDLED;
  9989. }
  9990.  
  9991. if (g_reset[id] >= 30)
  9992. {
  9993. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Llegastes al level maximo de resets")
  9994. return PLUGIN_HANDLED;
  9995. }
  9996.  
  9997. switch (key)
  9998. {
  9999. case 0:
  10000. {
  10001. if (g_level[id] >= 1000)
  10002. {
  10003. g_level[id] = 1
  10004. g_reset[id]++
  10005. g_ammopacks[id] = 0
  10006. g_skill_points[id][0][0] += 1 // 5 sumadas a daño humana
  10007. g_skill_points[id][0][1] += 1 // 5 a vida humana
  10008. g_skill_points[id][0][4] += 1 // 5 sumadas a chaleco humana
  10009. g_skill_points[id][1][0] += 1 // 5 a speed zombie
  10010. g_skill_points[id][1][1] += 1 // 5 a algo
  10011. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Acabas de resetear, ahora tenes^x03 %d reset!", g_reset[id])
  10012. WPN_AUTO_ON = 0
  10013. g_zombieclassnext[id] = -1
  10014. g_humanclassnext[id] = -1
  10015. }
  10016. else
  10017. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Para resetear necesitas ser level: 1000")
  10018. }
  10019. }
  10020. return PLUGIN_HANDLED
  10021. }
  10022.  
  10023. //Public del menu de Grand Reset
  10024. public show_menu_grand_reset(id)
  10025. {
  10026. static menu[800], len
  10027. len = 0
  10028.  
  10029. len += formatex(menu[len], charsmax(menu) - len, "\y%L^n^n\r- \rRequisitos^n\y- Reset:\w30^n\r- Benefcios:^n\y- Humano: \wMas Vida, Daño, Armadura^n\y- Zombie: \wMas Vida, Velocidad^n^n", id, "MENU_GRAND_RESET_TITLE")
  10030.  
  10031. if (g_reset[id] >= 30) // Los resets requeridos
  10032. len += formatex(menu[len], charsmax(menu) - len, "\r1.\w Gran Reseteo de Personaje^n^n^n^n")
  10033.  
  10034. else
  10035. len += formatex(menu[len], charsmax(menu) - len, "\r1.\d Gran Reseteo de Personaje - Tienes %d resets - De 30^n^n^n^n", g_reset[id])
  10036.  
  10037.  
  10038. len += formatex(menu[len], charsmax(menu) - len, "\r0.\w %L", id, "MENU_EXIT")
  10039.  
  10040. show_menu(id, KEYSMENU, menu, -1, "Menu Grand Reset")
  10041. }
  10042.  
  10043. //Grand Reseteo
  10044. public menu_grand_reset(id, key)
  10045. {
  10046.  
  10047. if (key >= 1)
  10048. {
  10049. if (key != MENU_KEY_EXIT)
  10050. show_menu_grand_reset(id)
  10051.  
  10052. return PLUGIN_HANDLED;
  10053. }
  10054.  
  10055. if (g_grandreset[id] >= 50)
  10056. {
  10057. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Vicio,llegastes al ultimo Grand Reset")
  10058. return PLUGIN_HANDLED;
  10059. }
  10060.  
  10061. switch (key)
  10062. {
  10063. case 0:
  10064. {
  10065. if (g_reset[id] == 30)
  10066. {
  10067. g_level[id] = 1
  10068. g_reset[id] = 0
  10069. g_grandreset[id]++
  10070. g_ammopacks[id] = 0
  10071. g_skill_points[id][0][0] += 3 // 5 sumadas a daño humana
  10072. g_skill_points[id][0][1] += 3 // 5 a vida humana
  10073. g_skill_points[id][0][4] += 3 // 5 sumadas a chaleco humana
  10074. g_skill_points[id][1][0] += 3 // 5 a speed zombie
  10075. g_skill_points[id][1][1] += 3 // 5 a algo
  10076. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Acabas de hacer Grand Reset, ahora tenes^x03 %d Grand Resets!", g_grandreset[id])
  10077. WPN_AUTO_ON = 0
  10078. g_zombieclassnext[id] = -1
  10079. g_humanclassnext[id] = -1
  10080. }
  10081. else
  10082. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Reset: 30")
  10083. }
  10084. }
  10085. return PLUGIN_HANDLED
  10086. }
  10087. show_menu_especiales(id)
  10088. {
  10089. new menu = menu_create("\yArmas Modificadas:", "menu_especiala")
  10090.  
  10091. if(g_level[id] >= 330 && g_reset[id] >= 0)
  10092. menu_additem(menu, "\wAk Destruction \r[\yHabilitada Level: 330\r]", "1", 0);
  10093. else
  10094. menu_additem(menu, "\dAk Destruction \r[\dLevel\r: \d330 \r| \dReset\r: \d0\r]", "1", 0);
  10095. if(g_level[id] >= 400 && g_reset[id] >= 0)
  10096. menu_additem(menu, "\wVG Ultimate \r[\yHabilitada Level: 400\r]", "2", 0);
  10097. else
  10098. menu_additem(menu, "\dVG Ultimate \r[\dLevel\r: \d400 \r| \dReset\r: \d0\r]", "2", 0);
  10099. if(g_level[id] >= 450 && g_reset[id] >= 0)
  10100. menu_additem(menu, "\wSVT 40 Atomic \r[\yHabilitada Level: 450\r]", "3", 0);
  10101. else
  10102. menu_additem(menu, "\dSVT 40 Atomic \r[\dLevel\r: \d450 \r| \dReset\r: \d0\r]", "3", 0);
  10103. if(g_level[id] >= 510 && g_reset[id] >= 0)
  10104. menu_additem(menu, "\wDP- 31 Massive \r[\yHabilitada Level: 510\r]", "4", 0);
  10105. else
  10106. menu_additem(menu, "\dDP- 31 Massive \r[\dLevel\r: \d510 \r| \dReset\r: \d0\r]", "4", 0);
  10107. if(g_level[id] >= 600 && g_reset[id] >= 0)
  10108. menu_additem(menu, "\wNavi Strike \r[\yHabilitada Level: 600\r]", "5", 0);
  10109. else
  10110. menu_additem(menu, "\dNavi Strike \r[\dLevel\r: \d600 \r| \dReset\r: \d0\r]", "5", 0);
  10111. if(g_level[id] >= 651 && g_reset[id] >= 0)
  10112. menu_additem(menu, "\wXM1014 Overpower \r[\yHabilitada Level: 651\r]", "5", 0);
  10113. else
  10114. menu_additem(menu, "\dXM1014 Overpower \r[\dLevel\r: \d651 \r| \dReset\r: \d0\r]", "5", 0);
  10115. if(g_level[id] >= 700 && g_reset[id] >= 0)
  10116. menu_additem(menu, "\wSTFU 69 \r[\yHabilitada Level: 700\r]", "6", 0);
  10117. else
  10118. menu_additem(menu, "\dSTFU 69 \r[\dLevel\r: \d700 \r| \dReset\r: \d0\r]", "6", 0);
  10119. if(g_level[id] >= 730 && g_reset[id] >= 0)
  10120. menu_additem(menu, "\wRLP 17 \r[\yHabilitada Level: 730\r]", "7", 0);
  10121. else
  10122. menu_additem(menu, "\dRLP 17 \r[\dLevel\r: \d730 \r| \dReset\r: \d0\r]", "7", 0);
  10123. if(g_level[id] >= 770 && g_reset[id] >= 0)
  10124. menu_additem(menu, "\wM4 Extreme \r[\yHabilitada Level: 770\r]", "8", 0);
  10125. else
  10126. menu_additem(menu, "\dM4 Extreme \r[\dLevel\r: \d770 \r| \dReset\r: \d0\r]", "8", 0);
  10127. if(g_level[id] >= 800 && g_reset[id] >= 0)
  10128. menu_additem(menu, "\wBarret 5.0 \r[\yHabilitada Level: 800\r]", "9", 0);
  10129. else
  10130. menu_additem(menu, "\dBarret 5.0 \r[\dLevel\r: \d800 \r| \dReset\r: \d0\r]", "9", 0);
  10131. if(g_level[id] >= 860 && g_reset[id] >= 0)
  10132. menu_additem(menu, "\wDevil Strike \r[\yHabilitada Level: 860\r]", "10", 0);
  10133. else
  10134. menu_additem(menu, "\dDevil Strike \r[\dLevel\r: \d860 \r| \dReset\r: \d0\r]", "10", 0);
  10135. if(g_level[id] >= 950 && g_reset[id] >= 0)
  10136. menu_additem(menu, "\wM16 Rampage \r[\yHabilitada Level: 950\r]", "11", 0);
  10137. else
  10138. menu_additem(menu, "\dM16 Rampage \r[\dLevel\r: \d950 \r| \dReset\r: \d0\r]", "11", 0);
  10139. if(g_level[id] >= 400 && g_reset[id] >= 1)
  10140. menu_additem(menu, "\wSupermide \r[\wHabilitada \rLevel: \w400 \rReset: \w1\r]", "12", 0);
  10141. else
  10142. menu_additem(menu, "\dSupermide \r[\dLevel\r: \d400 \r| \dReset\r: \d1\r]", "12", 0);
  10143. if(g_level[id] >= 650 && g_reset[id] >= 3)
  10144. menu_additem(menu, "\wFarger \r[\wHabilitada \rLevel: \w650 \rReset: \w3\r]", "13", 0);
  10145. else
  10146. menu_additem(menu, "\dFarger \r[\dLevel\r: \d650 \r| \dReset\r: \d3\r]", "13", 0);
  10147. if(g_level[id] >= 500 && g_reset[id] >= 6)
  10148. menu_additem(menu, "\wStorm \r[\wHabilitada \rLevel: \w500 \rReset: \w6\r]", "14", 0);
  10149. else
  10150. menu_additem(menu, "\dStorm \r[\dLevel\r: \d500 \r| \dReset\r: \d6\r]", "14", 0);
  10151. if(g_level[id] >= 450 && g_reset[id] >= 10)
  10152. menu_additem(menu, "\wADGE-777 \r[\wHabilitada \rLevel: \w450 \rReset: \w10\r]", "15", 0);
  10153. else
  10154. menu_additem(menu, "\dADGE-777 \r[\dLevel\r: \d450 \r| \dReset\r: \d10\r]", "15", 0);
  10155. if(g_level[id] >= 601 && g_reset[id] >= 15)
  10156. menu_additem(menu, "\wXM10 Ultrapower \r[\wHabilitada \rLevel: \w601 \rReset: \w15\r]", "16", 0);
  10157. else
  10158. menu_additem(menu, "\dXM10 Ultrapower \r[\dLevel\r: \d601 \r| \dReset\r: \d15\r]", "16", 0);
  10159. if(g_level[id] >= 550 && g_reset[id] >= 20)
  10160. menu_additem(menu, "\wNule Strike \r[\wHabilitada \rLevel: \w550 \rReset: \w20\r]", "17", 0);
  10161. else
  10162. menu_additem(menu, "\dNule Strike \r[\dLevel\r: \d550 \r| \dReset\r: \d20\r]", "17", 0);
  10163. if(g_level[id] >= 490 && g_reset[id] >= 24)
  10164. menu_additem(menu, "\wSuper Strike \r[\wHabilitada \rLevel: \w490 \rReset: \w24\r]", "18", 0);
  10165. else
  10166. menu_additem(menu, "\dSuper Strike \r[\dLevel\r: \d490 \r| \dReset\r: \d24\r]", "18", 0);
  10167. if(g_level[id] >= 501 && g_reset[id] >= 26)
  10168. menu_additem(menu, "\wUltra Killer \r[\wHabilitada \rLevel: \w501 \rReset: \w26\r]", "19", 0);
  10169. else
  10170. menu_additem(menu, "\dUltra Killer \r[\dLevel\r: \d501 \r| \dReset\r: \d26\r]", "19", 0);
  10171. if(g_level[id] >= 1 && g_reset[id] >= 30)
  10172. menu_additem(menu, "\wRampage \r[\wHabilitada \rLevel: \w1 \rReset: \w30\r]", "20", 0);
  10173. else
  10174. menu_additem(menu, "\dRampage \r[\dLevel\r: \d1 \r| \dReset\r: \d30\r]", "20", 0);
  10175.  
  10176. menu_setprop(menu, MPROP_EXITNAME, "\ySalir")
  10177. menu_display(id, menu, 0)
  10178. }
  10179.  
  10180. public menu_especiala(id, menu, key)
  10181. {
  10182. switch(key)
  10183. {
  10184. case 0:
  10185. {
  10186. if(g_level[id] >= 330 && g_reset[id] >= 0)
  10187. {
  10188. g_akdestruction[id] = true
  10189. give_item(id, "weapon_ak47")
  10190. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AK47], AMMOTYPE[CSW_AK47], MAXBPAMMO[CSW_AK47])
  10191. g_canbuy[id] = 0;
  10192. show_menu_buy2(id);
  10193. }
  10194. else
  10195. {
  10196. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 330 y Reset: 0");
  10197. show_menu_especiales(id);
  10198. return PLUGIN_HANDLED;
  10199. }
  10200. }
  10201. case 1:
  10202. {
  10203. if(g_level[id] >= 400 && g_reset[id] >= 0)
  10204. {
  10205. g_ultimate[id] = true
  10206. give_item(id, "weapon_sg552")
  10207. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_SG552], AMMOTYPE[CSW_SG552], MAXBPAMMO[CSW_SG552])
  10208. g_canbuy[id] = 0;
  10209. show_menu_buy2(id);
  10210. }
  10211. else
  10212. {
  10213. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 400 y Reset: 0");
  10214. show_menu_especiales(id);
  10215. return PLUGIN_HANDLED;
  10216. }
  10217. }
  10218. case 2:
  10219. {
  10220. if(g_level[id] >= 450 && g_reset[id] >= 0)
  10221. {
  10222. g_atomic[id] = true
  10223. give_item(id, "weapon_famas")
  10224. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_FAMAS], AMMOTYPE[CSW_FAMAS], MAXBPAMMO[CSW_FAMAS])
  10225. g_canbuy[id] = 0;
  10226. show_menu_buy2(id);
  10227. }
  10228. else
  10229. {
  10230. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 450 y Reset: 0");
  10231. show_menu_especiales(id);
  10232. return PLUGIN_HANDLED;
  10233. }
  10234. }
  10235. case 3:
  10236. {
  10237. if(g_level[id] >= 510 && g_reset[id] >= 0)
  10238. {
  10239. g_masive[id] = true
  10240. give_item(id, "weapon_p90")
  10241. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_P90], AMMOTYPE[CSW_P90], MAXBPAMMO[CSW_P90])
  10242. g_canbuy[id] = 0;
  10243. show_menu_buy2(id);
  10244. }
  10245. else
  10246. {
  10247. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 510 y Reset: 0");
  10248. show_menu_especiales(id);
  10249. return PLUGIN_HANDLED;
  10250. }
  10251. }
  10252. case 4:
  10253. {
  10254. if(g_level[id] >= 600 && g_reset[id] >= 0)
  10255. {
  10256. g_navi[id] = true
  10257. give_item(id, "weapon_mp5navy")
  10258. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_MP5NAVY], AMMOTYPE[CSW_MP5NAVY], MAXBPAMMO[CSW_MP5NAVY])
  10259. g_canbuy[id] = 0;
  10260. show_menu_buy2(id);
  10261. }
  10262. else
  10263. {
  10264. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 600 y Reset: 0");
  10265. show_menu_especiales(id);
  10266. return PLUGIN_HANDLED;
  10267. }
  10268. }
  10269. case 5:
  10270. {
  10271. if(g_level[id] >= 651 && g_reset[id] >= 0)
  10272. {
  10273. g_power[id] = true
  10274. give_item(id, "weapon_xm1014")
  10275. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_XM1014], AMMOTYPE[CSW_XM1014], MAXBPAMMO[CSW_XM1014])
  10276. g_canbuy[id] = 0;
  10277. show_menu_buy2(id);
  10278. }
  10279. else
  10280. {
  10281. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 651 y Reset: 0");
  10282. show_menu_especiales(id);
  10283. return PLUGIN_HANDLED;
  10284. }
  10285. }
  10286. case 6:
  10287. {
  10288. if(g_level[id] >= 700 && g_reset[id] >= 0)
  10289. {
  10290. g_stfu[id] = true
  10291. give_item(id, "weapon_g3sg1")
  10292. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_G3SG1], AMMOTYPE[CSW_G3SG1], MAXBPAMMO[CSW_G3SG1])
  10293. g_canbuy[id] = 0;
  10294. show_menu_buy2(id);
  10295. }
  10296. else
  10297. {
  10298. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 700 y Reset: 0");
  10299. show_menu_especiales(id);
  10300. return PLUGIN_HANDLED;
  10301. }
  10302. }
  10303. case 7:
  10304. {
  10305. if(g_level[id] >= 730 && g_reset[id] >= 0)
  10306. {
  10307. g_rlp[id] = true
  10308. give_item(id, "weapon_ump45")
  10309. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_UMP45], AMMOTYPE[CSW_UMP45], MAXBPAMMO[CSW_UMP45])
  10310. g_canbuy[id] = 0;
  10311. show_menu_buy2(id);
  10312. }
  10313. else
  10314. {
  10315. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 730 y Reset: 0");
  10316. show_menu_especiales(id);
  10317. return PLUGIN_HANDLED;
  10318. }
  10319. }
  10320. case 8:
  10321. {
  10322. if(g_level[id] >= 770 && g_reset[id] >= 0)
  10323. {
  10324. g_m4[id] = true
  10325. give_item(id, "weapon_m4a1")
  10326. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M4A1], AMMOTYPE[CSW_M4A1], MAXBPAMMO[CSW_M4A1])
  10327. g_canbuy[id] = 0;
  10328. show_menu_buy2(id);
  10329. }
  10330. else
  10331. {
  10332. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 770 y Reset: 0");
  10333. show_menu_especiales(id);
  10334. return PLUGIN_HANDLED;
  10335. }
  10336. }
  10337. case 9:
  10338. {
  10339. if(g_level[id] >= 800 && g_reset[id] >= 0)
  10340. {
  10341. g_barret[id] = true
  10342. give_item(id, "weapon_m3")
  10343. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M3], AMMOTYPE[CSW_M3], MAXBPAMMO[CSW_M3])
  10344. g_canbuy[id] = 0;
  10345. show_menu_buy2(id);
  10346. }
  10347. else
  10348. {
  10349. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 800 y Reset: 0");
  10350. show_menu_especiales(id);
  10351. return PLUGIN_HANDLED;
  10352. }
  10353. }
  10354. case 10:
  10355. {
  10356. if(g_level[id] >= 860 && g_reset[id] >= 0)
  10357. {
  10358. g_devil[id] = true
  10359. give_item(id, "weapon_galil")
  10360. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_GALIL], AMMOTYPE[CSW_GALIL], MAXBPAMMO[CSW_GALIL])
  10361. g_canbuy[id] = 0;
  10362. show_menu_buy2(id);
  10363. }
  10364. else
  10365. {
  10366. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 860 y Reset: 0");
  10367. show_menu_especiales(id);
  10368. return PLUGIN_HANDLED;
  10369. }
  10370. }
  10371. case 11:
  10372. {
  10373. if(g_level[id] >= 950 && g_reset[id] >= 0)
  10374. {
  10375. g_rampage[id] = true
  10376. give_item(id, "weapon_aug")
  10377. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AUG], AMMOTYPE[CSW_AUG], MAXBPAMMO[CSW_AUG])
  10378. g_canbuy[id] = 0;
  10379. show_menu_buy2(id);
  10380. }
  10381. else
  10382. {
  10383. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 950 y Reset: 0");
  10384. show_menu_especiales(id);
  10385. return PLUGIN_HANDLED;
  10386. }
  10387. }
  10388. case 12:
  10389. {
  10390. if(g_level[id] >= 400 && g_reset[id] >= 1)
  10391. {
  10392. g_supermide[id] = true
  10393. give_item(id, "weapon_ak47")
  10394. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AK47], AMMOTYPE[CSW_AK47], MAXBPAMMO[CSW_AK47])
  10395. g_canbuy[id] = 0;
  10396. show_menu_buy2(id);
  10397. }
  10398. else
  10399. {
  10400. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 400 y Reset: 1");
  10401. show_menu_especiales(id);
  10402. return PLUGIN_HANDLED;
  10403. }
  10404. }
  10405. case 13:
  10406. {
  10407. if(g_level[id] >= 650 && g_reset[id] >= 3)
  10408. {
  10409. g_farger[id] = true
  10410. give_item(id, "weapon_m4a1")
  10411. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M4A1], AMMOTYPE[CSW_M4A1], MAXBPAMMO[CSW_M4A1])
  10412. g_canbuy[id] = 0;
  10413. show_menu_buy2(id);
  10414. }
  10415. else
  10416. {
  10417. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 650 y Reset: 3");
  10418. show_menu_especiales(id);
  10419. return PLUGIN_HANDLED;
  10420. }
  10421. }
  10422. case 14:
  10423. {
  10424. if(g_level[id] >= 500 && g_reset[id] >= 6)
  10425. {
  10426. g_storm[id] = true
  10427. give_item(id, "weapon_galil")
  10428. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_GALIL], AMMOTYPE[CSW_GALIL], MAXBPAMMO[CSW_GALIL])
  10429. g_canbuy[id] = 0;
  10430. show_menu_buy2(id);
  10431. }
  10432. else
  10433. {
  10434. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 500 y Reset: 6");
  10435. show_menu_especiales(id);
  10436. return PLUGIN_HANDLED;
  10437. }
  10438. }
  10439. case 15:
  10440. {
  10441. if(g_level[id] >= 450 && g_reset[id] >= 10)
  10442. {
  10443. g_adge[id] = true
  10444. give_item(id, "weapon_famas")
  10445. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_FAMAS], AMMOTYPE[CSW_FAMAS], MAXBPAMMO[CSW_FAMAS])
  10446. g_canbuy[id] = 0;
  10447. show_menu_buy2(id);
  10448. }
  10449. else
  10450. {
  10451. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 450 y Reset: 10");
  10452. show_menu_especiales(id);
  10453. return PLUGIN_HANDLED;
  10454. }
  10455. }
  10456. case 16:
  10457. {
  10458. if(g_level[id] >= 601 && g_reset[id] >= 15)
  10459. {
  10460. g_ultra[id] = true
  10461. give_item(id, "weapon_xm1014")
  10462. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_XM1014], AMMOTYPE[CSW_XM1014], MAXBPAMMO[CSW_XM1014])
  10463. g_canbuy[id] = 0;
  10464. show_menu_buy2(id);
  10465. }
  10466. else
  10467. {
  10468. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 601 y Reset: 15");
  10469. show_menu_especiales(id);
  10470. return PLUGIN_HANDLED;
  10471. }
  10472. }
  10473. case 17:
  10474. {
  10475. if(g_level[id] >= 550 && g_reset[id] >= 20)
  10476. {
  10477. g_nule[id] = true
  10478. give_item(id, "weapon_aug")
  10479. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AUG], AMMOTYPE[CSW_AUG], MAXBPAMMO[CSW_AUG])
  10480. g_canbuy[id] = 0;
  10481. show_menu_buy2(id);
  10482. }
  10483. else
  10484. {
  10485. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 550 y Reset: 20");
  10486. show_menu_especiales(id);
  10487. return PLUGIN_HANDLED;
  10488. }
  10489. }
  10490. case 18:
  10491. {
  10492. if(g_level[id] >= 490 && g_reset[id] >= 24)
  10493. {
  10494. g_super[id] = true
  10495. give_item(id, "weapon_m3")
  10496. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M3], AMMOTYPE[CSW_M3], MAXBPAMMO[CSW_M3])
  10497. g_canbuy[id] = 0;
  10498. show_menu_buy2(id);
  10499. }
  10500. else
  10501. {
  10502. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 490 y Reset: 24");
  10503. show_menu_especiales(id);
  10504. return PLUGIN_HANDLED;
  10505. }
  10506. }
  10507. case 19:
  10508. {
  10509. if(g_level[id] >= 501 && g_reset[id] >= 26)
  10510. {
  10511. g_ultrak[id] = true
  10512. give_item(id, "weapon_sg552")
  10513. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_SG552], AMMOTYPE[CSW_SG552], MAXBPAMMO[CSW_SG552])
  10514. g_canbuy[id] = 0;
  10515. show_menu_buy2(id);
  10516. }
  10517. else
  10518. {
  10519. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 501 y Reset: 26");
  10520. show_menu_especiales(id);
  10521. return PLUGIN_HANDLED;
  10522. }
  10523. }
  10524. case 20:
  10525. {
  10526. if(g_level[id] >= 1 && g_reset[id] >= 30)
  10527. {
  10528. g_raampage[id] = true
  10529. give_item(id, "weapon_g3sg1")
  10530. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_G3SG1], AMMOTYPE[CSW_G3SG1], MAXBPAMMO[CSW_G3SG1])
  10531. g_canbuy[id] = 0;
  10532. show_menu_buy2(id);
  10533. }
  10534. else
  10535. {
  10536. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y Reset: 30");
  10537. show_menu_especiales(id);
  10538. return PLUGIN_HANDLED;
  10539. }
  10540. }
  10541. }
  10542. return PLUGIN_HANDLED;
  10543. }
  10544.  
  10545. show_menu_eleccion(id)
  10546. {
  10547. new menu = menu_create("\yElegir Armas:", "menu_eleccion")
  10548.  
  10549. menu_additem(menu, "\wArmas Comunes", "1", 0);
  10550. menu_additem(menu, "\rArmas Modificadas", "2", 0);
  10551.  
  10552. menu_setprop(menu, MPROP_EXITNAME, "\ySalir")
  10553. menu_display(id, menu, 0)
  10554. }
  10555.  
  10556. public menu_eleccion(id, menu, key)
  10557. {
  10558. switch(key)
  10559. {
  10560. case 0: show_menu_buy1(id);
  10561. case 1: show_menu_especiales(id);
  10562.  
  10563. }
  10564. return PLUGIN_HANDLED;
  10565. }
  10566.  
  10567. // En 'Notice_One' estamos haciendo un Hud Message, con colores y en un lugar, todo configurado.
  10568. public Notice_One()
  10569. {
  10570. set_hudmessage(141, 63, 158, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
  10571. ShowSyncHudMsg(0, g_MsgSync, "El Fin De Los Tiempos Se Acerca!!!")
  10572.  
  10573. set_task(6.0, "Notice_Two") // Llamamos a 'Notice_Two' luego de 4.3 Segundos que aparecio 'Notice_One'
  10574. }
  10575.  
  10576. // En 'Notice_Two' estamos haciendo un Hud Message, con colores y en un lugar, todo configurado.
  10577. public Notice_Two()
  10578. {
  10579. set_hudmessage(141, 63, 158, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
  10580. ShowSyncHudMsg(0, g_MsgSync, "Modo Armagedon!!")
  10581. }
  10582.  
  10583. public EffectModeEnd()
  10584. {
  10585. message_begin(MSG_BROADCAST, g_msgScreenFade) // Open The Function
  10586. write_short((1<<12)*4) // Duration
  10587. write_short(floatround((1<<12)*1.0)) // Hold Time
  10588. write_short(0x0000) // Fade Type
  10589. write_byte(0) // Color Red
  10590. write_byte(0) // Color Green
  10591. write_byte(0) // Color Blue
  10592. write_byte(250) // Alpha
  10593. message_end() // Close The Function
  10594. }
  10595.  
  10596. // En este Efecto, diran que es el mismo que hizimos antes, pero no es asi.
  10597. // Si se fijan bien, tiene otras configuraciones.
  10598. // Lo que estamos haciendo, es que el ScreenFade desaparesca de a poquito y no de Golpe.
  10599. // Seria como un Estilo mas realista.
  10600.  
  10601. effectlevelup(id)
  10602. {
  10603. new vec1[3], vec2[3]
  10604. get_user_origin(id, vec2)
  10605.  
  10606. vec2[2] -= 26
  10607. vec1[0] = vec2[0]
  10608. vec1[1] = vec2[1]
  10609. vec1[2] = vec2[2] + 400
  10610.  
  10611. // Thunder 1
  10612. message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
  10613. write_byte( 0 )
  10614. write_coord(vec1[0])
  10615. write_coord(vec1[1]+30)
  10616. write_coord(vec1[2])
  10617. write_coord(vec2[0])
  10618. write_coord(vec2[1]+30)
  10619. write_coord(vec2[2])
  10620. write_short(g_thunder1Spr) // sprite que utilizaremos
  10621. write_byte(1) // startframe
  10622. write_byte(5) // flamerate
  10623. write_byte(2) // life
  10624. write_byte(20) // width
  10625. write_byte(30) // noise
  10626. write_byte(255) // Intensidad del color rojo
  10627. write_byte(255) // Intensidad del color verde
  10628. write_byte(0) // Intensidad del color azul
  10629. write_byte(200) // brillo del rayo
  10630. write_byte(100) // Rapidéz del rayo al caer
  10631. message_end()
  10632.  
  10633. // Thunder 2
  10634. message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
  10635. write_byte( 0 )
  10636. write_coord(vec1[0])
  10637. write_coord(vec1[1]+30)
  10638. write_coord(vec1[2])
  10639. write_coord(vec2[0])
  10640. write_coord(vec2[1]+30)
  10641. write_coord(vec2[2])
  10642. write_short(g_thunder2Spr) // sprite que utilizaremos
  10643. write_byte(1) // startframe
  10644. write_byte(5) // flamerate
  10645. write_byte(2) // life
  10646. write_byte(20) // width
  10647. write_byte(30) // noise
  10648. write_byte(255) // Intensidad del color rojo
  10649. write_byte(255) // Intensidad del color verde
  10650. write_byte(0) // Intensidad del color azul
  10651. write_byte(200) // brillo del rayo
  10652. write_byte(100) // Rapidéz del rayo al caer
  10653. message_end()
  10654. }
  10655.  
  10656. // menu granadasds
  10657. public show_menu_granades(id)
  10658. {
  10659. new menu = menu_create("\ySeleccionar Granadas \r[1-4]", "menu_handler")
  10660.  
  10661. if(g_level[id] >= 0)
  10662. menu_additem(menu, "\y1 Fuego", "1", 0);
  10663. else
  10664. menu_additem(menu, "\d1 Fuego \r[Bloqueado]", "1", 0);
  10665. if(g_level[id] >= 30)
  10666. menu_additem(menu, "\y1 Fuego || 1 Hileo", "2", 0);
  10667. else
  10668. menu_additem(menu, "\d1 Fuego || 1 Hileo \r[Level: 30]", "2", 0);
  10669. if(g_level[id] >= 70)
  10670. menu_additem(menu, "\y3 Hielo", "3", 0);
  10671. else
  10672. menu_additem(menu, "\d3 Hielo \r[Level: 70]", "3", 0);
  10673. if(g_level[id] >= 145)
  10674. menu_additem(menu, "\y2 Fuego || 2 Hielo", "4", 0);
  10675. else
  10676. menu_additem(menu, "\d2 Fuego || 2 Hielo \r[Level: 145]", "4", 0);
  10677. if(g_level[id] >= 200)
  10678. menu_additem(menu, "\y1 Fuego || 1 Hielo || 1 Burbuja", "5", 0);
  10679. else
  10680. menu_additem(menu, "\d1 Fuego || 1 Hielo || 1 Burbuja \r[Level: 200]", "5", 0);
  10681. if(g_level[id] >= 260)
  10682. menu_additem(menu, "\y1 Fuego || 2 Hielo || 1 Burbuja", "6", 0);
  10683. else
  10684. menu_additem(menu, "\d1 Fuego || 2 Hielo || 1 Burbuja \r[Level: 260]", "6", 0);
  10685. if(g_level[id] >= 330)
  10686. menu_additem(menu, "\y2 Fuego || 2 Hielo || 1 Burbuja", "7", 0);
  10687. else
  10688. menu_additem(menu, "\d2 Fuego || 2 Hielo || 1 Burbuja \r[Level: 330]", "7", 0);
  10689.  
  10690. menu_display(id, menu, 0)
  10691. }
  10692. // Menu Grenades
  10693. public menu_handler(id, menu, key)
  10694. {
  10695. if(g_zombie[id])
  10696. {
  10697. menu_destroy(menu)
  10698. return PLUGIN_HANDLED
  10699. }
  10700.  
  10701. switch(key)
  10702. {
  10703. case 0:
  10704. {
  10705. if (g_level[id] >= 0)
  10706. {
  10707. give_item(id, "weapon_hegrenade");
  10708. }
  10709. else
  10710. {
  10711. show_menu_granades(id);
  10712. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 No Tienes Nivel Suficiente Para Esta Granada");
  10713. return PLUGIN_HANDLED;
  10714. }
  10715. }
  10716. case 1:
  10717. {
  10718. if (g_level[id] >= 30)
  10719. {
  10720. give_item(id, "weapon_hegrenade");
  10721. give_item(id, "weapon_flashbang");
  10722. }
  10723. else
  10724. {
  10725. show_menu_granades(id);
  10726. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 No Tienes Nivel Suficiente Para Esta Granada");
  10727. return PLUGIN_HANDLED;
  10728. }
  10729. }
  10730. case 2:
  10731. {
  10732. if (g_level[id] >= 70)
  10733. {
  10734. give_item(id, "weapon_flashbang");
  10735. give_item(id, "weapon_flashbang");
  10736. give_item(id, "weapon_flashbang");
  10737. cs_set_user_bpammo(id, CSW_FLASHBANG, 3);
  10738. }
  10739. else
  10740. {
  10741. show_menu_granades(id);
  10742. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 No Tienes Nivel Suficiente Para Esta Granada");
  10743. return PLUGIN_HANDLED;
  10744. }
  10745. }
  10746. case 3:
  10747. {
  10748. if (g_level[id] >= 145)
  10749. {
  10750. give_item(id, "weapon_flashbang");
  10751. give_item(id, "weapon_flashbang");
  10752. give_item(id, "weapon_hegrenade");
  10753. cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
  10754. }
  10755. else
  10756. {
  10757. show_menu_granades(id);
  10758. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 No Tienes Nivel Suficiente Para Esta Granada");
  10759. return PLUGIN_HANDLED;
  10760. }
  10761. }
  10762. case 4:
  10763. {
  10764. if (g_level[id] >= 200)
  10765. {
  10766. g_bubble_bomb[id] = true
  10767. g_bubble_bomb[id]++
  10768. fm_give_item(id, "weapon_hegrenade")
  10769. fm_give_item(id, "weapon_flashbang")
  10770. fm_give_item(id, "weapon_smokegrenade")
  10771. fm_set_user_bpammo(id, CSW_SMOKEGRENADE, 1)
  10772. }
  10773. else
  10774. {
  10775. show_menu_granades(id);
  10776. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 No Tienes Nivel Suficiente Para Esta Granada");
  10777. return PLUGIN_HANDLED;
  10778. }
  10779. }
  10780. case 5:
  10781. {
  10782. if (g_level[id] >= 260)
  10783. {
  10784. g_bubble_bomb[id] = true
  10785. g_bubble_bomb[id] ++
  10786. fm_give_item(id, "weapon_hegrenade");
  10787. fm_give_item(id, "weapon_flashbang");
  10788. fm_give_item(id, "weapon_flashbang");
  10789. fm_give_item(id, "weapon_smokegrenade");
  10790. fm_set_user_bpammo(id, CSW_SMOKEGRENADE, 1)
  10791. }
  10792. else
  10793. {
  10794. show_menu_granades(id);
  10795. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 No Tienes Nivel Suficiente Para Esta Granada");
  10796. return PLUGIN_HANDLED;
  10797. }
  10798. }
  10799. case 6:
  10800. {
  10801. if (g_level[id] >= 330)
  10802. {
  10803. g_bubble_bomb[id] = true
  10804. g_bubble_bomb[id] += 2
  10805. fm_give_item(id, "weapon_hegrenade");
  10806. fm_give_item(id, "weapon_hegrenade");
  10807. fm_give_item(id, "weapon_flashbang");
  10808. fm_give_item(id, "weapon_flashbang");
  10809. fm_give_item(id, "weapon_smokegrenade");
  10810. fm_set_user_bpammo(id, CSW_SMOKEGRENADE, 2)
  10811. fm_set_user_bpammo(id, CSW_HEGRENADE, 2)
  10812. }
  10813. else
  10814. {
  10815. show_menu_granades(id);
  10816. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 No Tienes Nivel Suficiente Para Esta Granada");
  10817. return PLUGIN_HANDLED;
  10818. }
  10819. }
  10820. }
  10821. return PLUGIN_HANDLED
  10822. }
  10823.  
  10824. public dar_cuchillo(id)
  10825. {
  10826. if (is_user_alive(id))
  10827. {
  10828. give_item(id, "weapon_knife")
  10829. client_cmd(id, "cl_forwardspeed 10000")
  10830. client_cmd(id, "cl_sidespeed 10000")
  10831. }
  10832. else
  10833. {
  10834. return;
  10835. }
  10836. }
  10837.  
  10838.  
  10839. public Combo_Terminado(id)
  10840. {
  10841. id -= TASK_COMBO;
  10842.  
  10843. for(new i = 0 ; i < sizeof Combo ; i++)
  10844. {
  10845. if (g_combo[id] >= Combo[i][Combos] && g_combo[id] < Combo[i+1][Combos])
  10846. {
  10847. if (!g_happytime)
  10848. {
  10849. set_hudmessage(255, 255, 255, -1.0, 0.29, 0, 0.1, 4.5, 0.01, 0.01, -1)
  10850. ShowSyncHudMsg(id, g_MsgSync3, "Combo de (%d) Finalizado^nBonificacion Multiplicada x%d^nTotal de AmmoPacks Ganado(%d)", g_combo[id], Combo[i][Multiplicado], g_combo[id] * Combo[i][Multiplicado])
  10851. g_ammopacks[id] += g_combo[id] * Combo[i][Multiplicado]
  10852. zp_colored_print(id, "^x04[ZP]^x03 Combo Nivel ^x04 (%d)^x03 Finalizado - Bonificacion Multiplicada ^x04 x%d ^x03 - Total de Ammopacks Ganados ^x04 (%d)", g_combo[id], Combo[i][Multiplicado], g_combo[id] * Combo[i][Multiplicado])
  10853. }
  10854. else
  10855. {
  10856. set_hudmessage(255, 255, 255, -1.0, 0.29, 0, 0.1, 4.5, 0.01, 0.01, -1)
  10857. ShowSyncHudMsg(id, g_MsgSync3, "Combo de (%d) Finalizado^nBonificacion Multiplicada x%d^nTotal de AmmoPacks Ganado(%d)", g_combo[id], Comboh[i][Multiplicado], g_combo[id] * Comboh[i][Multiplicado])
  10858. g_ammopacks[id] += g_combo[id] * Comboh[i][Multiplicado]
  10859. zp_colored_print(id, "^x04[ZP]^x03 Combo Loco Level ^x04 (%d)^x03 Finalizado - Bonificacion Multiplicada ^x04 x%d ^x03 - Total de Ammopacks Ganados ^x04 (%d)", g_combo[id], Comboh[i][Multiplicado], g_combo[id] * Comboh[i][Multiplicado])
  10860. }
  10861. }
  10862. }
  10863. g_damage[id] = g_total[id] = g_combo[id] = 0;
  10864. update_ap(id, 0, 1);
  10865. }
  10866. public menu_usuario(id)
  10867. {
  10868. new menu = menu_create("\rConfiguracion \rDel \rUsuario\r:", "menu_usuarioo")
  10869.  
  10870. menu_additem(menu, "\wHacer \wReset" , "1", 0);
  10871. menu_additem(menu, "\wHacer \wGrandReset" , "2", 0);
  10872. menu_additem(menu, "\yDatos Para Fotos. Presiona \rF5\y Para tomar Foto" , "3", 0);
  10873.  
  10874. menu_setprop(menu, MPROP_EXITNAME, "\ySalir")
  10875. menu_display(id, menu, 0)
  10876. }
  10877. public menu_usuarioo(id, menu, key)
  10878. {
  10879. switch(key)
  10880. {
  10881. case 0: show_menu_reset(id);
  10882. case 1: show_menu_grand_reset(id);
  10883. case 2: Datos(id);
  10884. }
  10885.  
  10886. return PLUGIN_HANDLED;
  10887. }
  10888.  
  10889. // Happy Hour
  10890. public happyhour(id)
  10891. {
  10892. new data[12]
  10893. get_time("%H", data, 12)
  10894. new Tiempo = str_to_num(data)
  10895.  
  10896. for(new i=0;i <= sizeof horas - 1;i++)
  10897. {
  10898. if(Tiempo != horas[i]) continue
  10899. g_happytime = true
  10900. break;
  10901. }
  10902. if(g_happytime)
  10903. {
  10904. zp_colored_print(0, "^x04[HL]^x01 -^x03 HORA LOCA:^x01 Ya Comenzo!!! ^x01, El server esta tan ^x04LOCO ^x01que ganas ^x03x2 ^x01de ^x04Packs ^x03x2 ^x01de ^x04Puntos ^x01y ^x03x2 ^x01de ^x04 COMBO!!")
  10905. client_cmd(id, "spk %s", HoraLoca)
  10906. }
  10907. }
  10908.  
  10909. public cmdParty(id)
  10910. {
  10911. if(g_PartyData[id][In_Party])
  10912. show_party_info_menu(id)
  10913. else
  10914. show_party_menu(id)
  10915.  
  10916. return PLUGIN_HANDLED
  10917. }
  10918.  
  10919. public show_party_menu(id)
  10920. {
  10921. new iMenu = menu_create("|Guar| Guarimberos Gaming Vzla \rMenu Party:","party_menu"), BlockParty[50]
  10922.  
  10923. menu_additem(iMenu, "\yCrear Party", "0")
  10924.  
  10925. formatex(BlockParty, charsmax(BlockParty), "\yBloquear Invitaciones De Party: \w%s",g_PartyData[id][Block_Party] ? "Si" : "No")
  10926.  
  10927. menu_additem(iMenu, BlockParty, "1")
  10928.  
  10929. menu_setprop(iMenu, MPROP_EXITNAME, "Salir")
  10930. menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  10931. menu_display(id, iMenu, 0)
  10932. }
  10933.  
  10934. public show_party_info_menu(id)
  10935. {
  10936. new iMenu = menu_create("|Guar| Guarimberos Gaming Vzla \rMenu Party:","party_info_menu")
  10937.  
  10938. menu_additem(iMenu, "Agregar Integrante", .callback = g_MenuCallback[MASTER])
  10939. menu_additem(iMenu, "Expulsar Integrante", .callback = g_MenuCallback[MASTER])
  10940. menu_additem(iMenu, "Destruir Party", .callback = g_MenuCallback[MASTER])
  10941. menu_additem(iMenu, "Salir del Party", .callback = g_MenuCallback[USER])
  10942.  
  10943. menu_setprop(iMenu, MPROP_EXITNAME, "Salir")
  10944. menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  10945. menu_display(id, iMenu)
  10946. }
  10947.  
  10948. public show_party_add_menu(id)
  10949. {
  10950. new iMenu = menu_create(g_PartyData[id][In_Party] ? "\rAgregar Integrante:" : "\rCrear Party:", "party_create_menu"), Poss[3], Name[32]
  10951.  
  10952. for(new i = 1; i <= get_maxplayers();i++)
  10953. {
  10954. if(!is_available_to_party(i) || id == i)
  10955. continue;
  10956.  
  10957. get_user_name(i, Name, charsmax(Name))
  10958. num_to_str(i, Poss, charsmax(Poss))
  10959. menu_additem(iMenu, Name, Poss)
  10960. }
  10961.  
  10962. menu_setprop(iMenu, MPROP_EXITNAME, "Salir")
  10963. menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  10964. menu_display(id, iMenu)
  10965. }
  10966.  
  10967. public show_party_kick_menu(id)
  10968. {
  10969. new iMenu = menu_create("\rKick Party Menu:","party_kick_menu"), Players[32], Poss[3], user
  10970.  
  10971. get_party_index(id, Players)
  10972.  
  10973. for(new i; i < g_PartyData[id][Amount_In_Party]; i++)
  10974. {
  10975. user = Players[i]
  10976. num_to_str(user, Poss, charsmax(Poss))
  10977. menu_additem(iMenu, g_PartyData[user][UserName], Poss)
  10978. }
  10979.  
  10980. menu_setprop(iMenu, MPROP_EXITNAME, "Salir")
  10981. menu_display(id, iMenu)
  10982. }
  10983.  
  10984. public show_party_invite_menu(id2, MasterId)
  10985. {
  10986. new MenuTitle[128], iMenu, Str_MasterId[3]
  10987.  
  10988. set_player_party_name(MasterId)
  10989. set_player_party_name(id2)
  10990.  
  10991. client_print(MasterId, print_chat, "%s Solicitud enviada a %s", TAG, g_PartyData[id2][UserName])
  10992.  
  10993. formatex(MenuTitle, charsmax(MenuTitle), "%s te mando una invitacion para %s Party", g_PartyData[MasterId][UserName], g_PartyData[MasterId][In_Party] ? "unirte al" : "crear un")
  10994.  
  10995. new UserTaskArgs[3]
  10996.  
  10997. UserTaskArgs[0] = iMenu = menu_create( MenuTitle , "party_invite_menu")
  10998. UserTaskArgs[1] = MasterId
  10999.  
  11000. num_to_str(MasterId, Str_MasterId, charsmax(Str_MasterId))
  11001.  
  11002. menu_additem( iMenu , "Aceptar", Str_MasterId)
  11003. menu_additem( iMenu , "Rechazar", Str_MasterId)
  11004.  
  11005. if(is_user_bot(id2) && get_pcvar_num(cvar_allow_bots))
  11006. {
  11007. party_invite_menu(id2, iMenu, 0)
  11008. return
  11009. }
  11010.  
  11011. menu_setprop(iMenu, MPROP_EXIT, MEXIT_NEVER)
  11012. menu_display(id2, iMenu)
  11013. remove_task_acept(id2)
  11014. set_task(get_pcvar_float(cvar_time_acept), "Time_Acept", id2+TASK_ACEPT, UserTaskArgs, 2)
  11015. }
  11016.  
  11017. public party_menu(id, menu, item)
  11018. {
  11019. if(item == MENU_EXIT)
  11020. {
  11021. menu_destroy(menu)
  11022. return
  11023. }
  11024.  
  11025. if(item)
  11026. {
  11027. g_PartyData[id][Block_Party] = g_PartyData[id][Block_Party] ? false : true
  11028. show_party_menu(id)
  11029. }
  11030. else
  11031. show_party_add_menu(id)
  11032.  
  11033. menu_destroy(menu)
  11034. }
  11035.  
  11036. public party_create_menu(id, menu, item)
  11037. {
  11038. if(item == MENU_EXIT)
  11039. {
  11040. menu_destroy(menu)
  11041. return
  11042. }
  11043.  
  11044. new iKey[6], iAccess, iCallback, id2
  11045. menu_item_getinfo(menu, item, iAccess, iKey, charsmax(iKey), _, _, iCallback)
  11046.  
  11047. id2 = str_to_num(iKey)
  11048.  
  11049. if(!is_available_to_party(id2))
  11050. return
  11051.  
  11052. show_party_invite_menu(id2, id)
  11053. menu_destroy(menu)
  11054. }
  11055.  
  11056. public party_invite_menu(id, menu, item)
  11057. {
  11058. if(item == MENU_EXIT)
  11059. {
  11060. menu_destroy(menu)
  11061. remove_task_acept(id)
  11062. return
  11063. }
  11064.  
  11065. new iKey[6], iAccess, iCallback, id_master
  11066. menu_item_getinfo(menu, item, iAccess, iKey, charsmax(iKey), _, _, iCallback)
  11067.  
  11068. id_master = str_to_num(iKey)
  11069.  
  11070. switch(item)
  11071. {
  11072. case 0:
  11073. {
  11074.  
  11075. if(!g_PartyData[id_master][In_Party])
  11076. {
  11077. create_party(id_master, id)
  11078. set_task_party_hud(id_master)
  11079. set_task_party_hud(id)
  11080. }
  11081. else
  11082. {
  11083. if(g_PartyData[id_master][Amount_In_Party] == get_pcvar_num(cvar_max_players))
  11084. {
  11085. client_print(id, print_chat, "%s Ya se alcanzo el numero maximo de integrantes en la party", TAG)
  11086. client_print(id_master, print_chat, "%s Ya alcanzaste el numero maximo de integrantes en la party", TAG)
  11087.  
  11088. remove_task_acept(id)
  11089.  
  11090. menu_destroy(menu)
  11091. return
  11092. }
  11093.  
  11094. add_party_user(id_master, id)
  11095. set_task_party_hud(id)
  11096. }
  11097. client_print(id_master, print_chat, "%s %s fue agregado al Party", TAG, g_PartyData[id][UserName])
  11098. }
  11099. case 1: client_print(id_master, print_chat, "%s %s cancelo la invitacion de Party", TAG, g_PartyData[id][UserName])
  11100. }
  11101.  
  11102. remove_task_acept(id)
  11103. menu_destroy(menu)
  11104. }
  11105.  
  11106. public party_kick_menu(id, menu, item)
  11107. {
  11108. if(item == MENU_EXIT)
  11109. {
  11110. menu_destroy(menu)
  11111. return
  11112. }
  11113.  
  11114. new iKey[6], iAccess, iCallback, id2
  11115. menu_item_getinfo(menu, item, iAccess, iKey, charsmax(iKey), _, _, iCallback)
  11116.  
  11117. id2 = str_to_num(iKey)
  11118.  
  11119. if(is_user_connected(id2))
  11120. g_PartyData[id][Amount_In_Party] == 2 ? destoy_party(id) : remove_party_user(id2)
  11121.  
  11122. menu_destroy(menu)
  11123. }
  11124.  
  11125. public party_info_menu(id, menu,item)
  11126. {
  11127. if(item == MENU_EXIT)
  11128. {
  11129. menu_destroy(menu)
  11130. return
  11131. }
  11132.  
  11133. switch(item)
  11134. {
  11135. case 0:
  11136. {
  11137. if(g_PartyData[id][Amount_In_Party] < get_pcvar_num(cvar_max_players))
  11138. show_party_add_menu(id)
  11139. else
  11140. client_print(id, print_chat, "%s Ya alcanzaste el numero maximo de integrantes en la party", TAG)
  11141. }
  11142. case 1: show_party_kick_menu(id)
  11143. case 2: destoy_party(id)
  11144. case 3: remove_party_user(id)
  11145. }
  11146. menu_destroy(menu)
  11147. }
  11148.  
  11149. public PartyHud(taskid)
  11150. {
  11151. static id
  11152. id = ID_HUD
  11153.  
  11154. if(!is_user_connected(id))
  11155. {
  11156. remove_task(taskid)
  11157. return
  11158. }
  11159.  
  11160. static CountParty, PartyMsg[256], Players[32], id2
  11161.  
  11162. CountParty = 0
  11163. PartyMsg[0] = 0
  11164.  
  11165. get_party_index(id, Players)
  11166. for(new i; i < g_PartyData[id][Amount_In_Party]; i++)
  11167. {
  11168. id2 = Players[i]
  11169.  
  11170. if(CountParty)
  11171. add(PartyMsg, charsmax(PartyMsg), "^n^n")
  11172.  
  11173. format(PartyMsg, charsmax(PartyMsg), "%s%s ^nLevel: %d^nAmmopacsk: %d", strlen(PartyMsg) ? PartyMsg : "^t^t^tMiembros del Party^n", g_PartyData[id2][UserName], g_level[id2], g_ammopacks[id2])
  11174. CountParty++
  11175. }
  11176.  
  11177. set_hudmessage(255, 0, 0, 0.75, 0.34, 0, 6.0, 1.0);
  11178. show_hudmessage(id, PartyMsg)
  11179. }
  11180.  
  11181. public Time_Acept(UserTaskArgs[], taskid)
  11182. {
  11183. taskid -= TASK_ACEPT;
  11184.  
  11185. if(!g_PartyData[taskid][In_Party])
  11186. {
  11187. client_print(UserTaskArgs[1], print_chat, "%s %s cancelo la invitacion de party", TAG, g_PartyData[taskid][UserName])
  11188. menu_destroy(UserTaskArgs[0])
  11189. show_menu(taskid, 0, "^n", 1)
  11190. }
  11191. }
  11192.  
  11193. stock create_party(master, guest)
  11194. {
  11195. set_party_member(master, master)
  11196. set_party_member(master, guest)
  11197. set_party_member(guest, master)
  11198. set_party_member(guest, guest)
  11199.  
  11200. set_party_vars(master, Start_Amount)
  11201. set_party_vars(guest, ++g_PartyData[master][Amount_In_Party])
  11202. }
  11203.  
  11204. stock add_party_user(master, guest)
  11205. {
  11206. new Players[32], member, amount = g_PartyData[master][Amount_In_Party]
  11207.  
  11208. get_party_index(master, Players)
  11209.  
  11210. for(new i; i < amount; i++)
  11211. {
  11212. member = Players[i]
  11213.  
  11214. set_party_member(guest, member)
  11215. set_party_member(member, guest)
  11216. g_PartyData[member][Amount_In_Party]++
  11217.  
  11218. }
  11219.  
  11220. set_party_member(guest, guest)
  11221. set_party_vars(guest, amount+1)
  11222. }
  11223.  
  11224. stock set_party_member(id, id2)
  11225. ArrayPushCell(Party_Ids[id], id2)
  11226.  
  11227. stock set_party_vars(id, amount)
  11228. {
  11229. g_PartyData[id][In_Party] = true
  11230. g_PartyData[id][Position] = amount-1
  11231. g_PartyData[id][Amount_In_Party] = amount
  11232. }
  11233.  
  11234. stock destoy_party(id)
  11235. {
  11236. new Players[32], id2, Amount = g_PartyData[id][Amount_In_Party]
  11237. get_party_index(id, Players)
  11238.  
  11239. for(new i; i < Amount; i++)
  11240. {
  11241. id2 = Players[i]
  11242. clear_party_user(id2)
  11243. client_print(id2, print_chat, "%s La party fue destruida", TAG)
  11244.  
  11245. }
  11246. }
  11247.  
  11248. stock remove_party_user(user)
  11249. {
  11250. new Players[32], id, Amount = g_PartyData[user][Amount_In_Party]
  11251. get_party_index(user, Players)
  11252.  
  11253. clear_party_user(user)
  11254.  
  11255. for(new i; i < Amount; i++)
  11256. {
  11257. id = Players[i]
  11258.  
  11259. if(id != user)
  11260. {
  11261. ArrayClear(Party_Ids[id])
  11262.  
  11263. for(new z; z < Amount; z++)
  11264. if(Players[z] != user)
  11265. set_party_member(id, Players[z])
  11266.  
  11267. g_PartyData[id][Position] = i
  11268. g_PartyData[id][Amount_In_Party] = Amount-1
  11269. client_print(id, print_chat, "%s %s salio del party", TAG, g_PartyData[user][UserName])
  11270. }
  11271. }
  11272. }
  11273.  
  11274. stock clear_party_user(id)
  11275. {
  11276. ArrayClear(Party_Ids[id])
  11277. g_PartyData[id][In_Party] = false
  11278. g_PartyData[id][Position] = NONE
  11279. g_PartyData[id][Amount_In_Party] = NONE
  11280. remove_task_party_hud(id)
  11281. }
  11282.  
  11283. stock set_task_party_hud(id)
  11284. set_task(1.0, "PartyHud", id+TASK_HUD, _, _, "b")
  11285.  
  11286. stock remove_task_party_hud(id)
  11287. remove_task(id+TASK_HUD)
  11288.  
  11289. stock remove_task_acept(id)
  11290. {
  11291. if(task_exists(id+TASK_ACEPT))
  11292. remove_task(id+TASK_ACEPT)
  11293. }
  11294.  
  11295. stock set_player_party_name(id)
  11296. {
  11297. if(g_PartyData[id][UserName][0])
  11298. return 0
  11299.  
  11300. get_user_name(id, g_PartyData[id][UserName], charsmax(g_PartyData[][UserName]))
  11301.  
  11302. return 1
  11303. }
  11304.  
  11305. stock is_available_to_party(id)
  11306. {
  11307. if(!is_user_connected(id) || g_PartyData[id][In_Party] || g_PartyData[id][Block_Party])
  11308. return false
  11309.  
  11310. return true
  11311. }
  11312.  
  11313. stock get_party_index(id, players[])
  11314. {
  11315. for(new i; i < g_PartyData[id][Amount_In_Party]; i++)
  11316. players[i] = ArrayGetCell(Party_Ids[id], i)
  11317.  
  11318. return players[0] ? 1 : 0
  11319. }
  11320.  
  11321. public check_master(id)
  11322. return g_PartyData[id][Position] ? ITEM_DISABLED : ITEM_ENABLED
  11323.  
  11324. public check_user(id)
  11325. return g_PartyData[id][Position] ? ITEM_ENABLED : ITEM_DISABLED
  11326.  
  11327. public cmdSayTeam(id)
  11328. {
  11329. static Text[192]
  11330. read_args(Text, charsmax(Text))
  11331. remove_quotes(Text)
  11332.  
  11333. replace_all(Text, charsmax(Text), "%", "")
  11334.  
  11335. if(!ValidMessage(Text) || !g_PartyData[id][In_Party])
  11336. {
  11337. client_print(id, print_chat,"%s Tu Mensaje es invalido o no te encuentras en un Party", TAG)
  11338. return PLUGIN_HANDLED;
  11339. }
  11340.  
  11341. static Message[192], Players[32], id2, Amount
  11342. Amount = g_PartyData[id][Amount_In_Party]
  11343.  
  11344. get_party_index(id, Players)
  11345.  
  11346. formatex(Message, charsmax(Message), "^x04%s ^x03%s^x01 : %s", TAG, g_PartyData[id][UserName], Text)
  11347.  
  11348. for(new i; i < Amount; i++)
  11349. {
  11350. id2 = Players[i]
  11351.  
  11352. message_begin(MSG_ONE_UNRELIABLE, g_MsgSayText, _, id2)
  11353. write_byte(id)
  11354. write_string(Message)
  11355. message_end()
  11356. }
  11357.  
  11358. return PLUGIN_HANDLED;
  11359. }
  11360.  
  11361. ValidMessage(text[])
  11362. {
  11363. static len, i
  11364. len = strlen(text)
  11365.  
  11366. if(!len)
  11367. return false
  11368.  
  11369. for(i = 0; i < len; i++)
  11370. if( text[i] != ' ' )
  11371. return true
  11372.  
  11373. return false
  11374. }
  11375.  
  11376. public set_sombrero(id)
  11377. {
  11378. if(!g_reset[id])
  11379. return
  11380.  
  11381. if(is_user_alive(id))
  11382. {
  11383. if(g_reset[id] >= 1) g_sombrero[id] = 0
  11384. if(g_reset[id] >= 3) g_sombrero[id] = 1
  11385. if(g_reset[id] >= 5) g_sombrero[id] = 2
  11386. if(g_reset[id] >= 7) g_sombrero[id] = 3
  11387. if(g_reset[id] >= 9) g_sombrero[id] = 4
  11388. }
  11389.  
  11390. if(!g_sombrero_ent[id] || !is_valid_ent(g_sombrero_ent[id]))
  11391. {
  11392. new ent = create_entity("info_target")
  11393. entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
  11394. entity_set_edict(ent, EV_ENT_aiment, id)
  11395. g_sombrero_ent[id] = ent
  11396. }
  11397.  
  11398. entity_set_model(g_sombrero_ent[id], g_sombretos_modes[g_sombrero[id]])
  11399. }
  11400.  
  11401. public del_sombrero(id)
  11402. {
  11403. if(is_valid_ent(g_sombrero_ent[id]))
  11404. remove_entity(g_sombrero_ent[id])
  11405.  
  11406. g_sombrero_ent[id] = 0
  11407. }
  11408.  
  11409. // Bubble Grenade Explosion
  11410. public bubble_explode(id)
  11411. {
  11412. // Get origin
  11413. static Float:originF[3] // originF para llamar la entidad de create_blast4
  11414. pev(id, pev_origin, originF) // ...
  11415.  
  11416. // Create Blast
  11417. create_blast4(originF) // entidad de los anillos de explocion
  11418.  
  11419. set_pcvar_num(cvar_flaregrenades,1) // tomamos las cvar de la flare, para usarla como activador y desactivador de esta bomba.
  11420.  
  11421. // Create entitity
  11422. new iEntity = create_entity("info_target") // creamo la entidad con su determinado objetivo
  11423.  
  11424. if(!is_valid_ent(iEntity)) // determinamos que la entidad esta en false
  11425. return PLUGIN_HANDLED // tramitamos nuevamente
  11426.  
  11427. new Float: Origin[3] // origen
  11428. entity_get_vector(id, EV_VEC_origin, Origin)
  11429.  
  11430. entity_set_string(iEntity, EV_SZ_classname, entclas) // llamamos ala clase de entidad
  11431.  
  11432. entity_set_vector(iEntity,EV_VEC_origin, Origin) // no se que es
  11433. entity_set_model(iEntity,model) // modelo dela burbuja
  11434. entity_set_int(iEntity, EV_INT_solid, SOLID_TRIGGER) // no se que es
  11435. entity_set_size(iEntity, Float: {-110.0, -110.0, -110.0}, Float: {110.0, 110.0, 110.0}) // size de la entidad ( campo ) osea el tamaño
  11436. entity_set_int(iEntity, EV_INT_renderfx, kRenderFxGlowShell) // le damos el glow
  11437. entity_set_int(iEntity, EV_INT_rendermode, kRenderTransAlpha) // hacemos que sea transparente
  11438. entity_set_float(iEntity, EV_FL_renderamt, 50.0) // le damos la intensidad
  11439.  
  11440. // Colored Aura / aura cuando explota la granada
  11441. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  11442. write_byte(TE_DLIGHT) // aura
  11443. engfunc(EngFunc_WriteCoord, originF[0]) // x position
  11444. engfunc(EngFunc_WriteCoord, originF[1]) // y position
  11445. engfunc(EngFunc_WriteCoord, originF[2]) // z position
  11446. write_byte(15) // radius / radio
  11447. write_byte(255) // red: rojo
  11448. write_byte(255) // green: verde
  11449. write_byte(255) // blue: azul
  11450. write_byte(2) // life
  11451. write_byte(0) // decay rate / desintegración de la tasa
  11452. message_end() // cerramos la entidad
  11453.  
  11454. #if defined RANDOM_COLOR // color por default
  11455. if(is_valid_ent(iEntity)) // entidad valida
  11456. {
  11457. new Float:vColor[3] // variable vColor defaul / por defecto
  11458.  
  11459. for(new i; i < 3; i++) // nose que es
  11460. vColor[i] = random_float(0.0, 255.0) // color r, g, b
  11461.  
  11462. entity_set_vector(iEntity, EV_VEC_rendercolor, vColor) // el glow de la burbuja
  11463. }
  11464. #endif
  11465.  
  11466. #if defined ONE_COLOR
  11467. entity_set_vector(iEntity, EV_VEC_rendercolor, colour_force_shield) // declaramos el color cuztomizable al principio
  11468. #endif
  11469.  
  11470. #if defined CAMPO_TASK
  11471. set_task(15.0, "DeleteEntity", iEntity) // tiempo que demora en removerse el campo
  11472. #endif
  11473.  
  11474. return PLUGIN_CONTINUE;
  11475. }
  11476.  
  11477. // Bubble Grenade: Yellow Blast
  11478. create_blast4(const Float:originF[3])
  11479. {
  11480. // Smallest ring / anillo de explcion 1
  11481. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  11482. write_byte(TE_BEAMCYLINDER) // TE id
  11483. engfunc(EngFunc_WriteCoord, originF[0]) // x
  11484. engfunc(EngFunc_WriteCoord, originF[1]) // y
  11485. engfunc(EngFunc_WriteCoord, originF[2]) // z
  11486. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  11487. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  11488. engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
  11489. write_short(g_exploSpr) // sprite de los anillos
  11490. write_byte(0) // startframe / fotograma inicial
  11491. write_byte(0) // framerate / imágenes por segundo
  11492. write_byte(4) // life
  11493. write_byte(60) // width / ancho
  11494. write_byte(0) // noise / ruido
  11495. write_byte(255) // red: rojo
  11496. write_byte(255) // green: verde
  11497. write_byte(255) // blue: azul
  11498. write_byte(200) // brightness / brillo
  11499. write_byte(0) // speed / rapidez
  11500. message_end()
  11501.  
  11502. // Medium ring
  11503. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  11504. write_byte(TE_BEAMCYLINDER) // TE id
  11505. engfunc(EngFunc_WriteCoord, originF[0]) // x
  11506. engfunc(EngFunc_WriteCoord, originF[1]) // y
  11507. engfunc(EngFunc_WriteCoord, originF[2]) // z
  11508. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  11509. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  11510. engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  11511. write_short(g_exploSpr) // sprite
  11512. write_byte(0) // startframe / fotograma inicial
  11513. write_byte(0) // framerate / imágenes por segundo
  11514. write_byte(4) // life
  11515. write_byte(60) // width / ancho
  11516. write_byte(0) // noise / ruido
  11517. write_byte(255) // red: rojo
  11518. write_byte(255) // green: verde
  11519. write_byte(255) // blue: azul
  11520. write_byte(200) // brightness / brillo
  11521. write_byte(0) // speed / rapidez
  11522. message_end()
  11523.  
  11524. // Largest ring
  11525. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  11526. write_byte(TE_BEAMCYLINDER) // TE id
  11527. engfunc(EngFunc_WriteCoord, originF[0]) // x
  11528. engfunc(EngFunc_WriteCoord, originF[1]) // y
  11529. engfunc(EngFunc_WriteCoord, originF[2]) // z
  11530. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  11531. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  11532. engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  11533. write_short(g_exploSpr) // sprite
  11534. write_byte(0) // startframe / fotograma inicial
  11535. write_byte(0) // framerate / imágenes por segundo
  11536. write_byte(4) // life
  11537. write_byte(60) // width / ancho
  11538. write_byte(0) // noise / ruido
  11539. write_byte(255) // red: rojo
  11540. write_byte(255) // green: verde
  11541. write_byte(255) // blue: azul
  11542. write_byte(200) // brightness / brillo
  11543. write_byte(0) // speed / rapidez
  11544. message_end()
  11545. }
  11546.  
  11547. // Touch bomb bubble
  11548. public entity_touch(touched, toucher) // entidad cuando un zombie o nemesis la toca
  11549. {
  11550.  
  11551. if(g_zombie[toucher] || g_nemesis[toucher]) // los nemesis y zombies no pueden pasar
  11552. {
  11553. new Float:pos_ptr[3], Float:pos_ptd[3], Float:push_power = get_pcvar_float(cvar_bubblepush) // intensidad de rechazo
  11554.  
  11555. pev(touched, pev_origin, pos_ptr) // nose que es
  11556. pev(toucher, pev_origin, pos_ptd) // nose que es
  11557.  
  11558. for(new i = 0; i < 3; i++)
  11559. {
  11560. pos_ptd[i] -= pos_ptr[i] // nose que es
  11561. pos_ptd[i] *= push_power // poder cuando lo tocamos y nos rechaza
  11562. }
  11563. set_pev(toucher, pev_velocity, pos_ptd) // velocidad del rechazo
  11564. set_pev(toucher, pev_impulse, pos_ptd) // impulso del rechazo
  11565. }
  11566. }
  11567.  
  11568. // Hook bubble bomb
  11569. public hook_curwpn(id)
  11570. {
  11571. if(!is_user_alive(id)) // cliente muerto no recibe =D
  11572. return PLUGIN_CONTINUE;
  11573.  
  11574. if(g_bubble_bomb[id] && !g_zombie[id]) // la bomba solo la puede adquirir un humano
  11575. {
  11576. new wID = read_data(2)
  11577. if(wID == CSW_SMOKEGRENADE) // toma el lugar de la smoke grenade
  11578. set_pev(id, pev_viewmodel2, model_grenade) // modelo de la grana
  11579. }
  11580.  
  11581. return PLUGIN_CONTINUE;
  11582. }
  11583.  
  11584. // Give bubble item / hacemos que nos de el campo
  11585. public give_item_bubble(id)
  11586. {
  11587. g_bubble_bomb[id] = true // seteamos la variable a true
  11588. give_item(id,"weapon_smokegrenade") // le pedimos una smoke ya que el campo la remplaza
  11589. }
  11590.  
  11591. // Remove Entity / removemos la entidad con el task
  11592. public DeleteEntity(entity)
  11593. {
  11594. if(is_valid_ent(entity )) // hacemos valida la entidad
  11595. remove_entity(entity) // la removemos...
  11596. }
  11597.  
  11598. public Datos(id)
  11599. {
  11600. new menu[350], len;
  11601. len = 0;
  11602.  
  11603. len += formatex(menu[len], sizeof menu - 1 - len, "\r1. \yCuenta: \w%s^n", g_playername[id]);
  11604. len += formatex(menu[len], sizeof menu - 1 - len, "\r2. \yAmmoPacks: \w%d^n", g_ammopacks[id]);
  11605. len += formatex(menu[len], sizeof menu - 1 - len, "\r3. \yLevel: \w%d^n", g_level[id]);
  11606. len += formatex(menu[len], sizeof menu - 1 - len, "\r4. \yReset: \w%d^n", g_reset[id]);
  11607. len += formatex(menu[len], sizeof menu - 1 - len, "\r5. \yGranResets: \w%d^n", g_grandreset[id]);
  11608. len += formatex(menu[len], sizeof menu - 1 - len, "\r6. \yContraseña: \w%s^n", g_password[id]);
  11609. len += formatex(menu[len], sizeof menu - 1 - len, "\r7. \yMejoras Humanas^n\w- Daño: %d - Vida: %d - Velocidad: %d^n- Gravedad: %d - Armadura: %d^n", g_skill_points[id][0][0], g_skill_points[id][0][1], g_skill_points[id][0][2], g_skill_points[id][0][3], g_skill_points[id][0][4]);
  11610. len += formatex(menu[len], sizeof menu - 1 - len, "\r8. \yMejoras Zombies ^n\w- Daño: %d - Vida: %d^n- Velocidad: %d - Gravedad: %d^n^n^n", g_skill_points[id][1][0], g_skill_points[id][1][1], g_skill_points[id][1][2], g_skill_points[id][1][3]);
  11611. len += formatex(menu[len], sizeof menu - 1 - len, "\r0. \wSalir");
  11612.  
  11613. show_menu(id, KEYSMENU, menu, -1, "Menu");
  11614. //mostramos el menu al 'id' deseado, con las teclas ya definidas, el menu 'menu'
  11615. //el timpo es lo que tarda el menu en cerrarse en este caso -1 que es infinito, como lo registre en el init 'Menu')
  11616. }
  11617.  
  11618. public HandMenu(id, keys, menu) //los parametros deben ir en este orden
  11619. {
  11620. switch(keys) //hacemos un swicheo de los posibles resultados:
  11621. {
  11622. case 0:
  11623. {
  11624. zp_colored_print(id, "Cuenta: %s", g_playername[id])
  11625. Datos(id)
  11626. }
  11627. case 1:
  11628. {
  11629. zp_colored_print(id, "AmmoPacks: %d", g_ammopacks[id])
  11630. Datos(id)
  11631. }
  11632. case 2:
  11633. {
  11634. zp_colored_print(id, "Level: %d", g_level[id])
  11635. Datos(id)
  11636. }
  11637. case 3:
  11638. {
  11639. zp_colored_print(id, "Reset: %d", g_reset[id])
  11640. Datos(id)
  11641. }
  11642. case 4:
  11643. {
  11644. zp_colored_print(id, "GranReset: %d", g_grandreset[id])
  11645. Datos(id)
  11646. }
  11647. case 5:
  11648. {
  11649. zp_colored_print(id, "Contraseña: %s", g_password[id])
  11650. Datos(id)
  11651. }
  11652. case 6..7:
  11653. {
  11654. Datos(id)
  11655. }
  11656. case 9: menu_destroy(menu)
  11657. }
  11658. }
  11659.  
  11660. public oldmenu_handle( msgid, dest, id )
  11661. {
  11662. client_print( id, print_chat, "No puedes elegir tu equipo, Solo esta Habilitado para VGUI menu, El menu Grande" )
  11663. return PLUGIN_HANDLED
  11664. }
Add Comment
Please, Sign In to add comment