Guest User

Untitled

a guest
Aug 16th, 2016
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 389.76 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. // Access Flags Required (check CMDACCESS.INI for console commands)
  16. const ACCESS_FLAG = ADMIN_BAN // to access the admin menu
  17. const ACCESS_FLAG2 = ADMIN_RCON // to turn the mod on/off
  18. const ACCESS_FLAG3 = ADMIN_BAN // to get admin models
  19.  
  20. new const horas[] = { 0,2,4,6,8,10,12,14,16,18,20,22,24}
  21. new bool: g_happytime
  22.  
  23. new const AMMOTYPE[][] = { "", "357sig", "", "762nato", "", "buckshot", "", "45acp", "556nato", "", "9mm", "57mm", "45acp",
  24. "556nato", "556nato", "556nato", "45acp", "9mm", "338magnum", "9mm", "556natobox", "buckshot",
  25. "556nato", "9mm", "762nato", "", "50ae", "556nato", "762nato", "", "57mm" }
  26.  
  27. // ganancia admin
  28. enum _:ganancia
  29. {
  30. Admin,
  31. Ganancia,
  32. HH
  33. }
  34.  
  35. new const admganancia[][ganancia] =
  36. {
  37. {ADMIN_LEVEL_E, 12, 24},
  38. {ADMIN_LEVEL_H, 9, 18},
  39. {ADMIN_LEVEL_G, 6, 12},
  40. {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.
  41. }
  42.  
  43. #define ONE_COLOR // color de la burbuja.
  44. #define CAMPO_TASK // task = cuanto dura el campo de fuerza y lo elimina.
  45.  
  46. //#define RANDOM_COLOR // color por default.
  47.  
  48. #if defined ONE_COLOR
  49. new Float:colour_force_shield[3] = { 50.0 , 50.0 , 250.0 } // color de la burbuja ( red, gree, blue ).
  50. #endif
  51.  
  52. new g_bubble_bomb[33] // variable del campo
  53. new const model_grenade[] = "models/zombie_plague/v_auragren.mdl" // model "v_".
  54. new const model[] = "models/zombie_plague/aura8.mdl" // model de la burbuja.
  55. new const w_model[] = "models/zombie_plague/w_aura.mdl" // model "w_".
  56. new const entclas[] = "campo_grenade_forze" // nombre de la clase de entidad.
  57.  
  58. // Player Models (randomly chosen if more than one)
  59. new const model_nemesis[][] = { "[VG]Nemesis" } // Nemesis
  60. new const model_survivor[][] = { "[VG]Survivor" } // Survivor
  61. new const model_admin[][] = { "vip" } // Admin (human)
  62. new const model_admin_zombie[][] = { "zombie_source" } // Admin (zombie)
  63.  
  64. 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,
  65. 1568, 1682, 1800, 1922, 2048, 2178, 2312, 2450, 2592, 2738, 2888, 3042, 3200, 3362, 3528, 3692, 3872, 4050, 4232, 4418, 4608,
  66. 4802, 5000, 5202, 5408, 5618, 5832, 6050, 6272, 6498, 6728, 6962, 7200, 7442, 7688, 7938, 8192, 8450, 8712, 8978,
  67. 9248, 9522, 9800, 10082, 10368, 10658, 10952, 11250, 11552, 11858, 12168, 12482, 12800, 13122, 13448, 13778, 14112, 14450,
  68. 14792, 15138, 15488, 15842, 16200, 16562, 16928, 17298, 17672, 18050, 18432, 18818, 19208, 19602, 20000, 20402, 20808, 21218,
  69. 21632, 22050, 22472, 22898, 23328, 23762, 24200, 24642, 25088, 25538, 25992, 26450, 26912, 27378, 27848, 28322, 28800, 29282,
  70. 29768, 30258, 30752, 31250, 31752, 32258, 32768, 33282, 33800, 34322, 34848, 35378, 35912, 36450, 36992, 37538, 38088,
  71. 38642, 39200, 39762, 40328, 40898, 41472, 42050, 42632, 43218, 43808, 44402, 45000, 45602, 46208, 46818, 47432,
  72. 48050, 48672, 49298, 49928, 50562, 51200, 51842, 52488, 53138, 53792, 54450, 55112, 55778, 56448, 57122, 57800,
  73. 58482, 59168, 59858, 60552, 61250, 61952, 62658, 63368, 64082, 64800, 65522, 66248, 66978, 67712, 68450, 69192,
  74. 69938, 70688, 71442, 72200, 72962, 73728, 74498, 75272, 76050, 76832, 77618, 78408, 79202, 80000, 80802, 81608,
  75. 82418, 83232, 84050, 84872, 85698, 86528, 87362, 88200, 89042, 89888, 90738, 91592, 92450, 93312, 94178, 95048,
  76. 95922, 96800, 97682, 98568, 99458, 100352, 101250, 102152, 103058, 103968, 104882, 105800, 106722, 107648, 108578, 109512,
  77. 110450, 111392, 112338, 113288, 114242, 115200, 116162, 117128, 118098, 119072, 120050, 121032, 122018, 123008, 124002, 125000,
  78. 126002, 127008, 128018, 129032, 130050, 131072, 132098, 133128, 134162, 135200, 136242, 137288, 138338, 139392, 140450, 141512,
  79. 142578, 143648, 144722, 145800, 146882, 147968, 149058, 150152, 151250, 152352, 153458, 154568, 155682, 156800, 157922, 159048,
  80. 160178, 161312, 162450, 163592, 164738, 165888, 167042, 168200, 169362, 170528, 171698, 172872, 174050, 175232, 176418, 177608,
  81. 178802, 180000, 181202, 182408, 183618, 184832, 186050, 187272, 188498, 189728, 190962, 192200, 193442, 194688, 195938, 197192,
  82. 198450, 199712, 200978, 202248, 203522, 204800, 206082, 207368, 208658, 209952, 211250, 212552, 213858, 215168, 216482, 217800,
  83. 219122, 220448, 221778, 223112, 224450, 225792, 227138, 228488, 229842, 231200, 232562, 233928, 235298, 236672, 238050, 239432,
  84. 240818, 242208, 243602, 245000, 246402, 247808, 249218, 250632, 252050, 253472, 254898, 256328, 257762, 259200, 260652, 262088,
  85. 263538, 264992, 266450, 267912, 269378, 270848, 272322, 273800, 275282, 276768, 278258, 281250, 282752, 284258, 285768, 287282,
  86. 288800, 290332, 291848, 293378, 294912, 296450, 297992, 299538, 301088, 302642, 304200, 305762, 307328, 308898, 310472, 312050,
  87. 313632, 315218, 316808, 318402, 320000, 321602, 323208, 324818, 326432, 328050, 329672, 331298, 332928, 334562, 336200, 337842,
  88. 339488, 341138, 342792, 344450, 346112, 347778, 349448, 351122, 352800, 354482, 356168, 357858, 359552, 361250, 362952, 364652,
  89. 366368, 368082, 369800, 371522, 373248, 374978, 376712, 378450, 380192, 381938, 383688, 385442, 387200, 388962, 390728, 392498,
  90. 384272, 396050, 397832, 399618, 401408, 403202, 406000, 406802, 408608, 410418, 412232, 414050, 415872, 417698, 419529, 421362,
  91. 423200, 425042, 426888, 428738, 430592, 432450, 434312, 436178, 438048, 439922, 441800, 443682, 445568, 447458, 449352, 451250,
  92. 453152, 455058, 456968, 458882, 460800, 462722, 464648, 466578, 468512, 470450, 472392, 474338, 476288, 478242, 480200, 482162,
  93. 484128, 486098, 488072, 490050, 492032, 494018, 496008, 498002, 500000, 502002, 504008, 506018, 508032, 510050, 512072, 514098,
  94. 516128, 518162, 520200, 522242, 524288, 526338, 528392, 530450, 532512, 534578, 536648, 538722, 540800, 542882, 544968, 547058,
  95. 549152, 551250, 553352, 555458, 557568, 559682, 561800, 563922, 566048, 568178, 570312, 572450, 574592, 576738, 578888, 581042,
  96. 583200, 585362, 587528, 589698, 591872, 594050, 596232, 598418, 600608, 602802, 605000, 607202, 609408, 611618, 613832, 616050,
  97. 620498, 622728, 624962, 627200, 629442, 631688, 633938, 636192, 638450, 640712, 642978, 645248, 647522, 649800, 652082, 654360,
  98. 656658, 658952, 661250, 663552, 665858, 668168, 670482, 672800, 675122, 677448, 679778, 682112, 684450, 686792, 689138, 691488,
  99. 693842, 696200, 698562, 700928, 703298, 705672, 708050, 710432, 712818, 715208, 717602, 720000, 722402, 724808, 727218, 729632,
  100. 732050, 734472, 736898, 739328, 741762, 744200, 746642, 749088, 751538, 753992, 756452, 758912, 761378, 763848, 766322, 768800,
  101. 771282, 773768, 776258, 778752, 781250, 783752, 786258, 788768, 791282, 793800, 796322, 798848, 801378, 803912, 806450, 808992,
  102. 811538, 814088, 816642, 819200, 821762, 824328, 826898, 829472, 832050, 834632, 837218, 839808, 842402, 845000, 847602, 850208,
  103. 852818, 855432, 858050, 860672, 863298, 865928, 868562, 871200, 873842, 876488, 879138, 881792, 884450, 887112, 889778, 892448,
  104. 895122, 897800, 900482, 903168, 905858, 908552, 911250, 913952, 916658, 919368, 922082, 924800, 927522, 930248, 932978, 935712,
  105. 938450, 941192, 943938, 946688, 949442, 952200, 954962, 957728, 960498, 963272, 966050, 968832, 971618, 977202, 980000, 982802,
  106. 985608, 988418, 991232, 994050, 996872, 999698, 1002528, 1005362, 1008200, 1011042, 1013888, 1016738, 1019592, 1022450, 1025312, 1028178, 1031048,
  107. 1033922, 1036800, 1039682, 1042568, 1045458, 1048352, 1051250, 1054152, 1057058, 1059968, 1062882, 1065800, 1068722, 1071648, 1074578, 1077512, 1080450,
  108. 1083392, 1086338, 1089288, 1092242, 1095200, 1098162, 1101128, 1104098, 1107072, 1110050, 1113032, 1116018, 1119008, 1122002, 1125000, 1128002, 1131008,
  109. 1134018, 1137032, 1140050, 1143072, 1146098, 1149128, 1152162, 1155200, 1158242, 1161288, 1164338, 1167392, 1170450, 1173512, 1176578, 1179648, 1182722,
  110. 1185800, 1188882, 1191968, 1195058, 1198152, 1201250, 1204352, 1207458, 1210568, 1213682, 1216800, 1219922, 1223048, 1226178, 1229312, 1232450, 1235592,
  111. 1238738, 1241888, 1245042, 1248200, 1251362, 1254528, 1257698, 1260872, 1264050, 1267232, 1270418, 1273608, 1276802, 1280000, 1283202, 1286408, 1289618,
  112. 1292832, 1296050, 1299272, 1302498, 1305728, 1308962, 1312200, 1315442, 1318688, 1321938, 1325192, 1328450, 1331712, 1334978, 1338248, 1341522, 1344800,
  113. 1348082, 1351386, 1351368, 1354658, 1357952, 1361250, 1364552, 1367858, 1371168, 1374482, 1377800, 1381122, 1384448, 1387778, 1391112, 1394450, 1397792,
  114. 1401138, 1404488, 1407842, 1411200, 1414562, 1417928, 1421298, 1424672, 1428050, 1431432, 1434818, 1438208, 1455218, 1458632, 1462050, 1465472, 1468898,
  115. 1472328, 1475762, 1479200, 1482642, 1486088, 1489538, 1492992, 1496450, 1499912, 1503378, 1506848, 1510322, 1513800, 1517282, 1520768, 1524258, 1527752,
  116. 1531250, 1534752, 1538258, 1541768, 1545282, 1548800, 1552322, 1555848, 1557389, 1562712, 1566450, 1569992, 1573538, 1577088, 1580642, 1584200, 1587762,
  117. 1591328, 1594898, 1598472, 1602050, 1605632, 1608218, 1612808, 1616402, 1620000, 1623602, 1627202, 1630818, 1634432, 1638050, 1641672, 1645298, 1648928,
  118. 1652562, 1656200, 1659842, 1663488, 1667138, 1670792, 1674450, 1678112, 1681778, 1685448, 1689122, 1692800, 1696482, 1700168, 1703858, 1707552, 1701125,
  119. 1711250, 1714952, 1718658, 1722368, 1726082, 1729800, 1733522, 1737248, 1740978, 1744712, 1748450, 1752192, 1755938, 1759688, 1763442, 1767200, 1770962,
  120. 1774728, 1778498, 1782272, 1786050, 1789832, 1793618, 1797408, 1801202, 1805000, 1808802, 1812608, 1816418, 1820232, 1824050, 1827872, 1831698, 1835528,
  121. 1839362, 1843200, 1847042, 1850888, 1854738, 1858592, 1862450, 1866312, 1870178, 1874048, 1877922, 1881800, 1885682, 1889568, 1893458, 1897352, 1901250,
  122. 1905152, 1909058, 1912968, 1916882, 1920800, 1924722, 1928648, 1932578, 1936512, 1940450, 1944392, 1948338, 1952288, 1956242, 1960200, 1964162, 1968128,
  123. 1972098, 1976072, 1980050, 1984032, 1988018, 1992008, 1996002, 2000000, 2004002, 2008006, 2012012, 2016024, 2020048, 99999999 }
  124.  
  125. // Weapon Models
  126. new const model_vknife_nemesis[] = { "models/[VG]/v_nemesis.mdl" }
  127. new const model_vm249_survivor[] = { "models/[VG]/v_survivor.mdl" }
  128. new const model_pm249_survivor[] = { "models/[VG]/p_survivor.mdl" }
  129. new const model_grenade_infect[] = { "models/zombie_plague/v_grenade_infect.mdl" }
  130. new const model_grenade_fire[] = { "models/zombie_plague/v_grenade_fire.mdl" }
  131. new const model_grenade_frost[] = { "models/zombie_plague/v_grenade_frost.mdl" }
  132. new const model_grenade_flare[] = { "models/zombie_plague/v_grenade_flare.mdl" }
  133. new const model_akdestruction_human[] = { "models/[VG]/v_akdestruction.mdl" }
  134. new const model_akdestruction_human1[] = { "models/[VG]/p_akdestruction.mdl" }
  135. new const model_ultimate_human[] = { "models/[VG]/v_ultimate.mdl" }
  136. new const model_ultimate_human1[] = { "models/[VG]/p_ultimate.mdl" }
  137. new const model_atomic_human[] = { "models/[VG]/v_atomic.mdl" }
  138. new const model_atomic_human1[] = { "models/[VG]/p_atomic.mdl" }
  139. new const model_masive_human[] = { "models/[VG]/v_masive.mdl" }
  140. new const model_masive_human1[] = { "models/[VG]/p_masive.mdl" }
  141. new const model_navi_human[] = { "models/[VG]/v_navi.mdl" }
  142. new const model_navi_human1[] = { "models/[VG]/p_navi.mdl" }
  143. new const model_overpower_human[] = { "models/[VG]/v_overpower.mdl" }
  144. new const model_overpower_human1[] = { "models/[VG]/p_overpower.mdl" }
  145. new const model_stfu_human[] = { "models/[VG]/v_stfu.mdl" }
  146. new const model_stfu_human1[] = { "models/[VG]/p_stfu.mdl" }
  147. new const model_rlp_human[] = { "models/[VG]/v_rlp.mdl" }
  148. new const model_rlp_human1[] = { "models/[VG]/p_rlp.mdl" }
  149. new const model_m4_human[] = { "models/[VG]/v_m4.mdl" }
  150. new const model_m4_human1[] = { "models/[VG]/p_m4.mdl" }
  151. new const model_barret_human[] = { "models/[VG]/v_barret.mdl" }
  152. new const model_barret_human1[] = { "models/[VG]/p_barret.mdl" }
  153. new const model_devil_human[] = { "models/[VG]/v_devil.mdl" }
  154. new const model_devil_human1[] = { "models/[VG]/p_devil.mdl" }
  155. new const model_rampage_human[] = { "models/[VG]/v_rampage.mdl" }
  156. new const model_rampage_human1[] = { "models/[VG]/p_rampage.mdl" }
  157. new const model_supermide_human[] = { "models/[VG]/v_supermide.mdl" }
  158. new const model_supermide_human1[] = { "models/[VG]/p_supermide.mdl" }
  159. new const model_farger_human[] = { "models/[VG]/v_farger.mdl" }
  160. new const model_farger_human1[] = { "models/[VG]/p_farger.mdl" }
  161. new const model_storm_human[] = { "models/[VG]/v_storm.mdl" }
  162. new const model_storm_human1[] = { "models/[VG]/p_storm.mdl" }
  163. new const model_adge_human[] = { "models/[VG]/v_adge.mdl" }
  164. new const model_adge_human1[] = { "models/[VG]/p_adge.mdl" }
  165. new const model_ultra_human[] = { "models/[VG]/v_ultra.mdl" }
  166. new const model_ultra_human1[] = { "models/[VG]/p_ultra.mdl" }
  167. new const model_nule_human[] = { "models/[VG]/v_nule.mdl" }
  168. new const model_nule_human1[] = { "models/[VG]/p_nule.mdl" }
  169. new const model_super_human[] = { "models/[VG]/v_super.mdl" }
  170. new const model_super_human1[] = { "models/[VG]/p_super.mdl" }
  171. new const model_ultrak_human[] = { "models/[VG]/v_ultrak.mdl" }
  172. new const model_ultrak_human1[] = { "models/[VG]/p_ultrak.mdl" }
  173. new const model_raampage_human[] = { "models/[VG]/v_raampage.mdl" }
  174. new const model_raampage_human1[] = { "models/[VG]/p_raampage.mdl" }
  175. new const model_zpr350_human[] = { "models/[VG]/v_zpr350.mdl" }
  176. new const model_zpr350_human1[] = { "models/[VG]/p_zpr350.mdl" }
  177. new const model_rpg17_human[] = { "models/[VG]/v_rpg17.mdl" }
  178. new const model_rpg17_human1[] = { "models/[VG]/p_rpg17.mdl" }
  179. new const model_aru_human[] = { "models/[VG]/v_ar-u.mdl" }
  180. new const model_aru_human1[] = { "models/[VG]/p_ar-u.mdl" }
  181. new const model_xh500w_human[] = { "models/[VG]/v_xh500w.mdl" }
  182. new const model_xh500w_human1[] = { "models/[VG]/p_xh500w.mdl" }
  183. new const model_dvlsxx_human[] = { "models/[VG]/v_dvls-xx.mdl" }
  184. new const model_dvlsxx_human1[] = { "models/[VG]/p_dvls-xx.mdl" }
  185. new const model_thunderstorm_human[] = { "models/[VG]/v_thunderstorm.mdl" }
  186. new const model_thunderstorm_human1[] = { "models/[VG]/p_thunderstorm.mdl" }
  187. new const model_101000xx_human[] = { "models/[VG]/v_101000xx.mdl" }
  188. new const model_101000xx_human1[] = { "models/[VG]/p_101000xx.mdl" }
  189. new const model_101000cannon_human[] = { "models/[VG]/v_101000cannon.mdl" }
  190. new const model_101000cannon_human1[] = { "models/[VG]/p_101000cannon.mdl" }
  191. new const model_tmp2xx_human[] = { "models/[VG]/v_tmp2-xx.mdl" }
  192. new const model_tmp2xx_human1[] = { "models/[VG]/p_tmp2-xx.mdl" }
  193. new const model_coldtorment_human[] = { "models/[VG]/v_coldtorment.mdl" }
  194. new const model_coldtorment_human1[] = { "models/[VG]/p_coldtorment.mdl" }
  195. new const model_shredder_human[] = { "models/[VG]/v_shredder.mdl" }
  196. new const model_shredder_human1[] = { "models/[VG]/p_shredder.mdl" }
  197. new const model_nemesis2[] = { "models/player/[VG]Nemesis/[VG]NemesisT.mdl" }
  198. new const model_esqueleto[] = { "models/player/[VG]Esqueleto/[VG]EsqueletoT.mdl" }
  199. new const model_general[] = { "models/player/[VG]General/[VG]GeneralT.mdl" }
  200. new const model_gusano[] = { "models/player/[VG]Gusano/[VG]GusanoT.mdl" }
  201. new const model_subteniente[] = { "models/player/[VG]Subteniente/[VG]SubtenienteT.mdl" }
  202. new const model_supersoldado[] = { "models/player/[VG]Supersoldado/[VG]SupersoldadoT.mdl" }
  203.  
  204. // Grenade Sprites
  205. new const sprite_grenade_trail[] = { "sprites/laserbeam.spr" }
  206. new const sprite_grenade_ring[] = { "sprites/shockwave.spr" }
  207. new const sprite_grenade_fire[] = { "sprites/flame.spr" }
  208. new const sprite_grenade_smoke[] = { "sprites/black_smoke3.spr" }
  209. new const sprite_grenade_glass[] = { "models/glassgibs.mdl" }
  210.  
  211. // Sounds (randomly chosen if more than one)
  212. new const sound_win_zombies[][] = { "[VG]Sonidos/[VG]ZombieWin.wav" }
  213. new const sound_win_humans[][] = { "[VG]Sonidos/[VG]HumanWin.wav" }
  214. new const sound_win_no_one[][] = { "[VG]Sonidos/[VG]NadieGana.wav" }
  215. new const zombie_infect[][] = { "[VG]Sonidos/[VG]OtroZombie.wav" }
  216. 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" }
  217. new const nemesis_pain[][] = { "[VG]Sonidos/[VG]NemeDolor.wav" }
  218. 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" }
  219. new const zombie_fall[][] = { "zombie_plague/zombie_fall1.wav" }
  220. new const zombie_miss_slash[][] = { "weapons/knife_slash1.wav", "weapons/knife_slash2.wav" }
  221. new const zombie_miss_wall[][] = { "weapons/knife_hitwall1.wav" }
  222. new const zombie_hit_normal[][] = { "weapons/knife_hit1.wav", "weapons/knife_hit2.wav", "weapons/knife_hit3.wav", "weapons/knife_hit4.wav" }
  223. new const zombie_hit_stab[][] = { "weapons/knife_stab.wav" }
  224. 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" }
  225. new const zombie_idle_last[][] = { "nihilanth/nil_thelast.wav" }
  226. new const zombie_madness[][] = { "zombie_plague/zombie_madness1.wav" }
  227. new const sound_nemesis[][] = { "[VG]Sonidos/Evolution.wav" }
  228. new const sound_survivor[][] = { "[VG]Sonidos/Evolution.wav" }
  229. new const sound_swarm[][] = { "[VG]Sonidos/[VG]StartSwarmPlague.wav" }
  230. new const sound_multi[][] = { "[VG]Sonidos/[VG]StartSwarmPlague.wav" }
  231. new const sound_plague[][] = { "[VG]Sonidos/[VG]StartSwarmPlague.wav" }
  232. new const grenade_infect[][] = { "zombie_plague/grenade_infect.wav" }
  233. new const grenade_infect_player[][] = { "scientist/scream20.wav", "scientist/scream22.wav", "scientist/scream05.wav" }
  234. new const grenade_fire[][] = { "zombie_plague/grenade_explode.wav" }
  235. 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" }
  236. new const grenade_frost[][] = { "warcraft3/frostnova.wav" }
  237. new const grenade_frost_player[][] = { "warcraft3/impalehit.wav" }
  238. new const grenade_frost_break[][] = { "warcraft3/impalelaunch1.wav" }
  239. new const grenade_flare[][] = { "items/nvg_on.wav" }
  240. new const sound_antidote[][] = { "items/smallmedkit1.wav" }
  241. new const sound_thunder[][] = { "zombie_plague/thunder1.wav", "zombie_plague/thunder2.wav" }
  242.  
  243. // Uncomment the following line to enable ambience sounds
  244. #define AMBIENCE_SOUNDS
  245.  
  246. #if defined AMBIENCE_SOUNDS // Ambience Sounds List (only .wav and .mp3 formats supported)
  247. // Infection Rounds
  248. new const sound_ambience1[][] = { "[VG]Sonidos/[VG]Infeccion.mp3" } // sounds (played randomly)
  249. new const Float:sound_ambience1_duration[] = { 380.0 } // duration in seconds of each sound
  250. // Nemesis Rounds
  251. new const sound_ambience2[][] = { "[VG]Sonidos/[VG]Nemesis.mp3" }
  252. new const Float:sound_ambience2_duration[] = { 150.0 }
  253. // Survivor Rounds
  254. new const sound_ambience3[][] = { "[VG]Sonidos/[VG]Survivor.mp3" }
  255. new const Float:sound_ambience3_duration[] = { 147.0 }
  256. // Swarm Rounds
  257. new const sound_ambience4[][] = { "[VG]Sonidos/[VG]SwarmPlague.mp3" }
  258. new const Float:sound_ambience4_duration[] = { 195.0 }
  259. // Plague Rounds
  260. new const sound_ambience5[][] = { "[VG]Sonidos/[VG]SwarmPlague.mp3" }
  261. new const Float:sound_ambience5_duration[] = { 195.0 }
  262. #endif
  263.  
  264. // Buy Menu: Primary and Secondary Weapons
  265. new bool: g_akdestruction[33]
  266. new bool: g_ultimate[33]
  267. new bool: g_atomic[33]
  268. new bool: g_masive[33]
  269. new bool: g_navi[33]
  270. new bool: g_power[33]
  271. new bool: g_stfu[33]
  272. new bool: g_rlp[33]
  273. new bool: g_m4[33]
  274. new bool: g_barret[33]
  275. new bool: g_devil[33]
  276. new bool: g_rampage[33]
  277. new bool: g_supermide[33]
  278. new bool: g_farger[33]
  279. new bool: g_storm[33]
  280. new bool: g_adge[33]
  281. new bool: g_ultra[33]
  282. new bool: g_nule[33]
  283. new bool: g_super[33]
  284. new bool: g_ultrak[33]
  285. new bool: g_raampage[33]
  286. new bool: g_zpr350[33]
  287. new bool: g_rpg17[33]
  288. new bool: g_aru[33]
  289. new bool: g_xh500w[33]
  290. new bool: g_dvlsxx[33]
  291. new bool: g_thunderstorm[33]
  292. new bool: g_101000xx[33]
  293. new bool: g_101000cannon[33]
  294. new bool: g_tmp2xx[33]
  295. new bool: g_coldtorment[33]
  296. new bool: g_shredder[33]
  297.  
  298. 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
  299. new const resetarmas[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } // reset armas
  300.  
  301. 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
  302. new const g_primary_items[][] = { "weapon_tmp", "weapon_mac10", "weapon_ump45", "weapon_mp5navy", "weapon_p90", "weapon_m3", "weapon_scout",
  303. "weapon_famas", "weapon_galil", "weapon_aug", "weapon_sg552", "weapon_m4a1", "weapon_ak47", "weapon_xm1014"}
  304. new const g_secondary_items[][] = { "weapon_p228", "weapon_fiveseven", "weapon_glock18", "weapon_elite", "weapon_deagle", "weapon_usp" }
  305.  
  306. // Extra Items: Weapons and their costs
  307. new const g_extra_names[][] = { "Napalm Nade", "Frost Nade" }
  308. new const g_extra_items[][] = { "weapon_hegrenade", "weapon_flashbang" }
  309. new const g_extra_costs[] = { 3, 3 }
  310.  
  311. // Extra Items: costs for Night Vision, Antidote, Zombie Madness, and Infection Bomb
  312. new const g_extra_costs2[] = { 5, 7, 4, 12 }
  313.  
  314. // Weather Effects: uncomment a line to have the desired effect
  315. //#define AMBIENCE_RAIN // Rain
  316. //#define AMBIENCE_SNOW // Snow
  317. //#define AMBIENCE_FOG // Fog
  318.  
  319. #if defined AMBIENCE_FOG // Fog Customization (if enabled)
  320. new const FOG_DENSITY[] = "0.0018" // Density
  321. new const FOG_COLOR[] = "128 128 128" // Color: Red Green Blue
  322. #endif
  323.  
  324. // Sky Names (randomly chosen if more than one)
  325. new const skynames[][] = { "space" }
  326.  
  327. // Uncomment if you don't want the sky to be changed
  328. //#define DONT_CHANGE_SKY
  329.  
  330. // Lightning Lights Cycle
  331. 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"}
  332. 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"}
  333. 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"}
  334.  
  335. // Decal List for Zombie Bloodstains/Footsteps
  336. new const zombie_decals[] = { 99, 107, 108, 184, 185, 186, 187, 188, 189 }
  337.  
  338. // Knockback Power values for weapons
  339. // Note: negative values will disable knockback power for the weapon
  340. new const Float:kb_weapon_power[] =
  341. {
  342. -1.0, // ---
  343. 2.4, // P228
  344. -1.0, // ---
  345. 6.5, // SCOUT
  346. -1.0, // ---
  347. 8.0, // XM1014
  348. -1.0, // ---
  349. 2.3, // MAC10
  350. 5.0, // AUG
  351. -1.0, // ---
  352. 2.4, // ELITE
  353. 2.0, // FIVESEVEN
  354. 2.4, // UMP45
  355. 5.3, // SG550
  356. 5.5, // GALIL
  357. 5.5, // FAMAS
  358. 2.2, // USP
  359. 2.0, // GLOCK18
  360. 10.0, // AWP
  361. 2.5, // MP5NAVY
  362. 5.2, // M249
  363. 8.0, // M3
  364. 5.0, // M4A1
  365. 2.4, // TMP
  366. 6.5, // G3SG1
  367. -1.0, // ---
  368. 5.3, // DEAGLE
  369. 5.0, // SG552
  370. 6.0, // AK47
  371. -1.0, // ---
  372. 2.0 // P90
  373. }
  374.  
  375. // Dynamic Stuff Limiters (increase if needed)
  376. const MAX_EXTRA_ITEMS = 30
  377. const MAX_ZOMBIE_CLASSSES = 50
  378. const MAX_HUMAN_CLASSSES = 50
  379. const MAX_CSDM_SPAWNS = 128
  380. const MAX_STATS_SAVED = 64
  381. const MAX_MODELS_NEMESIS = 10
  382. const MAX_MODELS_SURVIVOR = 10
  383. const MAX_MODELS_HUMAN = 50
  384. const MAX_MODELS_ADM_HUMAN = 10
  385. const MAX_MODELS_ADM_ZOMBIE = 10
  386.  
  387. // Objective entites and anything that would affect plugin gameplay
  388. new const g_objective_ents[][] = { "func_bomb_target", "info_bomb_target", "info_vip_start", "func_vip_safetyzone", "func_escapezone", "hostage_entity",
  389. "monster_scientist", "func_hostage_rescue", "info_hostage_rescue", "env_fog", "env_rain", "env_snow", "item_longjump", "func_vehicle" }
  390.  
  391. // ***************************************************************
  392. // *** If you experience many SVC_BAD kicks, try the following ***
  393. // ***************************************************************
  394. // 1. Increase the delay between model changes here: (e.g. set it to 0.5)
  395. const Float:MODELCHANGE_DELAY = 0.2
  396. // 2. If the above doesn't help, uncomment the following line: (experimental!)
  397. //#define HANDLE_MODELS_ON_SEPARATE_ENT
  398.  
  399. // Alternate: This makes the plugin set the model index serverside offset
  400. // for accurate hitboxes and might also help with svc_bad (untested)
  401. // Note: Make sure your models don't have messed up hitboxes, otherwise
  402. // this setting may cause your server insane cpu usage and LAG!
  403. //#define SET_MODELINDEX_OFFSET
  404.  
  405. // ---------------------------------------------------------------
  406. // ------------------ Customization ends here!! ------------------
  407. // ---------------------------------------------------------------
  408.  
  409. /*================================================================================
  410. [Offsets and Constants]
  411. =================================================================================*/
  412.  
  413. // Plugin Version
  414. new const PLUGIN_VERSION[] = ""
  415.  
  416. // Task offsets
  417. enum (+= 100)
  418. {
  419. TASK_MODEL = 2000,
  420. TASK_TEAM,
  421. TASK_SPAWN,
  422. TASK_BLOOD,
  423. TASK_NVISION,
  424. TASK_FLASH,
  425. TASK_CHARGE,
  426. TASK_SHOWHUD,
  427. TASK_NADES,
  428. TASK_MAKEZOMBIE,
  429. TASK_WELCOMEMSG,
  430. TASK_THUNDER_PRE,
  431. TASK_THUNDER,
  432. TASK_AMBIENCESOUNDS,
  433. TASK_LIGHTING,
  434. TASK_COMBO
  435. }
  436.  
  437. // IDs inside tasks
  438. #define ID_MODEL (taskid - TASK_MODEL)
  439. #define ID_TEAM (taskid - TASK_TEAM)
  440. #define ID_SPAWN (taskid - TASK_SPAWN)
  441. #define ID_BLOOD (taskid - TASK_BLOOD)
  442. #define ID_NVISION (taskid - TASK_NVISION)
  443. #define ID_FLASH (taskid - TASK_FLASH)
  444. #define ID_CHARGE (taskid - TASK_CHARGE)
  445. #define ID_SHOWHUD (taskid - TASK_SHOWHUD)
  446.  
  447. // Flare and flame tasks
  448. #define FLARE_ENTITY args[0]
  449. #define FLARE_DURATION args[1]
  450. #define FLARE_R args[2]
  451. #define FLARE_G args[3]
  452. #define FLARE_B args[4]
  453. #define FLAME_DURATION args[0]
  454.  
  455. // For player list menu handlers
  456. #define PL_STARTID g_menu_data[id][0]
  457. #define PL_ACTION g_menu_data[id][1]
  458. #define PL_SELECTION (g_menu_data[id][0]+key+1)
  459.  
  460. // For weapon buy menu handlers
  461. #define WPN_STARTID g_menu_data[id][2]
  462. #define WPN_MAXIDS (sizeof g_primary_items)
  463. #define WPN_SELECTION (g_menu_data[id][2]+key)
  464. #define WPN_AUTO_ON g_menu_data[id][3]
  465. #define WPN_AUTO_PRI g_menu_data[id][4]
  466. #define WPN_AUTO_SEC g_menu_data[id][5]
  467.  
  468. // For extra items menu handlers
  469. #define EXTRAS_STARTID g_menu_data[id][6]
  470. #define EXTRAS_SELECTION (g_menu_data[id][6]+key)
  471. #define EXTRAS_CUSTOM_STARTID (4+sizeof g_extra_names)
  472.  
  473. // For zombie class menu handlers
  474. #define ZCLASSES_STARTID g_menu_data[id][7]
  475. #define ZCLASSES_SELECTION (g_menu_data[id][7]+key)
  476.  
  477. // For human class menu handlers
  478. #define HCLASSES_STARTID g_menu_data[id][8]
  479. #define HCLASSES_SELECTION (g_menu_data[id][8]+key)
  480.  
  481. // Menu selections
  482. const MENU_KEY_AUTOSELECT = 7
  483. const MENU_KEY_BACK = 7
  484. const MENU_KEY_NEXT = 8
  485. const MENU_KEY_EXIT = 9
  486.  
  487. // Hard coded extra items
  488. enum
  489. {
  490. EXTRA_NVISION = 0,
  491. EXTRA_ANTIDOTE,
  492. EXTRA_MADNESS,
  493. EXTRA_INFBOMB,
  494. EXTRA_WEAPONS_STARTID
  495. }
  496.  
  497. // Game modes
  498. enum
  499. {
  500. MODE_NONE = 0,
  501. MODE_INFECTION,
  502. MODE_NEMESIS,
  503. MODE_SURVIVOR,
  504. MODE_SWARM,
  505. MODE_MULTI,
  506. MODE_PLAGUE,
  507. MODE_ARMAGEDON
  508. }
  509.  
  510. // ZP Teams
  511. enum
  512. {
  513. ZP_TEAM_ANY = 0,
  514. ZP_TEAM_ZOMBIE,
  515. ZP_TEAM_HUMAN
  516. }
  517.  
  518. // Zombie classes
  519. const ZCLASS_NONE = -1
  520.  
  521. // Human classes
  522. const HCLASS_NONE = -1
  523.  
  524. // HUD messages
  525. const Float:HUD_EVENT_X = -1.0
  526. const Float:HUD_EVENT_Y = 0.17
  527. const Float:HUD_INFECT_X = 0.05
  528. const Float:HUD_INFECT_Y = 0.45
  529. const Float:HUD_SPECT_X = 0.6
  530. const Float:HUD_SPECT_Y = 0.17
  531. const Float:HUD_STATS_X = 0.02
  532. const Float:HUD_STATS_Y = 0.05
  533.  
  534. // CS Offsets (win32)
  535. const OFFSET_CSTEAMS = 114
  536. const OFFSET_CSMONEY = 115
  537. const OFFSET_NVGOGGLES = 129
  538. const OFFSET_ZOOMTYPE = 363
  539. const OFFSET_CSDEATHS = 444
  540. const OFFSET_AWM_AMMO = 377
  541. const OFFSET_SCOUT_AMMO = 378
  542. const OFFSET_PARA_AMMO = 379
  543. const OFFSET_FAMAS_AMMO = 380
  544. const OFFSET_M3_AMMO = 381
  545. const OFFSET_USP_AMMO = 382
  546. const OFFSET_FIVESEVEN_AMMO = 383
  547. const OFFSET_DEAGLE_AMMO = 384
  548. const OFFSET_P228_AMMO = 385
  549. const OFFSET_GLOCK_AMMO = 386
  550. const OFFSET_FLASH_AMMO = 387
  551. const OFFSET_HE_AMMO = 388
  552. const OFFSET_SMOKE_AMMO = 389
  553. const OFFSET_C4_AMMO = 390
  554. const OFFSET_CLIPAMMO = 51
  555. const OFFSET_MODELINDEX = 491 // by Orangutanz
  556.  
  557. const OFFSET_LINUX = 5 // offsets 5 higher in Linux builds
  558. const OFFSET_LINUX_WEAPONS = 4 // weapon offsets are only 4 steps higher on Linux
  559.  
  560. // CS Teams
  561. enum
  562. {
  563. CS_TEAM_UNASSIGNED = 0,
  564. CS_TEAM_T,
  565. CS_TEAM_CT,
  566. CS_TEAM_SPECTATOR
  567. }
  568. new const TEAMNAMES[][] = { "UNASSIGNED", "TERRORIST", "CT", "SPECTATOR" }
  569.  
  570. // Some constants
  571. const HIDE_MONEY = (1<<5|1<<3)
  572. const ATTRIB_BOMB = (1<<1)
  573. const UNIT_SECOND = (1<<12)
  574. const DMG_HEGRENADE = (1<<24)
  575. const CS_NO_ZOOM = 0x5A
  576. const HAS_NVGOGGLES = (1<<0)
  577. const IMPULSE_FLASHLIGHT = 100
  578. const USE_USING = 2
  579. const USE_STOPPED = 0
  580. const STEPTIME_SILENT = 999
  581. const BREAK_GLASS = 0x01
  582. const FFADE_IN = 0x0000
  583. const PEV_SPEC_TARGET = pev_iuser2
  584.  
  585. // Max BP ammo for weapons
  586. new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120,
  587. 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
  588.  
  589. // Max Clip for weapons
  590. new const MAXCLIP[] = { -1, 13, -1, 10, -1, 7, -1, 30, 30, -1, 30, 20, 25, 30, 35, 25, 12, 20,
  591. 10, 30, 100, 8, 30, 30, 20, -1, 7, 30, 30, -1, 50 }
  592.  
  593. // Amount of ammo to give when buying additional clips for weapons
  594. new const BUYAMMO[] = { -1, 13, -1, 30, -1, 8, -1, 12, 30, -1, 30, 50, 12, 30, 30, 30, 12, 30,
  595. 10, 30, 30, 8, 30, 30, 30, -1, 7, 30, 30, -1, 50 }
  596.  
  597. // Ammo IDs for weapons
  598. new const AMMOID[] = { -1, 9, -1, 2, 12, 5, 14, 6, 4, 13, 10, 7, 6, 4, 4, 4, 6, 10,
  599. 1, 10, 3, 5, 4, 10, 2, 11, 8, 4, 2, -1, 7 }
  600.  
  601. // Weapon IDs for ammo types
  602. new const AMMOWEAPON[] = { 0, CSW_AWP, CSW_SCOUT, CSW_M249, CSW_AUG, CSW_XM1014, CSW_MAC10, CSW_FIVESEVEN, CSW_DEAGLE,
  603. CSW_P228, CSW_ELITE, CSW_FLASHBANG, CSW_HEGRENADE, CSW_SMOKEGRENADE, CSW_C4 }
  604.  
  605. // Ammo Offsets for weapons
  606. new const AMMOOFFSET[] = { -1, OFFSET_P228_AMMO, -1, OFFSET_SCOUT_AMMO, OFFSET_HE_AMMO, OFFSET_M3_AMMO, OFFSET_C4_AMMO,
  607. OFFSET_USP_AMMO, OFFSET_FAMAS_AMMO, OFFSET_SMOKE_AMMO, OFFSET_GLOCK_AMMO, OFFSET_FIVESEVEN_AMMO,
  608. OFFSET_USP_AMMO, OFFSET_FAMAS_AMMO, OFFSET_FAMAS_AMMO, OFFSET_FAMAS_AMMO, OFFSET_USP_AMMO,
  609. OFFSET_GLOCK_AMMO, OFFSET_AWM_AMMO, OFFSET_GLOCK_AMMO, OFFSET_PARA_AMMO, OFFSET_M3_AMMO,
  610. OFFSET_FAMAS_AMMO, OFFSET_GLOCK_AMMO, OFFSET_SCOUT_AMMO, OFFSET_FLASH_AMMO, OFFSET_DEAGLE_AMMO,
  611. OFFSET_FAMAS_AMMO, OFFSET_SCOUT_AMMO, -1, OFFSET_FIVESEVEN_AMMO }
  612.  
  613. // Primary and Secondary Weapon Names
  614. new const WEAPONNAMES[][] = { "", "P228 Compact", "", "Schmidt Scout", "", "XM1014 M4", "", "Ingram MAC-10", "Steyr AUG A1",
  615. "", "Dual Elite Berettas", "FiveseveN", "UMP 45", "SG-550 Auto-Sniper", "IMI Galil", "Famas",
  616. "USP .45 ACP Tactical", "Glock 18C", "AWP Magnum Sniper", "MP5 Navy", "M249 Para Machinegun",
  617. "M3 Super 90", "M4A1 Carbine", "Schmidt TMP", "G3SG1 Auto-Sniper", "", "Desert Eagle .50 AE",
  618. "SG-552 Commando", "AK-47 Kalashnikov", "", "ES P90" }
  619.  
  620. // CS sounds
  621. new const sound_flashlight[] = "items/flashlight1.wav"
  622. new const sound_buyammo[] = "items/9mmclip1.wav"
  623. new const sound_armorhit[] = "player/bhit_helmet-1.wav"
  624.  
  625. // Explosion radius for custom grenades
  626. const Float:NADE_EXPLOSION_RADIUS = 240.0
  627.  
  628. // pev_ field used to store additional ammo on weapons
  629. const PEV_ADDITIONAL_AMMO = pev_iuser1
  630.  
  631. // pev_ field used to store custom nade types and their values
  632. const PEV_NADE_TYPE = pev_flTimeStepSound
  633. const NADE_TYPE_INFECTION = 1111
  634. const NADE_TYPE_NAPALM = 2222
  635. const NADE_TYPE_FROST = 3333
  636. const NADE_TYPE_FLARE = 4444
  637. const NADE_TYPE_CAMPO = 5555
  638. const PEV_FLARE_COLOR = pev_punchangle
  639.  
  640. // Weapon bitsums
  641. 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)
  642. const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
  643.  
  644. // Allowed weapons for zombies (added grenades/bomb for sub-plugin support, since they shouldn't be getting them aynway)
  645. const ZOMBIE_ALLOWED_WEAPONS_BITSUM = (1<<CSW_KNIFE)|(1<<CSW_HEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_C4)
  646.  
  647. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  648. // Classnames for separate model entities
  649. new const MODEL_ENT_CLASSNAME[] = "player_model"
  650. new const WEAPON_ENT_CLASSNAME[] = "weapon_model"
  651. #endif
  652.  
  653. // Menu keys
  654. const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
  655.  
  656. /*================================================================================
  657. [Global Variables]
  658. =================================================================================*/
  659.  
  660. // Stupid compiler
  661. #pragma unused g_models_targettime
  662.  
  663. // human and zombie upgrades names
  664. new const g_upgrades_names[2][5][] =
  665. {
  666. { "Damage", "Health", "Speed", "Gravity", "Armor" }, // HUMANS
  667. { "Damage", "Health", "Speed", "Gravity", "" } // ZOMBIES
  668. }
  669.  
  670. // Human and zombie max skills
  671. new const g_upgrade_max[][] =
  672. {
  673. { 45, 25, 25, 15, 25 }, // HUMANS
  674. { 45, 40, 35, 15, 0 } // ZOMBIES
  675. }
  676.  
  677. // Upgrades here!
  678. #define upgrade_cost(%1) (%1 * 2) + 1 // cost of upgrades
  679. #define H_DAMAGE(%1) (%1 + 3) * 0.2 // upgrade human damage
  680. #define H_SALUD(%1) (%1 * 30) // upgrade human health
  681. #define H_SPEED(%1) (%1 * 10) // upgrade human speed
  682. #define H_GRAVITY(%1) ((%1 * 0.005) * 2) // upgrade human gravity
  683. #define H_ARMOR(%1) (%1 * 20) // upgrade human armor
  684. #define Z_DAMAGE(%1) (%1 * 3)
  685. #define Z_SALUD(%1) (%1 * 80000) // upgrade zombie health
  686. #define Z_SPEED(%1) (%1 * 5) // upgrade zombie speed
  687. #define Z_GRAVITY(%1) ((%1 * 0.005) * 2) // upgrade zombie gravity
  688.  
  689. // creamos variables multidimensionales
  690. new g_points[33][2] // human and zombie points
  691. new g_usedpoints[33][2] // human and zombie points used
  692. new g_skill_points[33][2][5] // upgrade data
  693.  
  694. enum // Player state
  695. {
  696. OFFLINE, // Player offline
  697. ONLINE // Player online
  698. }
  699.  
  700. enum _:g_cm
  701. {
  702. Combos, //Cantidades de combos
  703. Msj[33], // Mensajes que va dependiendo del combo
  704. Rojo, // esto no creo q sea nesesario que lo explique
  705. Verde, // ""
  706. Azul, // ""
  707. Multiplicado // Multiplica el combo obtenido
  708. }
  709. new const Combo[][g_cm] =
  710. {
  711. { 0, "Good!", 255, 255, 255, 1 },
  712. { 25, "Better!", 0, 255, 255, 2 },
  713. { 60, "Very Good!", 0, 255, 255, 3 },
  714. { 127, "Excelent!", 255, 255, 0, 4 },
  715. { 200, "Perfect!", 255, 255, 0, 5 },
  716. { 345, "Amazing!", 255, 0, 255, 6 },
  717. { 99999999999, "", 255, 255, 255, 0 }
  718. }
  719.  
  720. #define TAG "[sG|Party]"
  721. #define ID_HUD (taskid - TASK_HUD)
  722.  
  723. enum (+= 77) {
  724. TASK_HUD = 777,
  725. TASK_ACEPT
  726. }
  727.  
  728. enum {
  729. NONE = -1,
  730. Master,
  731. Start_Amount
  732. }
  733.  
  734. enum _:pdata {
  735. In_Party,
  736. Position,
  737. Amount_In_Party,
  738. Block_Party,
  739. UserName[32]
  740. }
  741.  
  742. enum _:DataCallBack {
  743. MASTER,
  744. USER
  745. }
  746.  
  747. new g_PartyData[33][pdata], Array:Party_Ids[33], g_MenuCallback[DataCallBack], g_MsgSayText
  748.  
  749. new cvar_time_acept, cvar_max_players, cvar_allow_bots
  750.  
  751. new const g_sombretos_modes[][] =
  752. {
  753. "models/[VG]/reset1.mdl",
  754. "models/[VG]/reset3.mdl",
  755. "models/[VG]/reset5.mdl",
  756. "models/[VG]/reset7.mdl",
  757. "models/[VG]/reset9.mdl",
  758. "models/[VG]/reset11.mdl",
  759. "models/[VG]/reset13.mdl",
  760. "models/[VG]/reset15.mdl",
  761. "models/[VG]/reset17.mdl",
  762. "models/[VG]/reset19.mdl",
  763. "models/[VG]/reset21.mdl",
  764. "models/[VG]/reset23.mdl",
  765. "models/[VG]/reset25.mdl",
  766. "models/[VG]/reset27.mdl",
  767. "models/[VG]/reset30.mdl"
  768. }
  769.  
  770. // Player vars
  771. new g_level[33] // son los niveles
  772. new g_reset[33] // resets
  773. new g_grandreset[33] // gran reset
  774. new g_playername[33][32] // Nombre del jugador
  775. new g_names[33][32] // no cambia nombre
  776. new g_password[33][24] // contrasena
  777. new g_estado[33] // conectado?
  778. new Registrado[33] // registrado??
  779. new BadPassword[33] // contrasena mala
  780. new g_MsgSync3 // mensaje de hud
  781. new g_sombrero[33] // los hats
  782. new g_sombrero_ent[33] // donde van los hats
  783. new const SaveData[] = "Data"
  784. new g_combo[33] // variable del combo que vamos asiendo
  785. new g_MsgSync4 // mensaje de hud
  786. // new g_ExpSpr, g_lightingSpr, sprite_flare, sprite_beam, ic_particles, model_gibs, g_bubbles
  787. new Trie:g_tClass, gTracerSpr, gTracerSpr1 // efecto para armas de sreset
  788. new g_damage[33] // daño para level combo
  789. new g_total[33] // daño total del combo
  790. new g_ganancia[33] // ganacia de admin y vips
  791. new g_zombie[33] // is zombie
  792. new g_nemesis[33] // is nemesis
  793. new g_armagedon[33] // is armagedon
  794. new g_survivor[33] // is surivor
  795. new g_firstzombie[33] // is the first zombie
  796. new g_lastzombie[33] // is last zombie
  797. new g_lasthuman[33] // is last human
  798. new g_frozen[33] // is frozen (can't move)
  799. new g_nodamage[33] // has spawn protection/zombie madness
  800. new g_respawn_as_zombie[33] // should respawn as zombie
  801. new g_nvision[33] // has night vision
  802. new g_nvisionenabled[33] // has night vision turned on
  803. new g_zombieclass[33] // zombie class
  804. new g_zombieclassnext[33] // zombie class for next infection
  805. new g_humanclass[33] // clases humanas
  806. new g_humanclassnext[33] // siguiente clase de humano
  807. new g_flashlight[33] // has custom flashlight turned on
  808. new g_flashbattery[33] = { 100, ... } // custom flashlight battery
  809. new g_currentweapon[33] // current weapon the player is holding
  810. new g_canbuy[33] // is allowed to buy a new weapon through the menu
  811. new g_ammopacks[33] // ammo pack count
  812. new g_damagedealt[33] // damage dealt to zombies (used to calculate ammo packs reward)
  813. new g_restorevel[33], Float:g_velocity[33][3] // Pain Shock Free vars
  814. new Float:g_lastleaptime[33] // time leap was last used
  815. new Float:g_lastflashtime[33] // time flashlight was last turned on/off
  816. new g_switchingteam[33] // is switching team
  817. new g_playermodel[33][32] // current model's short name [player][model]
  818. new g_menu_data[33][9] // data for various menus
  819. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  820. new g_ent_playermodel[33] // player model entity
  821. new g_ent_weaponmodel[33] // weapon model entity
  822. #endif
  823.  
  824. // Game vars
  825. new g_pluginenabled // ZP plugin enabled
  826. new g_newround // new round starting
  827. new g_endround // round ended
  828. new g_nemround // nemesis round
  829. new g_armagedonround // armageddon round
  830. new g_survround // survivor round
  831. new g_swarmround // swarm round
  832. new g_plagueround // plague round
  833. new g_lastmode // last played mode
  834. new g_scorezombies, g_scorehumans // team scores
  835. new g_spawnCount // available spawn points counter
  836. new Float:g_spawns[MAX_CSDM_SPAWNS][3] // spawn points data
  837. new g_lights_i // lightning current lights counter
  838. new Float:g_models_targettime // for adding delays between Model Change messages
  839. new Float:g_teams_targettime // for adding delays between Team Change messages
  840. new g_MsgSync, g_MsgSync2 // message sync objects
  841. new g_trailSpr, g_exploSpr, g_flameSpr, g_smokeSpr, g_glassSpr // grenade sprites
  842. new g_modname[32] // for formating the mod name
  843. new g_freezetime // whether it's freeze time
  844. new g_maxplayers // max players counter
  845. new g_czero // whether we are running on a CZ server
  846. new g_hamczbots // whether ham forwards are registered for CZ bots
  847. new g_fwSpawn // spawn forward handle
  848. new g_infbombcounter // to limit buying infection bombs
  849.  
  850. // Precached model indexes
  851. new g_modelindex_nemesis[MAX_MODELS_NEMESIS]
  852. new g_modelindex_survivor[MAX_MODELS_SURVIVOR]
  853. new g_modelindex_admin[MAX_MODELS_ADM_HUMAN]
  854. new g_modelindex_admin_zombie[MAX_MODELS_ADM_ZOMBIE]
  855.  
  856. // Some forward handlers
  857. new g_fwRoundStart, g_fwRoundEnd, g_fwUserInfected_pre, g_fwUserInfected_post,
  858. g_fwUserHumanized_pre, g_fwUserHumanized_post, g_fwExtraItemSelected, g_fwDummyResult
  859.  
  860. // Temporary Database vars (used to restore players stats in case they get disconnected)
  861. new db_name[MAX_STATS_SAVED][32] // player name
  862. new db_ammopacks[MAX_STATS_SAVED] // ammo pack count
  863. new db_zombieclass[MAX_STATS_SAVED] // zombie class
  864. new db_humanclass[MAX_STATS_SAVED] // human class
  865. new db_slot_i // additional saved slots counter (should start on maxplayers+1)
  866.  
  867. // Extra Items vars
  868. new g_extraitem_name[MAX_EXTRA_ITEMS][32] // caption
  869. new g_extraitem_cost[MAX_EXTRA_ITEMS] // cost
  870. new g_extraitem_team[MAX_EXTRA_ITEMS] // team
  871. new g_extraitem_i // loaded extra items counter
  872.  
  873. // Zombie Classes vars
  874. new g_zclass_name[MAX_ZOMBIE_CLASSSES][32] // name
  875. new g_zclass_info[MAX_ZOMBIE_CLASSSES][32] // description
  876. new g_zclass_model[MAX_ZOMBIE_CLASSSES][32] // player model
  877. new g_zclass_modelindex[MAX_ZOMBIE_CLASSSES] // model index
  878. new g_zclass_clawmodel[MAX_ZOMBIE_CLASSSES][32] // claw model
  879. new g_zclass_hp[MAX_ZOMBIE_CLASSSES] // health
  880. new g_zclass_spd[MAX_ZOMBIE_CLASSSES] // speed
  881. new Float:g_zclass_grav[MAX_ZOMBIE_CLASSSES] // gravity
  882. new Float:g_zclass_kb[MAX_ZOMBIE_CLASSSES] // knockback
  883. new g_zclass_lvl[MAX_ZOMBIE_CLASSSES] // niveles
  884. new g_zclass_i // loaded zombie classes counter
  885.  
  886. // Human Classes vars
  887. new g_hclass_name[MAX_HUMAN_CLASSSES][32] // name
  888. new g_hclass_info[MAX_HUMAN_CLASSSES][32] // description
  889. new g_hclass_model[MAX_HUMAN_CLASSSES][32] // player model
  890. new g_hclass_modelindex[MAX_HUMAN_CLASSSES] // model index
  891. new g_hclass_clawmodel[MAX_HUMAN_CLASSSES][32] // claw model
  892. new g_hclass_hp[MAX_HUMAN_CLASSSES] // health
  893. new g_hclass_spd[MAX_HUMAN_CLASSSES] // speed
  894. new Float:g_hclass_grav[MAX_HUMAN_CLASSSES] // gravity
  895. new g_hclass_lvl[MAX_HUMAN_CLASSSES] // level
  896. new g_hclass_ar[MAX_HUMAN_CLASSSES] // armadura
  897. new g_hclass_i // loaded human classes counter
  898.  
  899. // Message IDs vars
  900. new g_msgScoreInfo, g_msgNVGToggle, g_msgScoreAttrib, g_msgAmmoPickup, g_msgScreenFade,
  901. g_msgDeathMsg, g_msgSetFOV, g_msgFlashlight, g_msgFlashBat, g_msgTeamInfo, g_msgDamage,
  902. g_msgHideWeapon, g_msgCrosshair, g_msgSayText, g_msgScreenShake, g_msgCurWeapon
  903.  
  904. // CVAR pointers
  905. new cvar_lighting, cvar_zombiefov, cvar_plague, cvar_plaguechance, cvar_zombiefirsthp,
  906. cvar_removemoney, cvar_thunder, cvar_zombiebonushp, cvar_nemhp, cvar_nem, cvar_surv,
  907. cvar_nemchance, cvar_deathmatch, cvar_nemglow, cvar_cnvg, cvar_hitzones,
  908. cvar_nemgravity, cvar_flashsize, cvar_ammodamage, cvar_zombiearmor, cvar_survpainfree,
  909. cvar_nempainfree, cvar_nemspd, cvar_survchance, cvar_survhp, cvar_survspd,
  910. cvar_swarmchance, cvar_flashdrain, cvar_zombiebleeding, cvar_removedoors, cvar_cflash,
  911. cvar_randspawn, cvar_multi, cvar_multichance, cvar_infammo, cvar_swarm, cvar_ammoinfect,
  912. cvar_toggle, cvar_knockbackpower, cvar_freezeduration, cvar_triggered, cvar_flashcharge,
  913. cvar_firegrenades, cvar_frostgrenades, cvar_survgravity, cvar_logcommands, cvar_survglow,
  914. cvar_spawnprotection, cvar_nvgsize, cvar_flareduration, cvar_zclasses,
  915. cvar_extraitems, cvar_showactivity, cvar_humanlasthp, cvar_nemignorefrags, cvar_warmup,
  916. cvar_flashdist, cvar_flarecolor, cvar_survignorefrags, cvar_fireduration, cvar_firedamage,
  917. cvar_flaregrenades, cvar_knockbackducking, cvar_knockbackdamage, cvar_knockbackzvel,
  918. cvar_multiratio, cvar_flaresize, cvar_spawndelay, cvar_extraantidote, cvar_extramadness,
  919. cvar_extraweapons, cvar_extranvision, cvar_nvggive, cvar_preventconsecutive, cvar_botquota,
  920. cvar_buycustom, cvar_zombiepainfree, cvar_fireslowdown, cvar_survbasehp, cvar_survaura,
  921. cvar_nemignoreammo, cvar_survignoreammo, cvar_nemaura, cvar_extrainfbomb, cvar_knockback,
  922. cvar_fragsinfect, cvar_fragskill, cvar_zombiesilent, cvar_removedropped,
  923. cvar_plagueratio, cvar_blocksuicide, cvar_knockbackdist, cvar_nemdamage, cvar_leapzombies,
  924. cvar_leapzombiesforce, cvar_leapzombiesheight, cvar_leapzombiescooldown, cvar_leapnemesis,
  925. cvar_leapnemesisforce, cvar_leapnemesisheight, cvar_leapnemesiscooldown, cvar_leapsurvivor,
  926. cvar_leapsurvivorforce, cvar_leapsurvivorheight, cvar_nemminplayers, cvar_survminplayers,
  927. cvar_respawnonsuicide, cvar_respawnafterlast, cvar_leapsurvivorcooldown, cvar_statssave,
  928. cvar_swarmminplayers, cvar_multiminplayers, cvar_plagueminplayers, cvar_adminmodelshuman,
  929. cvar_adminmodelszombie, cvar_nembasehp, cvar_blockpushables, cvar_respawnworldspawnkill,
  930. cvar_madnessduration, cvar_plaguenemnum, cvar_plaguenemhpmulti, cvar_plaguesurvhpmulti,
  931. cvar_survweapon, cvar_plaguesurvnum, cvar_infectionscreenfade, cvar_infectionscreenshake,
  932. cvar_infectionsparkle, cvar_infectiontracers, cvar_infectionparticles, cvar_infbomblimit,
  933. cvar_hudicons, cvar_flashshowall, cvar_hclasses, cvar_bubblepush, cvar_armagedonratio,
  934. cvar_armagedon, cvar_armagedonchance, cvar_armagedonminplayers, cvar_armagedonhpsurvi, cvar_armagedonhpneme,
  935. cvar_nvgcolor[3], cvar_nemnvgcolor[3], cvar_humnvgcolor[3], cvar_flashcolor[3]
  936.  
  937. /*================================================================================
  938. [Natives, Precache and Init]
  939. =================================================================================*/
  940.  
  941. public plugin_natives()
  942. {
  943. // Player specific natives
  944. register_native("zp_get_user_zombie", "native_get_user_zombie", 1)
  945. register_native("zp_get_user_nemesis", "native_get_user_nemesis", 1)
  946. register_native("zp_get_user_armagedon", "native_get_user_armagedon", 1)
  947. register_native("zp_get_user_survivor", "native_get_user_survivor", 1)
  948. register_native("zp_get_user_first_zombie", "native_get_user_first_zombie", 1)
  949. register_native("zp_get_user_last_zombie", "native_get_user_last_zombie", 1)
  950. register_native("zp_get_user_last_human", "native_get_user_last_human", 1)
  951. register_native("zp_get_user_zombie_class", "native_get_user_zombie_class", 1)
  952. register_native("zp_set_user_zombie_class", "native_set_user_zombie_class", 1)
  953. register_native("zp_get_user_human_class", "native_get_user_human_class", 1)
  954. register_native("zp_set_user_human_class", "native_set_user_human_class", 1)
  955. register_native("zp_get_user_ammo_packs", "native_get_user_ammo_packs", 1)
  956. register_native("zp_set_user_ammo_packs", "native_set_user_ammo_packs", 1)
  957. register_native("zp_get_user_level", "native_get_user_level", 1)
  958. register_native("zp_set_user_level", "native_set_user_level", 1)
  959. register_native("zp_get_zombie_maxhealth", "native_get_zombie_maxhealth", 1)
  960. register_native("zp_get_user_batteries", "native_get_user_batteries", 1)
  961. register_native("zp_set_user_batteries", "native_set_user_batteries", 1)
  962. register_native("zp_infect_user", "native_infect_user", 1)
  963. register_native("zp_disinfect_user", "native_disinfect_user", 1)
  964. register_native("zp_respawn_user", "native_respawn_user", 1)
  965.  
  966. // Round natives
  967. register_native("zp_has_round_started", "native_has_round_started", 1)
  968. register_native("zp_is_nemesis_round", "native_is_nemesis_round", 1)
  969. register_native("zp_is_armagedon_round", "native_is_armagedon_round", 1)
  970. register_native("zp_is_survivor_round", "native_is_survivor_round", 1)
  971. register_native("zp_is_swarm_round", "native_is_swarm_round", 1)
  972. register_native("zp_is_plague_round", "native_is_plague_round", 1)
  973.  
  974. // External additions natives
  975. register_native("zp_register_extra_item", "native_register_extra_item", 1)
  976. register_native("zp_register_zombie_class", "native_register_zombie_class", 1)
  977. register_native("zp_register_human_class", "native_register_human_class", 1)
  978.  
  979. // Load up the hard coded extra items
  980. native_register_extra_item2("nvision", g_extra_costs2[0], ZP_TEAM_HUMAN)
  981. native_register_extra_item2("antidote", g_extra_costs2[1], ZP_TEAM_ZOMBIE)
  982. native_register_extra_item2("madness", g_extra_costs2[2], ZP_TEAM_ZOMBIE)
  983. native_register_extra_item2("infbomb", g_extra_costs2[3], ZP_TEAM_ZOMBIE)
  984. for (new i = 0; i < sizeof g_extra_names; i++) // weapons
  985. native_register_extra_item2(g_extra_names[i], g_extra_costs[i], ZP_TEAM_HUMAN)
  986. }
  987.  
  988. public plugin_precache()
  989. {
  990. // To switch plugin on/off
  991. register_concmd("zp_toggle", "cmd_toggle", ACCESS_FLAG2, "<1/0> - Enable/Disable Zombie Plague (will restart the current map)")
  992. cvar_toggle = register_cvar("zp_on", "1")
  993.  
  994.  
  995. // Plugin disabled?
  996. if (!get_pcvar_num(cvar_toggle)) return;
  997. g_pluginenabled = true
  998.  
  999. g_tClass = TrieCreate()
  1000. RegisterHam(Ham_TraceAttack, "worldspawn", "TraceAttack", 1)
  1001. TrieSetCell(g_tClass, "worldspawn", 1)
  1002. RegisterHam(Ham_TraceAttack, "player", "TraceAttack", 1)
  1003. TrieSetCell(g_tClass, "player", 1)
  1004. register_forward(FM_Spawn, "Spawn", 1)
  1005. gTracerSpr = engfunc(EngFunc_PrecacheModel, "sprites/lvlupvg.spr") // Sprite Default Half Life
  1006. gTracerSpr1 = engfunc(EngFunc_PrecacheModel, "sprites/lvlupvg.spr") // Sprite Default Half Life
  1007.  
  1008.  
  1009. new i, playermodel[100]
  1010.  
  1011. // Custom player models
  1012. for (i = 0; i < sizeof model_nemesis; i++)
  1013. {
  1014. formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_nemesis[i], model_nemesis[i])
  1015. g_modelindex_nemesis[i] = engfunc(EngFunc_PrecacheModel, playermodel)
  1016. }
  1017. for (i = 0; i < sizeof model_survivor; i++)
  1018. {
  1019. formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_survivor[i], model_survivor[i])
  1020. g_modelindex_survivor[i] = engfunc(EngFunc_PrecacheModel, playermodel)
  1021. }
  1022. for (i = 0; i < sizeof model_admin; i++)
  1023. {
  1024. formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_admin[i], model_admin[i])
  1025. g_modelindex_admin[i] = engfunc(EngFunc_PrecacheModel, playermodel)
  1026. }
  1027. for (i = 0; i < sizeof model_admin_zombie; i++)
  1028. {
  1029. formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_admin_zombie[i], model_admin_zombie[i])
  1030. g_modelindex_admin_zombie[i] = engfunc(EngFunc_PrecacheModel, playermodel)
  1031. }
  1032.  
  1033. {
  1034. static i
  1035.  
  1036. for (i = 0; i < sizeof g_sombretos_modes; i++)
  1037. precache_model(g_sombretos_modes[i])
  1038. }
  1039.  
  1040. // Custom weapon models
  1041. engfunc(EngFunc_PrecacheModel, model_vknife_nemesis)
  1042. engfunc(EngFunc_PrecacheModel, model_vm249_survivor)
  1043. engfunc(EngFunc_PrecacheModel, model_pm249_survivor)
  1044. engfunc(EngFunc_PrecacheModel, model_grenade_infect)
  1045. engfunc(EngFunc_PrecacheModel, model_grenade_fire)
  1046. engfunc(EngFunc_PrecacheModel, model_grenade_frost)
  1047. engfunc(EngFunc_PrecacheModel, model_grenade_flare)
  1048. engfunc(EngFunc_PrecacheModel, model_akdestruction_human) // Precacheamos
  1049. engfunc(EngFunc_PrecacheModel, model_akdestruction_human1) // Precacheamos
  1050. engfunc(EngFunc_PrecacheModel, model_ultimate_human) // Precacheamos
  1051. engfunc(EngFunc_PrecacheModel, model_ultimate_human1) // Precacheamos
  1052. engfunc(EngFunc_PrecacheModel, model_atomic_human) // Precacheamos
  1053. engfunc(EngFunc_PrecacheModel, model_atomic_human1) // Precacheamos
  1054. engfunc(EngFunc_PrecacheModel, model_masive_human) // Precacheamos
  1055. engfunc(EngFunc_PrecacheModel, model_masive_human1) // Precacheamos
  1056. engfunc(EngFunc_PrecacheModel, model_navi_human) // Precacheamos
  1057. engfunc(EngFunc_PrecacheModel, model_navi_human1) // Precacheamos
  1058. engfunc(EngFunc_PrecacheModel, model_overpower_human) // Precacheamos
  1059. engfunc(EngFunc_PrecacheModel, model_overpower_human1) // Precacheamos
  1060. engfunc(EngFunc_PrecacheModel, model_stfu_human) // Precacheamos
  1061. engfunc(EngFunc_PrecacheModel, model_stfu_human1) // Precacheamos
  1062. engfunc(EngFunc_PrecacheModel, model_rlp_human) // Precacheamos
  1063. engfunc(EngFunc_PrecacheModel, model_rlp_human1) // Precacheamos
  1064. engfunc(EngFunc_PrecacheModel, model_m4_human) // Precacheamos
  1065. engfunc(EngFunc_PrecacheModel, model_m4_human1) // Precacheamos
  1066. engfunc(EngFunc_PrecacheModel, model_barret_human) // Precacheamos
  1067. engfunc(EngFunc_PrecacheModel, model_barret_human1) // Precacheamos
  1068. engfunc(EngFunc_PrecacheModel, model_devil_human) // Precacheamos
  1069. engfunc(EngFunc_PrecacheModel, model_devil_human1) // Precacheamos
  1070. engfunc(EngFunc_PrecacheModel, model_rampage_human) // Precacheamos
  1071. engfunc(EngFunc_PrecacheModel, model_rampage_human1) // Precacheamos
  1072. engfunc(EngFunc_PrecacheModel, model_supermide_human) // Precacheamos
  1073. engfunc(EngFunc_PrecacheModel, model_supermide_human1) // Precacheamos
  1074. engfunc(EngFunc_PrecacheModel, model_farger_human) // Precacheamos
  1075. engfunc(EngFunc_PrecacheModel, model_farger_human1) // Precacheamos
  1076. engfunc(EngFunc_PrecacheModel, model_storm_human) // Precacheamos
  1077. engfunc(EngFunc_PrecacheModel, model_storm_human1) // Precacheamos
  1078. engfunc(EngFunc_PrecacheModel, model_adge_human) // Precacheamos
  1079. engfunc(EngFunc_PrecacheModel, model_adge_human1) // Precacheamos
  1080. engfunc(EngFunc_PrecacheModel, model_ultra_human) // Precacheamos
  1081. engfunc(EngFunc_PrecacheModel, model_ultra_human1) // Precacheamos
  1082. engfunc(EngFunc_PrecacheModel, model_nule_human) // Precacheamos
  1083. engfunc(EngFunc_PrecacheModel, model_nule_human1) // Precacheamos
  1084. engfunc(EngFunc_PrecacheModel, model_super_human) // Precacheamos
  1085. engfunc(EngFunc_PrecacheModel, model_super_human1) // Precacheamos
  1086. engfunc(EngFunc_PrecacheModel, model_ultrak_human) // Precacheamos
  1087. engfunc(EngFunc_PrecacheModel, model_ultrak_human1) // Precacheamos
  1088. engfunc(EngFunc_PrecacheModel, model_raampage_human) // Precacheamos
  1089. engfunc(EngFunc_PrecacheModel, model_raampage_human1) // Precacheamos
  1090. engfunc(EngFunc_PrecacheModel, model_zpr350_human) // Precacheamos
  1091. engfunc(EngFunc_PrecacheModel, model_zpr350_human1) // Precacheamos
  1092. engfunc(EngFunc_PrecacheModel, model_rpg17_human) // Precacheamos
  1093. engfunc(EngFunc_PrecacheModel, model_rpg17_human1) // Precacheamos
  1094. engfunc(EngFunc_PrecacheModel, model_aru_human) // Precacheamos
  1095. engfunc(EngFunc_PrecacheModel, model_aru_human1) // Precacheamos
  1096. engfunc(EngFunc_PrecacheModel, model_xh500w_human) // Precacheamos
  1097. engfunc(EngFunc_PrecacheModel, model_xh500w_human1) // Precacheamos
  1098. engfunc(EngFunc_PrecacheModel, model_dvlsxx_human) // Precacheamos
  1099. engfunc(EngFunc_PrecacheModel, model_dvlsxx_human1) // Precacheamos
  1100. engfunc(EngFunc_PrecacheModel, model_thunderstorm_human) // Precacheamos
  1101. engfunc(EngFunc_PrecacheModel, model_thunderstorm_human1) // Precacheamos
  1102. engfunc(EngFunc_PrecacheModel, model_101000xx_human) // Precacheamos
  1103. engfunc(EngFunc_PrecacheModel, model_101000xx_human1) // Precacheamos
  1104. engfunc(EngFunc_PrecacheModel, model_101000cannon_human) // Precacheamos
  1105. engfunc(EngFunc_PrecacheModel, model_101000cannon_human1) // Precacheamos
  1106. engfunc(EngFunc_PrecacheModel, model_tmp2xx_human) // Precacheamos
  1107. engfunc(EngFunc_PrecacheModel, model_tmp2xx_human1) // Precacheamos
  1108. engfunc(EngFunc_PrecacheModel, model_coldtorment_human) // Precacheamos
  1109. engfunc(EngFunc_PrecacheModel, model_coldtorment_human1) // Precacheamos
  1110. engfunc(EngFunc_PrecacheModel, model_shredder_human) // Precacheamos
  1111. engfunc(EngFunc_PrecacheModel, model_shredder_human1) // Precacheamos
  1112. engfunc(EngFunc_PrecacheModel, model_grenade) // precacheamos el model "v_".
  1113. engfunc(EngFunc_PrecacheModel, model) // precacheamos el model de la burbuja.
  1114. engfunc(EngFunc_PrecacheModel, w_model) // precacheamos el model "w_".
  1115. engfunc(EngFunc_PrecacheModel, model_nemesis2)
  1116. engfunc(EngFunc_PrecacheModel, model_esqueleto)
  1117. engfunc(EngFunc_PrecacheModel, model_general)
  1118. engfunc(EngFunc_PrecacheModel, model_gusano)
  1119. engfunc(EngFunc_PrecacheModel, model_subteniente)
  1120. engfunc(EngFunc_PrecacheModel, model_supersoldado)
  1121.  
  1122. // Custom sounds
  1123. for (i = 0; i < sizeof sound_win_zombies; i++)
  1124. engfunc(EngFunc_PrecacheSound, sound_win_zombies[i])
  1125. for (i = 0; i < sizeof sound_win_humans; i++)
  1126. engfunc(EngFunc_PrecacheSound, sound_win_humans[i])
  1127. for (i = 0; i < sizeof sound_win_no_one; i++)
  1128. engfunc(EngFunc_PrecacheSound, sound_win_no_one[i])
  1129. for (i = 0; i < sizeof zombie_infect; i++)
  1130. engfunc(EngFunc_PrecacheSound, zombie_infect[i])
  1131. for (i = 0; i < sizeof zombie_pain; i++)
  1132. engfunc(EngFunc_PrecacheSound, zombie_pain[i])
  1133. for (i = 0; i < sizeof nemesis_pain; i++)
  1134. engfunc(EngFunc_PrecacheSound, nemesis_pain[i])
  1135. for (i = 0; i < sizeof zombie_die; i++)
  1136. engfunc(EngFunc_PrecacheSound, zombie_die[i])
  1137. for (i = 0; i < sizeof zombie_fall; i++)
  1138. engfunc(EngFunc_PrecacheSound, zombie_fall[i])
  1139. for (i = 0; i < sizeof zombie_miss_slash; i++)
  1140. engfunc(EngFunc_PrecacheSound, zombie_miss_slash[i])
  1141. for (i = 0; i < sizeof zombie_miss_wall; i++)
  1142. engfunc(EngFunc_PrecacheSound, zombie_miss_wall[i])
  1143. for (i = 0; i < sizeof zombie_hit_normal; i++)
  1144. engfunc(EngFunc_PrecacheSound, zombie_hit_normal[i])
  1145. for (i = 0; i < sizeof zombie_hit_stab; i++)
  1146. engfunc(EngFunc_PrecacheSound, zombie_hit_stab[i])
  1147. for (i = 0; i < sizeof zombie_idle; i++)
  1148. engfunc(EngFunc_PrecacheSound, zombie_idle[i])
  1149. for (i = 0; i < sizeof zombie_idle_last; i++)
  1150. engfunc(EngFunc_PrecacheSound, zombie_idle_last[i])
  1151. for (i = 0; i < sizeof zombie_madness; i++)
  1152. engfunc(EngFunc_PrecacheSound, zombie_madness[i])
  1153. for (i = 0; i < sizeof sound_nemesis; i++)
  1154. engfunc(EngFunc_PrecacheSound, sound_nemesis[i])
  1155. for (i = 0; i < sizeof sound_survivor; i++)
  1156. engfunc(EngFunc_PrecacheSound, sound_survivor[i])
  1157. for (i = 0; i < sizeof sound_swarm; i++)
  1158. engfunc(EngFunc_PrecacheSound, sound_swarm[i])
  1159. for (i = 0; i < sizeof sound_multi; i++)
  1160. engfunc(EngFunc_PrecacheSound, sound_multi[i])
  1161. for (i = 0; i < sizeof sound_plague; i++)
  1162. engfunc(EngFunc_PrecacheSound, sound_plague[i])
  1163. for (i = 0; i < sizeof grenade_infect; i++)
  1164. engfunc(EngFunc_PrecacheSound, grenade_infect[i])
  1165. for (i = 0; i < sizeof grenade_infect_player; i++)
  1166. engfunc(EngFunc_PrecacheSound, grenade_infect_player[i])
  1167. for (i = 0; i < sizeof grenade_fire; i++)
  1168. engfunc(EngFunc_PrecacheSound, grenade_fire[i])
  1169. for (i = 0; i < sizeof grenade_fire_player; i++)
  1170. engfunc(EngFunc_PrecacheSound, grenade_fire_player[i])
  1171. for (i = 0; i < sizeof grenade_frost; i++)
  1172. engfunc(EngFunc_PrecacheSound, grenade_frost[i])
  1173. for (i = 0; i < sizeof grenade_frost_player; i++)
  1174. engfunc(EngFunc_PrecacheSound, grenade_frost_player[i])
  1175. for (i = 0; i < sizeof grenade_frost_break; i++)
  1176. engfunc(EngFunc_PrecacheSound, grenade_frost_break[i])
  1177. for (i = 0; i < sizeof grenade_flare; i++)
  1178. engfunc(EngFunc_PrecacheSound, grenade_flare[i])
  1179. for (i = 0; i < sizeof sound_antidote; i++)
  1180. engfunc(EngFunc_PrecacheSound, sound_antidote[i])
  1181. for (i = 0; i < sizeof sound_thunder; i++)
  1182. engfunc(EngFunc_PrecacheSound, sound_thunder[i])
  1183. #if defined AMBIENCE_SOUNDS
  1184. for (i = 0; i < sizeof sound_ambience1; i++)
  1185. {
  1186. if (equal(sound_ambience1[i][strlen(sound_ambience1[i])-4], ".mp3"))
  1187. {
  1188. formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience1[i])
  1189. engfunc(EngFunc_PrecacheGeneric, playermodel)
  1190. }
  1191. else
  1192. {
  1193. engfunc(EngFunc_PrecacheSound, sound_ambience1[i])
  1194. }
  1195. }
  1196. for (i = 0; i < sizeof sound_ambience2; i++)
  1197. {
  1198. if (equal(sound_ambience2[i][strlen(sound_ambience2[i])-4], ".mp3"))
  1199. {
  1200. formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience2[i])
  1201. engfunc(EngFunc_PrecacheGeneric, playermodel)
  1202. }
  1203. else
  1204. {
  1205. engfunc(EngFunc_PrecacheSound, sound_ambience2[i])
  1206. }
  1207. }
  1208. for (i = 0; i < sizeof sound_ambience3; i++)
  1209. {
  1210. if (equal(sound_ambience3[i][strlen(sound_ambience3[i])-4], ".mp3"))
  1211. {
  1212. formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience3[i])
  1213. engfunc(EngFunc_PrecacheGeneric, playermodel)
  1214. }
  1215. else
  1216. {
  1217. engfunc(EngFunc_PrecacheSound, sound_ambience3[i])
  1218. }
  1219. }
  1220. for (i = 0; i < sizeof sound_ambience4; i++)
  1221. {
  1222. if (equal(sound_ambience4[i][strlen(sound_ambience4[i])-4], ".mp3"))
  1223. {
  1224. formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience4[i])
  1225. engfunc(EngFunc_PrecacheGeneric, playermodel)
  1226. }
  1227. else
  1228. {
  1229. engfunc(EngFunc_PrecacheSound, sound_ambience4[i])
  1230. }
  1231. }
  1232. for (i = 0; i < sizeof sound_ambience5; i++)
  1233. {
  1234. if (equal(sound_ambience5[i][strlen(sound_ambience5[i])-5], ".mp3"))
  1235. {
  1236. formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience5[i])
  1237. engfunc(EngFunc_PrecacheGeneric, playermodel)
  1238. }
  1239. else
  1240. {
  1241. engfunc(EngFunc_PrecacheSound, sound_ambience5[i])
  1242. }
  1243. }
  1244. #endif
  1245.  
  1246. // CS sounds (just in case)
  1247. engfunc(EngFunc_PrecacheSound, sound_flashlight)
  1248. engfunc(EngFunc_PrecacheSound, sound_buyammo)
  1249. engfunc(EngFunc_PrecacheSound, sound_armorhit)
  1250.  
  1251. // Custom models/sprites for grenades
  1252. g_trailSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_trail)
  1253. g_exploSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_ring)
  1254. g_flameSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_fire)
  1255. g_smokeSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_smoke)
  1256. g_glassSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_glass)
  1257.  
  1258. new ent
  1259.  
  1260. // Fake Hostage (to force round ending)
  1261. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "hostage_entity"))
  1262. if (pev_valid(ent))
  1263. {
  1264. engfunc(EngFunc_SetOrigin, ent, Float:{8192.0 ,8192.0 ,8192.0})
  1265. dllfunc(DLLFunc_Spawn, ent)
  1266. }
  1267.  
  1268. #if defined AMBIENCE_FOG
  1269. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_fog"))
  1270. if (pev_valid(ent))
  1271. {
  1272. fm_set_kvd(ent, "density", FOG_DENSITY, "env_fog")
  1273. fm_set_kvd(ent, "rendercolor", FOG_COLOR, "env_fog")
  1274. }
  1275. #endif
  1276.  
  1277. #if defined AMBIENCE_RAIN
  1278. engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_rain"))
  1279. #endif
  1280.  
  1281. #if defined AMBIENCE_SNOW
  1282. engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_snow"))
  1283. #endif
  1284.  
  1285. // Prevent some entities from spawning
  1286. g_fwSpawn = register_forward(FM_Spawn, "fw_Spawn")
  1287. }
  1288.  
  1289. public plugin_init()
  1290. {
  1291. // Register plugin call
  1292. register_plugin("SilentGamerz", PLUGIN_VERSION, "Shady")
  1293.  
  1294. // Plugin disabled?
  1295. if (!g_pluginenabled) return;
  1296.  
  1297. // No zombie classes?
  1298. if (!g_zclass_i) set_fail_state("No zombie classes loaded!")
  1299.  
  1300. // No human classes?
  1301. if (!g_hclass_i) set_fail_state("No human classes loaded!")
  1302.  
  1303. // Language files
  1304. register_dictionary("zombie_plague.txt")
  1305.  
  1306. // Events
  1307. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  1308. register_logevent("logevent_round_start",2, "1=Round_Start")
  1309. register_logevent("logevent_round_end", 2, "1=Round_End")
  1310. #if defined AMBIENCE_SOUNDS
  1311. register_event("30", "event_intermission", "a")
  1312. #endif
  1313. register_event("CurWeapon", "event_cur_weapon", "b", "1=1")
  1314. register_event("35", "event_weapon_anim", "b")
  1315.  
  1316. register_clcmd("BUBBLEBOMB", "give_item_bubble") // podemos llamar a la bomba. console_cmd(id, "BUBBLEBOMB")
  1317. register_event("CurWeapon", "hook_curwpn", "be", "1=1", "2!29");
  1318. cvar_bubblepush = register_cvar("zp_bubble_push", "2.0") // es la cvar, que al tocar al campo nos retira de el.
  1319. register_touch(entclas, "player", "entity_touch") // nose bien que es, por lo que entiendo llamamos a la entidad
  1320.  
  1321. // Forwards
  1322. RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
  1323. RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  1324. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  1325. RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack")
  1326. RegisterHam(Ham_Use, "func_tank", "fw_UseStationary")
  1327. RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary")
  1328. RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary")
  1329. RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary")
  1330. RegisterHam(Ham_Use, "func_pushable", "fw_UsePushable")
  1331. RegisterHam(Ham_Touch, "weaponbox", "fw_TouchWeapon")
  1332. RegisterHam(Ham_Touch, "armoury_entity", "fw_TouchWeapon")
  1333. RegisterHam(Ham_Touch, "weapon_shield", "fw_TouchWeapon")
  1334. RegisterHam(Ham_AddPlayerItem, "player", "fw_AddPlayerItem")
  1335. register_forward(FM_ClientKill, "fw_ClientKill")
  1336. register_forward(FM_EmitSound, "fw_EmitSound")
  1337. #if !defined HANDLE_MODELS_ON_SEPARATE_ENT
  1338. register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")
  1339. register_forward(FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged")
  1340. register_forward(FM_ClientUserInfoChanged, "fwdCliUserInfoChanged")
  1341. #endif
  1342. register_forward(FM_GetGameDescription, "fw_GetGameDescription")
  1343. register_forward(FM_CmdStart, "fw_CmdStart")
  1344. register_forward(FM_SetModel, "fw_SetModel")
  1345. RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
  1346. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
  1347. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink_Post", 1)
  1348. unregister_forward(FM_Spawn, g_fwSpawn)
  1349.  
  1350. // Client commands
  1351. register_clcmd("say zpmenu", "clcmd_saymenu")
  1352. register_clcmd("say /zpmenu", "clcmd_saymenu")
  1353. register_clcmd("say unstuck", "clcmd_sayunstuck")
  1354. register_clcmd("say /unstuck", "clcmd_sayunstuck")
  1355. register_clcmd("nightvision", "clcmd_nightvision")
  1356. register_clcmd("drop", "clcmd_drop")
  1357. register_clcmd("buyammo1", "clcmd_buyammo")
  1358. register_clcmd("buyammo2", "clcmd_buyammo")
  1359. register_clcmd("chooseteam", "clcmd_changeteam")
  1360. register_clcmd("jointeam", "clcmd_jointeam")
  1361. register_clcmd("Create_Password", "clcmd_register")
  1362. register_clcmd("Login_Password", "clcmd_login")
  1363. register_clcmd("say /party", "cmdParty")
  1364. register_clcmd("say /reglas", "info")
  1365. register_clcmd("say_team", "cmdSayTeam")
  1366. register_clcmd("say /account", "Datos")
  1367. register_clcmd("say /aps", "update_ammopacks")
  1368. register_clcmd("say /yo", "Datos1")
  1369. register_clcmd("say", "HookSay")
  1370.  
  1371.  
  1372. // Menus
  1373. register_menu("Buy Menu 1", KEYSMENU, "menu_buy1")
  1374. register_menu("Buy Menu 2", KEYSMENU, "menu_buy2")
  1375. register_menu("Zombie Class Menu", KEYSMENU, "menu_zclass")
  1376. register_menu("Human Class Menu", KEYSMENU, "menu_hclass")
  1377. register_menu("Game Menu", KEYSMENU, "menu_game")
  1378. register_menu("Extra Items", KEYSMENU, "menu_extras")
  1379. register_menu("Admin Menu", KEYSMENU, "menu_admin")
  1380. register_menu("Player List Menu", KEYSMENU, "menu_player_list")
  1381. register_menu("Menu Reset", KEYSMENU, "menu_reset")
  1382. register_menu("Menu Super Reset", KEYSMENU, "menu_grand_reset")
  1383. register_menu("Habilidades", KEYSMENU, "menu_upgrade_handler")
  1384. register_menu("Menu Register", KEYSMENU, "menu_registro")
  1385. register_menu("Datos1", KEYSMENU, "HandMenu")
  1386.  
  1387.  
  1388. // Admin commands
  1389. register_concmd("zp_zombie", "cmd_zombie", ACCESS_FLAG, "<target> - Turn someone into a Zombie")
  1390. register_concmd("zp_human", "cmd_human", ACCESS_FLAG, "<target> - Turn someone back to Human")
  1391. register_concmd("zp_nemesis", "cmd_nemesis", ACCESS_FLAG, "<target> - Turn someone into a Nemesis")
  1392. register_concmd("zp_survivor", "cmd_survivor", ACCESS_FLAG, "<target> - Turn someone into a Survivor")
  1393. register_concmd("zp_respawn", "cmd_respawn", ACCESS_FLAG, "<target> - Respawn someone")
  1394. register_concmd("zp_swarm", "cmd_swarm", ACCESS_FLAG, " - Start Swarm Mode")
  1395. register_concmd("zp_multi", "cmd_multi", ACCESS_FLAG, " - Start Multi Infection")
  1396. register_concmd("zp_plague", "cmd_plague", ACCESS_FLAG, " - Start Plague Mode")
  1397. register_concmd("zp_armagedon", "cmd_armagedon", ACCESS_FLAG, " - Start Mode Armagedon")
  1398.  
  1399.  
  1400. // Message IDs
  1401. g_msgScoreInfo = get_user_msgid("ScoreInfo")
  1402. g_msgTeamInfo = get_user_msgid("TeamInfo")
  1403. g_msgDeathMsg = get_user_msgid("DeathMsg")
  1404. g_msgScoreAttrib = get_user_msgid("ScoreAttrib")
  1405. g_msgSetFOV = get_user_msgid("SetFOV")
  1406. g_msgScreenFade = get_user_msgid("ScreenFade")
  1407. g_msgScreenShake = get_user_msgid("ScreenShake")
  1408. g_msgNVGToggle = get_user_msgid("NVGToggle")
  1409. g_msgFlashlight = get_user_msgid("Flashlight")
  1410. g_msgFlashBat = get_user_msgid("FlashBat")
  1411. g_msgAmmoPickup = get_user_msgid("AmmoPickup")
  1412. g_msgDamage = get_user_msgid("Damage")
  1413. g_msgHideWeapon = get_user_msgid("HideWeapon")
  1414. g_msgCrosshair = get_user_msgid("Crosshair")
  1415. g_msgSayText = get_user_msgid("SayText")
  1416. g_msgCurWeapon = get_user_msgid("CurWeapon")
  1417.  
  1418. // Message hooks
  1419. register_message(g_msgCurWeapon, "message_cur_weapon")
  1420. register_message(get_user_msgid("AmmoX"), "message_ammo_x")
  1421. register_message(get_user_msgid("Money"), "message_money")
  1422. register_message(get_user_msgid("Health"), "message_health")
  1423. register_message(g_msgFlashBat, "message_flashbat")
  1424. register_message(g_msgScreenFade, "message_screenfade")
  1425. register_message(g_msgNVGToggle, "message_nvgtoggle")
  1426. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  1427. register_message(get_user_msgid("ClCorpse"), "message_clcorpse")
  1428. #endif
  1429. register_message(get_user_msgid("WeapPickup"), "message_weappickup")
  1430. register_message(g_msgAmmoPickup, "message_ammopickup")
  1431. register_message(get_user_msgid("Scenario"), "message_scenario")
  1432. register_message(get_user_msgid("HostagePos"), "message_hostagepos")
  1433. register_message(get_user_msgid("TextMsg"), "message_textmsg")
  1434. register_message(get_user_msgid("SendAudio"), "message_sendaudio")
  1435. register_message(get_user_msgid("TeamScore"), "message_teamscore")
  1436. register_message(g_msgTeamInfo, "message_teaminfo")
  1437. register_message(get_user_msgid("ShowMenu"), "oldmenu_handle")
  1438.  
  1439. // CVARS - General Purpose
  1440. cvar_warmup = register_cvar("zp_delay", "10")
  1441. cvar_lighting = register_cvar("zp_lighting", "a")
  1442. cvar_thunder = register_cvar("zp_thunderclap", "90")
  1443. cvar_triggered = register_cvar("zp_triggered_lights", "1")
  1444. cvar_removedoors = register_cvar("zp_remove_doors", "0")
  1445. cvar_blockpushables = register_cvar("zp_blockuse_pushables", "1")
  1446. cvar_blocksuicide = register_cvar("zp_block_suicide", "1")
  1447. cvar_deathmatch = register_cvar("zp_deathmatch", "0")
  1448. cvar_spawndelay = register_cvar("zp_spawn_delay", "5")
  1449. cvar_spawnprotection = register_cvar("zp_spawn_protection", "5")
  1450. cvar_respawnonsuicide = register_cvar("zp_respawn_on_suicide", "1")
  1451. cvar_respawnafterlast = register_cvar("zp_respawn_after_last_human", "1")
  1452. cvar_respawnworldspawnkill = register_cvar("zp_respawn_on_worldspawn_kill", "1")
  1453. cvar_randspawn = register_cvar("zp_random_spawn", "1")
  1454. cvar_removedropped = register_cvar("zp_remove_dropped", "0")
  1455. cvar_removemoney = register_cvar("zp_remove_money", "1")
  1456. cvar_buycustom = register_cvar("zp_buy_custom", "1")
  1457. cvar_adminmodelshuman = register_cvar("zp_admin_models_human", "0")
  1458. cvar_adminmodelszombie = register_cvar("zp_admin_models_zombie", "0")
  1459. cvar_zclasses = register_cvar("zp_zombie_classes", "1")
  1460. cvar_hclasses = register_cvar("zp_human_classes", "1")
  1461. cvar_statssave = register_cvar("zp_stats_save", "1")
  1462. cvar_preventconsecutive = register_cvar("zp_prevent_consecutive_modes", "1")
  1463. cvar_time_acept = register_cvar("party_time_acept","15")
  1464. cvar_max_players = register_cvar("party_max_players","3")
  1465. cvar_allow_bots = register_cvar("party_allow_bots","0")
  1466.  
  1467. // CVARS - Extra Items
  1468. cvar_extraitems = register_cvar("zp_extra_items", "1")
  1469. cvar_extraweapons = register_cvar("zp_extra_weapons", "1")
  1470. cvar_extranvision = register_cvar("zp_extra_nvision", "0")
  1471. cvar_extraantidote = register_cvar("zp_extra_antidote", "1")
  1472. cvar_extramadness = register_cvar("zp_extra_madness", "1")
  1473. cvar_madnessduration = register_cvar("zp_extra_madness_duration", "5.0")
  1474. cvar_extrainfbomb = register_cvar("zp_extra_infbomb", "1")
  1475. cvar_infbomblimit = register_cvar("zp_extra_infbomb_limit", "1")
  1476.  
  1477. // CVARS - Flashlight and Nightvision
  1478. cvar_nvggive = register_cvar("zp_nvg_give", "0")
  1479. cvar_cnvg = register_cvar("zp_nvg_custom", "1")
  1480. cvar_nvgsize = register_cvar("zp_nvg_size", "80")
  1481. cvar_nvgcolor[0] = register_cvar("zp_nvg_color_R", "0")
  1482. cvar_nvgcolor[1] = register_cvar("zp_nvg_color_G", "150")
  1483. cvar_nvgcolor[2] = register_cvar("zp_nvg_color_B", "0")
  1484. cvar_humnvgcolor[0] = register_cvar("zp_nvg_hum_color_R", "0")
  1485. cvar_humnvgcolor[1] = register_cvar("zp_nvg_hum_color_G", "150")
  1486. cvar_humnvgcolor[2] = register_cvar("zp_nvg_hum_color_B", "0")
  1487. cvar_nemnvgcolor[0] = register_cvar("zp_nvg_nem_color_R", "150")
  1488. cvar_nemnvgcolor[1] = register_cvar("zp_nvg_nem_color_G", "0")
  1489. cvar_nemnvgcolor[2] = register_cvar("zp_nvg_nem_color_B", "0")
  1490. cvar_cflash = register_cvar("zp_flash_custom", "0")
  1491. cvar_flashsize = register_cvar("zp_flash_size", "10")
  1492. cvar_flashdrain = register_cvar("zp_flash_drain", "1")
  1493. cvar_flashcharge = register_cvar("zp_flash_charge", "5")
  1494. cvar_flashdist = register_cvar("zp_flash_distance", "1000")
  1495. cvar_flashcolor[0] = register_cvar("zp_flash_color_R", "100")
  1496. cvar_flashcolor[1] = register_cvar("zp_flash_color_G", "100")
  1497. cvar_flashcolor[2] = register_cvar("zp_flash_color_B", "100")
  1498. cvar_flashshowall = register_cvar("zp_flash_show_all", "1")
  1499.  
  1500. // CVARS - Knockback
  1501. cvar_knockback = register_cvar("zp_knockback", "0")
  1502. cvar_knockbackdamage = register_cvar("zp_knockback_damage", "1")
  1503. cvar_knockbackpower = register_cvar("zp_knockback_power", "1")
  1504. cvar_knockbackzvel = register_cvar("zp_knockback_zvel", "0")
  1505. cvar_knockbackducking = register_cvar("zp_knockback_ducking", "0.25")
  1506. cvar_knockbackdist = register_cvar("zp_knockback_distance", "500")
  1507.  
  1508. // CVARS - Leap
  1509. cvar_leapzombies = register_cvar("zp_leap_zombies", "0")
  1510. cvar_leapzombiesforce = register_cvar("zp_leap_zombies_force", "500")
  1511. cvar_leapzombiesheight = register_cvar("zp_leap_zombies_height", "300")
  1512. cvar_leapzombiescooldown = register_cvar("zp_leap_zombies_cooldown", "5.0")
  1513. cvar_leapnemesis = register_cvar("zp_leap_nemesis", "1")
  1514. cvar_leapnemesisforce = register_cvar("zp_leap_nemesis_force", "500")
  1515. cvar_leapnemesisheight = register_cvar("zp_leap_nemesis_height", "300")
  1516. cvar_leapnemesiscooldown = register_cvar("zp_leap_nemesis_cooldown", "0.5")
  1517. cvar_leapsurvivor = register_cvar("zp_leap_survivor", "0")
  1518. cvar_leapsurvivorforce = register_cvar("zp_leap_survivor_force", "500")
  1519. cvar_leapsurvivorheight = register_cvar("zp_leap_survivor_height", "300")
  1520. cvar_leapsurvivorcooldown = register_cvar("zp_leap_survivor_cooldown", "5.0")
  1521.  
  1522. // CVARS - Humans
  1523. cvar_humanlasthp = register_cvar("zp_human_last_extrahp", "0")
  1524. cvar_infammo = register_cvar("zp_human_unlimited_ammo", "1")
  1525. cvar_ammodamage = register_cvar("zp_human_damage_fuck", "450")
  1526. cvar_fragskill = register_cvar("zp_human_frags_for_kill", "1")
  1527.  
  1528. // CVARS - Custom Grenades
  1529. cvar_firegrenades = register_cvar("zp_fire_grenades", "1")
  1530. cvar_fireduration = register_cvar("zp_fire_duration", "10")
  1531. cvar_firedamage = register_cvar("zp_fire_damage", "5")
  1532. cvar_fireslowdown = register_cvar("zp_fire_slowdown", "0.5")
  1533. cvar_frostgrenades = register_cvar("zp_frost_grenades", "1")
  1534. cvar_freezeduration = register_cvar("zp_frost_duration", "4")
  1535. cvar_flaregrenades = register_cvar("zp_flare_grenades","1")
  1536. cvar_flareduration = register_cvar("zp_flare_duration", "0")
  1537. cvar_flaresize = register_cvar("zp_flare_size", "0")
  1538. cvar_flarecolor = register_cvar("zp_flare_color", "0")
  1539.  
  1540. // CVARS - Zombies
  1541. cvar_zombiefirsthp = register_cvar("zp_zombie_first_hp", "2.0")
  1542. cvar_zombiearmor = register_cvar("zp_zombie_armor", "0.75")
  1543. cvar_hitzones = register_cvar("zp_zombie_hitzones", "0")
  1544. cvar_zombiebonushp = register_cvar("zp_zombie_infect_health", "100")
  1545. cvar_zombiefov = register_cvar("zp_zombie_fov", "110")
  1546. cvar_zombiesilent = register_cvar("zp_zombie_silent", "1")
  1547. cvar_zombiepainfree = register_cvar("zp_zombie_painfree", "2")
  1548. cvar_zombiebleeding = register_cvar("zp_zombie_bleeding", "1")
  1549. cvar_ammoinfect = register_cvar("zp_zombie_infect_reward", "250")
  1550. cvar_fragsinfect = register_cvar("zp_zombie_frags_for_infect", "1")
  1551.  
  1552. // CVARS - Special Effects
  1553. cvar_infectionscreenfade = register_cvar("zp_infection_screenfade", "1")
  1554. cvar_infectionscreenshake = register_cvar("zp_infection_screenshake", "1")
  1555. cvar_infectionsparkle = register_cvar("zp_infection_sparkle", "1")
  1556. cvar_infectiontracers = register_cvar("zp_infection_tracers", "1")
  1557. cvar_infectionparticles = register_cvar("zp_infection_particles", "1")
  1558. cvar_hudicons = register_cvar("zp_hud_icons", "1")
  1559.  
  1560. // CVARS - Nemesis
  1561. cvar_nem = register_cvar("zp_nem_enabled", "1")
  1562. cvar_nemchance = register_cvar("zp_nem_chance", "20")
  1563. cvar_nemminplayers = register_cvar("zp_nem_min_players", "0")
  1564. cvar_nemhp = register_cvar("zp_nem_health", "150000")
  1565. cvar_nembasehp = register_cvar("zp_nem_base_health", "0")
  1566. cvar_nemspd = register_cvar("zp_nem_speed", "300")
  1567. cvar_nemgravity = register_cvar("zp_nem_gravity", "0.5")
  1568. cvar_nemdamage = register_cvar("zp_nem_damage", "250")
  1569. cvar_nemglow = register_cvar("zp_nem_glow", "1")
  1570. cvar_nemaura = register_cvar("zp_nem_aura", "0")
  1571. cvar_nempainfree = register_cvar("zp_nem_painfree", "1")
  1572. cvar_nemignorefrags = register_cvar("zp_nem_ignore_frags", "1")
  1573. cvar_nemignoreammo = register_cvar("zp_nem_ignore_rewards", "1")
  1574.  
  1575. // CVARS - Survivor
  1576. cvar_surv = register_cvar("zp_surv_enabled", "1")
  1577. cvar_survchance = register_cvar("zp_surv_chance", "20")
  1578. cvar_survminplayers = register_cvar("zp_surv_min_players", "0")
  1579. cvar_survhp = register_cvar("zp_surv_health", "2500")
  1580. cvar_survbasehp = register_cvar("zp_surv_base_health", "0")
  1581. cvar_survspd = register_cvar("zp_surv_speed", "400")
  1582. cvar_survgravity = register_cvar("zp_surv_gravity", "0.6")
  1583. cvar_survglow = register_cvar("zp_surv_glow", "1")
  1584. cvar_survaura = register_cvar("zp_surv_aura", "0")
  1585. cvar_survpainfree = register_cvar("zp_surv_painfree", "1")
  1586. cvar_survignorefrags = register_cvar("zp_surv_ignore_frags", "1")
  1587. cvar_survignoreammo = register_cvar("zp_surv_ignore_rewards", "1")
  1588. cvar_survweapon = register_cvar("zp_surv_weapon", "weapon_m249")
  1589.  
  1590. // CVARS - Swarm Mode
  1591. cvar_swarm = register_cvar("zp_swarm_enabled", "1")
  1592. cvar_swarmchance = register_cvar("zp_swarm_chance", "20")
  1593. cvar_swarmminplayers = register_cvar("zp_swarm_min_players", "0")
  1594.  
  1595. // CVARS - Armagedon Mode
  1596. cvar_armagedon = register_cvar("zp_armagedon_enabled", "1")
  1597. cvar_armagedonchance = register_cvar("zp_armagedon_chance", "15")
  1598. cvar_armagedonminplayers = register_cvar("zp_armagedon_min_players", "0")
  1599. cvar_armagedonhpsurvi = register_cvar("zp_armagedon_survihp", "1.0")
  1600. cvar_armagedonhpneme = register_cvar("zp_armagedon_nemehp", "1.0")
  1601. cvar_armagedonratio = register_cvar("zp_armagedon_ratio", "0.5")
  1602.  
  1603. // CVARS - Multi Infection
  1604. cvar_multi = register_cvar("zp_multi_enabled", "1")
  1605. cvar_multichance = register_cvar("zp_multi_chance", "20")
  1606. cvar_multiminplayers = register_cvar("zp_multi_min_players", "0")
  1607. cvar_multiratio = register_cvar("zp_multi_ratio", "0.15")
  1608.  
  1609. // CVARS - Plague Mode
  1610. cvar_plague = register_cvar("zp_plague_enabled", "1")
  1611. cvar_plaguechance = register_cvar("zp_plague_chance", "30")
  1612. cvar_plagueminplayers = register_cvar("zp_plague_min_players", "0")
  1613. cvar_plagueratio = register_cvar("zp_plague_ratio", "0.5")
  1614. cvar_plaguenemnum = register_cvar("zp_plague_nem_number", "1")
  1615. cvar_plaguenemhpmulti = register_cvar("zp_plague_nem_hp_multi", "0.5")
  1616. cvar_plaguesurvnum = register_cvar("zp_plague_surv_number", "1")
  1617. cvar_plaguesurvhpmulti = register_cvar("zp_plague_surv_hp_multi", "0.5")
  1618.  
  1619. // CVARS - Others
  1620. cvar_logcommands = register_cvar("zp_logcommands", "1")
  1621. cvar_showactivity = get_cvar_pointer("amx_show_activity")
  1622. cvar_botquota = get_cvar_pointer("bot_quota")
  1623. register_cvar("zp_version", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
  1624. set_cvar_string("zp_version", PLUGIN_VERSION)
  1625.  
  1626. // Custom Forwards
  1627. g_fwRoundStart = CreateMultiForward("zp_round_started", ET_IGNORE, FP_CELL, FP_CELL)
  1628. g_fwRoundEnd = CreateMultiForward("zp_round_ended", ET_IGNORE, FP_CELL)
  1629. g_fwUserInfected_pre = CreateMultiForward("zp_user_infected_pre", ET_IGNORE, FP_CELL, FP_CELL)
  1630. g_fwUserInfected_post = CreateMultiForward("zp_user_infected_post", ET_IGNORE, FP_CELL, FP_CELL)
  1631. g_fwUserHumanized_pre = CreateMultiForward("zp_user_humanized_pre", ET_IGNORE, FP_CELL)
  1632. g_fwUserHumanized_post = CreateMultiForward("zp_user_humanized_post", ET_IGNORE, FP_CELL)
  1633. g_fwExtraItemSelected = CreateMultiForward("zp_extra_item_selected", ET_IGNORE, FP_CELL, FP_CELL)
  1634. g_MsgSayText = get_user_msgid("SayText")
  1635. g_MenuCallback[MASTER] = menu_makecallback("check_master")
  1636. g_MenuCallback[USER] = menu_makecallback("check_user")
  1637.  
  1638. // Collect random spawn points
  1639. load_spawns()
  1640.  
  1641. #if !defined DONT_CHANGE_SKY
  1642. // Set a random skybox
  1643. set_cvar_string("sv_skyname", skynames[random_num(0, sizeof skynames - 1)])
  1644. #endif
  1645.  
  1646. // Disable sky lighting so it doesn't mess up our custom lighting
  1647. set_cvar_num("sv_skycolor_r", 0)
  1648. set_cvar_num("sv_skycolor_g", 0)
  1649. set_cvar_num("sv_skycolor_b", 0)
  1650.  
  1651. // Create the HUD Sync Objects
  1652. g_MsgSync = CreateHudSyncObj()
  1653. g_MsgSync2 = CreateHudSyncObj()
  1654. g_MsgSync3 = CreateHudSyncObj()
  1655. g_MsgSync4 = CreateHudSyncObj()
  1656.  
  1657. // Format mod name
  1658. formatex(g_modname, sizeof g_modname - 1, "SilentGamerz%s", PLUGIN_VERSION)
  1659.  
  1660. // Get Max Players
  1661. g_maxplayers = get_maxplayers()
  1662.  
  1663. // Reserved saving slots starts on maxplayers+1
  1664. db_slot_i = g_maxplayers+1
  1665.  
  1666. // Check if it's a CZ server
  1667. new mymod[6]
  1668. get_modname(mymod, sizeof mymod - 1)
  1669. if (equal(mymod, "czero")) g_czero = 1
  1670.  
  1671. // Lighting task
  1672. set_task(5.0, "lighting_effects", TASK_LIGHTING, _, _, "b")
  1673.  
  1674. // Call Round Start
  1675. set_task(1.0, "event_round_start")
  1676. }
  1677.  
  1678. public plugin_cfg()
  1679. {
  1680.  
  1681. for(new i = 1; i <= g_maxplayers; i++)
  1682. Party_Ids[i] = ArrayCreate(1, 1)
  1683.  
  1684. // Get configs dir
  1685. new cfgdir[32]
  1686. get_configsdir(cfgdir, sizeof cfgdir - 1);
  1687.  
  1688. // Execute config file (zombieplague.cfg)
  1689. server_cmd("exec %s/zombieplague.cfg", cfgdir)
  1690. }
  1691.  
  1692. /*================================================================================
  1693. [Main Events]
  1694. =================================================================================*/
  1695.  
  1696. // Event Round Start
  1697. public event_round_start()
  1698. {
  1699. set_task(5.0,"happyhour")
  1700. // Remove any tasks bound to custom nades (since they're removed at roundstart)
  1701. remove_task(TASK_NADES)
  1702.  
  1703. // Remove doors/lights?
  1704. set_task(0.2, "remove_stuff")
  1705.  
  1706. // New round starting
  1707. g_newround = true
  1708. g_endround = false
  1709. g_survround = false
  1710. g_nemround = false
  1711. g_armagedonround = false
  1712. g_swarmround = false
  1713. g_plagueround = false
  1714.  
  1715. // Reset bought infection bombs counter
  1716. g_infbombcounter = 0
  1717.  
  1718. // Freezetime begins
  1719. g_freezetime = true
  1720.  
  1721. // Show welcome message and T-Virus notice
  1722. remove_task(TASK_WELCOMEMSG)
  1723. set_task(2.0, "welcome_msg", TASK_WELCOMEMSG)
  1724.  
  1725. // Set a new "Make Zombie Task"
  1726. remove_task(TASK_MAKEZOMBIE)
  1727. set_task(2.0+random_float(get_pcvar_float(cvar_warmup), get_pcvar_float(cvar_warmup)+3.0), "make_zombie_task", TASK_MAKEZOMBIE)
  1728. }
  1729.  
  1730. // Log Event Round Start
  1731. public logevent_round_start()
  1732. {
  1733. // Freezetime ends
  1734. g_freezetime = false
  1735. }
  1736.  
  1737. // Log Event Round End
  1738. public logevent_round_end()
  1739. {
  1740.  
  1741. // Ganancia admin
  1742. for(new id=1; id<=get_maxplayers();id++)
  1743. {
  1744. if (is_user_admin(id))
  1745. {
  1746. static flags; flags = get_user_flags(id)
  1747. for (new i = 0; i < sizeof(admganancia); i++)
  1748. {
  1749. if (flags & admganancia[i][Admin])
  1750. {
  1751. g_ganancia[id] = admganancia[i][Ganancia]
  1752. break;
  1753. }
  1754. }
  1755. }
  1756. }
  1757.  
  1758. // Prevent this from getting called twice when restarting (bugfix)
  1759. static Float:lastendtime
  1760. if (get_gametime() - lastendtime < 0.5) return;
  1761. lastendtime = get_gametime()
  1762.  
  1763. // Temporarily save player stats?
  1764. if (get_pcvar_num(cvar_statssave))
  1765. {
  1766. static id, team
  1767. for (id = 1; id <= g_maxplayers; id++)
  1768. {
  1769. // Not connected
  1770. if (!is_user_connected(id))
  1771. continue;
  1772.  
  1773. team = fm_get_user_team(id)
  1774.  
  1775. // Not playing
  1776. if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
  1777. continue;
  1778.  
  1779. save_stats(id)
  1780. }
  1781. }
  1782.  
  1783. // Round ended
  1784. g_endround = true
  1785.  
  1786. // Stop old tasks (if any)
  1787. remove_task(TASK_WELCOMEMSG)
  1788. remove_task(TASK_MAKEZOMBIE)
  1789.  
  1790. #if defined AMBIENCE_SOUNDS
  1791. // Stop ambience sounds
  1792. remove_task(TASK_AMBIENCESOUNDS)
  1793. ambience_sound_stop()
  1794. #endif
  1795.  
  1796. // Balance the teams
  1797. set_task(0.1, "balance_teams")
  1798.  
  1799. // Show HUD notice, play win sound, update team scores...
  1800. if (!fnGetZombies())
  1801. {
  1802. // Human team wins
  1803. set_hudmessage(0, 0, 200, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
  1804. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_HUMAN")
  1805.  
  1806. // Play win sound and increase score
  1807. PlaySound(sound_win_humans[random_num(0, sizeof sound_win_humans -1)])
  1808. g_scorehumans++
  1809.  
  1810. // Round end forward
  1811. ExecuteForward(g_fwRoundEnd, g_fwDummyResult, 2);
  1812. }
  1813. else if (!fnGetHumans())
  1814. {
  1815. // Zombie team wins
  1816. set_hudmessage(200, 0, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
  1817. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_ZOMBIE")
  1818.  
  1819. // Play win sound and increase score
  1820. PlaySound(sound_win_zombies[random_num(0, sizeof sound_win_zombies -1)])
  1821. g_scorezombies++
  1822.  
  1823. // Round end forward
  1824. ExecuteForward(g_fwRoundEnd, g_fwDummyResult, 1);
  1825. }
  1826. else
  1827. {
  1828. // No one wins
  1829. set_hudmessage(0, 200, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
  1830. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_NO_ONE")
  1831. PlaySound(sound_win_no_one[random_num(0, sizeof sound_win_no_one -1)])
  1832.  
  1833. // Round end forward
  1834. ExecuteForward(g_fwRoundEnd, g_fwDummyResult, 0);
  1835. }
  1836. }
  1837.  
  1838. #if defined AMBIENCE_SOUNDS
  1839. // Event Map Ended
  1840. public event_intermission()
  1841. {
  1842. // Remove ambience sounds task
  1843. remove_task(TASK_AMBIENCESOUNDS)
  1844. }
  1845. #endif
  1846.  
  1847. // Current Weapon Event
  1848. public event_cur_weapon(id)
  1849. {
  1850. // Not alive
  1851. if (!is_user_alive(id))
  1852. return;
  1853.  
  1854. // Zombie not holding an allowed weapon for some reason
  1855. if (g_zombie[id] && !((1<<read_data(2)) & ZOMBIE_ALLOWED_WEAPONS_BITSUM))
  1856. {
  1857. // Switch to knife
  1858. engclient_cmd(id, "weapon_knife")
  1859.  
  1860. // Update the HUD and let other plugins know
  1861. emessage_begin(MSG_ONE, g_msgCurWeapon, _, id)
  1862. ewrite_byte(1) // active
  1863. ewrite_byte(CSW_KNIFE) // weapon
  1864. ewrite_byte(MAXCLIP[CSW_KNIFE]) // clip
  1865. emessage_end()
  1866. }
  1867. }
  1868.  
  1869. // Weapon Animation Event
  1870. public event_weapon_anim()
  1871. {
  1872. // Because of a weird bug within the AMXX event system, we need to
  1873. // hook this message to prevent some weird behavior when calling
  1874. // engclient_cmd(id, "weapon_knife") in the CurWeapon Event forward.
  1875. // http://forums.alliedmods.net/showthread.php?t=85161&page=2
  1876. }
  1877.  
  1878. /*================================================================================
  1879. [Main Forwards]
  1880. =================================================================================*/
  1881.  
  1882. // Client joins the game
  1883. public client_putinserver(id)
  1884. {
  1885.  
  1886. get_user_name(id, g_names[id], 31)
  1887.  
  1888. g_ganancia[id] = 1
  1889.  
  1890. if (is_user_admin(id))
  1891. {
  1892. static flags; flags = get_user_flags(id)
  1893. for (new i = 0; i < sizeof(admganancia); i++)
  1894. {
  1895. if (flags & admganancia[i][Admin])
  1896. {
  1897. g_ganancia[id] = admganancia[i][Ganancia]
  1898. break;
  1899. }
  1900. }
  1901. }
  1902. g_level[id] = 0
  1903. g_reset[id] = 0
  1904. g_grandreset[id] = 0
  1905. Registrado[id] = 0
  1906. BadPassword[id] = 0
  1907. g_estado[id] = OFFLINE
  1908. get_user_name(id, g_playername[id], charsmax(g_playername[]))
  1909. // Plugin disabled?
  1910. if (!g_pluginenabled) return;
  1911.  
  1912. // Initialize player vars
  1913. reset_vars(id, 1)
  1914.  
  1915. // Load player stats?
  1916. if (get_pcvar_num(cvar_statssave)) load_stats(id)
  1917.  
  1918. // Set some tasks for humans only
  1919. if (!is_user_bot(id))
  1920. {
  1921. // Set the custom HUD display task
  1922. set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b")
  1923.  
  1924. // Disable minmodels for clients to see zombies properly
  1925. set_task(5.0, "disable_minmodels", id)
  1926. }
  1927. else
  1928. {
  1929. // CZ bots seem to use a different "classtype" for player entities
  1930. // (or something like that) which needs to be hooked separately
  1931. if (!g_hamczbots && cvar_botquota)
  1932. {
  1933. // Set a task to let the private data initialize
  1934. set_task(0.1, "register_ham_czbots", id)
  1935. }
  1936. }
  1937. }
  1938.  
  1939. // Client disconnect
  1940. public client_disconnect(id)
  1941. {
  1942.  
  1943. if(g_PartyData[id][In_Party])
  1944. g_PartyData[id][Position] ? g_PartyData[id][Amount_In_Party] == 2 ? destoy_party(id) : remove_party_user(id) : destoy_party(id)
  1945.  
  1946. g_PartyData[id][UserName][0] = 0
  1947. g_PartyData[id][Block_Party] = false
  1948. del_sombrero(id)
  1949.  
  1950. client_cmd(id, "cl_backspeed 400")
  1951. client_cmd(id, "cl_forwardspeed 400")
  1952. client_cmd(id, "cl_sidespeed 400")
  1953.  
  1954. g_names[id][0] = 0
  1955. // Plugin disabled?
  1956. if (!g_pluginenabled) return;
  1957.  
  1958. // Check that we still have both humans and zombies to keep the round going
  1959. if (is_user_alive(id)) check_round(id)
  1960.  
  1961. // Temporarily save player stats?
  1962. if (get_pcvar_num(cvar_statssave)) save_stats(id)
  1963.  
  1964. // Remove previous tasks
  1965. remove_task(id+TASK_TEAM)
  1966. remove_task(id+TASK_MODEL)
  1967. remove_task(id+TASK_FLASH)
  1968. remove_task(id+TASK_CHARGE)
  1969. remove_task(id+TASK_SPAWN)
  1970. remove_task(id+TASK_BLOOD)
  1971. remove_task(id+TASK_NVISION)
  1972. remove_task(id+TASK_SHOWHUD)
  1973. remove_task(id+TASK_COMBO)
  1974.  
  1975. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  1976. // Remove custom model entities
  1977. fm_remove_model_ents(id)
  1978. #endif
  1979.  
  1980. // Last Zombie Check
  1981. set_task(0.1, "fnCheckLastZombie")
  1982.  
  1983. if (!is_user_bot(id))
  1984. Save(id)
  1985. }
  1986.  
  1987.  
  1988. // Entity Spawn Forward
  1989. public fw_Spawn(entity)
  1990. {
  1991. // Invalid entity
  1992. if (!pev_valid(entity)) return FMRES_IGNORED;
  1993.  
  1994. // Get classname
  1995. new classname[32]
  1996. pev(entity, pev_classname, classname, sizeof classname - 1)
  1997.  
  1998. // Check whether it needs to be removed
  1999. for (new i = 0; i < sizeof g_objective_ents; i++)
  2000. {
  2001. if (equal(classname, g_objective_ents[i]))
  2002. {
  2003. engfunc(EngFunc_RemoveEntity, entity)
  2004. return FMRES_SUPERCEDE;
  2005. }
  2006. }
  2007.  
  2008. return FMRES_IGNORED;
  2009. }
  2010.  
  2011. // Ham Player Spawn Post Forward
  2012. public fw_PlayerSpawn_Post(id)
  2013. {
  2014. // Not alive or didn't join a team yet
  2015. if (!is_user_alive(id) || !fm_get_user_team(id))
  2016. return;
  2017. set_task(0.5, "bugvelocidad", id); // debug para la velocidad humana y zm
  2018. g_akdestruction[id] = false
  2019. g_ultimate[id] = false
  2020. g_atomic[id] = false
  2021. g_masive[id] = false
  2022. g_navi[id] = false
  2023. g_power[id] = false
  2024. g_stfu[id] = false
  2025. g_rlp[id] = false
  2026. g_m4[id] = false
  2027. g_barret[id] = false
  2028. g_devil[id] = false
  2029. g_rampage[id] = false
  2030. g_supermide[id] = false
  2031. g_farger[id] = false
  2032. g_storm[id] = false
  2033. g_adge[id] = false
  2034. g_ultra[id] = false
  2035. g_nule[id] = false
  2036. g_super[id] = false
  2037. g_ultrak[id] = false
  2038. g_raampage[id] = false
  2039. g_zpr350[id] = false
  2040. g_rpg17[id] = false
  2041. g_aru[id] = false
  2042. g_xh500w[id] = false
  2043. g_dvlsxx[id] = false
  2044. g_thunderstorm[id] = false
  2045. g_101000xx[id] = false
  2046. g_101000cannon[id] = false
  2047. g_tmp2xx[id] = false
  2048. g_coldtorment[id] = false
  2049. g_shredder[id] = false
  2050. strip_user_weapons(id)
  2051. set_sombrero(id)
  2052.  
  2053.  
  2054. // Remove previous tasks
  2055. remove_task(id+TASK_SPAWN)
  2056. remove_task(id+TASK_TEAM)
  2057. remove_task(id+TASK_MODEL)
  2058. remove_task(id+TASK_BLOOD)
  2059.  
  2060. // Spawn randomly?
  2061. if (get_pcvar_num(cvar_randspawn)) do_random_spawn(id)
  2062.  
  2063. // Hide money?
  2064. if (get_pcvar_num(cvar_removemoney))
  2065. set_task(0.2, "task_hide_money", id+TASK_SPAWN)
  2066.  
  2067. // Respawn player if he dies because of a worldspawn kill?
  2068. if (get_pcvar_num(cvar_respawnworldspawnkill))
  2069. set_task(2.0, "respawn_player", id+TASK_SPAWN)
  2070.  
  2071. // Spawn as zombie?
  2072. if (g_respawn_as_zombie[id] && !g_newround)
  2073. {
  2074. reset_vars(id, 0) // reset player vars
  2075. zombieme(id, 0, 0, 0) // make him zombie right away
  2076. return;
  2077. }
  2078.  
  2079. // Reset player vars
  2080. reset_vars(id, 0)
  2081.  
  2082. // Set selected human class
  2083. g_humanclass[id] = g_humanclassnext[id]
  2084. if (g_humanclass[id] == HCLASS_NONE) g_humanclass[id] = 0
  2085.  
  2086. // Set health and gravity
  2087. fm_set_user_health(id, g_hclass_hp[g_humanclass[id]] + H_SALUD(g_skill_points[id][0][1]))
  2088. set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]] - H_GRAVITY(g_skill_points[id][0][3]))
  2089. set_user_armor(id, g_hclass_ar[g_humanclass[id]] + H_ARMOR(g_skill_points[id][0][4]))
  2090.  
  2091. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  2092.  
  2093. // Set the right model
  2094. if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
  2095. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[random_num(0, sizeof model_admin -1)])
  2096. else
  2097. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
  2098.  
  2099. // Set model on player model entity
  2100. fm_set_playermodel_ent(id)
  2101.  
  2102. // Remove glow on player model entity
  2103. fm_set_rendering(g_ent_playermodel[id])
  2104.  
  2105. #else
  2106.  
  2107. // Set the right model, after checking that we don't already have it
  2108. static currentmodel[32], already_has_model, i, iRand
  2109. already_has_model = false
  2110.  
  2111. // Get current model and compare it with current one
  2112. fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
  2113.  
  2114. if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
  2115. {
  2116. for (i = 0; i < sizeof model_admin; i++)
  2117. if (equal(model_admin[i], currentmodel)) already_has_model = true
  2118.  
  2119. if (!already_has_model)
  2120. {
  2121. iRand = random_num(0, sizeof model_admin -1)
  2122. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[iRand])
  2123. #if defined SET_MODELINDEX_OFFSET
  2124. fm_set_user_model_index(id, g_modelindex_admin[iRand])
  2125. #endif
  2126. }
  2127. }
  2128. else
  2129. {
  2130. if (equal(g_hclass_model[g_humanclass[id]], currentmodel)) already_has_model = true;
  2131.  
  2132. if (!already_has_model)
  2133. {
  2134. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
  2135. #if defined SET_MODELINDEX_OFFSET
  2136. fm_set_user_model_index(id, g_hclass_modelindex[g_humanclass[id]])
  2137. #endif
  2138. }
  2139. }
  2140.  
  2141. // Need to change the model?
  2142. if (!already_has_model)
  2143. {
  2144. // An additional delay is offset at round start
  2145. // since SVC_BAD is more likely to be triggered there
  2146. if (g_newround)
  2147. set_task(5.0*MODELCHANGE_DELAY, "fm_user_model_update", id+TASK_MODEL)
  2148. else
  2149. fm_user_model_update(id+TASK_MODEL)
  2150. }
  2151.  
  2152. // Remove glow
  2153. fm_set_rendering(id)
  2154.  
  2155. #endif
  2156.  
  2157. // Bots stuff
  2158. if (is_user_bot(id))
  2159. {
  2160. // Turn off NVG for bots
  2161. fm_set_bot_nvg(id, 0)
  2162.  
  2163. // Automatically buy extra items/weapons after first zombie is chosen
  2164. if (get_pcvar_num(cvar_extraitems))
  2165. {
  2166. if (g_newround) set_task(10.0+get_pcvar_float(cvar_warmup), "bot_buy_extras", id+TASK_SPAWN)
  2167. else set_task(10.0, "bot_buy_extras", id+TASK_SPAWN)
  2168. }
  2169. }
  2170.  
  2171. // Show custom buy menu?
  2172. show_menu_eleccion(id)
  2173.  
  2174. // Get spawn protection time
  2175. static Float:sptime
  2176. sptime = get_pcvar_float(cvar_spawnprotection)
  2177.  
  2178. // Enable spawn protection for humans spawning mid-round
  2179. if (!g_newround && sptime > 0.0)
  2180. {
  2181. // Dont take any damage
  2182. g_nodamage[id] = true
  2183.  
  2184. // Make temporarily invisible
  2185. set_pev(id, pev_effects, pev(id, pev_effects) | EF_NODRAW)
  2186.  
  2187. // Set task to remove it
  2188. set_task(sptime, "remove_spawn_protection", id+TASK_SPAWN)
  2189. }
  2190.  
  2191. // Last Zombie Check
  2192. set_task(0.1, "fnCheckLastZombie")
  2193. }
  2194.  
  2195. // Ham Player Killed Forward
  2196. public fw_PlayerKilled(victim, attacker, shouldgib)
  2197. {
  2198. // Last Zombie Check
  2199. set_task(0.1, "fnCheckLastZombie")
  2200.  
  2201. // Enable dead players nightvision
  2202. set_task(0.2, "spec_nvision", victim)
  2203.  
  2204. static name[33]; get_user_name(attacker, name, charsmax(name));
  2205.  
  2206. if(!g_zombie[attacker] && g_nemesis[victim])
  2207. {
  2208. if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
  2209. {
  2210. g_points[attacker][0]+= 12
  2211. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 12^x01 human points for being ^x04 VIP x12^x01 and killing a^x03 Nemesis", name)
  2212. }
  2213. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
  2214. {
  2215. g_points[attacker][0]+= 24
  2216. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 24^x01 human points for being ^x04 VIP x12^x01 and killing a^x03 Nemesis^x01 in ^x04 HAPPY HOUR", name)
  2217. }
  2218. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
  2219. {
  2220. g_points[attacker][0]+= 9
  2221. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 9^x01 human points for being ^x04 VIP x9^x01 and killing a^x03 Nemesis", name)
  2222. }
  2223. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
  2224. {
  2225. g_points[attacker][0]+= 18
  2226. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 18^x01 human points for being ^x04 VIP x9^x01 and killing a^x03 Nemesis^x01 in ^x04 HAPPY HOUR", name)
  2227. }
  2228. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
  2229. {
  2230. g_points[attacker][0]+= 6
  2231. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 6^x01 human points for being ^x04 VIP x6^x01 and killing a^x03 Nemesis", name)
  2232. }
  2233. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
  2234. {
  2235. g_points[attacker][0]+= 12
  2236. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 12^x01 points for being ^x04 VIP x6^x01 and killing a^x03 Nemesis^x01 in ^x04 HAPPY HOUR", name)
  2237. }
  2238. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
  2239. {
  2240. g_points[attacker][0]+= 3
  2241. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 3^x01 points for being ^x04 VIP x3^x01 and killing a^x03 Nemesis", name)
  2242. }
  2243. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
  2244. {
  2245. g_points[attacker][0]+= 6
  2246. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 6^x01 points for being ^x04 VIP x3^x01 and killing a^x03 Nemesis^x01 in ^x04 HAPPY HOUR", name)
  2247. }
  2248. else if (g_happytime)
  2249. {
  2250. g_points[attacker][0]+= 4
  2251. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 4^x01 points for killing a^x03 Nemesis^x01 in ^x04 HAPPY HOUR", name)
  2252. }
  2253. else
  2254. {
  2255. g_points[attacker][0]+= 2
  2256. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 2^x01 points for killing a^x03 Nemesis", name)
  2257. }
  2258. }
  2259.  
  2260. if(g_zombie[attacker] && g_survivor[victim])
  2261. {
  2262. if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
  2263. {
  2264. g_points[attacker][1] += 12
  2265. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 12^x01 zombie points for being ^x04 VIP x12^x01 and killing a^x03 Survivor", name)
  2266. }
  2267. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
  2268. {
  2269. g_points[attacker][1]+= 24
  2270. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 24^x01 zombie points for being ^x04 VIP x12^x01 and killing a^x03 Survivor^x01 in ^x04 HAPPY HOUR", name)
  2271. }
  2272. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
  2273. {
  2274. g_points[attacker][1]+= 9
  2275. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 9^x01 points for being ^x04 VIP x9^x01 and killing a^x03 Survivor", name)
  2276. }
  2277. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
  2278. {
  2279. g_points[attacker][1]+= 18
  2280. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 18^x01 points for being ^x04 VIP x9^x01 and killing a^x03 Survivor^x01 in ^x04 HAPPY HOUR", name)
  2281. }
  2282. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
  2283. {
  2284. g_points[attacker][1]+= 6
  2285. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 6^x01 zombie points for being ^x04 VIP x6^x01 and killing a^x03 Survivor", name)
  2286. }
  2287. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
  2288. {
  2289. g_points[attacker][1]+= 12
  2290. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 12^x01 zombie points for being ^x04 VIP x6^x01 and killing a^x03 Survivor^x01 in ^x04 HAPPY HOUR", name)
  2291. }
  2292. else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
  2293. {
  2294. g_points[attacker][1]+= 3
  2295. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 3^x01 zombie points for being ^x04 VIP x3^x01 and killing a^x03 Survivor", name)
  2296. }
  2297. else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
  2298. {
  2299. g_points[attacker][1]+= 6
  2300. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 6^x01 zombie points for being ^x04 VIP x3^x01 and killing a^x03 Survivor^x01 in ^x04 HAPPY HOUR", name)
  2301. }
  2302. else if (g_happytime)
  2303. {
  2304. g_points[attacker][1]+= 4
  2305. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 4^x01 zombie points for killing a^x03 Survivor^x01 in ^x04 HAPPY HOUR", name)
  2306. }
  2307. else
  2308. {
  2309. g_points[attacker][1]+= 2
  2310. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 2^x01 point for killing a^x03 Survivor", name)
  2311. }
  2312. }
  2313.  
  2314. // Get nightvision give setting
  2315. static nvggive
  2316. nvggive = get_pcvar_num(cvar_nvggive)
  2317.  
  2318. // Disable nightvision when killed (bugfix)
  2319. if (nvggive == 0 && g_nvision[victim])
  2320. {
  2321. if (g_nvisionenabled[victim] && !get_pcvar_num(cvar_cnvg)) set_user_gnvision(victim, 0)
  2322. g_nvision[victim] = false
  2323. g_nvisionenabled[victim] = false
  2324. }
  2325.  
  2326. // Turn off nightvision when killed (bugfix)
  2327. if (nvggive == 2 && g_nvision[victim] && g_nvisionenabled[victim])
  2328. {
  2329. if (!get_pcvar_num(cvar_cnvg)) set_user_gnvision(victim, 0)
  2330. g_nvisionenabled[victim] = false
  2331. }
  2332.  
  2333. // Stop bleeding/burning when killed
  2334. if (g_zombie[victim])
  2335. remove_task(victim+TASK_BLOOD)
  2336.  
  2337. // Nemesis explodes!
  2338. if (g_nemesis[victim])
  2339. SetHamParamInteger(3, 2)
  2340.  
  2341. // Get deathmatch mode status and whether the player killed himself
  2342. static deathmatch, selfkill
  2343. deathmatch = get_pcvar_num(cvar_deathmatch)
  2344. selfkill = (victim == attacker || !is_user_connected(attacker)) ? true : false
  2345.  
  2346. // Respawn if deathmatch is enabled
  2347. if (deathmatch)
  2348. {
  2349. // Respawn on suicide?
  2350. if (selfkill && !get_pcvar_num(cvar_respawnonsuicide))
  2351. return;
  2352.  
  2353. // Respawn if only the last human is left?
  2354. if (!get_pcvar_num(cvar_respawnafterlast) && fnGetHumans() == 1)
  2355. return;
  2356.  
  2357. // Respawn as zombie?
  2358. if (deathmatch == 2 || (deathmatch == 3 && random_num(0, 1)) || (deathmatch == 4 && fnGetZombies() < fnGetAlive()/2))
  2359. g_respawn_as_zombie[victim] = true
  2360.  
  2361. // Set the respawn task
  2362. set_task(get_pcvar_float(cvar_spawndelay), "respawn_player", victim+TASK_SPAWN)
  2363. }
  2364.  
  2365. // Killed by a non-player entity or self killed
  2366. if (selfkill) return;
  2367.  
  2368. // Ignore Nemesis/Survivor Frags?
  2369. if ((g_nemesis[attacker] && get_pcvar_num(cvar_nemignorefrags)) || (g_survivor[attacker] && get_pcvar_num(cvar_survignorefrags)))
  2370. RemoveFrags(attacker, victim)
  2371.  
  2372. // Zombie/nemesis killed human, reward ammo packs
  2373. if (g_zombie[attacker] && (!g_nemesis[attacker] || !get_pcvar_num(cvar_nemignoreammo)))
  2374. update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0)
  2375.  
  2376. // Get frag rewards for humans and zombies
  2377. static fragskill, fragsinfect
  2378. fragskill = get_pcvar_num(cvar_fragskill)
  2379. fragsinfect = get_pcvar_num(cvar_fragsinfect)
  2380.  
  2381. // Human killed zombie, add up the extra frags for kill
  2382. if (!g_zombie[attacker] && fragskill > 1)
  2383. UpdateFrags(attacker, victim, fragskill-1, 0, 0)
  2384.  
  2385. // Zombie killed human, add up the extra frags for kill
  2386. if (g_zombie[attacker] && fragsinfect > 1)
  2387. UpdateFrags(attacker, victim, fragsinfect-1, 0, 0)
  2388. }
  2389.  
  2390. // Ham Take Damage Forward (inflictor = weapon)
  2391. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
  2392. {
  2393. // Non-player damage or self damage
  2394. if (victim == attacker || !is_user_connected(attacker))
  2395. return HAM_IGNORED;
  2396.  
  2397. // New round starting or round ended
  2398. if (g_newround || g_endround)
  2399. return HAM_SUPERCEDE;
  2400.  
  2401. // Victim shouldn't take damage or victim is frozen
  2402. if( g_nodamage[ victim ] || g_frozen[ attacker ] )
  2403. return HAM_SUPERCEDE;
  2404.  
  2405. // Prevent friendly fire
  2406. if (g_zombie[attacker] == g_zombie[victim])
  2407. return HAM_SUPERCEDE;
  2408.  
  2409. // Attacker is human...
  2410. if (!g_zombie[attacker])
  2411. {
  2412. if (g_akdestruction[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2413. {
  2414. SetHamParamFloat(4, damage *= 3.0)
  2415. }
  2416. else if (g_ultimate[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2417. {
  2418. SetHamParamFloat(4, damage *= 3.5)
  2419. }
  2420. else if (g_atomic[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2421. {
  2422. SetHamParamFloat(4, damage *= 4.0)
  2423. }
  2424. else if (g_masive[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2425. {
  2426. SetHamParamFloat(4, damage *= 5.0)
  2427. }
  2428. else if (g_navi[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2429. {
  2430. SetHamParamFloat(4, damage *= 5.5)
  2431. }
  2432. else if (g_power[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2433. {
  2434. SetHamParamFloat(4,damage *= 7.0)
  2435. }
  2436. else if (g_stfu[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2437. {
  2438. SetHamParamFloat(4, damage *= 7.5)
  2439. }
  2440. else if (g_rlp[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2441. {
  2442. SetHamParamFloat(4, damage *= 8.0)
  2443. }
  2444. else if (g_m4[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2445. {
  2446. SetHamParamFloat(4, damage *= 8.5)
  2447. }
  2448. else if (g_barret[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2449. {
  2450. SetHamParamFloat(4, damage *= 9.0)
  2451. }
  2452. else if (g_devil[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2453. {
  2454. SetHamParamFloat(4, damage *= 9.5)
  2455. }
  2456. else if (g_rampage[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2457. {
  2458. SetHamParamFloat(4, damage *= 10.0)
  2459. }
  2460. else if (g_supermide[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2461. {
  2462. SetHamParamFloat(4, damage *= 10.5)
  2463. }
  2464. else if (g_farger[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2465. {
  2466. SetHamParamFloat(4, damage *= 11.0)
  2467. }
  2468. else if (g_storm[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2469. {
  2470. SetHamParamFloat(4, damage *= 12.0)
  2471. }
  2472. else if (g_adge[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2473. {
  2474. SetHamParamFloat(4, damage *= 13.0)
  2475. }
  2476. else if (g_ultra[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2477. {
  2478. SetHamParamFloat(4, damage *= 14.0)
  2479. }
  2480. else if (g_nule[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2481. {
  2482. SetHamParamFloat(4, damage *= 15.0)
  2483. }
  2484. else if (g_super[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2485. {
  2486. SetHamParamFloat(4, damage *= 17.0)
  2487. }
  2488. else if (g_ultrak[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2489. {
  2490. SetHamParamFloat(4, damage *= 20.0)
  2491. }
  2492. else if (g_raampage[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2493. {
  2494. SetHamParamFloat(4, damage *= 25.0)
  2495. }
  2496. else if (g_zpr350[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2497. {
  2498. SetHamParamFloat(4, damage *= 29.0)
  2499. }
  2500. else if (g_rpg17[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2501. {
  2502. SetHamParamFloat(4, damage *= 35.0)
  2503. }
  2504. else if (g_aru[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2505. {
  2506. SetHamParamFloat(4, damage *= 40.0)
  2507. }
  2508. else if (g_xh500w[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2509. {
  2510. SetHamParamFloat(4, damage *= 45.0)
  2511. }
  2512. else if (g_dvlsxx[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2513. {
  2514. SetHamParamFloat(4, damage *= 50.0)
  2515. }
  2516. else if (g_thunderstorm[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2517. {
  2518. SetHamParamFloat(4, damage *= 55.0)
  2519. }
  2520. else if (g_101000xx[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2521. {
  2522. SetHamParamFloat(4, damage *= 60.0)
  2523. }
  2524. else if (g_101000cannon[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2525. {
  2526. SetHamParamFloat(4, damage *= 65.0)
  2527. }
  2528. else if (g_tmp2xx[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2529. {
  2530. SetHamParamFloat(4, damage *= 70.0)
  2531. }
  2532. else if (g_coldtorment[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2533. {
  2534. SetHamParamFloat(4, damage *= 75.0)
  2535. }
  2536. else if (g_shredder[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
  2537. {
  2538. SetHamParamFloat(4, damage *= 85.0)
  2539. }
  2540. // Armor multiplier for the final damage on normal zombies
  2541. if (!g_nemesis[victim])
  2542. {
  2543. damage *= H_DAMAGE(g_skill_points[attacker][0][0])
  2544. SetHamParamFloat(4, damage)
  2545. }
  2546. if (g_survivor[attacker])
  2547. {
  2548. SetHamParamFloat(4, damage *= 80)
  2549. }
  2550.  
  2551.  
  2552. // Reward ammo packs
  2553. if (!g_survivor[attacker] || !get_pcvar_num(cvar_survignoreammo))
  2554. {
  2555. // Store damage dealt
  2556. g_damagedealt[attacker] += floatround(damage)
  2557. g_damage[attacker] += floatround(damage)
  2558. g_total[attacker] += floatround(damage)
  2559. remove_task(attacker+TASK_COMBO)
  2560.  
  2561. // Get damage required to get an ammo pack
  2562. static ammodamage
  2563. ammodamage = get_pcvar_num(cvar_ammodamage)
  2564.  
  2565. // Reward ammo packs for every [ammo damage] dealt
  2566. while (g_damagedealt[attacker] >= (ammodamage / (g_happytime + 1)) )
  2567. {
  2568. if(g_PartyData[attacker][In_Party])
  2569. {
  2570. new Players[32], user
  2571. get_party_index(attacker, Players)
  2572.  
  2573. for(new i; i < g_PartyData[attacker][Amount_In_Party]; i++) {
  2574. user = Players[i]
  2575. if (!g_zombie[user])
  2576. {
  2577. update_ap(user, g_ganancia[attacker]/g_PartyData[attacker][Amount_In_Party] +1, 0)
  2578. }
  2579. }
  2580. g_damagedealt[attacker] -= ammodamage
  2581. }
  2582. else
  2583. {
  2584. update_ap(attacker, g_ganancia[attacker], 0)
  2585. g_damagedealt[attacker] -= ammodamage
  2586. }
  2587. }
  2588. while (g_damage[attacker] >= 450)
  2589. {
  2590. g_ammopacks[attacker]++
  2591. g_combo[attacker] ++
  2592. g_damage[attacker] -= 450
  2593. }
  2594.  
  2595. for(new i = 0 ; i < sizeof Combo ; i++)
  2596. {
  2597. if (g_combo[attacker] >= Combo[i][Combos])
  2598. {
  2599. set_hudmessage(Combo[i][Rojo], Combo[i][Verde], Combo[i][Azul], -1.0, 0.27, 1, 4.5, 4.5, 0.01, 0.01)
  2600. ShowSyncHudMsg(attacker, g_MsgSync4, "[Combo of: %d AmmoPacks]^n[Combo: %s]^n[Total Damage: %d]", g_combo[attacker], Combo[i][Msj], g_total[attacker])
  2601.  
  2602. }
  2603. }
  2604.  
  2605. set_task(4.0, "Combo_Terminado", attacker+TASK_COMBO)
  2606. }
  2607.  
  2608. return HAM_IGNORED;
  2609. }
  2610.  
  2611.  
  2612. // Attacker is zombie...
  2613. if (g_zombie[attacker])
  2614. {
  2615. SetHamParamFloat(4, damage + Z_DAMAGE(g_skill_points[attacker][1][0]))
  2616. }
  2617. // Prevent infection by HE grenade (bugfix)
  2618. if (damage_type & DMG_HEGRENADE)
  2619. return HAM_SUPERCEDE;
  2620.  
  2621. // Nemesis?
  2622. if (g_nemesis[attacker])
  2623. {
  2624. // Set nemesis damage
  2625. SetHamParamFloat(4, get_pcvar_float(cvar_nemdamage))
  2626. return HAM_IGNORED;
  2627. }
  2628.  
  2629. // Last human or swarm round or plague round
  2630. if (g_swarmround || g_plagueround || g_armagedonround || fnGetHumans() == 1)
  2631. return HAM_IGNORED; // human is killed
  2632.  
  2633. // Does human armor need to be reduced before infecting?
  2634. if (g_hclass_ar[g_humanclass[attacker]])
  2635. {
  2636. // Get victim armor
  2637. static Float:armor
  2638. pev(victim, pev_armorvalue, armor)
  2639.  
  2640. // Block the attack if he has some
  2641. if (armor > 0.0)
  2642. {
  2643. engfunc(EngFunc_EmitSound, victim, CHAN_BODY, sound_armorhit, 1.0, ATTN_NORM, 0, PITCH_NORM)
  2644. set_pev(victim, pev_armorvalue, floatmax(0.0, armor - damage-Z_DAMAGE(g_skill_points[attacker][1][0])))
  2645. return HAM_SUPERCEDE;
  2646. }
  2647. }
  2648.  
  2649. // Infection allowed
  2650. SendDeathMsg(attacker, victim) // send death notice
  2651. FixDeadAttrib(victim) // fix the "dead" attrib on scoreboard
  2652. UpdateFrags(attacker, victim, get_pcvar_num(cvar_fragsinfect), 1, 1) // add corresponding frags and deaths
  2653.  
  2654. zombieme(victim, attacker, 0, 0) // turn into zombie
  2655. update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0) // ammo packs given to zombie for infection
  2656. fm_set_user_health(attacker, pev(attacker, pev_health)+get_pcvar_num(cvar_zombiebonushp)) // attacker gets bonus HP for the infection
  2657.  
  2658. return HAM_SUPERCEDE;
  2659. }
  2660.  
  2661. // Ham Trace Attack Forward
  2662. public fw_TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type)
  2663. {
  2664. // Non-player damage or self damage
  2665. if (victim == attacker || !is_user_connected(attacker))
  2666. return HAM_IGNORED;
  2667.  
  2668. // New round starting or round ended
  2669. if (g_newround || g_endround)
  2670. return HAM_SUPERCEDE;
  2671.  
  2672. // Victim shouldn't take damage or victim is frozen
  2673. if( g_nodamage[ victim ] || g_frozen[ attacker ] )
  2674. return HAM_SUPERCEDE;
  2675.  
  2676. // Prevent friendly fire
  2677. if (g_zombie[attacker] == g_zombie[victim])
  2678. return HAM_SUPERCEDE;
  2679.  
  2680. // Victim isn't a normal zombie
  2681. if (!g_zombie[victim] || g_nemesis[victim])
  2682. return HAM_IGNORED;
  2683.  
  2684. // Get custom hitzones setting
  2685. static hitzones
  2686. hitzones = get_pcvar_num(cvar_hitzones)
  2687.  
  2688. // Check if we hit an allowed one
  2689. if (hitzones && !(hitzones & (1<<get_tr2(tracehandle, TR_iHitgroup))))
  2690. return HAM_SUPERCEDE;
  2691.  
  2692. // Knockback disabled or not bullet damage
  2693. if (!(damage_type & DMG_BULLET) || !get_pcvar_num(cvar_knockback))
  2694. return HAM_IGNORED;
  2695.  
  2696. // Get victim flags and knockback while ducking setting
  2697. static victimflags, Float:knockduck
  2698. victimflags = pev(victim, pev_flags)
  2699. knockduck = get_pcvar_float(cvar_knockbackducking)
  2700.  
  2701. // Zombie is ducking on ground
  2702. if (knockduck == 0.0 && (victimflags & FL_DUCKING) && (victimflags & FL_ONGROUND))
  2703. return HAM_IGNORED;
  2704.  
  2705. // Get distance between players
  2706. static Float:origin1F[3], Float:origin2F[3]
  2707. pev(victim, pev_origin, origin1F)
  2708. pev(attacker, pev_origin, origin2F)
  2709.  
  2710. // Max distance exceeded
  2711. if (get_distance_f(origin1F, origin2F) > get_pcvar_float(cvar_knockbackdist))
  2712. return HAM_IGNORED;
  2713.  
  2714. // Get victim's velocity
  2715. static Float:velocity[3]
  2716. pev(victim, pev_velocity, velocity)
  2717.  
  2718. // Use damage on knockback calculation
  2719. if (get_pcvar_num(cvar_knockbackdamage))
  2720. xs_vec_mul_scalar(direction, damage, direction)
  2721.  
  2722. // Use weapon power on knockback calculation
  2723. if (kb_weapon_power[g_currentweapon[attacker]] > 0.0 && get_pcvar_num(cvar_knockbackpower))
  2724. xs_vec_mul_scalar(direction, kb_weapon_power[g_currentweapon[attacker]], direction)
  2725.  
  2726. // Apply ducking knockback multiplier
  2727. if ((victimflags & FL_DUCKING) && (victimflags & FL_ONGROUND))
  2728. xs_vec_mul_scalar(direction, knockduck, direction)
  2729.  
  2730. // Apply zombie class knockback multiplier
  2731. xs_vec_mul_scalar(direction, g_zclass_kb[g_zombieclass[victim]], direction)
  2732.  
  2733. // Add up the new vector
  2734. xs_vec_add(velocity, direction, direction)
  2735.  
  2736. // Should knockback also affect vertical velocity?
  2737. if (!get_pcvar_num(cvar_knockbackzvel))
  2738. direction[2] = velocity[2]
  2739.  
  2740. // Set the knockback'd victim's velocity
  2741. set_pev(victim, pev_velocity, direction)
  2742.  
  2743. return HAM_IGNORED;
  2744. }
  2745.  
  2746. // Ham Use Stationary Gun Forward
  2747. public fw_UseStationary(entity, caller, activator, use_type)
  2748. {
  2749. // Not a player
  2750. if (!is_user_connected(caller))
  2751. return HAM_IGNORED;
  2752.  
  2753. // Prevent zombies from using stationary guns
  2754. if (use_type == USE_USING && g_zombie[caller])
  2755. return HAM_SUPERCEDE;
  2756.  
  2757. // Someone stopped using a stationary gun
  2758. if (use_type == USE_STOPPED)
  2759. set_task(0.1, "replace_models", caller) // replace weapon models (bugfix)
  2760.  
  2761. return HAM_IGNORED;
  2762. }
  2763.  
  2764. // Ham Use Pushable Forward
  2765. public fw_UsePushable()
  2766. {
  2767. // Prevent speed bug with pushables?
  2768. if (get_pcvar_num(cvar_blockpushables))
  2769. return HAM_SUPERCEDE;
  2770.  
  2771. return HAM_IGNORED;
  2772. }
  2773.  
  2774. // Ham Weapon Touch Forward
  2775. public fw_TouchWeapon(weapon, id)
  2776. {
  2777. // Not a player
  2778. if (!is_user_connected(id))
  2779. return HAM_IGNORED;
  2780.  
  2781. // Dont pickup weapons if zombie or survivor (+PODBot MM fix)
  2782. if (g_zombie[id] || (g_survivor[id] && !is_user_bot(id)))
  2783. return HAM_SUPERCEDE;
  2784.  
  2785. return HAM_IGNORED;
  2786. }
  2787.  
  2788. // Ham Weapon Pickup Forward
  2789. public fw_AddPlayerItem(id, weapon_ent)
  2790. {
  2791. // Retrieve our custom extra ammo from the weapon
  2792. static extra_ammo
  2793. extra_ammo = pev(weapon_ent, PEV_ADDITIONAL_AMMO)
  2794.  
  2795. // If present, add to player's bpammo (dont exceed max capacity though)
  2796. if (extra_ammo)
  2797. {
  2798. static wname[32], weapon
  2799. pev(weapon_ent, pev_classname, wname, sizeof wname - 1)
  2800. weapon = get_weaponid(wname)
  2801.  
  2802. fm_set_user_bpammo(id, weapon, min(fm_get_user_bpammo(id, weapon)+extra_ammo, MAXBPAMMO[weapon]))
  2803. set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, 0)
  2804. }
  2805. }
  2806.  
  2807. // Client Kill Forward
  2808. public fw_ClientKill()
  2809. {
  2810. // Prevent players from killing themselves?
  2811. if (get_pcvar_num(cvar_blocksuicide))
  2812. return FMRES_SUPERCEDE;
  2813.  
  2814. return FMRES_IGNORED;
  2815. }
  2816.  
  2817. // Emit Sound Forward
  2818. public fw_EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch)
  2819. {
  2820. // Replace these sounds for zombies only
  2821. if (!is_user_connected(id) || !g_zombie[id])
  2822. return FMRES_IGNORED;
  2823.  
  2824. // Zombie being hit
  2825. if (equal(sample[7], "bhit", 4))
  2826. {
  2827. if (g_nemesis[id])
  2828. engfunc(EngFunc_EmitSound, id, channel, nemesis_pain[random_num(0, sizeof nemesis_pain - 1)], volume, attn, flags, pitch)
  2829. else
  2830. engfunc(EngFunc_EmitSound, id, channel, zombie_pain[random_num(0, sizeof zombie_pain - 1)], volume, attn, flags, pitch)
  2831. return FMRES_SUPERCEDE;
  2832. }
  2833.  
  2834. // Zombie attacks with knife
  2835. if (equal(sample[8], "kni", 3))
  2836. {
  2837. if (equal(sample[14], "sla", 3)) // slash
  2838. {
  2839. engfunc(EngFunc_EmitSound, id, channel, zombie_miss_slash[random_num(0, sizeof zombie_miss_slash - 1)], volume, attn, flags, pitch)
  2840. return FMRES_SUPERCEDE;
  2841. }
  2842. if (equal(sample[14], "hit", 3))
  2843. {
  2844. if (sample[17] == 'w') // wall
  2845. {
  2846. engfunc(EngFunc_EmitSound, id, channel, zombie_miss_wall[random_num(0, sizeof zombie_miss_wall - 1)], volume, attn, flags, pitch)
  2847. return FMRES_SUPERCEDE;
  2848. }
  2849. else // hit
  2850. {
  2851. engfunc(EngFunc_EmitSound, id, channel, zombie_hit_normal[random_num(0, sizeof zombie_hit_normal - 1)], volume, attn, flags, pitch)
  2852. return FMRES_SUPERCEDE;
  2853. }
  2854. }
  2855. if (equal(sample[14], "sta", 3)) // stab
  2856. {
  2857. engfunc(EngFunc_EmitSound, id, channel, zombie_hit_stab[random_num(0, sizeof zombie_hit_stab - 1)], volume, attn, flags, pitch)
  2858. return FMRES_SUPERCEDE;
  2859. }
  2860. }
  2861.  
  2862. // Zombie dies
  2863. if (equal(sample[7], "die", 3) || equal(sample[7], "dea", 3))
  2864. {
  2865. engfunc(EngFunc_EmitSound, id, channel, zombie_die[random_num(0, sizeof zombie_die - 1)], volume, attn, flags, pitch)
  2866. return FMRES_SUPERCEDE;
  2867. }
  2868.  
  2869. // Zombie falls off
  2870. if (equal(sample[10], "fall", 4))
  2871. {
  2872. engfunc(EngFunc_EmitSound, id, channel, zombie_fall[random_num(0, sizeof zombie_fall - 1)], volume, attn, flags, pitch)
  2873. return FMRES_SUPERCEDE;
  2874. }
  2875.  
  2876. return FMRES_IGNORED;
  2877. }
  2878.  
  2879. #if !defined HANDLE_MODELS_ON_SEPARATE_ENT
  2880. // Forward Set ClientKey Value -prevent CS from changing player models-
  2881. public fw_SetClientKeyValue(id, const infobuffer[], const key[])
  2882. {
  2883. // Block CS model changes
  2884. if (equal(key, "model"))
  2885. return FMRES_SUPERCEDE;
  2886.  
  2887. return FMRES_IGNORED;
  2888. }
  2889.  
  2890. // Forward Client User Info Changed -prevent players from changing models-
  2891. public fw_ClientUserInfoChanged(id)
  2892. {
  2893. // Get current model
  2894. static currentmodel[32]
  2895. fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
  2896.  
  2897. // If they're different, set model again
  2898. if (!equal(currentmodel, g_playermodel[id]) && !task_exists(id+TASK_MODEL))
  2899. fm_set_user_model(id+TASK_MODEL)
  2900. }
  2901. #endif
  2902.  
  2903. // Forward Get Game Description
  2904. public fw_GetGameDescription()
  2905. {
  2906. // Return the mod name so it can be easily identified
  2907. forward_return(FMV_STRING, g_modname)
  2908.  
  2909. return FMRES_SUPERCEDE;
  2910. }
  2911.  
  2912. // Forward CmdStart
  2913. public fw_CmdStart(id, handle)
  2914. {
  2915. // Check if it's a flashlight impulse
  2916. if (get_uc(handle, UC_Impulse) != IMPULSE_FLASHLIGHT)
  2917. return;
  2918.  
  2919. // Not alive
  2920. if (!is_user_alive(id))
  2921. return;
  2922.  
  2923. // Block it for zombies, survivor (and override it for humans when custom flashlight is on)
  2924. if (g_zombie[id] || g_survivor[id] || (!g_zombie[id] && get_pcvar_num(cvar_cflash)))
  2925. {
  2926. // Human's custom flashlight should be turned on instead
  2927. if (!g_zombie[id] && !g_survivor[id] && get_gametime() - g_lastflashtime[id] > 1.1)
  2928. {
  2929. // Prevent turning the flashlight on/off too quickly (bugfix)
  2930. g_lastflashtime[id] = get_gametime()
  2931.  
  2932. // Turn custom flashlight on/off
  2933. g_flashlight[id] = !(g_flashlight[id])
  2934.  
  2935. // Set the flashlight charge task
  2936. remove_task(id+TASK_CHARGE)
  2937. set_task(1.0, "flashlight_charge", id+TASK_CHARGE, _, _, "b")
  2938.  
  2939. // Update flashlight status on the HUD
  2940. message_begin(MSG_ONE, g_msgFlashlight, _, id)
  2941. write_byte(g_flashlight[id]) // toggle
  2942. write_byte(g_flashbattery[id]) // battery
  2943. message_end()
  2944.  
  2945. // Turn off original flashlight if active
  2946. set_pev(id, pev_effects, pev(id, pev_effects) & ~EF_DIMLIGHT)
  2947.  
  2948. // Play flashlight toggle sound
  2949. engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_flashlight, 1.0, ATTN_NORM, 0, PITCH_NORM)
  2950.  
  2951. // Finally call our custom flashlight task
  2952. remove_task(id+TASK_FLASH)
  2953. set_task(0.1, "set_user_flashlight", id+TASK_FLASH, _, _, "b")
  2954. }
  2955.  
  2956. // Block the impulse
  2957. set_uc(handle, UC_Impulse, 0)
  2958. }
  2959. }
  2960.  
  2961. // Forward Set Model
  2962. public fw_SetModel(entity, const model[])
  2963. {
  2964. // Get remove dropped weapons setting
  2965. static Float:removeweapons
  2966. removeweapons = get_pcvar_float(cvar_removedropped)
  2967.  
  2968. // Remove weapons?
  2969. if (removeweapons > 0.0)
  2970. {
  2971. // Get entity's classname
  2972. static class[10]
  2973. pev(entity, pev_classname, class, sizeof class - 1)
  2974.  
  2975. // Check if it's a weapon box
  2976. if (equal(class, "weaponbox"))
  2977. {
  2978. // They get automatically removed when thinking
  2979. set_pev(entity, pev_nextthink, get_gametime() + removeweapons)
  2980. return;
  2981. }
  2982. }
  2983.  
  2984. // Get damage time of grenade
  2985. static Float:dmgtime
  2986. pev(entity, pev_dmgtime, dmgtime)
  2987.  
  2988. // Grenade not yet thrown
  2989. if (dmgtime == 0.0)
  2990. return;
  2991.  
  2992. if (equal(model[7], "w_he", 4))
  2993. {
  2994. if (g_zombie[pev(entity, pev_owner)]) // [ZOMBIE] - Infection Grenade
  2995. {
  2996. // Give it a glow
  2997. fm_set_rendering(entity, kRenderFxGlowShell, 0, 200, 0, kRenderNormal, 16);
  2998.  
  2999. // And a colored trail
  3000. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  3001. write_byte(TE_BEAMFOLLOW) // TE id
  3002. write_short(entity) // entity
  3003. write_short(g_trailSpr) // sprite
  3004. write_byte(10) // life
  3005. write_byte(10) // width
  3006. write_byte(0) // r
  3007. write_byte(200) // g
  3008. write_byte(0) // b
  3009. write_byte(200) // brightness
  3010. message_end()
  3011.  
  3012. // Set grenade type on the thrown grenade entity
  3013. set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_INFECTION)
  3014. }
  3015. else if (get_pcvar_num(cvar_firegrenades)) // [HUMAN] - Fire Grenade
  3016. {
  3017. // Give it a glow
  3018. fm_set_rendering(entity, kRenderFxGlowShell, 200, 0, 0, kRenderNormal, 16);
  3019.  
  3020. // And a colored trail
  3021. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  3022. write_byte(TE_BEAMFOLLOW) // TE id
  3023. write_short(entity) // entity
  3024. write_short(g_trailSpr) // sprite
  3025. write_byte(10) // life
  3026. write_byte(10) // width
  3027. write_byte(200) // r
  3028. write_byte(0) // g
  3029. write_byte(0) // b
  3030. write_byte(200) // brightness
  3031. message_end()
  3032.  
  3033. // Set grenade type on the thrown grenade entity
  3034. set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_NAPALM)
  3035. }
  3036. }
  3037. else if (equal(model[7], "w_fl", 4) && get_pcvar_num(cvar_frostgrenades)) // Frost Grenade
  3038. {
  3039. // Give it a glow
  3040. fm_set_rendering(entity, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 16);
  3041.  
  3042. // And a colored trail
  3043. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  3044. write_byte(TE_BEAMFOLLOW) // TE id
  3045. write_short(entity) // entity
  3046. write_short(g_trailSpr) // sprite
  3047. write_byte(10) // life
  3048. write_byte(10) // width
  3049. write_byte(0) // r
  3050. write_byte(100) // g
  3051. write_byte(200) // b
  3052. write_byte(200) // brightness
  3053. message_end()
  3054.  
  3055. // Set grenade type on the thrown grenade entity
  3056. set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FROST)
  3057. }
  3058. 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
  3059. {
  3060. if(!g_zombie[pev(entity, pev_owner)] && g_bubble_bomb[pev(entity, pev_owner)]) // aca determinamos que la bomba es solo para humanos.
  3061. {
  3062. fm_set_rendering(entity, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 16) // aca determinamos el color de glow de la granada.
  3063. message_begin(MSG_BROADCAST, SVC_TEMPENTITY) // ni idea.
  3064. write_byte(TE_BEAMFOLLOW) // aca determinamos que es un trail la entidad
  3065. write_short(entity) // declaramos que es una entidad
  3066. write_short(g_trailSpr) // el sprite correspondiente al trail.
  3067. write_byte(10) // life. ( nose que es )
  3068. write_byte(10) // width: esto quiere decir el ancho del trail
  3069. write_byte(255) // red: color rojo
  3070. write_byte(255) // green: color verde
  3071. write_byte(255) // blue: color azul
  3072. write_byte(500) // brightness: brillo
  3073. message_end()
  3074.  
  3075. set_pev(entity, pev_flTimeStepSound, NADE_TYPE_CAMPO) // tipo de bomba ( NADE_TYPE_CAMPO )
  3076.  
  3077. entity_set_model(entity, w_model) // llamamos al model de la granada en el piso "w_".
  3078. }
  3079. else
  3080. {
  3081. // Make the flare color
  3082. static rgb[3]
  3083. switch (get_pcvar_num(cvar_flarecolor))
  3084. {
  3085. case 0: // white
  3086. {
  3087. rgb[0] = 255 // red: rojo
  3088. rgb[1] = 255 // green: verde
  3089. rgb[2] = 255 // blue: azul
  3090. }
  3091. case 1: // red
  3092. {
  3093. rgb[0] = random_num(50,255) // rer: rojo con un random_num, eso quiere decir que saldra desde el 50 al 255
  3094. rgb[1] = 0 // green: verde
  3095. rgb[2] = 0 // blue: azul
  3096. }
  3097. case 2: // green
  3098. {
  3099. rgb[0] = 0 // red: rojo
  3100. rgb[1] = random_num(50,255) // green: verde con un random_num, eso quiere decir que saldra desde el 50 al 255
  3101. rgb[2] = 0 // blue: azul
  3102. }
  3103. case 3: // blue
  3104. {
  3105. rgb[0] = 0 // red: rojo
  3106. rgb[1] = 0 // green: verde
  3107. rgb[2] = random_num(50,255) // blue: azul con un random_num, eso quiere decir que saldra desde el 50 al 255
  3108. }
  3109. case 4: // random (all colors): quiere decir que pueden salir varios colores por que los combina
  3110. {
  3111. rgb[0] = random_num(50,200) // red: rojo con un random_num, eso quiere decir que saldra desde el 50 al 255
  3112. rgb[1] = random_num(50,200) // green: verde con un random_num, eso quiere decir que saldra desde el 50 al 255
  3113. rgb[2] = random_num(50,200) // blue: azul con un random_num, eso quiere decir que saldra desde el 50 al 255
  3114. }
  3115. case 5: // random (r,g,b): al azar entre rojo, verde, azul
  3116. {
  3117. switch (random_num(1, 3))
  3118. {
  3119. case 1: // red
  3120. {
  3121. rgb[0] = random_num(50,255) // red: rojo con un random_num, eso quiere decir que saldra desde el 50 al 255
  3122. rgb[1] = 0 // green: verde
  3123. rgb[2] = 0 // blue: azul
  3124. }
  3125. case 2: // green
  3126. {
  3127. rgb[0] = 0 // red: rojo
  3128. rgb[1] = random_num(50,255) // green: verde con un random_num, eso quiere decir que saldra desde el 50 al 255
  3129. rgb[2] = 0 // blue: azul
  3130. }
  3131. case 3: // blue
  3132. {
  3133. rgb[0] = 0 // red: rojo
  3134. rgb[1] = 0 // green: verde
  3135. rgb[2] = random_num(50,255) // blue: azul con un random_num, eso quiere decir que saldra desde el 50 al 255
  3136. }
  3137. }
  3138. }
  3139. }
  3140.  
  3141. // Give it a glow / toma el glow color, si la bomba fuese de color rojo, el glow de la grana sera rojo...
  3142. fm_set_rendering(entity, kRenderFxGlowShell, rgb[0], rgb[1], rgb[2], kRenderNormal, 16);
  3143.  
  3144. // And a colored trail / le damos un trail
  3145. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  3146. write_byte(TE_BEAMFOLLOW) // entidad del trail
  3147. write_short(entity) // decimos que es una entidad
  3148. write_short(g_trailSpr) // sprite correspondiente al trail
  3149. write_byte(10) // life ( nose que es )
  3150. write_byte(10) // width: ancho del trail
  3151. write_byte(rgb[0]) // red: rojo -- depende de que color sea la bomba (rgb[0] = 1)
  3152. write_byte(rgb[1]) // green: verde -- depende de que color sea la bomba (rgb[1] = 2)
  3153. write_byte(rgb[2]) // blue: azul -- depende de que color sea la bomba (rgb[2] = 3)
  3154. write_byte(200) // brightness: brillo del trail
  3155. message_end() // terminamos la entidad
  3156.  
  3157. // Set grenade type on the thrown grenade entity
  3158. set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FLARE) // tipo de granada ( flare bomb )
  3159.  
  3160. // Set flare color on the thrown grenade entity
  3161. set_pev(entity, PEV_FLARE_COLOR, rgb) // Establecer color bengala en la entidad granada lanzada
  3162. }
  3163. }
  3164. }
  3165.  
  3166. // Ham Grenade Think Forward
  3167. public fw_ThinkGrenade(entity)
  3168. {
  3169. // Invalid entity
  3170. if (!pev_valid(entity)) return FMRES_IGNORED;
  3171.  
  3172. // Get damage time of grenade
  3173. static Float:dmgtime
  3174. pev(entity, pev_dmgtime, dmgtime)
  3175.  
  3176. // Check if it's time to go off
  3177. if (dmgtime > get_gametime())
  3178. return HAM_IGNORED;
  3179.  
  3180. // Check if it's one of our custom nades
  3181. switch (pev(entity, PEV_NADE_TYPE))
  3182. {
  3183. case NADE_TYPE_INFECTION: // Infection Bomb
  3184. {
  3185. infection_explode(entity)
  3186. }
  3187. case NADE_TYPE_NAPALM: // Napalm Grenade
  3188. {
  3189. fire_explode(entity)
  3190. }
  3191. case NADE_TYPE_FROST: // Frost Grenade
  3192. {
  3193. frost_explode(entity)
  3194. }
  3195. case NADE_TYPE_CAMPO: // Bubble Grenade / tipo de bomba bubble ( campo )
  3196. {
  3197. bubble_explode(entity) // llamamos a la entidad del campo
  3198. return HAM_SUPERCEDE;
  3199. }
  3200. case NADE_TYPE_FLARE: // Flare
  3201. {
  3202. // Light up when it's stopped on ground
  3203. if ((pev(entity, pev_flags) & FL_ONGROUND) && fm_get_speed(entity) < 10)
  3204. {
  3205. // Flare sound
  3206. engfunc(EngFunc_EmitSound, entity, CHAN_WEAPON, grenade_flare[random_num(0, sizeof grenade_flare - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  3207.  
  3208. // Our task params
  3209. static params[5]
  3210. params[0] = entity // entity id
  3211. params[1] = get_pcvar_num(cvar_flareduration)/5 // duration
  3212.  
  3213. // Retrieve flare color from entity
  3214. pev(entity, PEV_FLARE_COLOR, params[2]) // params[2] r - params[3] g - params[4] b
  3215.  
  3216. // Call our lighting task
  3217. set_task(0.1, "flare_lighting", TASK_NADES, params, sizeof params)
  3218. }
  3219. else
  3220. {
  3221. // Delay the explosion until we hit ground
  3222. set_pev(entity, pev_dmgtime, get_gametime() + 0.5)
  3223. return HAM_IGNORED;
  3224. }
  3225. }
  3226. default: return HAM_IGNORED;
  3227. }
  3228.  
  3229. return HAM_SUPERCEDE;
  3230. }
  3231.  
  3232. // Forward Player PreThink
  3233. public fw_PlayerPreThink(id)
  3234. {
  3235. // Not alive
  3236. if (!is_user_alive(id))
  3237. return;
  3238.  
  3239. // Silent footsteps for zombies?
  3240. if (g_zombie[id] && !g_nemesis[id] && get_pcvar_num(cvar_zombiesilent))
  3241. set_pev(id, pev_flTimeStepSound, STEPTIME_SILENT)
  3242.  
  3243. // Set Player MaxSpeed
  3244. if (g_frozen[id])
  3245. {
  3246. set_pev(id, pev_velocity, Float:{0.0,0.0,0.0}) // stop motion
  3247. set_pev(id, pev_maxspeed, 1.0) // prevent from moving
  3248. }
  3249. else if (!g_freezetime)
  3250. {
  3251. if (g_zombie[id])
  3252. {
  3253. if (g_nemesis[id])
  3254. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_nemspd))
  3255. else
  3256. set_pev(id, pev_maxspeed, float(g_zclass_spd[g_zombieclass[id]] + Z_SPEED(g_skill_points[id][1][2])))
  3257. }
  3258. else
  3259. {
  3260. if (g_survivor[id])
  3261. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_survspd))
  3262. else
  3263. set_pev(id, pev_maxspeed, float(g_hclass_spd[g_humanclass[id]] + H_SPEED(g_skill_points[id][0][2])))
  3264. }
  3265. }
  3266.  
  3267. // Should Leap?
  3268. if (allowed_leap(id))
  3269. {
  3270. // Get force and height cvars
  3271. static force, height, Float:velocity[3]
  3272. force = g_survivor[id] ? get_pcvar_num(cvar_leapsurvivorforce) : g_nemesis[id] ? get_pcvar_num(cvar_leapnemesisforce) : get_pcvar_num(cvar_leapzombiesforce)
  3273. height = g_survivor[id] ? get_pcvar_num(cvar_leapsurvivorheight) : g_nemesis[id] ? get_pcvar_num(cvar_leapnemesisheight) : get_pcvar_num(cvar_leapzombiesheight)
  3274.  
  3275. // Make velocity vector
  3276. velocity_by_aim(id, force, velocity)
  3277.  
  3278. // Set custom height
  3279. velocity[2] = float(height)
  3280.  
  3281. // Apply the new velocity
  3282. set_pev(id, pev_velocity, velocity)
  3283.  
  3284. // Set the current leap time
  3285. g_lastleaptime[id] = get_gametime()
  3286. }
  3287.  
  3288. // Should be Pain Shock Free?
  3289. if (allowed_painshockfree(id))
  3290. {
  3291. // Remember his velocity
  3292. pev(id, pev_velocity, g_velocity[id])
  3293. g_restorevel[id] = true
  3294. }
  3295. }
  3296.  
  3297. // Forward Player PreThink Post
  3298. public fw_PlayerPreThink_Post(id)
  3299. {
  3300. // Pain Shock Free: need to restore velocity?
  3301. if (!g_restorevel[id])
  3302. return FMRES_IGNORED;
  3303.  
  3304. g_restorevel[id] = false
  3305.  
  3306. // Not alive
  3307. if (!is_user_alive(id))
  3308. return FMRES_IGNORED;
  3309.  
  3310. // Driving a vehicle
  3311. if (pev(id, pev_flags) & FL_ONTRAIN)
  3312. return FMRES_IGNORED;
  3313.  
  3314. // NOTE: within DLL PlayerPreThink Jump() function is called;
  3315. // there is a conveyor velocity addiction we should care of
  3316. static groundent
  3317. groundent = pev(id, pev_groundentity)
  3318.  
  3319. if (pev_valid(groundent) && (pev(groundent, pev_flags) & FL_CONVEYOR))
  3320. {
  3321. // Add pev_basevelocity to our stored velocity
  3322. static Float:tempvel[3]
  3323. pev(id, pev_basevelocity, tempvel)
  3324. xs_vec_add(g_velocity[id], tempvel, g_velocity[id])
  3325. }
  3326.  
  3327. // Restore previous velocity
  3328. set_pev(id, pev_velocity, g_velocity[id])
  3329. return FMRES_HANDLED;
  3330. }
  3331.  
  3332. /*================================================================================
  3333. [Client Commands]
  3334. =================================================================================*/
  3335.  
  3336. // Say "/zpmenu"
  3337. public clcmd_saymenu(id)
  3338. {
  3339. show_menu_game(id) // show game menu
  3340. }
  3341.  
  3342. // Say "/unstuck"
  3343. public clcmd_sayunstuck(id)
  3344. {
  3345. menu_game(id, 3) // try to get unstuck
  3346. }
  3347.  
  3348. // Nightvision toggle
  3349. public clcmd_nightvision(id)
  3350. {
  3351. if (g_nvision[id])
  3352. {
  3353. // Enable-disable
  3354. g_nvisionenabled[id] = !(g_nvisionenabled[id])
  3355.  
  3356. // Custom nvg?
  3357. if (get_pcvar_num(cvar_cnvg))
  3358. {
  3359. remove_task(id+TASK_NVISION);
  3360. set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
  3361. }
  3362. else
  3363. set_user_gnvision(id, g_nvisionenabled[id])
  3364. }
  3365.  
  3366. return PLUGIN_HANDLED;
  3367. }
  3368.  
  3369. // Weapon Drop
  3370. public clcmd_drop(id)
  3371. {
  3372. return PLUGIN_HANDLED
  3373. client_print(id, print_center, "No puedes botar tu arma")
  3374. }
  3375.  
  3376. // Buy BP Ammo
  3377. public clcmd_buyammo(id)
  3378. {
  3379. // Not alive or infinite ammo setting enabled
  3380. if (get_pcvar_num(cvar_infammo) || !is_user_alive(id))
  3381. return PLUGIN_HANDLED;
  3382.  
  3383. // Not human
  3384. if (g_zombie[id])
  3385. {
  3386. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_HUMAN_ONLY")
  3387. return PLUGIN_HANDLED;
  3388. }
  3389.  
  3390. // Not enough ammo packs
  3391. if (g_ammopacks[id] < 1)
  3392. {
  3393. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "NOT_ENOUGH_AMMO")
  3394. return PLUGIN_HANDLED;
  3395. }
  3396.  
  3397. // Get user weapons
  3398. static weapons[32], num, i, currentammo, weaponid, refilled
  3399. num = 0 // reset passed weapons count (bugfix)
  3400. refilled = false
  3401. get_user_weapons(id, weapons, num)
  3402.  
  3403. // Loop through them and give the right ammo type
  3404. for (i = 0; i < num; i++)
  3405. {
  3406. // Prevents re-indexing the array
  3407. weaponid = weapons[i]
  3408.  
  3409. // Primary and secondary only
  3410. if (MAXBPAMMO[weaponid] > 2)
  3411. {
  3412. // Get current ammo of the weapon
  3413. currentammo = fm_get_user_bpammo(id, weaponid)
  3414.  
  3415. // Check if we are close to the BP ammo limit
  3416. if (currentammo < MAXBPAMMO[weaponid]-BUYAMMO[weaponid])
  3417. {
  3418. // Flash ammo in hud
  3419. message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
  3420. write_byte(AMMOID[weaponid]) // ammo id
  3421. write_byte(BUYAMMO[weaponid]) // ammo amount
  3422. message_end()
  3423.  
  3424. // Increase BP ammo
  3425. fm_set_user_bpammo(id, weaponid, currentammo + BUYAMMO[weaponid])
  3426.  
  3427. refilled = true
  3428. }
  3429. else if (currentammo < MAXBPAMMO[weaponid])
  3430. {
  3431. // Flash ammo in hud
  3432. message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
  3433. write_byte(AMMOID[weaponid]) // ammo id
  3434. write_byte(MAXBPAMMO[weaponid]-currentammo) // ammo amount
  3435. message_end()
  3436.  
  3437. // Reached the limit
  3438. fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
  3439.  
  3440. refilled = true
  3441. }
  3442. }
  3443. }
  3444.  
  3445. // Weapons already have full ammo
  3446. if (!refilled) return PLUGIN_HANDLED;
  3447.  
  3448. // Deduce ammo packs, play clip purchase sound, and notify the player
  3449. update_ap(id, -1, 0)
  3450. engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  3451. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "AMMO_BOUGHT")
  3452.  
  3453. return PLUGIN_HANDLED;
  3454. }
  3455.  
  3456. // Block Team Change
  3457. public clcmd_changeteam(id)
  3458. {
  3459. static team
  3460. team = fm_get_user_team(id)
  3461.  
  3462. if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
  3463. return PLUGIN_CONTINUE;
  3464.  
  3465. if (g_estado[id] != ONLINE)
  3466. return PLUGIN_CONTINUE;
  3467.  
  3468. show_menu_game(id)
  3469. return PLUGIN_HANDLED;
  3470. }
  3471.  
  3472. // Block changeteam
  3473. public clcmd_jointeam(id)
  3474. {
  3475. if(g_estado[id] == ONLINE)
  3476. return PLUGIN_CONTINUE;
  3477.  
  3478. show_menu_registro(id)
  3479. return PLUGIN_HANDLED;
  3480. }
  3481.  
  3482. /*================================================================================
  3483. [Menus]
  3484. =================================================================================*/
  3485.  
  3486. // Game Menu
  3487. show_menu_game(id)
  3488. {
  3489. static menu[250], len
  3490. len = 0
  3491.  
  3492. // Title
  3493. len += formatex(menu[len], sizeof menu - 1 - len, "\y%s^n^n", g_modname)
  3494.  
  3495. // 1. Buy weapons
  3496. if (get_pcvar_num(cvar_buycustom))
  3497. len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\w %L^n", id, "MENU_BUY")
  3498. else
  3499. len += formatex(menu[len], sizeof menu - 1 - len, "\d1. %L^n", id, "MENU_BUY")
  3500.  
  3501. // 2. Extra items
  3502. if (!g_survivor[id] && !g_nemesis[id] && get_pcvar_num(cvar_extraitems) && is_user_alive(id))
  3503. len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\w %L^n^n", id, "MENU_EXTRABUY")
  3504. else
  3505. len += formatex(menu[len], sizeof menu - 1 - len, "\d2. %L^n^n", id, "MENU_EXTRABUY")
  3506.  
  3507. // 3. Zombie class || Human class
  3508. if (g_zombie[id])
  3509. len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w %L^n", id,"MENU_ZCLASS")
  3510. else
  3511. len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w %L^n", id,"MENU_HCLASS")
  3512.  
  3513. // 4. Unstuck
  3514. if (is_user_alive(id))
  3515. len += formatex(menu[len], sizeof menu - 1 - len, "\r4.\w %L^n^n", id, "MENU_UNSTUCK")
  3516. else
  3517. len += formatex(menu[len], sizeof menu - 1 - len, "\d4. %L^n^n", id, "MENU_UNSTUCK")
  3518.  
  3519. // 5. Help and join spec
  3520. len += formatex(menu[len], sizeof menu - 1 - len, "\r5.\w %L^n", id, "MENU_SPECTATOR")
  3521.  
  3522. // 6. Reset
  3523. len += formatex(menu[len], charsmax(menu) - len, "^n\r6.\r Account Configuration^n^n")
  3524.  
  3525. // 7. Habilidades
  3526. len += formatex(menu[len], sizeof menu - 1 - len, "\r7.\w Abilities^n")
  3527.  
  3528. len += formatex(menu[len], sizeof menu - 1 - len, "\r8.\w Party^n^n")
  3529.  
  3530. // 9. Admin menu
  3531. if (get_user_flags(id) & ACCESS_FLAG)
  3532. len += formatex(menu[len], sizeof menu - 1 - len, "\r9.\w %L", id, "MENU_ADMIN")
  3533. else
  3534. len += formatex(menu[len], sizeof menu - 1 - len, "\d9. %L", id, "MENU_ADMIN")
  3535.  
  3536. // 0. Exit
  3537. len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
  3538.  
  3539. show_menu(id, KEYSMENU, menu, -1, "Game Menu")
  3540. }
  3541.  
  3542. // Buy Menu 1
  3543. public show_menu_buy1(taskid)
  3544. {
  3545. // Get player id
  3546. static id
  3547. (taskid > g_maxplayers) ? (id = ID_SPAWN) : (id = taskid);
  3548.  
  3549. // Zombies or survivors get no guns
  3550. if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
  3551. return;
  3552.  
  3553. // Bots pick their weapons randomly
  3554. if (is_user_bot(id))
  3555. {
  3556. buy_primary_weapon(id, random_num(0, sizeof g_primary_items - 1))
  3557. menu_buy2(id, random_num(0, sizeof g_secondary_items - 1))
  3558. return;
  3559. }
  3560.  
  3561. // Automatic selection enabled for player and menu called on spawn event
  3562. if (WPN_AUTO_ON && taskid > g_maxplayers)
  3563. {
  3564. buy_primary_weapon(id, WPN_AUTO_PRI)
  3565. menu_buy2(id, WPN_AUTO_SEC)
  3566. return;
  3567. }
  3568.  
  3569. static menu[999], len, weap
  3570. len = 0
  3571.  
  3572. // Title
  3573. 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))
  3574.  
  3575. // 1-7. Weapon List
  3576. for (weap = WPN_STARTID; weap < min(WPN_STARTID+7, WPN_MAXIDS); weap++)
  3577. if (g_level[id] >= lvlarmas[weap] && g_reset[id] >= resetarmas[weap])
  3578. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", weap-WPN_STARTID+1, ArmasName[weap])
  3579. else
  3580. 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])
  3581.  
  3582. // 8. Auto Select
  3583. 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")
  3584.  
  3585. // 9. Next/Back - 0. Exit
  3586. 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")
  3587.  
  3588. show_menu(id, KEYSMENU, menu, -1, "Buy Menu 1")
  3589. }
  3590.  
  3591.  
  3592. // Buy Menu 2
  3593. show_menu_buy2(id)
  3594. {
  3595. static menu[250], len, weap
  3596. len = 0
  3597.  
  3598. // Title
  3599. len += formatex(menu[len], sizeof menu - 1 - len, "\y%L^n", id, "MENU_BUY2_TITLE")
  3600.  
  3601. // 1-6. Weapon List
  3602. for (weap = 0; weap < sizeof g_secondary_items; weap++)
  3603. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r%d.\w %s", weap+1, WEAPONNAMES[get_weaponid(g_secondary_items[weap])])
  3604.  
  3605. // 8. Auto Select
  3606. 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")
  3607.  
  3608. // 0. Exit
  3609. len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
  3610.  
  3611. show_menu(id, KEYSMENU, menu, -1, "Buy Menu 2")
  3612. }
  3613.  
  3614. // Extra Items Menu
  3615. show_menu_extras(id)
  3616. {
  3617. static menu[400], len, item
  3618. len = 0
  3619.  
  3620. // Title
  3621. 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))
  3622.  
  3623. // 1-7. Item List
  3624. for (item = EXTRAS_STARTID; item < min(EXTRAS_STARTID+7, g_extraitem_i); item++)
  3625. {
  3626. // Unavailable item
  3627. 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))
  3628. || (item == EXTRA_INFBOMB && (!get_pcvar_num(cvar_extrainfbomb) || g_infbombcounter >= get_pcvar_num(cvar_infbomblimit))) || (item >= EXTRA_WEAPONS_STARTID && item <= EXTRAS_CUSTOM_STARTID-1 && !get_pcvar_num(cvar_extraweapons)))
  3629. {
  3630. // Check if it's one of the hardcoded items and set the correct caption
  3631. switch (item)
  3632. {
  3633. case EXTRA_NVISION: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA1")
  3634. case EXTRA_ANTIDOTE: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA2")
  3635. case EXTRA_MADNESS: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA3")
  3636. case EXTRA_INFBOMB: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA4")
  3637. default: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s", item-EXTRAS_STARTID+1, g_extraitem_name[item])
  3638. }
  3639. // Item Cost
  3640. len += formatex(menu[len], sizeof menu - 1 - len, " %d Ammopacks^n", g_extraitem_cost[item] * g_level[id])
  3641. }
  3642. else
  3643. {
  3644. // Check if it's one of the hardcoded items and set the correct caption
  3645. switch (item)
  3646. {
  3647. case EXTRA_NVISION: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA1")
  3648. case EXTRA_ANTIDOTE: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA2")
  3649. case EXTRA_MADNESS: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA3")
  3650. case EXTRA_INFBOMB: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA4")
  3651. default: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s", item-EXTRAS_STARTID+1, g_extraitem_name[item])
  3652. }
  3653. // Item Cost
  3654. len += formatex(menu[len], sizeof menu - 1 - len, " %d Ammopacks^n", g_extraitem_cost[item] * g_level[id])
  3655. }
  3656. }
  3657.  
  3658. // 8. Back - 9. Next - 0. Exit
  3659. 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")
  3660.  
  3661. show_menu(id, KEYSMENU, menu, -1, "Extra Items")
  3662. }
  3663.  
  3664. // Zombie Class Menu
  3665. public show_menu_zclass(id)
  3666. {
  3667. // Player disconnected
  3668. if (!is_user_connected(id))
  3669. return;
  3670.  
  3671. // Bots pick their zombie class randomly
  3672. if (is_user_bot(id))
  3673. {
  3674. g_zombieclassnext[id] = random_num(0, g_zclass_i - 1)
  3675. return;
  3676. }
  3677.  
  3678. static menu[999], len, class
  3679. len = 0
  3680.  
  3681. // Title
  3682. 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))
  3683.  
  3684. // 1-7. Class List
  3685. for (class = ZCLASSES_STARTID; class < min(ZCLASSES_STARTID+6, g_zclass_i); class++)
  3686. {
  3687. if (g_level[id] >= g_zclass_lvl[class])
  3688. {
  3689. if (class == g_zombieclassnext[id])
  3690. 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])
  3691. else
  3692. 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])
  3693. }
  3694. else
  3695. 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])
  3696. }
  3697.  
  3698. // 8. Back - 9. Next - 0. Exit
  3699. 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")
  3700.  
  3701. show_menu(id, KEYSMENU, menu, -1, "Zombie Class Menu")
  3702. }
  3703.  
  3704. // Human Class Menu
  3705. public show_menu_hclass(id)
  3706. {
  3707. // Player disconnected
  3708. if (!is_user_connected(id))
  3709. return;
  3710.  
  3711. // Bots pick their zombie class randomly
  3712. if (is_user_bot(id))
  3713. {
  3714. g_humanclassnext[id] = random_num(0, g_hclass_i - 1)
  3715. return;
  3716. }
  3717.  
  3718. static menu[400], len, class
  3719. len = 0
  3720.  
  3721. // Title
  3722. 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))
  3723.  
  3724. // 1-7. Class List
  3725. for (class = HCLASSES_STARTID; class < min(HCLASSES_STARTID+6, g_hclass_i); class++)
  3726. {
  3727. if (g_level[id] >= g_hclass_lvl[class])
  3728. {
  3729. if (class == g_humanclassnext[id])
  3730. 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])
  3731. else
  3732. 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])
  3733. }
  3734. else
  3735. 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])
  3736. }
  3737.  
  3738. // 8. Back - 9. Next - 0. Exit
  3739. 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")
  3740.  
  3741. show_menu(id, KEYSMENU, menu, -1, "Human Class Menu")
  3742. }
  3743.  
  3744. // Help Menu
  3745. public show_menu_info(id)
  3746. {
  3747. // Player disconnected
  3748. if (!is_user_connected(id))
  3749. return;
  3750.  
  3751. static menu[150]
  3752.  
  3753. 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")
  3754. show_menu(id, KEYSMENU, menu, -1, "Mod Info")
  3755. }
  3756.  
  3757. // Reset Menu
  3758. public show_menu_reset(id)
  3759. {
  3760. static menu[800], len, lvl
  3761. lvl = 1000 - g_level[id]
  3762. len = 0
  3763.  
  3764. len += formatex(menu[len], charsmax(menu) - len, "\y%L^n^n\r- \rRequierements^n\y- Level:\w1000^n\y- Human Points:\w0^n\y- Zombie Points:\w0^n\r- Benefits:^n\y- Humans: \wHealth, Damage and Armor^n\y- Zombie: \wHealth and Speed^n^n", id, "MENU_RESET_TITLE") // otra vez lo del lang
  3765.  
  3766. if (g_level[id] >= 1000)
  3767. len += formatex(menu[len], charsmax(menu) - len, "\r1.\w Reset^n^n^n^n")
  3768.  
  3769. else
  3770. len += formatex(menu[len], charsmax(menu) - len, "\r1.\d Reset - You have %d levels left^n^n^n^n", lvl, g_points[id][0], g_points[id][1])
  3771.  
  3772.  
  3773. len += formatex(menu[len], charsmax(menu) - len, "\r0.\w %L", id, "MENU_EXIT")
  3774.  
  3775.  
  3776. show_menu(id, KEYSMENU, menu, -1, "Menu Reset")
  3777. }
  3778.  
  3779. // Admin Menu
  3780. show_menu_admin(id)
  3781. {
  3782. static menu[250], len
  3783. len = 0
  3784.  
  3785. // Title
  3786. len += formatex(menu[len], sizeof menu - 1 - len, "\y%L^n^n", id, "MENU_ADMIN_TITLE")
  3787.  
  3788. // 1. Zombiefy/Humanize command
  3789. if (!g_endround && !g_swarmround && !g_nemround && !g_survround && !g_plagueround && !task_exists(TASK_WELCOMEMSG))
  3790. len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\w %L^n", id, "MENU_ADMIN1")
  3791. else
  3792. len += formatex(menu[len], sizeof menu - 1 - len, "\d1. %L^n", id, "MENU_ADMIN1")
  3793.  
  3794. // 2. Nemesis command
  3795. if (g_newround && !g_endround && get_pcvar_num(cvar_nem) && !task_exists(TASK_WELCOMEMSG))
  3796. len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\w %L^n", id, "MENU_ADMIN2")
  3797. else
  3798. len += formatex(menu[len], sizeof menu - 1 - len, "\d2. %L^n", id, "MENU_ADMIN2")
  3799.  
  3800. // 3. Survivor command
  3801. if (g_newround && !g_endround && get_pcvar_num(cvar_surv) && !task_exists(TASK_WELCOMEMSG))
  3802. len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w %L^n", id, "MENU_ADMIN3")
  3803. else
  3804. len += formatex(menu[len], sizeof menu - 1 - len, "\d3. %L^n", id, "MENU_ADMIN3")
  3805.  
  3806. // 4. Respawn command
  3807. if (!g_endround && !g_survround && !g_swarmround && !g_nemround && !g_plagueround)
  3808. len += formatex(menu[len], sizeof menu - 1 - len, "\r4.\w %L^n", id, "MENU_ADMIN4")
  3809. else
  3810. len += formatex(menu[len], sizeof menu - 1 - len, "\d4. %L^n", id, "MENU_ADMIN4")
  3811.  
  3812. // 5. Swarm mode command
  3813. if (allowed_swarm())
  3814. len += formatex(menu[len], sizeof menu - 1 - len, "\r5.\w %L^n", id, "MENU_ADMIN5")
  3815. else
  3816. len += formatex(menu[len], sizeof menu - 1 - len, "\d5. %L^n", id, "MENU_ADMIN5")
  3817.  
  3818. // 6. Multi infection command
  3819. if (allowed_multi())
  3820. len += formatex(menu[len], sizeof menu - 1 - len, "\r6.\w %L^n", id, "MENU_ADMIN6")
  3821. else
  3822. len += formatex(menu[len], sizeof menu - 1 - len, "\d6. %L^n", id, "MENU_ADMIN6")
  3823.  
  3824. // 7. Plague mode command
  3825. if (allowed_plague())
  3826. len += formatex(menu[len], sizeof menu - 1 - len, "\r7.\w %L^n", id, "MENU_ADMIN7")
  3827. else
  3828. len += formatex(menu[len], sizeof menu - 1 - len, "\d7. %L^n", id, "MENU_ADMIN7")
  3829.  
  3830. // 8. Armagedon mode command
  3831. if (allowed_armagedon())
  3832. len += formatex(menu[len], sizeof menu - 1 - len, "\r8.\w %L^n", id, "MENU_ADMIN8")
  3833. else
  3834. len += formatex(menu[len], sizeof menu - 1 - len, "\d8. %L^n", id, "MENU_ADMIN8")
  3835.  
  3836.  
  3837. // 0. Exit
  3838. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r0.\w %L", id, "MENU_EXIT")
  3839.  
  3840. show_menu(id, KEYSMENU, menu, -1, "Admin Menu")
  3841. }
  3842.  
  3843. // Player List Menu
  3844. show_menu_player_list(id)
  3845. {
  3846. static menu[400], len, player, name[32]
  3847. len = 0
  3848.  
  3849. // Title
  3850. switch (PL_ACTION)
  3851. {
  3852. case 0: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN1")
  3853. case 1: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN2")
  3854. case 2: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN3")
  3855. case 3: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN4")
  3856. }
  3857. len += formatex(menu[len], sizeof menu - 1 - len, "\r[%d-%d]^n^n", PL_STARTID+1, min(PL_STARTID+7, g_maxplayers))
  3858.  
  3859. // 1-7. player list
  3860. for (player = PL_STARTID+1; player <= min(PL_STARTID+7, g_maxplayers); player++)
  3861. {
  3862. if (is_user_connected(player)) // check if it's connected
  3863. {
  3864. // Get player's name
  3865. get_user_name(player, name, sizeof name - 1)
  3866.  
  3867. // Format text depending on the action to take
  3868. switch (PL_ACTION)
  3869. {
  3870. case 0:
  3871. {
  3872. if (g_zombie[player])
  3873. {
  3874. if (allowed_human(player))
  3875. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s \r[%L]^n", player-PL_STARTID, name, id, "CLASS_ZOMBIE")
  3876. else
  3877. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s [%L]^n", player-PL_STARTID, name, id, "CLASS_ZOMBIE")
  3878. }
  3879. else
  3880. {
  3881. if (allowed_zombie(player))
  3882. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s \y[%L]^n", player-PL_STARTID, name, id, "CLASS_HUMAN")
  3883. else
  3884. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s [%L]^n", player-PL_STARTID, name, id, "CLASS_HUMAN")
  3885. }
  3886. }
  3887. case 1:
  3888. {
  3889. if (allowed_nemesis(player))
  3890. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", player-PL_STARTID, name)
  3891. else
  3892. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s^n", player-PL_STARTID, name)
  3893. }
  3894. case 2:
  3895. {
  3896. if (allowed_survivor(player))
  3897. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", player-PL_STARTID, name)
  3898. else
  3899. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s^n", player-PL_STARTID, name)
  3900. }
  3901. case 3:
  3902. {
  3903. if (allowed_respawn(player))
  3904. len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", player-PL_STARTID, name)
  3905. else
  3906. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s^n", player-PL_STARTID, name)
  3907. }
  3908. }
  3909. }
  3910. else
  3911. {
  3912. len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. -----^n", player-PL_STARTID)
  3913. }
  3914. }
  3915.  
  3916. // 8. Back - 9. Next - 0. Exit
  3917. 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")
  3918.  
  3919. show_menu(id, KEYSMENU, menu, -1, "Player List Menu")
  3920. }
  3921.  
  3922. public show_menu_registro(id)
  3923. {
  3924. static menu[999], szData[512], len; len = 0
  3925.  
  3926. // Title
  3927. len += formatex(menu[len], sizeof menu - 1 - len, "\w|===================\y||\r|SilentGamerz|\y||\w==================|^n \r|sG| \wZombie plague + Levels Edited By\y --\rShady\y--\w^n|===================\y||\r|SilentGamerz|\y||\w==================|^n^n")
  3928.  
  3929. if (fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  3930. len += formatex(menu[len], sizeof menu - 1 - len, "\r-\y Welcome\w %s^n^n\yYour name already has an account.^nPress\w Login\y to enter the game.^n^n", g_playername[id])
  3931. else
  3932. len += formatex(menu[len], sizeof menu - 1 - len, "\r-\y Welcome\w %s^n^n\yYour name does not have an account.^nPress\w Register\y to create an account and play.^n^n", g_playername[id])
  3933.  
  3934. // Option n°1
  3935. if (!fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  3936. len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\w Register^n")
  3937. else
  3938. len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\d Register^n")
  3939.  
  3940. // Option n°2
  3941. if (fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  3942. len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\w Login^n")
  3943. else
  3944. len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\d Login^n")
  3945.  
  3946. len += formatex(menu[len], sizeof menu - 1 - len, "^n\r0.\w Exit")
  3947.  
  3948. show_menu(id, KEYSMENU, menu, -1, "Menu Register")
  3949. }
  3950.  
  3951. /*================================================================================
  3952. [Menu Handlers]
  3953. =================================================================================*/
  3954.  
  3955. // Game Menu
  3956. public menu_game(id, key)
  3957. {
  3958. switch (key)
  3959. {
  3960. case 0: // Buy Weapons
  3961. {
  3962. // Custom buy menus enabled?
  3963. if (get_pcvar_num(cvar_buycustom))
  3964. {
  3965. // Disable the remember selection setting
  3966. WPN_AUTO_ON = 0
  3967. zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"BUY_ENABLED")
  3968.  
  3969. // Show menu if player hasn't yet bought anything
  3970. if (g_canbuy[id]) show_menu_eleccion(id)
  3971. }
  3972. else
  3973. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  3974. }
  3975. case 1: // Extra Items
  3976. {
  3977. // Extra items enabled?
  3978. if (get_pcvar_num(cvar_extraitems))
  3979. {
  3980. // Check whether the player is able to buy anything
  3981. if (is_user_alive(id) && !g_survivor[id] && !g_nemesis[id])
  3982. show_menu_extras(id)
  3983. else
  3984. zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT")
  3985. }
  3986. else
  3987. zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT_EXTRAS")
  3988. }
  3989. case 2: // Zombie Classes || Human Classes
  3990. {
  3991. // Zombie classes enabled?
  3992. if (g_zombie[id])
  3993. show_menu_zclass(id)
  3994. else
  3995. show_menu_hclass(id)
  3996. }
  3997. case 3: // Unstuck
  3998. {
  3999. // Check if player is stuck
  4000. if (is_user_alive(id) && is_player_stuck(id))
  4001. {
  4002. // Spawn randomly / get back to base
  4003. if (get_pcvar_num(cvar_randspawn))
  4004. do_random_spawn(id)
  4005. else
  4006. dllfunc(DLLFunc_Spawn, id)
  4007. }
  4008. else
  4009. zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT_STUCK")
  4010. }
  4011. case 4: // Join Spectator
  4012. {
  4013. // If alive
  4014. if (is_user_alive(id))
  4015. {
  4016. // Check that we still have both humans and zombies to keep the round going
  4017. check_round(id)
  4018.  
  4019. // Kill him before he switches team
  4020. dllfunc(DLLFunc_ClientKill, id)
  4021. }
  4022.  
  4023. // Temporarily save player stats?
  4024. if (get_pcvar_num(cvar_statssave)) save_stats(id)
  4025.  
  4026. // Remove previous tasks
  4027. remove_task(id+TASK_TEAM)
  4028. remove_task(id+TASK_MODEL)
  4029. remove_task(id+TASK_FLASH)
  4030. remove_task(id+TASK_CHARGE)
  4031. remove_task(id+TASK_SPAWN)
  4032. remove_task(id+TASK_BLOOD)
  4033.  
  4034. // Then move him to the spectator team
  4035. fm_set_user_team(id, CS_TEAM_SPECTATOR)
  4036. fm_user_team_update(id)
  4037. }
  4038. case 5: menu_usuario(id)
  4039. case 6: menu_upgrade(id)
  4040. case 7: cmdParty(id)
  4041. case 8: // Admin Menu
  4042. {
  4043. // Check if player has the required access
  4044. if (get_user_flags(id) & ACCESS_FLAG)
  4045. show_menu_admin(id)
  4046. else
  4047. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_ACCESS")
  4048. }
  4049. }
  4050.  
  4051. return PLUGIN_HANDLED;
  4052. }
  4053.  
  4054. // Buy Menu 1
  4055. public menu_buy1(id, key)
  4056. {
  4057. // Zombies or survivors get no guns
  4058. if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
  4059. return PLUGIN_HANDLED;
  4060.  
  4061. // Special keys / weapon list exceeded
  4062. if (key >= MENU_KEY_AUTOSELECT || WPN_SELECTION >= WPN_MAXIDS)
  4063. {
  4064. switch (key)
  4065. {
  4066. case MENU_KEY_AUTOSELECT: // toggle auto select
  4067. {
  4068. WPN_AUTO_ON = 1 - WPN_AUTO_ON
  4069. }
  4070. case MENU_KEY_NEXT: // next/back
  4071. {
  4072. if (WPN_STARTID+7 < WPN_MAXIDS)
  4073. WPN_STARTID += 7
  4074. else
  4075. WPN_STARTID = 0
  4076. }
  4077. case MENU_KEY_EXIT: // exit
  4078. {
  4079. return PLUGIN_HANDLED;
  4080. }
  4081. }
  4082.  
  4083. // Show buy menu again
  4084. show_menu_buy1(id)
  4085. return PLUGIN_HANDLED;
  4086. }
  4087.  
  4088. if(g_level[id] >= lvlarmas[WPN_SELECTION] && g_reset[id] >= resetarmas[WPN_SELECTION])
  4089. {
  4090. // Store selected weapon id
  4091. WPN_AUTO_PRI = WPN_SELECTION
  4092.  
  4093. // Buy primary weapon
  4094. buy_primary_weapon(id, WPN_AUTO_PRI)
  4095.  
  4096. // Show pistols menu
  4097. show_menu_buy2(id)
  4098. }
  4099. else
  4100. show_menu_buy1(id)
  4101.  
  4102. return PLUGIN_HANDLED;
  4103. }
  4104.  
  4105.  
  4106. // Buy Primary Weapon
  4107. buy_primary_weapon(id, selection)
  4108. {
  4109. // Drop previous weapons
  4110. drop_weapons(id, 1)
  4111. drop_weapons(id, 2)
  4112.  
  4113. // Strip off from weapons
  4114. fm_strip_user_weapons(id)
  4115. fm_give_item(id, "weapon_knife")
  4116.  
  4117. // Get weapon index
  4118. static weaponid
  4119. weaponid = get_weaponid(g_primary_items[selection])
  4120.  
  4121. // Give the new weapon
  4122. fm_give_item(id, g_primary_items[selection])
  4123. fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
  4124.  
  4125. // Weapons bought
  4126. g_canbuy[id] = false
  4127.  
  4128. }
  4129.  
  4130. // Buy Menu 2
  4131. public menu_buy2(id, key)
  4132. {
  4133. // Zombies or survivors get no guns
  4134. if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
  4135. return PLUGIN_HANDLED;
  4136.  
  4137. // Special keys / weapon list exceeded
  4138. if (key >= sizeof g_secondary_items)
  4139. {
  4140. // Toggle autoselect
  4141. if (key == MENU_KEY_AUTOSELECT)
  4142. WPN_AUTO_ON = 1 - WPN_AUTO_ON
  4143.  
  4144. // Reshow menu unless user exited
  4145. if (key != MENU_KEY_EXIT)
  4146. show_menu_buy2(id)
  4147.  
  4148. return PLUGIN_HANDLED;
  4149. }
  4150.  
  4151. // Store selected weapon
  4152. WPN_AUTO_SEC = key
  4153.  
  4154. // Drop secondary gun again, in case we picked another (bugfix)
  4155. drop_weapons(id, 2)
  4156.  
  4157. // Get weapon index
  4158. static weaponid
  4159. weaponid = get_weaponid(g_secondary_items[key])
  4160.  
  4161. // Give the new weapon with full ammo
  4162. fm_give_item(id, g_secondary_items[key])
  4163. fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
  4164.  
  4165. show_menu_granades(id)
  4166. if (g_humanclassnext[id] == HCLASS_NONE && get_pcvar_num(cvar_hclasses))
  4167. set_task(5.0, "show_menu_hclass", id)
  4168.  
  4169. return PLUGIN_HANDLED;
  4170. }
  4171.  
  4172. // Extra Items Menu
  4173. public menu_extras(id, key)
  4174. {
  4175. // Nemesis or Survivor shouldnt get extra items
  4176. if (g_survivor[id] || g_nemesis[id] || !is_user_alive(id))
  4177. {
  4178. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4179. return PLUGIN_HANDLED;
  4180. }
  4181.  
  4182. // Special keys / items list exceeded
  4183. if (key >= MENU_KEY_BACK || EXTRAS_SELECTION >= g_extraitem_i)
  4184. {
  4185. switch (key)
  4186. {
  4187. case MENU_KEY_BACK: // back
  4188. {
  4189. if (EXTRAS_STARTID-7 >= 0) EXTRAS_STARTID -= 7
  4190. }
  4191. case MENU_KEY_NEXT: // next
  4192. {
  4193. if (EXTRAS_STARTID+7 < g_extraitem_i) EXTRAS_STARTID += 7
  4194. }
  4195. case MENU_KEY_EXIT: // exit
  4196. {
  4197. return PLUGIN_HANDLED;
  4198. }
  4199. }
  4200.  
  4201. // Show extra items menu again
  4202. show_menu_extras(id)
  4203. return PLUGIN_HANDLED;
  4204. }
  4205.  
  4206. // Try to buy the item
  4207. buy_extra_item(id, EXTRAS_SELECTION);
  4208.  
  4209. return PLUGIN_HANDLED;
  4210. }
  4211.  
  4212. // Buy Extra Item
  4213. buy_extra_item(id, itemid)
  4214. {
  4215. // Check for human only items
  4216. if (g_zombie[id] && g_extraitem_team[itemid] == ZP_TEAM_HUMAN)
  4217. {
  4218. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_HUMAN_ONLY")
  4219. return;
  4220. }
  4221.  
  4222. // Check for zombie only items
  4223. if (!g_zombie[id] && g_extraitem_team[itemid] == ZP_TEAM_ZOMBIE)
  4224. {
  4225. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_ZOMBIE_ONLY")
  4226. return;
  4227. }
  4228.  
  4229. // Check for unavailable items
  4230. 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)))
  4231. {
  4232. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4233. return;
  4234. }
  4235.  
  4236. // Check for hard coded items with special conditions
  4237. if ((itemid == EXTRA_ANTIDOTE && (g_endround || g_swarmround || g_armagedonround || 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)))
  4238. {
  4239. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_CANTUSE")
  4240. return;
  4241. }
  4242.  
  4243. // Check that we have enough ammo packs
  4244. if (g_ammopacks[id] < g_extraitem_cost[itemid] * g_level[id])
  4245. {
  4246. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "NOT_ENOUGH_AMMO")
  4247. return;
  4248. }
  4249.  
  4250. // Deduce item cost
  4251. update_ap(id, 0 - g_extraitem_cost[itemid] * g_level[id], 0)
  4252.  
  4253. // Check which kind of item we're buying
  4254. switch (itemid)
  4255. {
  4256. case EXTRA_NVISION: // Night Vision
  4257. {
  4258. if (!is_user_bot(id))
  4259. {
  4260. g_nvision[id] = true
  4261. g_nvisionenabled[id] = true
  4262.  
  4263. // Custom nvg?
  4264. if (get_pcvar_num(cvar_cnvg))
  4265. {
  4266. remove_task(id+TASK_NVISION)
  4267. set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
  4268. }
  4269. else
  4270. set_user_gnvision(id, 1)
  4271. }
  4272. else
  4273. fm_set_bot_nvg(id, 1)
  4274. }
  4275. case EXTRA_ANTIDOTE: // Antidote
  4276. {
  4277. humanme(id, 0)
  4278. }
  4279. case EXTRA_MADNESS: // Zombie Madness
  4280. {
  4281. g_nodamage[id] = true
  4282. zombie_aura(id+TASK_BLOOD)
  4283. engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_madness[random_num(0, sizeof zombie_madness - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  4284. set_task(get_pcvar_float(cvar_madnessduration), "madness_over", id+TASK_BLOOD)
  4285. }
  4286. case EXTRA_INFBOMB: // Infection Bomb
  4287. {
  4288. // Increase infection bomb purchase count for this round
  4289. g_infbombcounter++
  4290.  
  4291. // Already own one
  4292. if (user_has_weapon(id, CSW_HEGRENADE))
  4293. {
  4294. // Increase BP ammo on it instead
  4295. fm_set_user_bpammo(id, CSW_HEGRENADE, fm_get_user_bpammo(id, CSW_HEGRENADE) + 1)
  4296.  
  4297. // Flash ammo in hud
  4298. message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
  4299. write_byte(AMMOID[CSW_HEGRENADE]) // ammo id
  4300. write_byte(1) // ammo amount
  4301. message_end()
  4302.  
  4303. // Play clip purchase sound
  4304. engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  4305.  
  4306. return; // stop here
  4307. }
  4308.  
  4309. // Give weapon to the player
  4310. fm_give_item(id, "weapon_hegrenade")
  4311. }
  4312. case EXTRA_WEAPONS_STARTID .. EXTRAS_CUSTOM_STARTID-1: // Weapons
  4313. {
  4314. // Get weapon index
  4315. static weaponid
  4316. weaponid = get_weaponid(g_extra_items[itemid-4])
  4317.  
  4318. // If we are giving a primary/secondary weapon
  4319. if (MAXBPAMMO[weaponid] > 2)
  4320. {
  4321. // Make user drop the previous one
  4322. if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
  4323. drop_weapons(id, 1)
  4324. else
  4325. drop_weapons(id, 2)
  4326.  
  4327. // Give full BP ammo for the new one
  4328. fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
  4329. }
  4330. // If we are giving a grenade which the user already owns
  4331. else if (user_has_weapon(id, weaponid))
  4332. {
  4333. // Increase BP ammo on it instead
  4334. fm_set_user_bpammo(id, weaponid, fm_get_user_bpammo(id, weaponid) + 1)
  4335.  
  4336. // Flash ammo in hud
  4337. message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
  4338. write_byte(AMMOID[weaponid]) // ammo id
  4339. write_byte(1) // ammo amount
  4340. message_end()
  4341.  
  4342. // Play clip purchase sound
  4343. engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  4344.  
  4345. return; // stop here
  4346. }
  4347.  
  4348. // Give weapon to the player
  4349. fm_give_item(id, g_extra_items[itemid-4])
  4350. }
  4351. default: // Custom additions
  4352. {
  4353. // Item selected forward
  4354. ExecuteForward(g_fwExtraItemSelected, g_fwDummyResult, id, itemid);
  4355. }
  4356. }
  4357. }
  4358.  
  4359. // Zombie Class Menu
  4360. public menu_zclass(id, key)
  4361. {
  4362. // Special keys / items list exceeded
  4363. if (key >= MENU_KEY_BACK || ZCLASSES_SELECTION >= g_zclass_i)
  4364. {
  4365. switch (key)
  4366. {
  4367. case MENU_KEY_BACK: // back
  4368. {
  4369. if (ZCLASSES_STARTID-6 >= 0) ZCLASSES_STARTID -= 6
  4370. }
  4371. case MENU_KEY_NEXT: // next
  4372. {
  4373. if (ZCLASSES_STARTID+6 < g_zclass_i) ZCLASSES_STARTID += 6
  4374. }
  4375. case MENU_KEY_EXIT: // exit
  4376. {
  4377. return PLUGIN_HANDLED;
  4378. }
  4379. }
  4380.  
  4381. // Show extra items menu again
  4382. show_menu_zclass(id)
  4383. return PLUGIN_HANDLED;
  4384. }
  4385.  
  4386. if (g_level[id] >= g_zclass_lvl[ZCLASSES_SELECTION])
  4387. {
  4388. // Store selection for the next infection
  4389. g_zombieclassnext[id] = ZCLASSES_SELECTION;
  4390.  
  4391. // Show selected zombie class info and stats
  4392. zp_colored_print(id, "^x04[ZP]^x01 %L: %s", id, "ZOMBIE_SELECT", g_zclass_name[g_zombieclassnext[id]])
  4393. 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]],
  4394. id, "ZOMBIE_ATTRIB3", floatround(g_zclass_grav[g_zombieclassnext[id]]*800), id, "ZOMBIE_ATTRIB4", floatround(g_zclass_kb[g_zombieclassnext[id]]*100))
  4395. }
  4396. else
  4397. {
  4398. 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])
  4399. return PLUGIN_HANDLED;
  4400. }
  4401.  
  4402. return PLUGIN_HANDLED;
  4403. }
  4404.  
  4405. // Human Class Menu
  4406. public menu_hclass(id, key)
  4407. {
  4408. // Special keys / items list exceeded
  4409. if (key >= MENU_KEY_BACK || HCLASSES_SELECTION >= g_hclass_i)
  4410. {
  4411. switch (key)
  4412. {
  4413. case MENU_KEY_BACK: // back
  4414. {
  4415. if (HCLASSES_STARTID-6 >= 0) HCLASSES_STARTID -= 6
  4416. }
  4417. case MENU_KEY_NEXT: // next
  4418. {
  4419. if (HCLASSES_STARTID+6 < g_hclass_i) HCLASSES_STARTID += 6
  4420. }
  4421. case MENU_KEY_EXIT: // exit
  4422. {
  4423. return PLUGIN_HANDLED;
  4424. }
  4425. }
  4426.  
  4427. // Show extra items menu again
  4428. show_menu_hclass(id)
  4429. return PLUGIN_HANDLED;
  4430. }
  4431.  
  4432. if (g_level[id] >= g_hclass_lvl[HCLASSES_SELECTION])
  4433. {
  4434. // Store selection for the next infection
  4435. g_humanclassnext[id] = HCLASSES_SELECTION;
  4436.  
  4437. // Show selected zombie class info and stats
  4438. zp_colored_print(id, "^x04[ZP]^x01 %L: %s", id, "HUMAN_SELECT", g_hclass_name[g_humanclassnext[id]])
  4439. 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]],
  4440. id, "HUMAN_ATTRIB3", floatround(g_hclass_grav[g_humanclassnext[id]]*800))
  4441. }
  4442. else
  4443. {
  4444. 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])
  4445. return PLUGIN_HANDLED;
  4446. }
  4447.  
  4448. return PLUGIN_HANDLED;
  4449. }
  4450.  
  4451. // Info Menu
  4452. public menu_info(id, key)
  4453. {
  4454. static motd[1000], len
  4455. len = 0
  4456.  
  4457. switch (key)
  4458. {
  4459. case 0: // General
  4460. {
  4461. static weather, lights[2]
  4462. weather = 0
  4463.  
  4464. // Get light style
  4465. get_pcvar_string(cvar_lighting, lights, sizeof lights - 1)
  4466. strtolower(lights)
  4467.  
  4468. len += formatex(motd[len], sizeof motd - 1 - len, "%L ", id, "MOTD_INFO11", "Zombie Plague", PLUGIN_VERSION, "Alan<3")
  4469. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO12")
  4470. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_A")
  4471.  
  4472. #if defined AMBIENCE_FOG
  4473. len += formatex(motd[len], sizeof motd - 1 - len, (weather < 1) ? " %L" : ". %L", id, "MOTD_FOG")
  4474. weather++
  4475. #endif
  4476. #if defined AMBIENCE_RAIN
  4477. len += formatex(motd[len], sizeof motd - 1 - len, (weather < 1) ? " %L" : ". %L", id, "MOTD_RAIN")
  4478. weather++
  4479. #endif
  4480. #if defined AMBIENCE_SNOW
  4481. len += formatex(motd[len], sizeof motd - 1 - len, (weather < 1) ? " %L" : ". %L", id, "MOTD_SNOW")
  4482. weather++
  4483. #endif
  4484. if (weather < 1) len += formatex(motd[len], sizeof motd - 1 - len, " %L", id, "MOTD_DISABLED")
  4485.  
  4486. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_B", lights)
  4487. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_C", id, get_pcvar_num(cvar_triggered) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4488. 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))
  4489. 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")
  4490. 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")
  4491. if (get_pcvar_num(cvar_deathmatch)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_G", get_pcvar_num(cvar_spawnprotection))
  4492. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_H", id, get_pcvar_num(cvar_randspawn) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4493. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_I", id, get_pcvar_num(cvar_extraitems) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4494. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_J", id, get_pcvar_num(cvar_zclasses) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4495. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_K", id, get_pcvar_num(cvar_cnvg) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4496. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_L", id, get_pcvar_num(cvar_cflash) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4497.  
  4498. show_motd(id, motd)
  4499. }
  4500. case 1: // Humans
  4501. {
  4502. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2")
  4503. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_A", g_hclass_hp[0])
  4504. 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))
  4505. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_C", g_hclass_spd[0])
  4506. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_D", floatround(g_hclass_grav[0]*800))
  4507. 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")
  4508. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_F", get_pcvar_num(cvar_ammodamage))
  4509. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_G", id, get_pcvar_num(cvar_firegrenades) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4510. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_H", id, get_pcvar_num(cvar_frostgrenades) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4511. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_I", id, get_pcvar_num(cvar_flaregrenades) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4512. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_J", id, get_pcvar_num(cvar_knockback) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4513.  
  4514. show_motd(id, motd)
  4515. }
  4516. case 2: // Zombies
  4517. {
  4518. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3")
  4519. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_A", g_zclass_hp[0])
  4520. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_B", floatround(g_zclass_hp[0]*get_pcvar_float(cvar_zombiefirsthp)))
  4521. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_C", floatround(get_pcvar_float(cvar_zombiearmor)*100))
  4522. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_D", g_zclass_spd[0])
  4523. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_E", floatround(g_zclass_grav[0]*800))
  4524. if (get_pcvar_num(cvar_zombiebonushp)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_F", get_pcvar_num(cvar_zombiebonushp))
  4525. 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")
  4526. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_H", id, get_pcvar_num(cvar_zombiebleeding) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4527. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_I", get_pcvar_num(cvar_ammoinfect))
  4528.  
  4529. show_motd(id, motd)
  4530. }
  4531. case 3: // Gameplay Modes
  4532. {
  4533. static nemhp[5], survhp[5]
  4534.  
  4535. // Get nemesis and survivor health
  4536. num_to_str(get_pcvar_num(cvar_nemhp), nemhp, sizeof nemhp - 1)
  4537. num_to_str(get_pcvar_num(cvar_survhp), survhp, sizeof survhp - 1)
  4538.  
  4539. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4")
  4540. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_A", id, get_pcvar_num(cvar_nem) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4541. if (get_pcvar_num(cvar_nem)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_B", get_pcvar_num(cvar_nemchance))
  4542. 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]")
  4543. if (get_pcvar_num(cvar_nem)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_D", get_pcvar_num(cvar_nemspd))
  4544. 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))
  4545. 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")
  4546. 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")
  4547. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_H", id, get_pcvar_num(cvar_surv) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4548. if (get_pcvar_num(cvar_surv)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_I", get_pcvar_num(cvar_survchance))
  4549. 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]")
  4550. if (get_pcvar_num(cvar_surv)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_K", get_pcvar_num(cvar_survspd))
  4551. 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))
  4552. 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")
  4553. 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")
  4554. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_O", id, get_pcvar_num(cvar_swarm) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4555. if (get_pcvar_num(cvar_swarm)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_P", get_pcvar_num(cvar_swarmchance))
  4556. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_Q", id, get_pcvar_num(cvar_multi) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4557. if (get_pcvar_num(cvar_multi)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_R", get_pcvar_num(cvar_multichance))
  4558. 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))
  4559. len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_T", id, get_pcvar_num(cvar_plague) ? "MOTD_ENABLED" : "MOTD_DISABLED")
  4560. if (get_pcvar_num(cvar_plague)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_U", get_pcvar_num(cvar_plaguechance))
  4561. 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))
  4562.  
  4563. show_motd(id, motd)
  4564. }
  4565. default: return PLUGIN_HANDLED;
  4566. }
  4567.  
  4568. // Show help menu again if user wishes to read another topic
  4569. set_task(0.2, "show_menu_info", id);
  4570.  
  4571. return PLUGIN_HANDLED;
  4572. }
  4573.  
  4574. // Admin Menu
  4575. public menu_admin(id, key)
  4576. {
  4577. switch (key)
  4578. {
  4579. case 0: // Zombiefy/Humanize command
  4580. {
  4581. if (g_endround || g_swarmround || g_nemround || g_survround || g_plagueround || task_exists(TASK_WELCOMEMSG))
  4582. {
  4583. // Not available
  4584. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4585. show_menu_admin(id)
  4586. }
  4587. else
  4588. {
  4589. // Show player list for admin to pick a target
  4590. PL_ACTION = key
  4591. show_menu_player_list(id)
  4592. }
  4593. }
  4594. case 1: // Nemesis command
  4595. {
  4596. if (g_endround || !g_newround || !get_pcvar_num(cvar_nem) || task_exists(TASK_WELCOMEMSG))
  4597. {
  4598. // Not available
  4599. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4600. show_menu_admin(id)
  4601. }
  4602. else
  4603. {
  4604. // Show player list for admin to pick a target
  4605. PL_ACTION = key
  4606. show_menu_player_list(id)
  4607. }
  4608. }
  4609. case 2: // Survivor command
  4610. {
  4611. if (g_endround || !g_newround || !get_pcvar_num(cvar_surv) || task_exists(TASK_WELCOMEMSG))
  4612. {
  4613. // Not available
  4614. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4615. show_menu_admin(id)
  4616. }
  4617. else
  4618. {
  4619. // Show player list for admin to pick a target
  4620. PL_ACTION = key
  4621. show_menu_player_list(id)
  4622. }
  4623. }
  4624. case 3: // Respawn command
  4625. {
  4626. if (g_endround || g_survround || g_swarmround || g_nemround || g_plagueround)
  4627. {
  4628. // Not available
  4629. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4630. show_menu_admin(id)
  4631. }
  4632. else
  4633. {
  4634. // Show player list for admin to pick a target
  4635. PL_ACTION = key
  4636. show_menu_player_list(id)
  4637. }
  4638. }
  4639. case 4: // Swarm Mode command
  4640. {
  4641. if (allowed_swarm())
  4642. command_swarm(id)
  4643. else
  4644. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4645.  
  4646. show_menu_admin(id)
  4647. }
  4648. case 5: // Multiple Infection command
  4649. {
  4650. if (allowed_multi())
  4651. command_multi(id)
  4652. else
  4653. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4654.  
  4655. show_menu_admin(id)
  4656. }
  4657. case 6: // Plague Mode command
  4658. {
  4659. if (allowed_plague())
  4660. command_plague(id)
  4661. else
  4662. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4663.  
  4664. show_menu_admin(id)
  4665. }
  4666. case 7: // Armagedon Mode command
  4667. {
  4668. if (allowed_armagedon())
  4669. command_armagedon(id)
  4670. else
  4671. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4672.  
  4673. show_menu_admin(id)
  4674. }
  4675.  
  4676. }
  4677.  
  4678. return PLUGIN_HANDLED;
  4679. }
  4680.  
  4681. // Player List Menu
  4682. public menu_player_list(id, key)
  4683. {
  4684. switch (key)
  4685. {
  4686. case MENU_KEY_BACK: // back
  4687. {
  4688. if (PL_STARTID-7 >= 0) PL_STARTID -= 7
  4689. }
  4690. case MENU_KEY_NEXT: // next
  4691. {
  4692. if (PL_STARTID+7 < g_maxplayers) PL_STARTID += 7
  4693. }
  4694. case MENU_KEY_EXIT: // go back to admin menu
  4695. {
  4696. show_menu_admin(id);
  4697. return PLUGIN_HANDLED
  4698. }
  4699. default: // perform action on player
  4700. {
  4701. // Make sure it's connected
  4702. if (is_user_connected(PL_SELECTION))
  4703. {
  4704. // Perform the right action if allowed
  4705. switch (PL_ACTION)
  4706. {
  4707. case 0:
  4708. {
  4709. if (g_zombie[PL_SELECTION])
  4710. {
  4711. if (allowed_human(PL_SELECTION))
  4712. command_human(id, PL_SELECTION)
  4713. else
  4714. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4715. }
  4716. else
  4717. {
  4718. if (allowed_zombie(PL_SELECTION))
  4719. command_zombie(id, PL_SELECTION)
  4720. else
  4721. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4722. }
  4723. }
  4724. case 1:
  4725. {
  4726. if (allowed_nemesis(PL_SELECTION))
  4727. command_nemesis(id, PL_SELECTION)
  4728. else
  4729. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4730. }
  4731. case 2:
  4732. {
  4733. if (allowed_survivor(PL_SELECTION))
  4734. command_survivor(id, PL_SELECTION)
  4735. else
  4736. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4737. }
  4738. case 3:
  4739. {
  4740. if (allowed_respawn(PL_SELECTION))
  4741. command_respawn(id, PL_SELECTION)
  4742. else
  4743. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4744. }
  4745. }
  4746. }
  4747. else
  4748. {
  4749. zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
  4750. }
  4751. }
  4752. }
  4753.  
  4754. show_menu_player_list(id)
  4755. return PLUGIN_HANDLED;
  4756. }
  4757.  
  4758. public menu_registro(id, key)
  4759. {
  4760. static szData[512]
  4761.  
  4762. switch (key)
  4763. {
  4764. case 0:
  4765. {
  4766. if (!fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  4767. {
  4768. client_cmd(id, "messagemode Create_Password")
  4769. set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
  4770. ShowSyncHudMsg(id, g_MsgSync3, "Enter a new password^nPress ESC to exit")
  4771. }
  4772. else
  4773. {
  4774. zp_colored_print(id, "^x04[ZP]^x01 You cannot use this option.")
  4775. show_menu_registro(id)
  4776. }
  4777. }
  4778. case 1:
  4779. {
  4780. if (fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  4781. {
  4782. client_cmd(id, "messagemode Login_Password")
  4783. set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
  4784. ShowSyncHudMsg(id, g_MsgSync3, "Enter your password^nPress ESC to exit.")
  4785. }
  4786. else
  4787. {
  4788. zp_colored_print(id, "^x04[ZP]^x01 You cannot use this option.")
  4789. show_menu_registro(id)
  4790. }
  4791. }
  4792. }
  4793.  
  4794. return PLUGIN_HANDLED;
  4795. }
  4796.  
  4797. /*================================================================================
  4798. [Admin Commands]
  4799. =================================================================================*/
  4800.  
  4801. // zp_toggle [1/0]
  4802. public cmd_toggle(id, level, cid)
  4803. {
  4804. // Check for access flag
  4805. if (!cmd_access(id, level, cid, 2))
  4806. return PLUGIN_HANDLED;
  4807.  
  4808. // Retrieve arguments
  4809. new arg[2]
  4810. read_argv(1, arg, sizeof arg - 1)
  4811.  
  4812. // Mod already enabled/disabled
  4813. if (str_to_num(arg) == g_pluginenabled)
  4814. return PLUGIN_HANDLED;
  4815.  
  4816. // Set the toggle cvar
  4817. set_pcvar_num(cvar_toggle, str_to_num(arg))
  4818.  
  4819. // Retrieve map name
  4820. new mapname[32]
  4821. get_mapname(mapname, sizeof mapname - 1)
  4822.  
  4823. // Restart current map
  4824. server_cmd("changelevel %s", mapname)
  4825.  
  4826. return PLUGIN_HANDLED;
  4827. }
  4828.  
  4829. // zp_zombie [target]
  4830. public cmd_zombie(id, level, cid)
  4831. {
  4832. // Check for access flag
  4833. if (!cmd_access(id, level, cid, 2))
  4834. return PLUGIN_HANDLED;
  4835.  
  4836. // Retrieve arguments
  4837. static arg[32], player
  4838. read_argv(1, arg, sizeof arg - 1)
  4839. player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
  4840.  
  4841. // Invalid target
  4842. if (!player) return PLUGIN_HANDLED;
  4843.  
  4844. // Target not allowed to be zombie
  4845. if (!allowed_zombie(player))
  4846. {
  4847. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4848. return PLUGIN_HANDLED
  4849. }
  4850.  
  4851. command_zombie(id, player)
  4852.  
  4853. return PLUGIN_HANDLED;
  4854. }
  4855.  
  4856. // zp_human [target]
  4857. public cmd_human(id, level, cid)
  4858. {
  4859. // Check for access flag
  4860. if (!cmd_access(id, level, cid, 2))
  4861. return PLUGIN_HANDLED;
  4862.  
  4863. // Retrieve arguments
  4864. static arg[32], player
  4865. read_argv(1, arg, sizeof arg - 1)
  4866. player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
  4867.  
  4868. // Invalid target
  4869. if (!player) return PLUGIN_HANDLED;
  4870.  
  4871. // Target not allowed to be human
  4872. if (!allowed_human(player))
  4873. {
  4874. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4875. return PLUGIN_HANDLED;
  4876. }
  4877.  
  4878. command_human(id, player)
  4879.  
  4880. return PLUGIN_HANDLED;
  4881. }
  4882.  
  4883. // zp_survivor [target]
  4884. public cmd_survivor(id, level, cid)
  4885. {
  4886. // Check for access flag
  4887. if (!cmd_access(id, level, cid, 2))
  4888. return PLUGIN_HANDLED;
  4889.  
  4890. // Retrieve arguments
  4891. static arg[32], player
  4892. read_argv(1, arg, sizeof arg - 1)
  4893. player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
  4894.  
  4895. // Invalid target
  4896. if (!player) return PLUGIN_HANDLED;
  4897.  
  4898. // Target not allowed to be survivor
  4899. if (!allowed_survivor(player))
  4900. {
  4901. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4902. return PLUGIN_HANDLED;
  4903. }
  4904.  
  4905. command_survivor(id, player)
  4906.  
  4907. return PLUGIN_HANDLED;
  4908. }
  4909.  
  4910. // zp_nemesis [target]
  4911. public cmd_nemesis(id, level, cid)
  4912. {
  4913. // Check for access flag
  4914. if (!cmd_access(id, level, cid, 2))
  4915. return PLUGIN_HANDLED;
  4916.  
  4917. // Retrieve arguments
  4918. static arg[32], player
  4919. read_argv(1, arg, sizeof arg - 1)
  4920. player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
  4921.  
  4922. // Invalid target
  4923. if (!player) return PLUGIN_HANDLED;
  4924.  
  4925. // Target not allowed to be nemesis
  4926. if (!allowed_nemesis(player))
  4927. {
  4928. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4929. return PLUGIN_HANDLED;
  4930. }
  4931.  
  4932. command_nemesis(id, player)
  4933.  
  4934. return PLUGIN_HANDLED;
  4935. }
  4936.  
  4937. // zp_respawn [target]
  4938. public cmd_respawn(id, level, cid)
  4939. {
  4940. // Check for access flag
  4941. if (!cmd_access(id, level, cid, 2))
  4942. return PLUGIN_HANDLED;
  4943.  
  4944. // Retrieve arguments
  4945. static arg[32], player
  4946. read_argv(1, arg, sizeof arg - 1)
  4947. player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
  4948.  
  4949. // Invalid target
  4950. if (!player) return PLUGIN_HANDLED;
  4951.  
  4952. // Target not allowed to be respawned
  4953. if (!allowed_respawn(player))
  4954. {
  4955. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4956. return PLUGIN_HANDLED;
  4957. }
  4958.  
  4959. command_respawn(id, player)
  4960.  
  4961. return PLUGIN_HANDLED;
  4962. }
  4963.  
  4964. // zp_swarm
  4965. public cmd_swarm(id, level, cid)
  4966. {
  4967. // Check for access flag
  4968. if (!cmd_access(id, level, cid, 1))
  4969. return PLUGIN_HANDLED;
  4970.  
  4971. // Swarm mode not allowed
  4972. if (!allowed_swarm())
  4973. {
  4974. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4975. return PLUGIN_HANDLED;
  4976. }
  4977.  
  4978. command_swarm(id)
  4979.  
  4980. return PLUGIN_HANDLED;
  4981. }
  4982.  
  4983. // zp_armagedon
  4984. public cmd_armagedon(id, level, cid)
  4985. {
  4986. // Check for access flag
  4987. if (!cmd_access(id, level, cid, 1))
  4988. return PLUGIN_HANDLED;
  4989.  
  4990. // Swarm mode not allowed
  4991. if (!allowed_armagedon())
  4992. {
  4993. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  4994. return PLUGIN_HANDLED;
  4995. }
  4996.  
  4997. command_armagedon(id)
  4998.  
  4999. return PLUGIN_HANDLED;
  5000. }
  5001.  
  5002.  
  5003. // zp_multi
  5004. public cmd_multi(id, level, cid)
  5005. {
  5006. // Check for access flag
  5007. if (!cmd_access(id, level, cid, 1))
  5008. return PLUGIN_HANDLED;
  5009.  
  5010. // Multi infection mode not allowed
  5011. if (!allowed_multi())
  5012. {
  5013. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  5014. return PLUGIN_HANDLED;
  5015. }
  5016.  
  5017. command_multi(id)
  5018.  
  5019. return PLUGIN_HANDLED;
  5020. }
  5021.  
  5022. // zp_plague
  5023. public cmd_plague(id, level, cid)
  5024. {
  5025. // Check for access flag
  5026. if (!cmd_access(id, level, cid, 1))
  5027. return PLUGIN_HANDLED;
  5028.  
  5029. // Plague mode not allowed
  5030. if (!allowed_plague())
  5031. {
  5032. client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
  5033. return PLUGIN_HANDLED;
  5034. }
  5035.  
  5036. command_plague(id)
  5037.  
  5038. return PLUGIN_HANDLED;
  5039. }
  5040.  
  5041. /*================================================================================
  5042. [Message Hooks]
  5043. =================================================================================*/
  5044.  
  5045. // Current Weapon info
  5046. public message_cur_weapon(msg_id, msg_dest, msg_entity)
  5047. {
  5048. // Player not alive or not an active weapon
  5049. if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
  5050. return;
  5051.  
  5052. // Get weapon id
  5053. static weapon
  5054. weapon = get_msg_arg_int(2)
  5055.  
  5056. // Store weapon id for reference
  5057. g_currentweapon[msg_entity] = weapon
  5058.  
  5059. // Replace weapon models with custom ones
  5060. replace_models(msg_entity)
  5061.  
  5062. // Unlimited Clip Ammo?
  5063. if (MAXBPAMMO[weapon] > 2 && (g_survivor[msg_entity] || get_pcvar_num(cvar_infammo) > 1))
  5064. {
  5065. // Refill when it's running out
  5066. if (get_msg_arg_int(3) < 7)
  5067. {
  5068. // Get weapon entity
  5069. static wname[32], weapon_ent
  5070. get_weaponname(weapon, wname, sizeof wname - 1)
  5071. weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
  5072.  
  5073. // Max out clip ammo
  5074. fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
  5075. }
  5076.  
  5077. // HUD should show full clip all the time
  5078. set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon])
  5079. }
  5080. }
  5081.  
  5082. // BP Ammo update
  5083. public message_ammo_x(msg_id, msg_dest, msg_entity)
  5084. {
  5085. // Get ammo type
  5086. static type
  5087. type = get_msg_arg_int(1)
  5088.  
  5089. // Unknown ammo type
  5090. if (type >= sizeof AMMOWEAPON) return;
  5091.  
  5092. // Get weapon id
  5093. static weapon
  5094. weapon = AMMOWEAPON[type]
  5095.  
  5096. // Primary and secondary only
  5097. if (MAXBPAMMO[weapon] > 2)
  5098. {
  5099. // Get ammo amount
  5100. static amount
  5101. amount = get_msg_arg_int(2)
  5102.  
  5103. // Unlimited BP Ammo?
  5104. if (g_survivor[msg_entity] || get_pcvar_num(cvar_infammo))
  5105. {
  5106. if (amount < MAXBPAMMO[weapon])
  5107. {
  5108. fm_set_user_bpammo(msg_entity, weapon, MAXBPAMMO[weapon])
  5109. set_msg_arg_int(2, get_msg_argtype(2), MAXBPAMMO[weapon])
  5110. }
  5111. }
  5112. // Bots automatically buy ammo when needed
  5113. else if (!g_zombie[msg_entity] && !g_survivor[msg_entity] && g_ammopacks[msg_entity] > 0 && amount <= BUYAMMO[weapon] && is_user_bot(msg_entity))
  5114. clcmd_buyammo(msg_entity);
  5115. }
  5116. }
  5117.  
  5118. // Take off player's money
  5119. public message_money(msg_id, msg_dest, msg_entity)
  5120. {
  5121. // Remove money setting enabled?
  5122. if (!get_pcvar_num(cvar_removemoney))
  5123. return PLUGIN_CONTINUE;
  5124.  
  5125. set_pdata_int(msg_entity, OFFSET_CSMONEY, 0, OFFSET_LINUX)
  5126. return PLUGIN_HANDLED;
  5127. }
  5128.  
  5129. // Fix for the HL engine bug when HP is multiples of 256
  5130. public message_health(msg_id, msg_dest, msg_entity)
  5131. {
  5132. // Get player's health
  5133. static health
  5134. health = get_msg_arg_int(1)
  5135.  
  5136. // Don't bother
  5137. if (health < 256) return;
  5138.  
  5139. // Check if we need to fix it
  5140. if (health % 256 == 0)
  5141. fm_set_user_health(msg_entity, pev(msg_entity, pev_health)+1)
  5142.  
  5143. // HUD can only show as much as 255 hp
  5144. set_msg_arg_int(1, get_msg_argtype(1), 255)
  5145. }
  5146.  
  5147. // Block flashlight battery messages when it's not available, or if custom flashlight is enabled instead
  5148. public message_flashbat(msg_id, msg_dest, msg_entity)
  5149. {
  5150. if (g_zombie[msg_entity] || g_survivor[msg_entity] || get_pcvar_num(cvar_cflash) || !is_user_alive(msg_entity))
  5151. return PLUGIN_HANDLED;
  5152.  
  5153. return PLUGIN_CONTINUE;
  5154. }
  5155.  
  5156. // Flashbangs should only affect zombies
  5157. public message_screenfade(msg_id, msg_dest, msg_entity)
  5158. {
  5159. 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)
  5160. return PLUGIN_CONTINUE;
  5161.  
  5162. // Nemesis shouldn't be FBed
  5163. if (g_zombie[msg_entity] && !g_nemesis[msg_entity])
  5164. {
  5165. // Set flash color to nighvision's
  5166. set_msg_arg_int(4, get_msg_argtype(4), get_pcvar_num(cvar_nvgcolor[0]))
  5167. set_msg_arg_int(5, get_msg_argtype(5), get_pcvar_num(cvar_nvgcolor[1]))
  5168. set_msg_arg_int(6, get_msg_argtype(6), get_pcvar_num(cvar_nvgcolor[2]))
  5169. return PLUGIN_CONTINUE;
  5170. }
  5171.  
  5172. return PLUGIN_HANDLED;
  5173. }
  5174.  
  5175. // Prevent spectators' nightvision from being turned off when switching targets, etc.
  5176. public message_nvgtoggle(msg_id, msg_dest, msg_entity)
  5177. {
  5178. return PLUGIN_HANDLED;
  5179. }
  5180.  
  5181. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  5182. // Set correct model on player corpses
  5183. public message_clcorpse()
  5184. {
  5185. set_msg_arg_string(1, g_playermodel[get_msg_arg_int(12)])
  5186. }
  5187. #endif
  5188.  
  5189. // Prevent zombies from seeing any weapon pickup icon
  5190. public message_weappickup(msg_id, msg_dest, msg_entity)
  5191. {
  5192. if (g_zombie[msg_entity])
  5193. return PLUGIN_HANDLED;
  5194.  
  5195. return PLUGIN_CONTINUE;
  5196. }
  5197.  
  5198. // Prevent zombies from seeing any ammo pickup icon
  5199. public message_ammopickup(msg_id, msg_dest, msg_entity)
  5200. {
  5201. if (g_zombie[msg_entity])
  5202. return PLUGIN_HANDLED;
  5203.  
  5204. return PLUGIN_CONTINUE;
  5205. }
  5206.  
  5207. // Block hostage HUD display
  5208. public message_scenario()
  5209. {
  5210. if (get_msg_args() > 1)
  5211. {
  5212. static sprite[8]
  5213. get_msg_arg_string(2, sprite, sizeof sprite - 1)
  5214.  
  5215. if (equal(sprite, "hostage"))
  5216. return PLUGIN_HANDLED;
  5217. }
  5218.  
  5219. return PLUGIN_CONTINUE;
  5220. }
  5221.  
  5222. // Block hostages from appearing on radar
  5223. public message_hostagepos()
  5224. {
  5225. return PLUGIN_HANDLED;
  5226. }
  5227.  
  5228. // Block some text messages
  5229. public message_textmsg()
  5230. {
  5231. static textmsg[22]
  5232. get_msg_arg_string(2, textmsg, sizeof textmsg - 1);
  5233.  
  5234. // Game restarting, reset scores and call round end to balance the teams
  5235. if (equal(textmsg, "#Game_will_restart_in"))
  5236. {
  5237. g_scorehumans = 0
  5238. g_scorezombies = 0
  5239. logevent_round_end()
  5240. }
  5241. // Block round end related messages
  5242. else if (equal(textmsg, "#Hostages_Not_Rescued") || equal(textmsg, "#Round_Draw") || equal(textmsg, "#Terrorists_Win") || equal(textmsg, "#CTs_Win"))
  5243. {
  5244. return PLUGIN_HANDLED;
  5245. }
  5246.  
  5247. return PLUGIN_CONTINUE;
  5248. }
  5249.  
  5250. // Block CS round win audio messages, since we're playing our own instead
  5251. public message_sendaudio()
  5252. {
  5253. static audio[17]
  5254. get_msg_arg_string(2, audio, sizeof audio - 1)
  5255.  
  5256. if(equal(audio[7], "terwin") || equal(audio[7], "ctwin") || equal(audio[7], "rounddraw"))
  5257. return PLUGIN_HANDLED;
  5258.  
  5259. return PLUGIN_CONTINUE;
  5260. }
  5261.  
  5262. // Send actual team scores (T = zombies // CT = humans)
  5263. public message_teamscore()
  5264. {
  5265. static team[2]
  5266. get_msg_arg_string(1, team, sizeof team - 1)
  5267.  
  5268. switch (team[0])
  5269. {
  5270. // CT
  5271. case 'C': set_msg_arg_int(2, get_msg_argtype(2), g_scorehumans)
  5272. // Terrorist
  5273. case 'T': set_msg_arg_int(2, get_msg_argtype(2), g_scorezombies)
  5274. }
  5275. }
  5276.  
  5277. // Team Switch (or player joining a team for first time)
  5278. public message_teaminfo(msg_id, msg_dest)
  5279. {
  5280. // Only hook global messages
  5281. if (msg_dest != MSG_ALL && msg_dest != MSG_BROADCAST) return;
  5282.  
  5283. // Get player id
  5284. static id
  5285. id = get_msg_arg_int(1)
  5286.  
  5287. // Don't pick up our own TeamInfo messages for this player (bugfix)
  5288. if (g_switchingteam[id]) return;
  5289.  
  5290. // Enable spectators' nightvision if not spawning right away
  5291. set_task(0.2, "spec_nvision", id)
  5292.  
  5293. // Round didn't start yet, nothing to worry about
  5294. if (g_newround) return;
  5295.  
  5296. // Get his new team
  5297. static team[2]
  5298. get_msg_arg_string(2, team, sizeof team - 1)
  5299.  
  5300. switch (team[0])
  5301. {
  5302. case 'C': // CT
  5303. {
  5304. if (g_survround && fnGetHumans()) // survivor alive --> switch to T and spawn as zombie
  5305. {
  5306. g_respawn_as_zombie[id] = true;
  5307. remove_task(id+TASK_TEAM)
  5308. fm_set_user_team(id, CS_TEAM_T)
  5309. set_msg_arg_string(2, "TERRORIST")
  5310. }
  5311. else if (!fnGetZombies()) // no zombies alive --> switch to T and spawn as zombie
  5312. {
  5313. g_respawn_as_zombie[id] = true;
  5314. remove_task(id+TASK_TEAM)
  5315. fm_set_user_team(id, CS_TEAM_T)
  5316. set_msg_arg_string(2, "TERRORIST")
  5317. }
  5318. }
  5319. case 'T': // Terrorist
  5320. {
  5321. if ((g_swarmround || g_survround) && fnGetHumans()) // survivor alive or swarm round w/ humans --> spawn as zombie
  5322. {
  5323. g_respawn_as_zombie[id] = true;
  5324. }
  5325. else if (g_armagedonround && fnGetHumans()) g_respawn_as_zombie[id] = false;
  5326. else if (fnGetZombies()) // zombies alive --> switch to CT
  5327. {
  5328. remove_task(id+TASK_TEAM)
  5329. fm_set_user_team(id, CS_TEAM_CT)
  5330. set_msg_arg_string(2, "CT")
  5331. }
  5332. }
  5333. }
  5334. }
  5335.  
  5336. /*================================================================================
  5337. [Main Functions]
  5338. =================================================================================*/
  5339.  
  5340. // Make Zombie Task
  5341. public make_zombie_task()
  5342. {
  5343. // Call make a zombie with no specific mode
  5344. make_a_zombie(MODE_NONE, 0)
  5345. }
  5346.  
  5347. // Make a Zombie Function
  5348. make_a_zombie(mode, id)
  5349. {
  5350. // Get alive players count
  5351. static iPlayersnum
  5352. iPlayersnum = fnGetAlive()
  5353.  
  5354. // Not enough players, come back later!
  5355. if (iPlayersnum < 1)
  5356. {
  5357. set_task(10.0, "make_zombie_task", TASK_MAKEZOMBIE)
  5358. return;
  5359. }
  5360.  
  5361. #if defined AMBIENCE_SOUNDS
  5362. // Start ambience sounds after a mode begins
  5363. remove_task(TASK_AMBIENCESOUNDS)
  5364. set_task(2.0, "ambience_sound_effects", TASK_AMBIENCESOUNDS)
  5365. #endif
  5366.  
  5367. // Get prevent consecutive modes setting
  5368. static preventconsecutive
  5369. preventconsecutive = get_pcvar_num(cvar_preventconsecutive)
  5370.  
  5371. // Round starting
  5372. g_newround = false
  5373. g_survround = false
  5374. g_nemround = false
  5375. g_swarmround = false
  5376. g_plagueround = false
  5377. g_armagedonround = false
  5378.  
  5379. // Set up some common vars
  5380. static forward_id, name[32], iZombies, iMaxZombies
  5381.  
  5382. if ((mode == MODE_NONE && (!preventconsecutive || g_lastmode != MODE_SURVIVOR) && random_num(1, get_pcvar_num(cvar_survchance)) == get_pcvar_num(cvar_surv) && iPlayersnum >= get_pcvar_num(cvar_survminplayers)) || mode == MODE_SURVIVOR)
  5383. {
  5384. // Survivor Mode
  5385. g_survround = true
  5386. g_lastmode = MODE_SURVIVOR
  5387.  
  5388. // Choose player randomly?
  5389. if (mode == MODE_NONE)
  5390. id = fnGetRandomAlive(random_num(1, iPlayersnum))
  5391.  
  5392. // Remember id for calling our forward later
  5393. forward_id = id
  5394.  
  5395. // Turn player into a survivor
  5396. humanme(id, 1)
  5397.  
  5398. // Turn the remaining players into zombies
  5399. for (id = 1; id <= g_maxplayers; id++)
  5400. {
  5401. // Not alive
  5402. if (!is_user_alive(id))
  5403. continue;
  5404.  
  5405. // Survivor or already a zombie
  5406. if (g_survivor[id] || g_zombie[id])
  5407. continue;
  5408.  
  5409. // Turn into a zombie
  5410. zombieme(id, 0, 0, 1)
  5411. }
  5412.  
  5413. // Play survivor sound
  5414. PlaySound(sound_survivor[random_num(0, sizeof sound_survivor -1)]);
  5415.  
  5416. // Get player's name
  5417. get_user_name(forward_id, name, sizeof name - 1)
  5418.  
  5419. // Show Survivor HUD notice
  5420. set_hudmessage(20, 20, 255, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5421. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SURVIVOR", name)
  5422.  
  5423. // Round start forward
  5424. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_SURVIVOR, forward_id);
  5425. }
  5426. 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)
  5427. {
  5428. //Armagedon Mode
  5429. g_plagueround = true
  5430. g_armagedonround = true
  5431.  
  5432. new Float:Time // Creamos un Float con el Nombre 'Time'
  5433. Time = 10.0 // Le asignamos al Float 'Time' 10 Segundos
  5434.  
  5435. // Creamos el Efecto (ScreenFade)
  5436. message_begin(MSG_BROADCAST, g_msgScreenFade) // Open The Function
  5437. write_short((1<<12)*4) // Duration
  5438. write_short(floatround((1<<12)*(Time+2.2))) // Hold Time
  5439. write_short(0x0001) // Fade Type
  5440. write_byte(0) // Color Red
  5441. write_byte(0) // Color Green
  5442. write_byte(0) // Color Blue
  5443. write_byte(255) // Alpha: 255 = Se oscurece toda la Pantalla
  5444. message_end() // Close The Funcion
  5445.  
  5446. set_task(2.0, "Notice_One") // Creamos un Task para dar la Noticia
  5447. set_task(Time, "EffectModeEnd", id) // Creamos un Task para poder sacar el ScreenFade de a poco y no de golpe.
  5448.  
  5449. // Aca sige todo tu modo...
  5450. // NOTA: Acuerdense de no poner el: set_hudmessage al final del Modo.
  5451.  
  5452. // Turn someone into a Survivor
  5453. id = fnGetRandomAlive(random_num(1, iPlayersnum))
  5454. humanme(id, 1)
  5455.  
  5456. // heal Svruivor
  5457. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpsurvi)))
  5458.  
  5459. // Turn someone into a Nemesis (not the survivor!)
  5460. while (g_survivor[id]) id = fnGetRandomAlive(random_num(1, iPlayersnum));
  5461. zombieme(id, 0, 1, 0)
  5462.  
  5463. // heal Nem
  5464. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpneme)))
  5465.  
  5466. // iMaxZombies is rounded up, in case there aren't enough players
  5467. iMaxZombies = floatround((iPlayersnum-2)*get_pcvar_float(cvar_plagueratio), floatround_ceil)
  5468. iZombies = 0
  5469.  
  5470. // Randomly turn iMaxZombies players into zombies
  5471. while (iZombies < iMaxZombies)
  5472. {
  5473. if (id < g_maxplayers)
  5474. id++
  5475. else
  5476. id = 1
  5477.  
  5478. // Dead or already a zombie or survivor
  5479. if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
  5480. continue;
  5481.  
  5482. // Random chance
  5483. if (random_num(0, 1))
  5484. {
  5485. // Turn into a nemesis
  5486. zombieme(id, 0, 1, 0)
  5487. iZombies++
  5488.  
  5489. // Apply nemesis health multiplier
  5490. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpneme)))
  5491.  
  5492. }
  5493. }
  5494.  
  5495. // Turn the rest of players into humans
  5496. for (id = 1; id <= g_maxplayers; id++)
  5497. {
  5498. // Only those of them who arent zombies or survivor
  5499. if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
  5500. continue
  5501.  
  5502. // Remove previous tasks and make them survivors
  5503. remove_task(id+TASK_TEAM)
  5504. humanme(id, 1)
  5505.  
  5506. // Apply survivor health multiplier
  5507. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpsurvi)))
  5508.  
  5509. /* Switch to CT
  5510. if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
  5511. {
  5512. fm_set_user_team(id, CS_TEAM_CT)
  5513. set_task(0.1+g_teams_i, "fm_set_user_team_msg", id+TASK_TEAM)
  5514. g_teams_i += 0.1; // increase teams task counter
  5515. }*/
  5516. }
  5517.  
  5518. // Play plague sound
  5519. PlaySound(sound_plague[random_num(0, sizeof sound_plague -1)]);
  5520.  
  5521. // Show Plague HUD notice
  5522. set_hudmessage(0, 50, 200, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5523. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_ARMAGEDON")
  5524.  
  5525. // Round start forward
  5526. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_ARMAGEDON, 0);
  5527. }
  5528. 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)
  5529. {
  5530. // Swarm Mode
  5531. g_swarmround = true
  5532. g_lastmode = MODE_SWARM
  5533.  
  5534. // Turn every T into a zombie
  5535. for (id = 1; id <= g_maxplayers; id++)
  5536. {
  5537. // Not alive
  5538. if (!is_user_alive(id))
  5539. continue;
  5540.  
  5541. // Not a Terrorist
  5542. if (fm_get_user_team(id) != CS_TEAM_T)
  5543. continue;
  5544.  
  5545. // Turn into a zombie
  5546. zombieme(id, 0, 0, 1)
  5547. }
  5548.  
  5549. // Play swarm sound
  5550. PlaySound(sound_swarm[random_num(0, sizeof sound_swarm -1)]);
  5551.  
  5552. // Show Swarm HUD notice
  5553. set_hudmessage(20, 255, 20, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5554. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SWARM")
  5555.  
  5556. // Round start forward
  5557. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_SWARM, 0);
  5558. }
  5559. 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)
  5560. {
  5561. // Multi Infection Mode
  5562. g_lastmode = MODE_MULTI
  5563.  
  5564. // iMaxZombies is rounded up, in case there aren't enough players
  5565. iMaxZombies = floatround(iPlayersnum*get_pcvar_float(cvar_multiratio), floatround_ceil)
  5566. iZombies = 0
  5567.  
  5568. // Randomly turn iMaxZombies players into zombies
  5569. while (iZombies < iMaxZombies)
  5570. {
  5571. // Keep looping through all players
  5572. if (++id > g_maxplayers) id = 1
  5573.  
  5574. // Dead or already a zombie
  5575. if (!is_user_alive(id) || g_zombie[id])
  5576. continue;
  5577.  
  5578. // Random chance
  5579. if (random_num(0, 1))
  5580. {
  5581. // Turn into a zombie
  5582. zombieme(id, 0, 0, 1)
  5583. iZombies++
  5584. }
  5585. }
  5586.  
  5587. // Turn the remaining players into humans
  5588. for (id = 1; id <= g_maxplayers; id++)
  5589. {
  5590. // Only those of them who aren't zombies
  5591. if (!is_user_alive(id) || g_zombie[id])
  5592. continue
  5593.  
  5594. // Remove previous tasks
  5595. remove_task(id+TASK_TEAM)
  5596.  
  5597. // Switch to CT
  5598. if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
  5599. {
  5600. fm_set_user_team(id, CS_TEAM_CT)
  5601. fm_user_team_update(id)
  5602. }
  5603. }
  5604.  
  5605. // Play multi infection sound
  5606. PlaySound(sound_multi[random_num(0, sizeof sound_multi -1)]);
  5607.  
  5608. // Show Multi Infection HUD notice
  5609. set_hudmessage(200, 50, 0, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5610. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_MULTI")
  5611.  
  5612. // Round start forward
  5613. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_MULTI, 0);
  5614. }
  5615. 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
  5616. && 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)
  5617. {
  5618. // Plague Mode
  5619. g_plagueround = true
  5620. g_lastmode = MODE_PLAGUE
  5621.  
  5622. // Turn specified amount of players into Survivors
  5623. static iSurvivors, iMaxSurvivors
  5624. iMaxSurvivors = get_pcvar_num(cvar_plaguesurvnum)
  5625. iSurvivors = 0
  5626.  
  5627. while (iSurvivors < iMaxSurvivors)
  5628. {
  5629. // Choose random guy
  5630. id = fnGetRandomAlive(random_num(1, iPlayersnum))
  5631.  
  5632. // Already a survivor?
  5633. if (g_survivor[id])
  5634. continue;
  5635.  
  5636. // If not, turn him into one
  5637. humanme(id, 1)
  5638. iSurvivors++
  5639.  
  5640. // Apply survivor health multiplier
  5641. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_plaguesurvhpmulti)))
  5642. }
  5643.  
  5644. // Turn specified amount of players into Nemesis
  5645. static iNemesis, iMaxNemesis
  5646. iMaxNemesis = get_pcvar_num(cvar_plaguenemnum)
  5647. iNemesis = 0
  5648.  
  5649. while (iNemesis < iMaxNemesis)
  5650. {
  5651. // Choose random guy
  5652. id = fnGetRandomAlive(random_num(1, iPlayersnum))
  5653.  
  5654. // Already a survivor or nemesis?
  5655. if (g_survivor[id] || g_nemesis[id])
  5656. continue;
  5657.  
  5658. // If not, turn him into one
  5659. zombieme(id, 0, 1, 0)
  5660. iNemesis++
  5661.  
  5662. // Apply nemesis health multiplier
  5663. fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_plaguenemhpmulti)))
  5664. }
  5665.  
  5666. // iMaxZombies is rounded up, in case there aren't enough players
  5667. iMaxZombies = floatround((iPlayersnum-(get_pcvar_num(cvar_plaguenemnum)+get_pcvar_num(cvar_plaguesurvnum)))*get_pcvar_float(cvar_plagueratio), floatround_ceil)
  5668. iZombies = 0
  5669.  
  5670. // Randomly turn iMaxZombies players into zombies
  5671. while (iZombies < iMaxZombies)
  5672. {
  5673. // Keep looping through all players
  5674. if (++id > g_maxplayers) id = 1
  5675.  
  5676. // Dead or already a zombie or survivor
  5677. if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
  5678. continue;
  5679.  
  5680. // Random chance
  5681. if (random_num(0, 1))
  5682. {
  5683. // Turn into a zombie
  5684. zombieme(id, 0, 0, 1)
  5685. iZombies++
  5686. }
  5687. }
  5688.  
  5689. // Turn the remaining players into humans
  5690. for (id = 1; id <= g_maxplayers; id++)
  5691. {
  5692. // Only those of them who arent zombies or survivor
  5693. if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
  5694. continue;
  5695.  
  5696. // Remove previous tasks
  5697. remove_task(id+TASK_TEAM)
  5698.  
  5699. // Switch to CT
  5700. if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
  5701. {
  5702. fm_set_user_team(id, CS_TEAM_CT)
  5703. fm_user_team_update(id)
  5704. }
  5705. }
  5706.  
  5707. // Play plague sound
  5708. PlaySound(sound_plague[random_num(0, sizeof sound_plague -1)]);
  5709.  
  5710. // Show Plague HUD notice
  5711. set_hudmessage(0, 50, 200, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5712. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_PLAGUE")
  5713.  
  5714. // Round start forward
  5715. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_PLAGUE, 0);
  5716. }
  5717. else
  5718. {
  5719. // Single Infection Mode or Nemesis Mode
  5720.  
  5721. // Choose player randomly?
  5722. if (mode == MODE_NONE)
  5723. id = fnGetRandomAlive(random_num(1, iPlayersnum))
  5724.  
  5725. // Remember id for calling our forward later
  5726. forward_id = id
  5727.  
  5728. 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)
  5729. {
  5730. // Nemesis Mode
  5731. g_nemround = true
  5732. g_lastmode = MODE_NEMESIS
  5733.  
  5734. // Turn player into nemesis
  5735. zombieme(id, 0, 1, 0)
  5736. }
  5737. else
  5738. {
  5739. // Single Infection Mode
  5740. g_lastmode = MODE_INFECTION
  5741.  
  5742. // Turn player into the first zombie
  5743. zombieme(id, 0, 0, 0)
  5744. }
  5745.  
  5746. // Remaining players should be humans (CTs)
  5747. for (id = 1; id <= g_maxplayers; id++)
  5748. {
  5749. // Not alive
  5750. if (!is_user_alive(id))
  5751. continue;
  5752.  
  5753. // First zombie/nemesis
  5754. if (g_zombie[id])
  5755. continue;
  5756.  
  5757. // Remove previous tasks
  5758. remove_task(id+TASK_TEAM)
  5759.  
  5760. // Switch to CT
  5761. if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
  5762. {
  5763. fm_set_user_team(id, CS_TEAM_CT)
  5764. fm_user_team_update(id)
  5765. }
  5766. }
  5767.  
  5768. if (g_nemround)
  5769. {
  5770. // Play Nemesis sound
  5771. PlaySound(sound_nemesis[random_num(0, sizeof sound_nemesis -1)]);
  5772.  
  5773. // Get player's name
  5774. get_user_name(forward_id, name, sizeof name - 1)
  5775.  
  5776. // Show Nemesis HUD notice
  5777. set_hudmessage(255, 20, 20, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
  5778. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_NEMESIS", name)
  5779.  
  5780. // Round start forward
  5781. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_NEMESIS, forward_id);
  5782. }
  5783. else
  5784. {
  5785. // Get player's name
  5786. get_user_name(forward_id, name, sizeof name - 1)
  5787.  
  5788. // Show First Zombie HUD notice
  5789. set_hudmessage(255, 0, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 5.0, 1.0, 1.0, -1)
  5790. ShowSyncHudMsg(0, g_MsgSync, "%L",LANG_PLAYER, "NOTICE_FIRST", name)
  5791.  
  5792. // Round start forward
  5793. ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_INFECTION, forward_id);
  5794. }
  5795. }
  5796.  
  5797. // Last Zombie Check
  5798. set_task(0.1, "fnCheckLastZombie")
  5799. }
  5800.  
  5801. // Zombie Me Function (player id, infector, turn into a nemesis, special mode)
  5802. zombieme(id, infector, nemesis, specialmode)
  5803. {
  5804. // Pre user infect forward
  5805. ExecuteForward(g_fwUserInfected_pre, g_fwDummyResult, id, infector)
  5806.  
  5807. // Show zombie class menu if they haven't chosen any (e.g. just connected)
  5808. if (g_zombieclassnext[id] == ZCLASS_NONE && get_pcvar_num(cvar_zclasses))
  5809. set_task(2.0, "show_menu_zclass", id)
  5810.  
  5811. // Set selected zombie class
  5812. g_zombieclass[id] = g_zombieclassnext[id]
  5813. // If no class selected yet, use the first (default) one
  5814. if (g_zombieclass[id] == ZCLASS_NONE) g_zombieclass[id] = 0
  5815.  
  5816. // Way to go...
  5817. g_zombie[id] = true
  5818. g_survivor[id] = false
  5819.  
  5820. // Set zombie attributes based on the mode
  5821. if (!specialmode)
  5822. {
  5823. if (nemesis)
  5824. {
  5825. // Nemesis
  5826. g_nemesis[id] = true
  5827.  
  5828. // Get nemesis health setting
  5829. static nemhealth, nembasehealth
  5830. nemhealth = get_pcvar_num(cvar_nemhp)
  5831. nembasehealth = get_pcvar_num(cvar_nembasehp)
  5832.  
  5833. // Set health [0 = auto]
  5834. if (nemhealth == 0)
  5835. {
  5836. if (nembasehealth == 0)
  5837. fm_set_user_health(id, g_zclass_hp[0]*fnGetAlive())
  5838. else
  5839. fm_set_user_health(id, nembasehealth*fnGetAlive())
  5840. }
  5841. else
  5842. fm_set_user_health(id, nemhealth)
  5843.  
  5844. // Set gravity
  5845. set_pev(id, pev_gravity, get_pcvar_float(cvar_nemgravity))
  5846. }
  5847. else if (fnGetZombies() == 1)
  5848. {
  5849. // First zombie
  5850. g_firstzombie[id] = true
  5851.  
  5852. // Set health and gravity
  5853. 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])))
  5854. set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]] - Z_GRAVITY(g_skill_points[id][1][3]))
  5855.  
  5856. // Infection sound
  5857. engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_infect[random_num(0, sizeof zombie_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  5858. }
  5859. else
  5860. {
  5861. // Infected by someone
  5862.  
  5863. // Set health and gravity
  5864. fm_set_user_health(id, g_zclass_hp[g_zombieclass[id]] + Z_SALUD(g_skill_points[id][1][1]))
  5865. set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]] - Z_GRAVITY(g_skill_points[id][1][3]))
  5866.  
  5867. // Infection sound
  5868. engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_infect[random_num(0, sizeof zombie_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  5869.  
  5870. // Get player's name
  5871. static name[32]
  5872. get_user_name(id, name, sizeof name - 1)
  5873.  
  5874. // Show Infection HUD notice
  5875. set_hudmessage(255, 0, 0, HUD_INFECT_X, HUD_INFECT_Y, 0, 0.0, 5.0, 1.0, 1.0, -1)
  5876.  
  5877. if (infector) // infected by someone?
  5878. {
  5879. static name2[32]
  5880. get_user_name(infector, name2, sizeof name2 - 1)
  5881. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_INFECT2", name, name2)
  5882. }
  5883. else ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_INFECT", name)
  5884. }
  5885. }
  5886. else
  5887. {
  5888. // Survivor/multi infection/swarm/plague/infection grenade
  5889.  
  5890. // Set health and gravity
  5891. fm_set_user_health(id, g_zclass_hp[g_zombieclass[id]] + Z_SALUD(g_skill_points[id][1][1]))
  5892. set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]] - Z_GRAVITY(g_skill_points[id][1][3]))
  5893. }
  5894.  
  5895. // Remove previous tasks
  5896. remove_task(id+TASK_TEAM)
  5897. remove_task(id+TASK_MODEL)
  5898. remove_task(id+TASK_BLOOD)
  5899.  
  5900. // Switch to T
  5901. if (fm_get_user_team(id) != CS_TEAM_T) // need to change team?
  5902. {
  5903. fm_set_user_team(id, CS_TEAM_T)
  5904. fm_user_team_update(id)
  5905. }
  5906.  
  5907. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  5908.  
  5909. // Set the right model
  5910. if (g_nemesis[id])
  5911. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_nemesis[random_num(0, sizeof model_nemesis -1)])
  5912. else
  5913. {
  5914. if (get_pcvar_num(cvar_adminmodelszombie) && get_user_flags(id) & ACCESS_FLAG3)
  5915. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin_zombie[random_num(0, sizeof model_admin_zombie -1)])
  5916. else
  5917. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_zclass_model[g_zombieclass[id]])
  5918. }
  5919.  
  5920. // Set model on player model entity
  5921. fm_set_playermodel_ent(id)
  5922.  
  5923. // Nemesis glow / remove glow on player model entity
  5924. if (g_nemesis[id] && get_pcvar_num(cvar_nemglow))
  5925. fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 25)
  5926. else
  5927. fm_set_rendering(g_ent_playermodel[id])
  5928.  
  5929. #else
  5930.  
  5931. // Set the right model, after checking that we don't already have it
  5932. static currentmodel[32], already_has_model, i, iRand
  5933. already_has_model = false
  5934.  
  5935. // Get current model and compare it with current one
  5936. fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
  5937.  
  5938. if (g_nemesis[id])
  5939. {
  5940. for (i = 0; i < sizeof model_nemesis; i++)
  5941. if (equal(model_nemesis[i], currentmodel)) already_has_model = true;
  5942.  
  5943. if (!already_has_model)
  5944. {
  5945. iRand = random_num(0, sizeof model_nemesis -1)
  5946. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_nemesis[iRand])
  5947. #if defined SET_MODELINDEX_OFFSET
  5948. fm_set_user_model_index(id, g_modelindex_nemesis[iRand])
  5949. #endif
  5950. }
  5951. }
  5952. else
  5953. {
  5954. if (get_pcvar_num(cvar_adminmodelszombie) && get_user_flags(id) & ACCESS_FLAG3)
  5955. {
  5956. for (i = 0; i < sizeof model_admin_zombie; i++)
  5957. if (equal(model_admin_zombie[i], currentmodel)) already_has_model = true;
  5958.  
  5959. if (!already_has_model)
  5960. {
  5961. iRand = random_num(0, sizeof model_admin_zombie -1)
  5962. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin_zombie[iRand])
  5963. #if defined SET_MODELINDEX_OFFSET
  5964. fm_set_user_model_index(id, g_modelindex_admin_zombie[iRand])
  5965. #endif
  5966. }
  5967. }
  5968. else
  5969. {
  5970. if (equal(g_zclass_model[g_zombieclass[id]], currentmodel)) already_has_model = true;
  5971.  
  5972. if (!already_has_model)
  5973. {
  5974. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_zclass_model[g_zombieclass[id]])
  5975. #if defined SET_MODELINDEX_OFFSET
  5976. fm_set_user_model_index(id, g_zclass_modelindex[g_zombieclass[id]])
  5977. #endif
  5978. }
  5979. }
  5980. }
  5981.  
  5982. // Need to change the model?
  5983. if (!already_has_model)
  5984. {
  5985. // An additional delay is offset at round start
  5986. // since SVC_BAD is more likely to be triggered there
  5987. if (g_newround)
  5988. set_task(5.0*MODELCHANGE_DELAY, "fm_user_model_update", id+TASK_MODEL)
  5989. else
  5990. fm_user_model_update(id+TASK_MODEL)
  5991. }
  5992.  
  5993. // Nemesis glow / remove glow
  5994. if (g_nemesis[id] && get_pcvar_num(cvar_nemglow))
  5995. fm_set_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 25)
  5996. else
  5997. fm_set_rendering(id)
  5998.  
  5999. #endif
  6000.  
  6001. // Remove any zoom (bugfix)
  6002. fm_remove_user_zoom(id)
  6003.  
  6004. // Remove armor
  6005. set_pev(id, pev_armorvalue, 0.0)
  6006.  
  6007. // Drop weapons when infected
  6008. drop_weapons(id, 1)
  6009. drop_weapons(id, 2)
  6010.  
  6011. // Strip zombies from guns and give them a knife
  6012. fm_strip_user_weapons(id)
  6013. fm_give_item(id, "weapon_knife")
  6014.  
  6015. // Fancy effects
  6016. infection_effects(id)
  6017.  
  6018. // Nemesis aura task
  6019. if (g_nemesis[id] && get_pcvar_num(cvar_nemaura))
  6020. zombie_aura(id+TASK_BLOOD)
  6021.  
  6022. // Get nightvision give setting
  6023. static nvggive
  6024. nvggive = get_pcvar_num(cvar_nvggive)
  6025.  
  6026. // Give Zombies Night Vision?
  6027. if (nvggive)
  6028. {
  6029. if (!is_user_bot(id))
  6030. {
  6031. g_nvision[id] = true
  6032.  
  6033. // Turn on Night Vision automatically?
  6034. if (nvggive == 1)
  6035. {
  6036. g_nvisionenabled[id] = true
  6037.  
  6038. // Custom nvg?
  6039. if (get_pcvar_num(cvar_cnvg))
  6040. {
  6041. remove_task(id+TASK_NVISION)
  6042. set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
  6043. }
  6044. else
  6045. set_user_gnvision(id, 1)
  6046. }
  6047. // Turn off nightvision when infected (bugfix)
  6048. else if (g_nvisionenabled[id])
  6049. {
  6050. if (!get_pcvar_num(cvar_cnvg)) set_user_gnvision(id, 0)
  6051. g_nvisionenabled[id] = false
  6052. }
  6053. }
  6054. else
  6055. fm_set_bot_nvg(id, 1); // turn on NVG for bots
  6056. }
  6057. // Disable nightvision when infected (bugfix)
  6058. else if (g_nvision[id])
  6059. {
  6060. if (g_nvisionenabled[id] && !get_pcvar_num(cvar_cnvg)) set_user_gnvision(id, 0)
  6061. g_nvision[id] = false
  6062. g_nvisionenabled[id] = false
  6063. }
  6064.  
  6065. // Get FOV setting
  6066. static fov
  6067. fov = get_pcvar_num(cvar_zombiefov)
  6068.  
  6069. // Set custom FOV?
  6070. if (fov != 90 && fov != 0)
  6071. {
  6072. message_begin(MSG_ONE, g_msgSetFOV, _, id)
  6073. write_byte(fov) // angle
  6074. message_end()
  6075. }
  6076.  
  6077. // Call the bloody task
  6078. if (!g_nemesis[id] && get_pcvar_num(cvar_zombiebleeding))
  6079. set_task(0.7, "make_blood", id+TASK_BLOOD, _, _, "b")
  6080.  
  6081. // Idle sounds task
  6082. if (!g_nemesis[id])
  6083. set_task(random_float(50.0, 70.0), "zombie_play_idle", id+TASK_BLOOD, _, _, "b")
  6084.  
  6085. // Turn off zombie's flashlight
  6086. turn_off_flashlight(id)
  6087.  
  6088. // Remove survivor's aura (bugfix)
  6089. set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_BRIGHTLIGHT)
  6090.  
  6091. // Remove spawn protection (bugfix)
  6092. g_nodamage[id] = false
  6093. set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_NODRAW)
  6094.  
  6095. // Post user infect forward
  6096. ExecuteForward(g_fwUserInfected_post, g_fwDummyResult, id, infector)
  6097.  
  6098. // Last Zombie Check
  6099. set_task(0.1, "fnCheckLastZombie")
  6100. }
  6101.  
  6102. // Function Human Me (player id, turn into a survivor)
  6103. humanme(id, survivor)
  6104. {
  6105. // Pre user humanize forward
  6106. ExecuteForward(g_fwUserHumanized_pre, g_fwDummyResult, id)
  6107.  
  6108. // Set selected human class
  6109. g_humanclass[id] = g_humanclassnext[id]
  6110.  
  6111. // If no class selected yet, use the first (default) one
  6112. if (g_humanclass[id] == HCLASS_NONE) g_humanclass[id] = 0
  6113.  
  6114. // Reset some vars
  6115. g_zombie[id] = false
  6116. g_nemesis[id] = false
  6117. g_firstzombie[id] = false
  6118. g_nodamage[id] = false
  6119. g_canbuy[id] = true
  6120. g_nvision[id] = false
  6121. g_nvisionenabled[id] = false
  6122.  
  6123. // Set human attributes based on the mode
  6124. if (survivor)
  6125. {
  6126. // Survivor
  6127. g_survivor[id] = true
  6128.  
  6129. // Get survivor health setting
  6130. static survhealth, survbasehealth
  6131. survhealth = get_pcvar_num(cvar_survhp)
  6132. survbasehealth = get_pcvar_num(cvar_survbasehp)
  6133.  
  6134. // Set Health [0 = auto]
  6135. if (survhealth == 0)
  6136. {
  6137. if (survbasehealth == 0)
  6138. fm_set_user_health(id, g_hclass_hp[0]*fnGetAlive())
  6139. else
  6140. fm_set_user_health(id, survbasehealth*fnGetAlive())
  6141. }
  6142. else
  6143. fm_set_user_health(id, survhealth)
  6144.  
  6145. // Set Gravity
  6146. set_pev(id, pev_gravity, get_pcvar_float(cvar_survgravity))
  6147.  
  6148. // Get survivor's weapon setting
  6149. static survweapon[32]
  6150. get_pcvar_string(cvar_survweapon, survweapon, sizeof survweapon - 1)
  6151.  
  6152. // Strip survivor from weapons and give him his own
  6153. fm_strip_user_weapons(id)
  6154. fm_give_item(id, "weapon_knife")
  6155. fm_give_item(id, survweapon)
  6156.  
  6157. // Turn off his flashlight
  6158. turn_off_flashlight(id)
  6159.  
  6160. // Give the survivor a bright light
  6161. if (get_pcvar_num(cvar_survaura)) set_pev(id, pev_effects, pev(id, pev_effects) | EF_BRIGHTLIGHT)
  6162.  
  6163. // Survivor bots will also need nightvision to see in the dark
  6164. if (is_user_bot(id)) fm_set_bot_nvg(id, 1);
  6165. }
  6166. else
  6167. {
  6168. // Set health
  6169. fm_set_user_health(id, g_hclass_hp[g_humanclass[id]] + H_SALUD(g_skill_points[id][0][1]))
  6170. set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]] - H_GRAVITY(g_skill_points[id][0][3]))
  6171. set_user_armor(id, g_hclass_ar[g_humanclass[id]] + H_ARMOR(g_skill_points[id][0][4]))
  6172.  
  6173. // Set gravity, unless frozen
  6174. if (!g_frozen[id]) set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]] - H_GRAVITY(g_skill_points[id][0][3]))
  6175.  
  6176.  
  6177. // Strip off from weapons
  6178. fm_strip_user_weapons(id)
  6179. fm_give_item(id, "weapon_knife")
  6180.  
  6181. // Show custom buy menu?
  6182. show_menu_eleccion(id)
  6183.  
  6184. // Antidote sound
  6185. engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_antidote[random_num(0, sizeof sound_antidote - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  6186.  
  6187. // Get player's name
  6188. static name[32]
  6189. get_user_name(id, name, sizeof name - 1)
  6190.  
  6191. // Show Antidote HUD notice
  6192. set_hudmessage(0, 0, 255, HUD_INFECT_X, HUD_INFECT_Y, 0, 0.0, 5.0, 1.0, 1.0, -1)
  6193. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_ANTIDOTE", name)
  6194. }
  6195.  
  6196. // Remove previous tasks
  6197. remove_task(id+TASK_TEAM)
  6198. remove_task(id+TASK_MODEL)
  6199. remove_task(id+TASK_BLOOD)
  6200.  
  6201. // Switch to CT
  6202. if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
  6203. {
  6204. fm_set_user_team(id, CS_TEAM_CT)
  6205. fm_user_team_update(id)
  6206. }
  6207.  
  6208. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  6209.  
  6210. // Set the right model
  6211. if (g_survivor[id])
  6212. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_survivor[random_num(0, sizeof model_survivor -1)])
  6213. else
  6214. {
  6215. if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
  6216. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[random_num(0, sizeof model_admin -1)])
  6217. else
  6218. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
  6219. }
  6220.  
  6221. // Set model on player model entity
  6222. fm_set_playermodel_ent(id)
  6223.  
  6224. // Set survivor glow / remove glow, unless frozen
  6225. if (g_survivor[id] && get_pcvar_num(cvar_survglow))
  6226. fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25)
  6227. else if (!g_frozen[id])
  6228. fm_set_rendering(g_ent_playermodel[id])
  6229.  
  6230. #else
  6231.  
  6232. // Set the right model, after checking that we don't already have it
  6233. static currentmodel[32], already_has_model, i, iRand
  6234. already_has_model = false;
  6235.  
  6236. // Get current model and compare it with current one
  6237. fm_get_user_model(id, currentmodel, sizeof currentmodel - 1);
  6238.  
  6239. if (g_survivor[id])
  6240. {
  6241. for (i = 0; i < sizeof model_survivor; i++)
  6242. if (equal(model_survivor[i], currentmodel)) already_has_model = true;
  6243.  
  6244. if (!already_has_model)
  6245. {
  6246. iRand = random_num(0, sizeof model_survivor -1)
  6247. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_survivor[iRand])
  6248. #if defined SET_MODELINDEX_OFFSET
  6249. fm_set_user_model_index(id, g_modelindex_survivor[iRand])
  6250. #endif
  6251. }
  6252. }
  6253. else
  6254. {
  6255. if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
  6256. {
  6257. for (i = 0; i < sizeof model_admin; i++)
  6258. if (equal(model_admin[i], currentmodel)) already_has_model = true;
  6259.  
  6260. if (!already_has_model)
  6261. {
  6262. iRand = random_num(0, sizeof model_admin -1)
  6263. copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[iRand])
  6264. #if defined SET_MODELINDEX_OFFSET
  6265. fm_set_user_model_index(id, g_modelindex_admin[iRand])
  6266. #endif
  6267. }
  6268. }
  6269. else
  6270. {
  6271. if (equal(g_hclass_model[g_humanclass[id]], currentmodel)) already_has_model = true;
  6272.  
  6273. if (!already_has_model)
  6274. {
  6275. copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
  6276. #if defined SET_MODELINDEX_OFFSET
  6277. fm_set_user_model_index(id, g_hclass_modelindex[g_humanclass[id]])
  6278. #endif
  6279. }
  6280. }
  6281. }
  6282.  
  6283. // Need to change the model?
  6284. if (!already_has_model)
  6285. {
  6286. // An additional delay is offset at round start
  6287. // since SVC_BAD is more likely to be triggered there
  6288. if (g_newround)
  6289. set_task(5.0*MODELCHANGE_DELAY, "fm_user_model_update", id+TASK_MODEL)
  6290. else
  6291. fm_user_model_update(id+TASK_MODEL)
  6292. }
  6293.  
  6294. // Set survivor glow / remove glow, unless frozen
  6295. if (g_survivor[id] && get_pcvar_num(cvar_survglow))
  6296. fm_set_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25)
  6297. else if (!g_frozen[id])
  6298. fm_set_rendering(id)
  6299.  
  6300. #endif
  6301.  
  6302. // Get FOV setting
  6303. static fov
  6304. fov = get_pcvar_num(cvar_zombiefov)
  6305.  
  6306. // Restore FOV?
  6307. if (fov != 90 && fov != 0)
  6308. {
  6309. message_begin(MSG_ONE, g_msgSetFOV, _, id)
  6310. write_byte(90) // angle
  6311. message_end()
  6312. }
  6313.  
  6314. // Disable nightvision
  6315. if (is_user_bot(id)) fm_set_bot_nvg(id, 0)
  6316. else if (!get_pcvar_num(cvar_cnvg)) set_user_gnvision(id, 0)
  6317.  
  6318. // Post user humanize forward
  6319. ExecuteForward(g_fwUserHumanized_post, g_fwDummyResult, id)
  6320.  
  6321. // Last Zombie Check
  6322. set_task(0.1, "fnCheckLastZombie")
  6323. }
  6324.  
  6325.  
  6326. public clcmd_login(id)
  6327. {
  6328. static Password[24], szData[512]
  6329.  
  6330. read_args(Password, charsmax(Password))
  6331. remove_quotes(Password)
  6332. trim(Password)
  6333.  
  6334. fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData))
  6335. parse(szData, g_password[id], charsmax(g_password[]))
  6336.  
  6337. if(!equali(Password, g_password[id]))
  6338. {
  6339. zp_colored_print(id, "^x04[ZP]^x01 Password incorrecta. Intente nuevamente.")
  6340. client_cmd(id, "messagemode Login_Password")
  6341. set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
  6342. ShowSyncHudMsg(id, g_MsgSync3, "Enter your password^nPress ESC to exit")
  6343. return PLUGIN_HANDLED;
  6344. }
  6345. else
  6346. {
  6347. g_estado[id] = ONLINE
  6348. Load(id)
  6349. zp_colored_print(0, "^x04[ZP]^x03 %s^x01 has entered the server.", g_playername[id])
  6350.  
  6351. engclient_cmd(id, "jointeam", "5")
  6352. engclient_cmd(id, "joinclass", "5")
  6353.  
  6354. return PLUGIN_HANDLED;
  6355. }
  6356.  
  6357. return PLUGIN_CONTINUE;
  6358. }
  6359.  
  6360. public clcmd_register(id)
  6361. {
  6362. read_args(g_password[id], charsmax(g_password[]))
  6363. remove_quotes(g_password[id])
  6364. trim(g_password[id])
  6365.  
  6366. if(equal(g_password[id], "") || contain(g_password[id], " ") != -1)
  6367. {
  6368. zp_colored_print(id, "^x04[ZP]^x01 The password must contain at least one letter and no space.")
  6369. client_cmd(id, "messagemode Create_Password")
  6370. set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
  6371. ShowSyncHudMsg(id, g_MsgSync3, "Enter a new password^nPress ESC to exit")
  6372. return PLUGIN_HANDLED;
  6373. }
  6374. else
  6375. {
  6376. get_user_name(id, g_playername[id], charsmax(g_playername[]))
  6377. g_password[id] = g_password[id]
  6378. g_estado[id] = ONLINE
  6379. Save(id)
  6380. Registrado[id] = 1
  6381. zp_colored_print(0, "^x04[ZP]^x03 %s^x01 has registered in the server.", g_playername[id])
  6382.  
  6383. engclient_cmd(id, "jointeam", "5")
  6384. engclient_cmd(id, "joinclass", "5")
  6385.  
  6386. return PLUGIN_HANDLED;
  6387. }
  6388.  
  6389. return PLUGIN_CONTINUE;
  6390. }
  6391.  
  6392. Load(id)
  6393. {
  6394. static szData[512], guardapacks[10], guardalevel[10], guardazclas[10], reset[10], registrado[10], guardahclas[10], superreset[10], guardahpo[10], guardazpo[10], guardahda[10], guardahvi[10], guardahve[10],
  6395. guardahgra[10], guardahar[10], guardazvi[10], guardazda[10], guardazve[10], guardazgra[10], usahu[10], usazo[10]
  6396.  
  6397. if(!fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
  6398. return;
  6399.  
  6400.  
  6401. parse(szData, g_password[id], charsmax(g_password[]), guardapacks, charsmax(guardapacks), guardalevel, charsmax(guardalevel), guardazclas, charsmax(guardazclas), reset, charsmax(reset),
  6402. registrado, charsmax(registrado), guardahclas, charsmax(guardahclas), superreset, charsmax(superreset) , guardahpo, charsmax(guardahpo), guardazpo, charsmax(guardazpo), guardahda,
  6403. charsmax(guardahda), guardahvi, charsmax(guardahvi), guardahve, charsmax(guardahve), guardahgra, charsmax(guardahgra), guardahar, charsmax(guardahar), guardazda, charsmax(guardazda),
  6404. guardazvi, charsmax(guardazvi), guardazve, charsmax(guardazve), guardazgra, charsmax(guardazgra), usahu, charsmax(usahu), usazo, charsmax(usazo))
  6405.  
  6406. g_ammopacks[id] = str_to_num(guardapacks)
  6407. g_level[id] = str_to_num(guardalevel)
  6408. g_zombieclassnext[id] = str_to_num(guardazclas)
  6409. g_reset[id] = str_to_num(reset)
  6410. Registrado[id] = str_to_num(registrado)
  6411. g_humanclassnext[id] = str_to_num(guardahclas)
  6412. g_grandreset[id] = str_to_num(superreset)
  6413. g_points[id][0] = str_to_num(guardahpo)
  6414. g_points[id][1] = str_to_num(guardazpo)
  6415. g_skill_points[id][0][0] = str_to_num(guardahda)
  6416. g_skill_points[id][0][1] = str_to_num(guardahvi)
  6417. g_skill_points[id][0][2] = str_to_num(guardahve)
  6418. g_skill_points[id][0][3] = str_to_num(guardahgra)
  6419. g_skill_points[id][0][4] = str_to_num(guardahar)
  6420. g_skill_points[id][1][0] = str_to_num(guardazda)
  6421. g_skill_points[id][1][1] = str_to_num(guardazvi)
  6422. g_skill_points[id][1][2] = str_to_num(guardazve)
  6423. g_skill_points[id][1][3] = str_to_num(guardazgra)
  6424. g_usedpoints[id][0] = str_to_num(usahu)
  6425. g_usedpoints[id][1] = str_to_num(usazo)
  6426. }
  6427.  
  6428. Save(id)
  6429. {
  6430. if (!Registrado[id] || BadPassword[id])
  6431. return PLUGIN_HANDLED;
  6432.  
  6433. static szData[512]
  6434. 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_zombieclassnext[id], g_reset[id], Registrado[id], g_humanclassnext[id], g_grandreset[id],g_points[id][0],
  6435. g_points[id][1], 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], g_usedpoints[id][0], g_usedpoints[id][1])
  6436. fvault_set_data(SaveData, g_playername[id], szData)
  6437. return PLUGIN_CONTINUE;
  6438. }
  6439.  
  6440. // Player info changed?
  6441. public FWClientUserInfoChanged(id, buffer)
  6442. {
  6443. if(!is_user_connected(id))
  6444. return FMRES_IGNORED;
  6445.  
  6446. static NickName[32], NickOld[32]; get_user_name(id, NickOld, 31)
  6447. engfunc(EngFunc_InfoKeyValue, buffer, "name", NickName, 31)
  6448.  
  6449. if(equal( NickName, NickOld))
  6450. return FMRES_IGNORED;
  6451.  
  6452. engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", NickOld)
  6453.  
  6454. client_cmd(id, "name ^"%s^"; setinfo name ^"%s^"", NickOld, NickOld)
  6455.  
  6456. return FMRES_SUPERCEDE;
  6457. }
  6458.  
  6459. /*================================================================================
  6460. [Other Functions and Tasks]
  6461. =================================================================================*/
  6462.  
  6463. // Register Ham Forwards for CZ bots
  6464. public register_ham_czbots(id)
  6465. {
  6466. // Make sure it's a CZ bot and it's still connected
  6467. if (g_hamczbots || !get_pcvar_num(cvar_botquota) || !is_user_connected(id) || !is_user_bot(id))
  6468. return;
  6469.  
  6470. RegisterHamFromEntity(Ham_Spawn, id, "fw_PlayerSpawn_Post", 1)
  6471. RegisterHamFromEntity(Ham_Killed, id, "fw_PlayerKilled")
  6472. RegisterHamFromEntity(Ham_TakeDamage, id, "fw_TakeDamage")
  6473. RegisterHamFromEntity(Ham_TraceAttack, id, "fw_TraceAttack")
  6474.  
  6475. // Ham forwards for CZ bots succesfully registered
  6476. g_hamczbots = true
  6477.  
  6478. // If the bot has already spawned, call the forward manually for him
  6479. if (is_user_alive(id)) fw_PlayerSpawn_Post(id)
  6480. }
  6481.  
  6482. // Disable minmodels task
  6483. public disable_minmodels(id)
  6484. {
  6485. if (!is_user_connected(id)) return;
  6486. client_cmd(id, "cl_minmodels 0")
  6487. }
  6488.  
  6489. // Bots automatically buy extra items
  6490. public bot_buy_extras(taskid)
  6491. {
  6492. // Nemesis or Survivor shouldnt get extra items
  6493. if (g_survivor[ID_SPAWN] || g_nemesis[ID_SPAWN] || !is_user_alive(ID_SPAWN))
  6494. return;
  6495.  
  6496. if (!g_zombie[ID_SPAWN]) // human bots
  6497. {
  6498. // Attempt to buy Night Vision
  6499. buy_extra_item(ID_SPAWN, EXTRA_NVISION)
  6500.  
  6501. // Attempt to buy a weapon
  6502. buy_extra_item(ID_SPAWN, random_num(EXTRA_WEAPONS_STARTID, EXTRAS_CUSTOM_STARTID-1))
  6503. }
  6504. else // zombie bots
  6505. {
  6506. // Attempt to buy an Antidote
  6507. buy_extra_item(ID_SPAWN, EXTRA_ANTIDOTE)
  6508. }
  6509. }
  6510.  
  6511. // Balance Teams Task
  6512. public balance_teams()
  6513. {
  6514. // Get users playing
  6515. static iPlayersnum
  6516. iPlayersnum = fnGetPlaying()
  6517.  
  6518. // No players, don't bother
  6519. if (iPlayersnum < 1) return;
  6520.  
  6521. // Split players evenly
  6522. static g_team[33], id, iTerrors, iMaxTerrors, team
  6523. iMaxTerrors = iPlayersnum/2
  6524. iTerrors = 0
  6525.  
  6526. // First, mark everyone as CT
  6527. for (id = 1; id <= g_maxplayers; id++)
  6528. g_team[id] = CS_TEAM_CT
  6529.  
  6530. // Then randomly mark half of the players as Terrorists
  6531. while (iTerrors < iMaxTerrors)
  6532. {
  6533. // Keep looping through all players
  6534. if (++id > g_maxplayers) id = 1
  6535.  
  6536. // Skip if not connected
  6537. if (!is_user_connected(id))
  6538. continue;
  6539.  
  6540. team = fm_get_user_team(id)
  6541.  
  6542. // Skip if not playing
  6543. if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
  6544. continue;
  6545.  
  6546. // Already a Terrorist
  6547. if (g_team[id] == CS_TEAM_T)
  6548. continue;
  6549.  
  6550. // Random chance
  6551. if (random_num(0, 1))
  6552. {
  6553. g_team[id] = CS_TEAM_T
  6554. iTerrors++
  6555. }
  6556. }
  6557.  
  6558. // Set everyone's team for real
  6559. for (id = 1; id <= g_maxplayers; id++)
  6560. {
  6561. // Skip if not connected
  6562. if (!is_user_connected(id))
  6563. continue;
  6564.  
  6565. team = fm_get_user_team(id)
  6566.  
  6567. // Skip if not playing
  6568. if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
  6569. continue;
  6570.  
  6571. // Set team
  6572. remove_task(id+TASK_TEAM)
  6573. fm_set_user_team(id, g_team[id])
  6574. }
  6575. }
  6576.  
  6577. // Welcome Message Task
  6578. public welcome_msg()
  6579. {
  6580. // Show mod info
  6581. zp_colored_print(0, "^x01**** ^x04%s^x01 ****", g_modname)
  6582. zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "NOTICE_INFO1")
  6583. if (!get_pcvar_num(cvar_infammo)) zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "NOTICE_INFO2")
  6584.  
  6585. // Show T-virus HUD notice
  6586. set_hudmessage(0, 125, 200, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
  6587. ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_VIRUS_FREE")
  6588. }
  6589.  
  6590. // Respawn Player Task
  6591. public respawn_player(taskid)
  6592. {
  6593. // Get player's team
  6594. static team
  6595. team = fm_get_user_team(ID_SPAWN)
  6596.  
  6597. // Respawn on infection rounds only
  6598. if (!g_endround && !g_survround && !g_swarmround && !g_nemround && !g_plagueround && team != CS_TEAM_SPECTATOR && team != CS_TEAM_UNASSIGNED && !is_user_alive(ID_SPAWN))
  6599. {
  6600. // Set proper team before respawning, so that the TeamInfo message that's sent doesn't confuse PODBots
  6601. if (g_respawn_as_zombie[ID_SPAWN])
  6602. fm_set_user_team(ID_SPAWN, CS_TEAM_T)
  6603. else
  6604. fm_set_user_team(ID_SPAWN, CS_TEAM_CT)
  6605.  
  6606. // Respawning a player has never been so easy
  6607. ExecuteHamB(Ham_CS_RoundRespawn, ID_SPAWN)
  6608. }
  6609. }
  6610.  
  6611. // Check Round Task -check that we still have both zombies & humans on a round-
  6612. check_round(leaving_player)
  6613. {
  6614. // Round ended or make_a_zombie task still active
  6615. if (g_endround || task_exists(TASK_MAKEZOMBIE))
  6616. return;
  6617.  
  6618. // Get alive players count
  6619. static iPlayersnum
  6620. iPlayersnum = fnGetAlive()
  6621.  
  6622. // Last alive player, don't bother
  6623. if (iPlayersnum < 2)
  6624. return;
  6625.  
  6626. // Set up some common vars
  6627. static id, name[32]
  6628.  
  6629. // Last zombie disconnecting
  6630. if (g_zombie[leaving_player] && fnGetZombies() == 1)
  6631. {
  6632. // Only one CT left, don't bother
  6633. if (fnGetHumans() == 1 && fnGetCTs() == 1)
  6634. return;
  6635.  
  6636. // Pick a random one to take his place
  6637. while ((id = fnGetRandomAlive(random_num(1, iPlayersnum))) == leaving_player ) {}
  6638.  
  6639. // Show last zombie left notice
  6640. get_user_name(id, name, sizeof name - 1)
  6641. zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "LAST_ZOMBIE_LEFT", name)
  6642.  
  6643. // Turn into a Nemesis or just a zombie?
  6644. if (g_nemesis[leaving_player] && !g_plagueround)
  6645. make_a_zombie(MODE_NEMESIS, id)
  6646. else
  6647. zombieme(id, 0, 0, 0)
  6648. }
  6649.  
  6650. // Last human disconnecting
  6651. else if (!g_zombie[leaving_player] && fnGetHumans() == 1)
  6652. {
  6653. // Only one T left, don't bother
  6654. if (fnGetZombies() == 1 && fnGetTs() == 1)
  6655. return;
  6656.  
  6657. // Pick a random one to take his place
  6658. while ((id = fnGetRandomAlive(random_num(1, iPlayersnum))) == leaving_player ) {}
  6659.  
  6660. // Show last human left notice
  6661. get_user_name(id, name, sizeof name - 1)
  6662. zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "LAST_HUMAN_LEFT", name)
  6663.  
  6664. // Turn into a Survivor or just a human?
  6665. if (g_survivor[leaving_player] && !g_plagueround)
  6666. make_a_zombie(MODE_SURVIVOR, id)
  6667. else
  6668. humanme(id, 0)
  6669. }
  6670. }
  6671.  
  6672. // Lighting Effects Task
  6673. public lighting_effects()
  6674. {
  6675. // Lighting style ["a"-"z"]
  6676. static lights[2]
  6677. get_pcvar_string(cvar_lighting, lights, sizeof lights - 1)
  6678. strtolower(lights)
  6679.  
  6680. // Lighting disabled? ["0"]
  6681. if (lights[0] == '0')
  6682. {
  6683. // Task not needed anymore
  6684. remove_task(TASK_LIGHTING)
  6685. return;
  6686. }
  6687.  
  6688. // Darkest light settings?
  6689. if (lights[0] >= 'a' && lights[0] <= 'd')
  6690. {
  6691. // Get thunderclaps setting
  6692. static Float:thunderclap
  6693. thunderclap = get_pcvar_float(cvar_thunder)
  6694.  
  6695. // Set thunderclap tasks if neccesary
  6696. if (thunderclap > 0.0 && !task_exists(TASK_THUNDER_PRE) && !task_exists(TASK_THUNDER))
  6697. {
  6698. g_lights_i = 0
  6699. switch (random_num(0, 2))
  6700. {
  6701. case 0: set_task(thunderclap, "thunderclap1", TASK_THUNDER_PRE)
  6702. case 1: set_task(thunderclap, "thunderclap2", TASK_THUNDER_PRE)
  6703. case 2: set_task(thunderclap, "thunderclap3", TASK_THUNDER_PRE)
  6704. }
  6705. }
  6706.  
  6707. // Set lighting only when no thunderclaps are going on
  6708. if (!task_exists(TASK_THUNDER)) engfunc(EngFunc_LightStyle, 0, lights)
  6709. }
  6710. else
  6711. {
  6712. // Remove thunderclap tasks
  6713. remove_task(TASK_THUNDER_PRE)
  6714. remove_task(TASK_THUNDER)
  6715.  
  6716. // Set lighting
  6717. engfunc(EngFunc_LightStyle, 0, lights)
  6718. }
  6719. }
  6720.  
  6721. // Thunderclap 1
  6722. public thunderclap1()
  6723. {
  6724. // Play thunder sound
  6725. if (!g_lights_i) PlaySound(sound_thunder[random_num(0, sizeof sound_thunder - 1)])
  6726.  
  6727. // Set lighting
  6728. engfunc(EngFunc_LightStyle, 0, lights_thunder1[g_lights_i])
  6729. g_lights_i++
  6730.  
  6731. // Loop the task until we reach the end of the cycle
  6732. if (g_lights_i >= sizeof lights_thunder1)
  6733. {
  6734. remove_task(TASK_THUNDER)
  6735. lighting_effects()
  6736. }
  6737. else if (!task_exists(TASK_THUNDER))
  6738. set_task(0.1, "thunderclap1", TASK_THUNDER, _, _, "b")
  6739. }
  6740.  
  6741. // Thunderclap 2
  6742. public thunderclap2()
  6743. {
  6744. // Play thunder sound
  6745. if (!g_lights_i) PlaySound(sound_thunder[random_num(0, sizeof sound_thunder - 1)])
  6746.  
  6747. // Set lighting
  6748. engfunc(EngFunc_LightStyle, 0, lights_thunder2[g_lights_i])
  6749. g_lights_i++
  6750.  
  6751. // Loop the task until we reach the end of the cycle
  6752. if (g_lights_i >= sizeof lights_thunder2)
  6753. {
  6754. remove_task(TASK_THUNDER)
  6755. lighting_effects()
  6756. }
  6757. else if (!task_exists(TASK_THUNDER))
  6758. set_task(0.1, "thunderclap2", TASK_THUNDER, _, _, "b")
  6759. }
  6760.  
  6761. // Thunderclap 3
  6762. public thunderclap3()
  6763. {
  6764. // Play thunder sound
  6765. if (!g_lights_i) PlaySound(sound_thunder[random_num(0, sizeof sound_thunder - 1)])
  6766.  
  6767. // Set lighting
  6768. engfunc(EngFunc_LightStyle, 0, lights_thunder3[g_lights_i])
  6769. g_lights_i++
  6770.  
  6771. // Loop the task until we reach the end of the cycle
  6772. if (g_lights_i >= sizeof lights_thunder3)
  6773. {
  6774. remove_task(TASK_THUNDER)
  6775. lighting_effects()
  6776. }
  6777. else if (!task_exists(TASK_THUNDER))
  6778. set_task(0.1, "thunderclap3", TASK_THUNDER, _, _, "b")
  6779. }
  6780.  
  6781. #if defined AMBIENCE_SOUNDS
  6782. // Ambience Sound Effects Task
  6783. public ambience_sound_effects(taskid)
  6784. {
  6785. // Play a random sound depending on the round
  6786. static amb_sound[64], isound, Float:duration
  6787.  
  6788. if (g_nemround) // Nemesis Mode
  6789. {
  6790. isound = random_num(0, sizeof sound_ambience2 - 1)
  6791. copy(amb_sound, sizeof amb_sound -1, sound_ambience2[isound])
  6792. duration = sound_ambience2_duration[isound]
  6793. }
  6794. else if (g_survround) // Survivor Mode
  6795. {
  6796. isound = random_num(0, sizeof sound_ambience3 - 1)
  6797. copy(amb_sound, sizeof amb_sound -1, sound_ambience3[isound])
  6798. duration = sound_ambience3_duration[isound]
  6799. }
  6800. else if (g_swarmround) // Swarm Mode
  6801. {
  6802. isound = random_num(0, sizeof sound_ambience4 - 1)
  6803. copy(amb_sound, sizeof amb_sound -1, sound_ambience4[isound])
  6804. duration = sound_ambience4_duration[isound]
  6805. }
  6806. else if (g_plagueround) // Plague Mode
  6807. {
  6808. isound = random_num(0, sizeof sound_ambience5 - 1)
  6809. copy(amb_sound, sizeof amb_sound -1, sound_ambience5[isound])
  6810. duration = sound_ambience5_duration[isound]
  6811. }
  6812. else // Infection Mode
  6813. {
  6814. isound = random_num(0, sizeof sound_ambience1 - 1)
  6815. copy(amb_sound, sizeof amb_sound -1, sound_ambience1[isound])
  6816. duration = sound_ambience1_duration[isound]
  6817. }
  6818.  
  6819. // Check whether it's a wav or mp3 and play it on clients
  6820. if (equal(amb_sound[strlen(amb_sound)-4], ".mp3"))
  6821. client_cmd(0, "mp3 play ^"sound/%s^"", amb_sound)
  6822. else
  6823. PlaySound(amb_sound)
  6824.  
  6825. // The task should be called again after the sound is done playing
  6826. set_task(duration, "ambience_sound_effects", TASK_AMBIENCESOUNDS)
  6827. }
  6828.  
  6829. // Ambience Sounds Stop Task
  6830. public ambience_sound_stop()
  6831. {
  6832. client_cmd(0, "mp3 stop; stopsound")
  6833. }
  6834. #endif
  6835.  
  6836. // Flashlight Charge Task
  6837. public flashlight_charge(taskid)
  6838. {
  6839. // Custom flashlight disabled or flashlight not available for player
  6840. if (g_zombie[ID_CHARGE] || g_survivor[ID_CHARGE] || !get_pcvar_num(cvar_cflash) || !is_user_alive(ID_CHARGE))
  6841. {
  6842. // Task not needed anymore
  6843. remove_task(taskid);
  6844. return;
  6845. }
  6846.  
  6847. // Drain or charge?
  6848. if (g_flashlight[ID_CHARGE])
  6849. g_flashbattery[ID_CHARGE] -= get_pcvar_num(cvar_flashdrain)
  6850. else
  6851. g_flashbattery[ID_CHARGE] += get_pcvar_num(cvar_flashcharge)
  6852.  
  6853. // Battery fully charged
  6854. if (g_flashbattery[ID_CHARGE] >= 100)
  6855. {
  6856. // Don't exceed 100%
  6857. g_flashbattery[ID_CHARGE] = 100;
  6858.  
  6859. // Update flashlight battery on HUD
  6860. message_begin(MSG_ONE, g_msgFlashBat, _, ID_CHARGE)
  6861. write_byte(g_flashbattery[ID_CHARGE]) // battery
  6862. message_end()
  6863.  
  6864. // Task not needed anymore
  6865. remove_task(taskid);
  6866. return;
  6867. }
  6868.  
  6869. // Battery depleted
  6870. if (g_flashbattery[ID_CHARGE] <= 0)
  6871. {
  6872. // Turn it off
  6873. g_flashlight[ID_CHARGE] = false;
  6874. g_flashbattery[ID_CHARGE] = 0;
  6875.  
  6876. // Update flashlight status on HUD
  6877. message_begin(MSG_ONE, g_msgFlashlight, _, ID_CHARGE)
  6878. write_byte(g_flashlight[ID_CHARGE]) // toggle
  6879. write_byte(g_flashbattery[ID_CHARGE]) // battery
  6880. message_end()
  6881. }
  6882. else
  6883. {
  6884. // Update flashlight battery on HUD
  6885. message_begin(MSG_ONE_UNRELIABLE, g_msgFlashBat, _, ID_CHARGE)
  6886. write_byte(g_flashbattery[ID_CHARGE]) // battery
  6887. message_end()
  6888. }
  6889. }
  6890.  
  6891. // Remove Spawn Protection Task
  6892. public remove_spawn_protection(taskid)
  6893. {
  6894. // Not alive
  6895. if (!is_user_alive(ID_SPAWN))
  6896. return;
  6897.  
  6898. // Remove spawn protection
  6899. g_nodamage[ID_SPAWN] = false;
  6900. set_pev(ID_SPAWN, pev_effects, pev(ID_SPAWN, pev_effects) & ~EF_NODRAW)
  6901. }
  6902.  
  6903. // Task Hide Player's Money
  6904. public task_hide_money(taskid)
  6905. {
  6906. // Not alive
  6907. if (!is_user_alive(ID_SPAWN))
  6908. return;
  6909.  
  6910. // Hide money
  6911. message_begin(MSG_ONE, g_msgHideWeapon, _, ID_SPAWN)
  6912. write_byte(HIDE_MONEY) // what to hide bitsum
  6913. message_end()
  6914.  
  6915. // Hide the HL crosshair that's drawn
  6916. message_begin(MSG_ONE, g_msgCrosshair, _, ID_SPAWN)
  6917. write_byte(0) // toggle
  6918. message_end()
  6919. }
  6920.  
  6921. // Turn Off Game Flashlight
  6922. turn_off_flashlight(id)
  6923. {
  6924. // Check if flashlight is on
  6925. if (pev(id, pev_effects) & EF_DIMLIGHT)
  6926. {
  6927. // Turn it off
  6928. set_pev(id, pev_effects, pev(id, pev_effects) & ~EF_DIMLIGHT)
  6929.  
  6930. // Update HUD
  6931. message_begin(MSG_ONE, g_msgFlashlight, _, id)
  6932. write_byte(0) // toggle
  6933. write_byte(100) // battery
  6934. message_end()
  6935. }
  6936.  
  6937. // Clear any stored flashlight impulse (bugfix)
  6938. set_pev(id, pev_impulse, 0)
  6939. }
  6940.  
  6941. // Infection Grenade Explosion
  6942. infection_explode(ent)
  6943. {
  6944. // Round ended (bugfix)
  6945. if (g_endround) return;
  6946.  
  6947. // Get origin
  6948. static Float:originF[3]
  6949. pev(ent, pev_origin, originF)
  6950.  
  6951. // Make the explosion
  6952. create_blast(originF)
  6953.  
  6954. // Infection nade explode sound
  6955. engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, grenade_infect[random_num(0, sizeof grenade_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  6956.  
  6957. // Get attacker
  6958. static attacker
  6959. attacker = pev(ent, pev_owner)
  6960.  
  6961. // Collisions
  6962. static victim
  6963. victim = -1
  6964.  
  6965. while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
  6966. {
  6967. // Only effect alive non-spawnprotected humans
  6968. if (!is_user_alive(victim) || g_zombie[victim] || g_nodamage[victim])
  6969. continue;
  6970.  
  6971. // Last human is killed
  6972. if (fnGetHumans() == 1)
  6973. {
  6974. ExecuteHamB(Ham_Killed, victim, attacker, 0)
  6975. continue;
  6976. }
  6977.  
  6978. // Infected victim's sound
  6979. engfunc(EngFunc_EmitSound, victim, CHAN_VOICE, grenade_infect_player[random_num(0, sizeof grenade_infect_player - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  6980.  
  6981. SendDeathMsg(attacker, victim) // send death notice
  6982. FixDeadAttrib(victim) // fix the "dead" attrib on scoreboard
  6983. UpdateFrags(attacker, victim, get_pcvar_num(cvar_fragsinfect), 1, 1) // add corresponding frags & deaths
  6984.  
  6985. zombieme(victim, attacker, 0, 1) // turn into zombie
  6986. update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0) // ammo packs given to zombie for infection
  6987. fm_set_user_health(attacker, pev(attacker, pev_health)+get_pcvar_num(cvar_zombiebonushp)) // infection HP bonus
  6988. }
  6989.  
  6990. // Get rid of the grenade
  6991. engfunc(EngFunc_RemoveEntity, ent)
  6992. }
  6993.  
  6994. // Fire Grenade Explosion
  6995. fire_explode(ent)
  6996. {
  6997. // Get origin
  6998. static Float:originF[3]
  6999. pev(ent, pev_origin, originF)
  7000.  
  7001. // Make the explosion
  7002. create_blast2(originF)
  7003.  
  7004. // Fire nade explode sound
  7005. engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, grenade_fire[random_num(0, sizeof grenade_fire - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7006.  
  7007. // Collisions
  7008. static victim
  7009. victim = -1
  7010.  
  7011. while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
  7012. {
  7013. // Only effect alive zombies
  7014. if (!is_user_alive(victim) || !g_zombie[victim] || g_nodamage[victim])
  7015. continue;
  7016.  
  7017. // Heat icon?
  7018. if (get_pcvar_num(cvar_hudicons))
  7019. {
  7020. message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim)
  7021. write_byte(0) // damage save
  7022. write_byte(0) // damage take
  7023. write_long(DMG_BURN) // damage type
  7024. write_coord(0) // x
  7025. write_coord(0) // y
  7026. write_coord(0) // z
  7027. message_end()
  7028. }
  7029.  
  7030. // Our task params
  7031. static params[1]
  7032.  
  7033. if (g_nemesis[victim]) // fire duration (nemesis takes less)
  7034. params[0] = get_pcvar_num(cvar_fireduration)
  7035. else
  7036. params[0] = get_pcvar_num(cvar_fireduration)*5
  7037.  
  7038. // Set burning task on victim
  7039. set_task(0.1, "burning_flame", victim+TASK_BLOOD, params, sizeof params)
  7040. }
  7041.  
  7042. // Get rid of the grenade
  7043. engfunc(EngFunc_RemoveEntity, ent)
  7044. }
  7045.  
  7046. // Frost Grenade Explosion
  7047. frost_explode(ent)
  7048. {
  7049. // Get origin
  7050. static Float:originF[3]
  7051. pev(ent, pev_origin, originF)
  7052.  
  7053. // Make the explosion
  7054. create_blast3(originF)
  7055.  
  7056. // Frost nade explode sound
  7057. engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, grenade_frost[random_num(0, sizeof grenade_frost - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7058.  
  7059. // Collisions
  7060. static victim
  7061. victim = -1
  7062.  
  7063. while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
  7064. {
  7065. // Only effect alive unfrozen zombies
  7066. if (!is_user_alive(victim) || !g_zombie[victim] || g_frozen[victim] || g_nodamage[victim])
  7067. continue;
  7068.  
  7069. // Nemesis shouldn't be frozen
  7070. if (g_nemesis[victim])
  7071. {
  7072. // Get player's origin
  7073. static Float:origin2F[3]
  7074. pev(victim, pev_origin, origin2F)
  7075.  
  7076. // Broken glass sound
  7077. engfunc(EngFunc_EmitSound, victim, CHAN_BODY, grenade_frost_break[random_num(0, sizeof grenade_frost_break - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7078.  
  7079. // Glass shatter
  7080. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2F, 0)
  7081. write_byte(TE_BREAKMODEL) // TE id
  7082. engfunc(EngFunc_WriteCoord, origin2F[0]) // x
  7083. engfunc(EngFunc_WriteCoord, origin2F[1]) // y
  7084. engfunc(EngFunc_WriteCoord, origin2F[2]+24.0) // z
  7085. write_coord(16) // size x
  7086. write_coord(16) // size y
  7087. write_coord(16) // size z
  7088. write_coord(random_num(-50, 50)) // velocity x
  7089. write_coord(random_num(-50, 50)) // velocity y
  7090. write_coord(25) // velocity z
  7091. write_byte(10) // random velocity
  7092. write_short(g_glassSpr) // model
  7093. write_byte(10) // count
  7094. write_byte(25) // life
  7095. write_byte(BREAK_GLASS) // flags
  7096. message_end()
  7097.  
  7098. continue;
  7099. }
  7100.  
  7101. // Freeze icon?
  7102. if (get_pcvar_num(cvar_hudicons))
  7103. {
  7104. message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim)
  7105. write_byte(0) // damage save
  7106. write_byte(0) // damage take
  7107. write_long(DMG_DROWN) // damage type - DMG_FREEZE
  7108. write_coord(0) // x
  7109. write_coord(0) // y
  7110. write_coord(0) // z
  7111. message_end()
  7112. }
  7113.  
  7114. // Light blue glow while frozen
  7115. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  7116. fm_set_rendering(g_ent_playermodel[victim], kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
  7117. #else
  7118. fm_set_rendering(victim, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
  7119. #endif
  7120.  
  7121. // Freeze sound
  7122. engfunc(EngFunc_EmitSound, victim, CHAN_BODY, grenade_frost_player[random_num(0, sizeof grenade_frost_player - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7123.  
  7124. // Get freeze duration setting
  7125. static Float:freezeduration
  7126. freezeduration = get_pcvar_float(cvar_freezeduration)
  7127.  
  7128. // Add a blue tint to their screen
  7129. message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, victim)
  7130. write_short(UNIT_SECOND*1) // duration
  7131. write_short(floatround(UNIT_SECOND*freezeduration)) // hold time
  7132. write_short(FFADE_IN) // fade type
  7133. write_byte(0) // red
  7134. write_byte(50) // green
  7135. write_byte(200) // blue
  7136. write_byte(100) // alpha
  7137. message_end()
  7138.  
  7139. // Prevent from jumping
  7140. if (pev(victim, pev_flags) & FL_ONGROUND)
  7141. set_pev(victim, pev_gravity, 999999.9) // set really high
  7142. else
  7143. set_pev(victim, pev_gravity, 0.000001) // no gravity
  7144.  
  7145. // Set a task to remove the freeze
  7146. g_frozen[victim] = true;
  7147. set_task(freezeduration, "remove_freeze", victim)
  7148. }
  7149.  
  7150. // Get rid of the grenade
  7151. engfunc(EngFunc_RemoveEntity, ent)
  7152. }
  7153.  
  7154. // Remove freeze task
  7155. public remove_freeze(id)
  7156. {
  7157. // Not alive or not frozen anymore
  7158. if (!g_frozen[id] || !is_user_alive(id))
  7159. return;
  7160.  
  7161. // Unfreeze
  7162. g_frozen[id] = false;
  7163.  
  7164. /// Restore normal gravity
  7165. if (g_zombie[id])
  7166. set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]])
  7167. else
  7168. set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]])
  7169.  
  7170. // Broken glass sound
  7171. engfunc(EngFunc_EmitSound, id, CHAN_BODY, grenade_frost_break[random_num(0, sizeof grenade_frost_break - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7172.  
  7173. // Remove glow
  7174. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  7175. fm_set_rendering(g_ent_playermodel[id])
  7176. #else
  7177. fm_set_rendering(id)
  7178. #endif
  7179.  
  7180. // Get player's origin
  7181. static Float:origin2F[3]
  7182. pev(id, pev_origin, origin2F)
  7183.  
  7184. // Glass shatter
  7185. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2F, 0)
  7186. write_byte(TE_BREAKMODEL) // TE id
  7187. engfunc(EngFunc_WriteCoord, origin2F[0]) // x
  7188. engfunc(EngFunc_WriteCoord, origin2F[1]) // y
  7189. engfunc(EngFunc_WriteCoord, origin2F[2]+24.0) // z
  7190. write_coord(16) // size x
  7191. write_coord(16) // size y
  7192. write_coord(16) // size z
  7193. write_coord(random_num(-50, 50)) // velocity x
  7194. write_coord(random_num(-50, 50)) // velocity y
  7195. write_coord(25) // velocity z
  7196. write_byte(10) // random velocity
  7197. write_short(g_glassSpr) // model
  7198. write_byte(10) // count
  7199. write_byte(25) // life
  7200. write_byte(BREAK_GLASS) // flags
  7201. message_end()
  7202. }
  7203.  
  7204. // Remove Stuff Task
  7205. public remove_stuff()
  7206. {
  7207. static ent, removedoors
  7208. removedoors = get_pcvar_num(cvar_removedoors)
  7209.  
  7210. // Remove rotating doors
  7211. if (removedoors > 0)
  7212. {
  7213. ent = -1;
  7214. while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_door_rotating")) != 0)
  7215. engfunc(EngFunc_SetOrigin, ent, Float:{8192.0 ,8192.0 ,8192.0})
  7216. }
  7217.  
  7218. // Remove all doors
  7219. if (removedoors > 1)
  7220. {
  7221. ent = -1;
  7222. while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_door")) != 0)
  7223. engfunc(EngFunc_SetOrigin, ent, Float:{8192.0 ,8192.0 ,8192.0})
  7224. }
  7225.  
  7226. // Triggered lights
  7227. if (!get_pcvar_num(cvar_triggered))
  7228. {
  7229. ent = -1
  7230. while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "light")) != 0)
  7231. {
  7232. dllfunc(DLLFunc_Use, ent, 0); // turn off the light
  7233. set_pev(ent, pev_targetname, 0) // prevent it from being triggered
  7234. }
  7235. }
  7236. }
  7237.  
  7238. // Set Custom Weapon Models
  7239. public replace_models(id)
  7240. {
  7241. // Not alive
  7242. if (!is_user_alive(id))
  7243. return;
  7244.  
  7245. switch (g_currentweapon[id])
  7246. {
  7247. case CSW_KNIFE: // Custom knife models
  7248. {
  7249. if (g_zombie[id] && !g_newround && !g_endround)
  7250. {
  7251. if (g_nemesis[id]) // Nemesis
  7252. {
  7253. set_pev(id, pev_viewmodel2, model_vknife_nemesis)
  7254. set_pev(id, pev_weaponmodel2, "")
  7255. }
  7256. else // Zombies
  7257. {
  7258. static mdl[100]
  7259. formatex(mdl, sizeof mdl - 1, "models/[VG]/%s", g_zclass_clawmodel[g_zombieclass[id]])
  7260. set_pev(id, pev_viewmodel2, mdl)
  7261. set_pev(id, pev_weaponmodel2, "")
  7262. }
  7263. }
  7264. else // Humans
  7265. {
  7266. static mdl[100]
  7267. formatex(mdl, sizeof mdl - 1, "models/[VG]/%s", g_hclass_clawmodel[g_humanclass[id]])
  7268. set_pev(id, pev_viewmodel2, mdl)
  7269. set_pev(id, pev_weaponmodel2, "")
  7270. }
  7271. }
  7272. case CSW_M249: // Survivor's M249
  7273. {
  7274. if (g_survivor[id])
  7275. {
  7276. set_pev(id, pev_viewmodel2, model_vm249_survivor)
  7277. set_pev(id, pev_weaponmodel2, model_pm249_survivor)
  7278. }
  7279. else if(g_rpg17[id])
  7280. {
  7281. set_pev(id, pev_viewmodel2, model_rpg17_human) // Este es para el player que tiene el arma en la mano
  7282. set_pev(id, pev_weaponmodel2, model_rpg17_human1)
  7283. }
  7284.  
  7285. }
  7286. case CSW_HEGRENADE: // Infection bomb or fire grenade
  7287. {
  7288. if (g_zombie[id] && !g_newround && !g_endround)
  7289. set_pev(id, pev_viewmodel2, model_grenade_infect)
  7290. else
  7291. set_pev(id, pev_viewmodel2, model_grenade_fire)
  7292. }
  7293. case CSW_FLASHBANG: // Frost grenade
  7294. {
  7295. set_pev(id, pev_viewmodel2, model_grenade_frost)
  7296. }
  7297. case CSW_AK47: // Arma
  7298. {
  7299. if (g_akdestruction[id] == true)
  7300. {
  7301. set_pev(id, pev_viewmodel2, model_akdestruction_human) // Este es para el player que tiene el arma en la mano
  7302. set_pev(id, pev_weaponmodel2, model_akdestruction_human1) // Este es para que los demas vean el modelo del arma que llevas usando´
  7303. }
  7304. else if (g_supermide[id])
  7305. {
  7306. set_pev(id, pev_viewmodel2, model_supermide_human) // Este es para el player que tiene el arma en la mano
  7307. set_pev(id, pev_weaponmodel2, model_supermide_human1)
  7308. }
  7309. }
  7310. case CSW_SG552: // Arma
  7311. {
  7312. if (g_ultimate[id] == true) // Variable
  7313. {
  7314. set_pev(id, pev_viewmodel2, model_ultimate_human) // Este es para el player que tiene el arma en la mano
  7315. set_pev(id, pev_weaponmodel2, model_ultimate_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7316. }
  7317. else if (g_ultrak[id])
  7318. {
  7319. set_pev(id, pev_viewmodel2, model_ultrak_human) // Este es para el player que tiene el arma en la mano
  7320. set_pev(id, pev_weaponmodel2, model_ultrak_human1)
  7321. }
  7322. else if (g_coldtorment[id])
  7323. {
  7324. set_pev(id, pev_viewmodel2, model_coldtorment_human) // Este es para el player que tiene el arma en la mano
  7325. set_pev(id, pev_weaponmodel2, model_coldtorment_human1)
  7326. }
  7327. }
  7328. case CSW_FAMAS: // Arma
  7329. {
  7330. if (g_atomic[id] == true) // Variable
  7331. {
  7332. set_pev(id, pev_viewmodel2, model_atomic_human) // Este es para el player que tiene el arma en la mano
  7333. set_pev(id, pev_weaponmodel2, model_atomic_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7334. }
  7335. else if (g_adge[id])
  7336. {
  7337. set_pev(id, pev_viewmodel2, model_adge_human) // Este es para el player que tiene el arma en la mano
  7338. set_pev(id, pev_weaponmodel2, model_adge_human1)
  7339. }
  7340. else if (g_aru[id])
  7341. {
  7342. set_pev(id, pev_viewmodel2, model_aru_human) // Este es para el player que tiene el arma en la mano
  7343. set_pev(id, pev_weaponmodel2, model_aru_human1)
  7344. }
  7345. }
  7346. case CSW_P90: // Arma
  7347. {
  7348. if (g_masive[id]) // Variable
  7349. {
  7350. set_pev(id, pev_viewmodel2, model_masive_human) // Este es para el player que tiene el arma en la mano
  7351. set_pev(id, pev_weaponmodel2, model_masive_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7352. }
  7353. }
  7354. case CSW_MP5NAVY: // Arma
  7355. {
  7356. if (g_navi[id]) // Variable
  7357. {
  7358. set_pev(id, pev_viewmodel2, model_navi_human) // Este es para el player que tiene el arma en la mano
  7359. set_pev(id, pev_weaponmodel2, model_navi_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7360. }
  7361. }
  7362. case CSW_XM1014: // Arma
  7363. {
  7364. if (g_power[id] == true) // Variable
  7365. {
  7366. set_pev(id, pev_viewmodel2, model_overpower_human) // Este es para el player que tiene el arma en la mano
  7367. set_pev(id, pev_weaponmodel2, model_overpower_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7368. }
  7369. else if (g_ultra[id])
  7370. {
  7371. set_pev(id, pev_viewmodel2, model_ultra_human) // Este es para el player que tiene el arma en la mano
  7372. set_pev(id, pev_weaponmodel2, model_ultra_human1)
  7373. }
  7374. else if (g_shredder[id])
  7375. {
  7376. set_pev(id, pev_viewmodel2, model_shredder_human) // Este es para el player que tiene el arma en la mano
  7377. set_pev(id, pev_weaponmodel2, model_shredder_human1)
  7378. }
  7379. }
  7380. case CSW_G3SG1: // Arma
  7381. {
  7382. if (g_stfu[id] == true) // Variable
  7383. {
  7384. set_pev(id, pev_viewmodel2, model_stfu_human) // Este es para el player que tiene el arma en la mano
  7385. set_pev(id, pev_weaponmodel2, model_stfu_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7386. }
  7387. else if (g_raampage[id])
  7388. {
  7389. set_pev(id, pev_viewmodel2, model_raampage_human) // Este es para el player que tiene el arma en la mano
  7390. set_pev(id, pev_weaponmodel2, model_raampage_human1)
  7391. }
  7392. }
  7393. case CSW_UMP45: // Arma
  7394. {
  7395. if (g_rlp[id] == true) // Variable
  7396. {
  7397. set_pev(id, pev_viewmodel2, model_rlp_human) // Este es para el player que tiene el arma en la mano
  7398. set_pev(id, pev_weaponmodel2, model_rlp_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7399. }
  7400. else if (g_101000cannon[id])
  7401. {
  7402. set_pev(id, pev_viewmodel2, model_101000cannon_human) // Este es para el player que tiene el arma en la mano
  7403. set_pev(id, pev_weaponmodel2, model_101000cannon_human1)
  7404. }
  7405. }
  7406. case CSW_M4A1: // Arma
  7407. {
  7408. if (g_m4[id] == true) // Variable
  7409. {
  7410. set_pev(id, pev_viewmodel2, model_m4_human) // Este es para el player que tiene el arma en la mano
  7411. set_pev(id, pev_weaponmodel2, model_m4_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7412. }
  7413. else if (g_farger[id])
  7414. {
  7415. set_pev(id, pev_viewmodel2, model_farger_human) // Este es para el player que tiene el arma en la mano
  7416. set_pev(id, pev_weaponmodel2, model_farger_human1)
  7417. }
  7418. else if (g_tmp2xx[id])
  7419. {
  7420. set_pev(id, pev_viewmodel2, model_tmp2xx_human) // Este es para el player que tiene el arma en la mano
  7421. set_pev(id, pev_weaponmodel2, model_tmp2xx_human1)
  7422. }
  7423. }
  7424. case CSW_M3: // Arma
  7425. {
  7426. if (g_barret[id] == true) // Variable
  7427. {
  7428. set_pev(id, pev_viewmodel2, model_barret_human) // Este es para el player que tiene el arma en la mano
  7429. set_pev(id, pev_weaponmodel2, model_barret_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7430. }
  7431. else if (g_super[id])
  7432. {
  7433. set_pev(id, pev_viewmodel2, model_super_human) // Este es para el player que tiene el arma en la mano
  7434. set_pev(id, pev_weaponmodel2, model_super_human1)
  7435. }
  7436. else if (g_zpr350[id])
  7437. {
  7438. set_pev(id, pev_viewmodel2, model_zpr350_human) // Este es para el player que tiene el arma en la mano
  7439. set_pev(id, pev_weaponmodel2, model_zpr350_human1)
  7440. }
  7441. }
  7442. case CSW_GALI: // Arma
  7443. {
  7444. if (g_devil[id] == true) // Variable
  7445. {
  7446. set_pev(id, pev_viewmodel2, model_devil_human) // Este es para el player que tiene el arma en la mano
  7447. set_pev(id, pev_weaponmodel2, model_devil_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7448. }
  7449. else if (g_storm[id])
  7450. {
  7451. set_pev(id, pev_viewmodel2, model_storm_human) // Este es para el player que tiene el arma en la mano
  7452. set_pev(id, pev_weaponmodel2, model_storm_human1)
  7453. }
  7454. else if (g_xh500w[id])
  7455. {
  7456. set_pev(id, pev_viewmodel2, model_xh500w_human) // Este es para el player que tiene el arma en la mano
  7457. set_pev(id, pev_weaponmodel2, model_xh500w_human1)
  7458. }
  7459. }
  7460. case CSW_AUG: // Arma
  7461. {
  7462. if (g_rampage[id] == true) // Variable
  7463. {
  7464. set_pev(id, pev_viewmodel2, model_rampage_human) // Este es para el player que tiene el arma en la mano
  7465. set_pev(id, pev_weaponmodel2, model_rampage_human1) // Este es para que los demas vean el modelo del arma que llevas usando
  7466. }
  7467. else if (g_nule[id])
  7468. {
  7469. set_pev(id, pev_viewmodel2, model_nule_human) // Este es para el player que tiene el arma en la mano
  7470. set_pev(id, pev_weaponmodel2, model_nule_human1)
  7471. }
  7472. else if (g_thunderstorm[id])
  7473. {
  7474. set_pev(id, pev_viewmodel2, model_thunderstorm_human) // Este es para el player que tiene el arma en la mano
  7475. set_pev(id, pev_weaponmodel2, model_thunderstorm_human1)
  7476. }
  7477. else if (g_101000xx[id])
  7478. {
  7479. set_pev(id, pev_viewmodel2, model_101000xx_human) // Este es para el player que tiene el arma en la mano
  7480. set_pev(id, pev_weaponmodel2, model_101000xx_human1)
  7481. }
  7482. }
  7483. case CSW_AWP:
  7484. {
  7485. if (g_dvlsxx[id] == true)
  7486. {
  7487. set_pev(id, pev_viewmodel2, model_dvlsxx_human) // Este es para el player que tiene el arma en la mano
  7488. set_pev(id, pev_weaponmodel2, model_dvlsxx_human1)
  7489. }
  7490. }
  7491. case CSW_SMOKEGRENADE: // Flare grenade
  7492. {
  7493. set_pev(id, pev_viewmodel2, model_grenade_flare)
  7494. }
  7495. }
  7496.  
  7497. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  7498. fm_set_weaponmodel_ent(id)
  7499. #endif
  7500. }
  7501.  
  7502. // Reset Player Vars
  7503. reset_vars(id, resetall)
  7504. {
  7505. g_zombie[id] = false
  7506. g_nemesis[id] = false
  7507. g_armagedon[id] = false
  7508. g_survivor[id] = false
  7509. g_firstzombie[id] = false
  7510. g_lastzombie[id] = false
  7511. g_lasthuman[id] = false
  7512. g_frozen[id] = false
  7513. g_nodamage[id] = false
  7514. g_respawn_as_zombie[id] = false
  7515. g_nvision[id] = false
  7516. g_nvisionenabled[id] = false
  7517. g_flashlight[id] = false
  7518. g_flashbattery[id] = 100
  7519. g_canbuy[id] = true
  7520.  
  7521. if (resetall)
  7522. {
  7523. g_grandreset[id] = 0
  7524. g_level[id] = 0
  7525. g_reset[id] = 0
  7526. g_ammopacks[id] = 0
  7527. g_damage[id] = 0
  7528. g_total[id] = 0
  7529. g_zombieclass[id] = ZCLASS_NONE
  7530. g_zombieclassnext[id] = ZCLASS_NONE
  7531. g_humanclass[id] = HCLASS_NONE
  7532. g_humanclassnext[id] = HCLASS_NONE
  7533. g_damagedealt[id] = 0
  7534. WPN_AUTO_ON = 0
  7535. g_points[id][0] = 0
  7536. g_points[id][1] = 0
  7537. g_skill_points[id][0][0] = 0
  7538. g_skill_points[id][0][1] = 0
  7539. g_skill_points[id][0][2] = 0
  7540. g_skill_points[id][0][3] = 0
  7541. g_skill_points[id][0][4] = 0
  7542. g_skill_points[id][1][0] = 0
  7543. g_skill_points[id][1][1] = 0
  7544. g_skill_points[id][1][2] = 0
  7545. g_skill_points[id][1][3] = 0
  7546. g_usedpoints[id][0] = 0
  7547. g_usedpoints[id][1] = 0
  7548. }
  7549. }
  7550.  
  7551. // Set spectators nightvision
  7552. public spec_nvision(id)
  7553. {
  7554. // Not connected, playing, or bot
  7555. if (!is_user_connected(id) || is_user_alive(id) || is_user_bot(id))
  7556. return;
  7557.  
  7558. // Give Night Vision?
  7559. if (get_pcvar_num(cvar_nvggive))
  7560. {
  7561. g_nvision[id] = true
  7562.  
  7563. // Turn on Night Vision automatically?
  7564. if (get_pcvar_num(cvar_nvggive) == 1)
  7565. {
  7566. g_nvisionenabled[id] = true
  7567.  
  7568. // Custom nvg?
  7569. if (get_pcvar_num(cvar_cnvg))
  7570. {
  7571. remove_task(id+TASK_NVISION)
  7572. set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
  7573. }
  7574. else
  7575. set_user_gnvision(id, 1)
  7576. }
  7577. }
  7578. }
  7579.  
  7580. // Show HUD Task
  7581. public ShowHUD(taskid)
  7582. {
  7583. static id
  7584. id = ID_SHOWHUD;
  7585.  
  7586. // Player died?
  7587. if (!is_user_alive(id))
  7588. {
  7589. // Get spectating target
  7590. id = pev(id, PEV_SPEC_TARGET)
  7591.  
  7592. // Target not alive
  7593. if (!is_user_alive(id)) return;
  7594. }
  7595.  
  7596. // Format the classname
  7597. static class[32], red, green, blue
  7598.  
  7599. if (g_zombie[id]) // zombies
  7600. {
  7601. red = 200
  7602. green = 250
  7603. blue = 0
  7604.  
  7605. if (g_nemesis[id])
  7606. formatex(class, sizeof class - 1, "%L", ID_SHOWHUD,"CLASS_NEMESIS")
  7607. else
  7608. copy(class, sizeof class - 1, g_zclass_name[g_zombieclass[id]])
  7609. }
  7610. else // humans
  7611. {
  7612. red = 0
  7613. green = 255
  7614. blue = 0
  7615.  
  7616. if (g_survivor[id])
  7617. formatex(class, sizeof class - 1, "%L", ID_SHOWHUD,"CLASS_SURVIVOR")
  7618. else
  7619. copy(class, sizeof class - 1, g_hclass_name[g_humanclass[id]])
  7620. }
  7621.  
  7622. // Spectating someone else?
  7623. if (id != ID_SHOWHUD)
  7624. {
  7625. static name[32]
  7626. get_user_name(id, name, sizeof name - 1)
  7627.  
  7628. // Show name, health, class, and ammo packs
  7629. set_hudmessage(255, 255, 255, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
  7630. ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "%L %s^nHP: %d - %L %s - %L %d", ID_SHOWHUD, "SPECTATING", name, pev(id, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[id])
  7631. }
  7632. else
  7633. {
  7634. new Float:Porcentaje = ((g_ammopacks[id] - NIVELES[g_level[id]-1]) * 100.0) / (NIVELES[g_level[id]] - NIVELES[g_level[id]-1])
  7635. // Show health, class and ammo packs
  7636. set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
  7637. ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "~ %L: %d ^n~ %L %s ^n~ %L %d ^n~ Level: %d/1000 ( %.2f%% )^n~ Aps Needed: %d^n~ Armor: %d ^n~ Resets: %d ^n~ Super Resets: %d", id, "ZOMBIE_ATTRIB1", pev(ID_SHOWHUD, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[ID_SHOWHUD],g_level[id] ,Porcentaje ,NIVELES[g_level[id]] - g_ammopacks[id] ,get_user_armor(id), g_reset[id], g_grandreset[id])
  7638. }
  7639. }
  7640.  
  7641. // Play idle zombie sounds
  7642. public zombie_play_idle(taskid)
  7643. {
  7644. // Round ended/new one starting
  7645. if (g_endround || g_newround)
  7646. return;
  7647.  
  7648. // Last zombie?
  7649. if (g_lastzombie[ID_BLOOD])
  7650. 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)
  7651. else
  7652. engfunc(EngFunc_EmitSound, ID_BLOOD, CHAN_VOICE, zombie_idle[random_num(0, sizeof zombie_idle - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
  7653. }
  7654.  
  7655. // Madness Over Task
  7656. public madness_over(taskid)
  7657. {
  7658. g_nodamage[ID_BLOOD] = false
  7659. }
  7660.  
  7661. // Place user at a random spawn
  7662. do_random_spawn(id)
  7663. {
  7664. // No spawns?
  7665. if (!g_spawnCount)
  7666. return;
  7667.  
  7668. // Get whether the player is crouching
  7669. static hull
  7670. hull = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN
  7671.  
  7672. // Choose random spawn to start looping at
  7673. static sp_index, i
  7674. sp_index = random_num(0, g_spawnCount - 1)
  7675.  
  7676. // Try to find a clear spawn
  7677. for (i = sp_index + 1; i != 999; i++)
  7678. {
  7679. // Start over when we reach the end
  7680. if (i >= g_spawnCount) i = 0
  7681.  
  7682. // Free spawn space?
  7683. if (is_hull_vacant(g_spawns[i], hull))
  7684. {
  7685. // Engfunc_SetOrigin is used so ent's mins and maxs get updated instantly
  7686. engfunc(EngFunc_SetOrigin, id, g_spawns[i])
  7687. break;
  7688. }
  7689.  
  7690. // Loop completed, no free space found
  7691. if (i == sp_index) break;
  7692. }
  7693. }
  7694.  
  7695. // Get Zombies -returns alive zombies number-
  7696. fnGetZombies()
  7697. {
  7698. static iZombies, id
  7699. iZombies = 0
  7700.  
  7701. for (id = 1; id <= g_maxplayers; id++)
  7702. {
  7703. if (is_user_alive(id) && g_zombie[id])
  7704. iZombies++
  7705. }
  7706.  
  7707. return iZombies;
  7708. }
  7709.  
  7710. // Get Humans -returns alive humans number-
  7711. fnGetHumans()
  7712. {
  7713. static iHumans, id
  7714. iHumans = 0
  7715.  
  7716. for (id = 1; id <= g_maxplayers; id++)
  7717. {
  7718. if (is_user_alive(id) && !g_zombie[id])
  7719. iHumans++
  7720. }
  7721.  
  7722. return iHumans;
  7723. }
  7724.  
  7725. // Get Alive -returns alive players number-
  7726. fnGetAlive()
  7727. {
  7728. static iAlive, id
  7729. iAlive = 0
  7730.  
  7731. for (id = 1; id <= g_maxplayers; id++)
  7732. {
  7733. if (is_user_alive(id))
  7734. iAlive++
  7735. }
  7736.  
  7737. return iAlive;
  7738. }
  7739.  
  7740. // Get Random Alive -returns index of alive player number n -
  7741. fnGetRandomAlive(n)
  7742. {
  7743. static iAlive, id
  7744. iAlive = 0
  7745.  
  7746. for (id = 1; id <= g_maxplayers; id++)
  7747. {
  7748. if (is_user_alive(id))
  7749. iAlive++
  7750.  
  7751. if (iAlive == n)
  7752. return id;
  7753. }
  7754.  
  7755. return -1;
  7756. }
  7757.  
  7758. // Get Playing -returns number of users playing-
  7759. fnGetPlaying()
  7760. {
  7761. static iPlaying, id, team
  7762. iPlaying = 0
  7763.  
  7764. for (id = 1; id <= g_maxplayers; id++)
  7765. {
  7766. if (is_user_connected(id))
  7767. {
  7768. team = fm_get_user_team(id)
  7769.  
  7770. if (team != CS_TEAM_SPECTATOR && team != CS_TEAM_UNASSIGNED)
  7771. iPlaying++
  7772. }
  7773. }
  7774.  
  7775. return iPlaying;
  7776. }
  7777.  
  7778. // Get CTs -returns number of CTs connected-
  7779. fnGetCTs()
  7780. {
  7781. static iCTs, id
  7782. iCTs = 0
  7783.  
  7784. for (id = 1; id <= g_maxplayers; id++)
  7785. {
  7786. if (is_user_connected(id))
  7787. {
  7788. if (fm_get_user_team(id) == CS_TEAM_CT)
  7789. iCTs++
  7790. }
  7791. }
  7792.  
  7793. return iCTs;
  7794. }
  7795.  
  7796. // Get Ts -returns number of Ts connected-
  7797. fnGetTs()
  7798. {
  7799. static iTs, id
  7800. iTs = 0
  7801.  
  7802. for (id = 1; id <= g_maxplayers; id++)
  7803. {
  7804. if (is_user_connected(id))
  7805. {
  7806. if (fm_get_user_team(id) == CS_TEAM_T)
  7807. iTs++
  7808. }
  7809. }
  7810.  
  7811. return iTs;
  7812. }
  7813.  
  7814. // Last Zombie Check -check for last zombie and set its flag-
  7815. public fnCheckLastZombie()
  7816. {
  7817. static id
  7818. for (id = 1; id <= g_maxplayers; id++)
  7819. {
  7820. // Last zombie
  7821. if (g_zombie[id] && is_user_alive(id) && fnGetZombies() == 1)
  7822. g_lastzombie[id] = true
  7823. else
  7824. g_lastzombie[id] = false
  7825.  
  7826. // Last human
  7827. if (!g_zombie[id] && !g_survivor[id] && is_user_alive(id) && fnGetHumans() == 1)
  7828. {
  7829. // Reward extra hp for last human?
  7830. if (!g_lasthuman[id]) fm_set_user_health(id, g_hclass_hp[g_humanclass[id]] + H_SALUD(g_skill_points[id][0][1]))
  7831. g_lasthuman[id] = true
  7832. }
  7833. else
  7834. g_lasthuman[id] = false
  7835. }
  7836. }
  7837.  
  7838. // Save player's stats into the database
  7839. save_stats(id)
  7840. {
  7841. // Get user name
  7842. static name[32]
  7843. get_user_name(id, name, sizeof name - 1)
  7844.  
  7845. // Check whether there is another record already in that slot
  7846. if (db_name[id][0] && !equal(name, db_name[id]))
  7847. {
  7848. // If DB size is exceeded, write over old records
  7849. if (db_slot_i >= sizeof db_name)
  7850. db_slot_i = g_maxplayers+1
  7851.  
  7852. // Move previous record onto an additional save slot
  7853. copy(db_name[db_slot_i], sizeof db_name[] - 1, db_name[id])
  7854. db_ammopacks[db_slot_i] = db_ammopacks[id]
  7855. db_zombieclass[db_slot_i] = db_zombieclass[id]
  7856. db_humanclass[db_slot_i] = db_humanclass[id]
  7857. db_slot_i++
  7858. }
  7859.  
  7860. // Now save the current player stats
  7861. copy(db_name[id], sizeof db_name[] - 1, name) // name
  7862. db_ammopacks[id] = g_ammopacks[id] // ammo packs
  7863. db_zombieclass[id] = g_zombieclassnext[id] // zombie class
  7864. db_humanclass[id] = g_humanclassnext[id] // human class
  7865. }
  7866.  
  7867. // Load player's stats from the database (if a record is found)
  7868. load_stats(id)
  7869. {
  7870. // Get user name
  7871. static name[32], i
  7872. get_user_name(id, name, sizeof name - 1)
  7873.  
  7874. // Look for a matching record in the DB
  7875. for (i = 0; i < sizeof db_name; i++)
  7876. {
  7877. if (equal(name, db_name[i]))
  7878. {
  7879. // Bingo!
  7880. g_ammopacks[id] = db_ammopacks[i]
  7881. g_zombieclass[id] = db_zombieclass[i]
  7882. g_zombieclassnext[id] = db_zombieclass[i]
  7883. g_humanclass[id] = db_humanclass[i]
  7884. g_humanclassnext[id] = db_humanclass[i]
  7885. return;
  7886. }
  7887. }
  7888. }
  7889.  
  7890. // Checks if a player should leap
  7891. allowed_leap(id)
  7892. {
  7893. // Leap available for zombies/nemesis/survivor only
  7894. if ((!g_zombie[id] && !g_survivor[id]) || g_frozen[id])
  7895. return false;
  7896.  
  7897. // Nemesis cvar not enabled
  7898. if (g_nemesis[id] && !get_pcvar_num(cvar_leapnemesis))
  7899. return false;
  7900.  
  7901. // Survivor cvar not enabled
  7902. if (g_survivor[id] && !get_pcvar_num(cvar_leapsurvivor))
  7903. return false;
  7904.  
  7905. // Get zombie cvar
  7906. static leapzombies
  7907. leapzombies = get_pcvar_num(cvar_leapzombies)
  7908.  
  7909. // Zombie cvar not enabled
  7910. if (leapzombies == 0 && !g_nemesis[id] && !g_survivor[id])
  7911. return false;
  7912.  
  7913. // Not the first zombie
  7914. if (leapzombies == 2 && !g_nemesis[id] && !g_survivor[id] && !g_firstzombie[id])
  7915. return false;
  7916.  
  7917. // Not the last zombie
  7918. if (leapzombies == 3 && !g_nemesis[id] && !g_survivor[id] && !g_lastzombie[id])
  7919. return false;
  7920.  
  7921. // Get currently pressed buttons
  7922. static buttons
  7923. buttons = pev(id, pev_button)
  7924.  
  7925. // Not doing a longjump (added bot support)
  7926. if ((!(buttons & IN_JUMP) || !(buttons & IN_DUCK)) && !is_user_bot(id))
  7927. return false;
  7928.  
  7929. // Get cooldown cvar
  7930. static Float:cooldown
  7931. cooldown = g_survivor[id] ? get_pcvar_float(cvar_leapsurvivorcooldown) : g_nemesis[id] ? get_pcvar_float(cvar_leapnemesiscooldown) : get_pcvar_float(cvar_leapzombiescooldown)
  7932.  
  7933. // Cooldown not over yet
  7934. if (get_gametime() - g_lastleaptime[id] < cooldown)
  7935. return false;
  7936.  
  7937. // Not on ground or not enough speed
  7938. if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
  7939. return false;
  7940.  
  7941. return true;
  7942. }
  7943.  
  7944. // Checks if a player should be Pain Shock Free
  7945. allowed_painshockfree(id)
  7946. {
  7947. // Pain shock free available for zombies/nemesis/survivor only
  7948. if (!g_zombie[id] && !g_survivor[id])
  7949. return false;
  7950.  
  7951. // Nemesis cvar not enabled
  7952. if (g_nemesis[id] && !get_pcvar_num(cvar_nempainfree))
  7953. return false;
  7954.  
  7955. // Survivor cvar not enabled
  7956. if (g_survivor[id] && !get_pcvar_num(cvar_survpainfree))
  7957. return false;
  7958.  
  7959. // Get zombie cvar
  7960. static zombiepainfree
  7961. zombiepainfree = get_pcvar_num(cvar_zombiepainfree)
  7962.  
  7963. // Zombie cvar not enabled
  7964. if (zombiepainfree == 0 && !g_survivor[id] && !g_nemesis[id])
  7965. return false;
  7966.  
  7967. // Not the last zombie
  7968. if (zombiepainfree == 2 && !g_survivor[id] && !g_nemesis[id] && !g_lastzombie[id])
  7969. return false;
  7970.  
  7971. // Not on ground
  7972. if (!(pev(id, pev_flags) & FL_ONGROUND))
  7973. return false;
  7974.  
  7975. return true;
  7976. }
  7977.  
  7978. // Checks if a player is allowed to be zombie
  7979. allowed_zombie(id)
  7980. {
  7981. if (g_zombie[id] || g_swarmround || g_nemround || g_survround || g_plagueround || g_endround || !is_user_alive(id) || task_exists(TASK_WELCOMEMSG) || (!g_zombie[id] && fnGetHumans() == 1))
  7982. return false;
  7983.  
  7984. return true;
  7985. }
  7986.  
  7987. // Checks if a player is allowed to be human
  7988. allowed_human(id)
  7989. {
  7990. if (!g_zombie[id] || g_swarmround || g_nemround || g_survround || g_plagueround || g_endround || !is_user_alive(id) || task_exists(TASK_WELCOMEMSG) || (g_zombie[id] && fnGetZombies() == 1))
  7991. return false;
  7992.  
  7993. return true;
  7994. }
  7995.  
  7996. // Checks if a player is allowed to be survivor
  7997. allowed_survivor(id)
  7998. {
  7999. if (g_endround || !g_newround || !is_user_alive(id) || !get_pcvar_num(cvar_surv) || task_exists(TASK_WELCOMEMSG) || fnGetAlive() < get_pcvar_num(cvar_survminplayers))
  8000. return false;
  8001.  
  8002. return true;
  8003. }
  8004.  
  8005. // Checks if a player is allowed to be nemesis
  8006. allowed_nemesis(id)
  8007. {
  8008. if (g_endround || !g_newround || !is_user_alive(id) || !get_pcvar_num(cvar_nem) || task_exists(TASK_WELCOMEMSG) || fnGetAlive() < get_pcvar_num(cvar_nemminplayers))
  8009. return false;
  8010.  
  8011. return true;
  8012. }
  8013.  
  8014. // Checks if a player is allowed to respawn
  8015. allowed_respawn(id)
  8016. {
  8017. static team
  8018. team = fm_get_user_team(id)
  8019.  
  8020. if (g_endround || g_survround || g_swarmround || g_armagedonround ||g_nemround || g_plagueround || team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED || !is_user_connected(id) || is_user_alive(id))
  8021. return false;
  8022.  
  8023. return true;
  8024. }
  8025.  
  8026. // Checks if swarm mode is allowed
  8027. allowed_swarm()
  8028. {
  8029. if (!get_pcvar_num(cvar_swarm) || g_endround || !g_newround || task_exists(TASK_WELCOMEMSG))
  8030. return false
  8031.  
  8032. return true
  8033. }
  8034.  
  8035. // Checks if multi infection mode is allowed
  8036. allowed_multi()
  8037. {
  8038. if (g_endround || !g_newround || !get_pcvar_num(cvar_multi) || task_exists(TASK_WELCOMEMSG) || floatround(fnGetAlive()*get_pcvar_float(cvar_multiratio), floatround_ceil) < 2 || floatround(fnGetAlive()*get_pcvar_float(cvar_multiratio), floatround_ceil) >= fnGetAlive() || fnGetAlive() < get_pcvar_num(cvar_multiminplayers))
  8039. return false;
  8040.  
  8041. return true;
  8042. }
  8043.  
  8044. // Checks if multi infection mode is allowed
  8045. allowed_armagedon()
  8046. {
  8047. if (g_endround || !g_newround || !get_pcvar_num(cvar_armagedon) || task_exists(TASK_WELCOMEMSG) || fnGetAlive() < get_pcvar_num(cvar_armagedonminplayers))
  8048. return false;
  8049.  
  8050. return true;
  8051. }
  8052.  
  8053. // Checks if plague mode is allowed
  8054. allowed_plague()
  8055. {
  8056. if (g_endround || !g_newround || !get_pcvar_num(cvar_plague) || task_exists(TASK_WELCOMEMSG) || floatround((fnGetAlive()-(get_pcvar_num(cvar_plaguenemnum)+get_pcvar_num(cvar_plaguesurvnum)))*get_pcvar_float(cvar_plagueratio), floatround_ceil) < 1
  8057. || fnGetAlive()-(get_pcvar_num(cvar_plaguesurvnum)+get_pcvar_num(cvar_plaguenemnum)+floatround((fnGetAlive()-(get_pcvar_num(cvar_plaguenemnum)+get_pcvar_num(cvar_plaguesurvnum)))*get_pcvar_float(cvar_plagueratio), floatround_ceil)) < 1 || fnGetAlive() < get_pcvar_num(cvar_plagueminplayers))
  8058. return false;
  8059.  
  8060. return true;
  8061. }
  8062.  
  8063. // Admin Command. zp_zombie
  8064. command_zombie(id, player)
  8065. {
  8066. static name1[32], name2[32]
  8067. get_user_name(id, name1, sizeof name1 - 1)
  8068. get_user_name(player, name2, sizeof name2 - 1)
  8069.  
  8070. // Show activity?
  8071. switch (get_pcvar_num(cvar_showactivity))
  8072. {
  8073. case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_INFECT")
  8074. case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_INFECT")
  8075. }
  8076.  
  8077. // Log to Zombie Plague log file?
  8078. if (get_pcvar_num(cvar_logcommands))
  8079. {
  8080. static logdata[100], authid[32], ip[16]
  8081. get_user_authid(id, authid, sizeof authid - 1)
  8082. get_user_ip(id, ip, sizeof ip - 1, 1)
  8083. 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)
  8084. log_to_file("zombieplague.log", logdata)
  8085. }
  8086.  
  8087. // New round?
  8088. if (g_newround)
  8089. {
  8090. // Set as first zombie
  8091. remove_task(TASK_MAKEZOMBIE)
  8092. make_a_zombie(MODE_INFECTION, player)
  8093. }
  8094. else
  8095. {
  8096. // Just infect
  8097. zombieme(player, 0, 0, 0)
  8098. }
  8099. }
  8100.  
  8101. // Admin Command. zp_human
  8102. command_human(id, player)
  8103. {
  8104. static name1[32], name2[32]
  8105. get_user_name(id, name1, sizeof name1 - 1)
  8106. get_user_name(player, name2, sizeof name2 - 1)
  8107.  
  8108. // Show activity?
  8109. switch (get_pcvar_num(cvar_showactivity))
  8110. {
  8111. case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_DISINFECT")
  8112. case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_DISINFECT")
  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> - %s %L (Players: %d/%d)", name1, authid, ip, name2, LANG_SERVER,"CMD_DISINFECT", fnGetPlaying(), g_maxplayers)
  8122. log_to_file("zombieplague.log", logdata)
  8123. }
  8124.  
  8125. // Turn to human
  8126. humanme(player, 0)
  8127. }
  8128.  
  8129. // Admin Command. zp_survivor
  8130. command_survivor(id, player)
  8131. {
  8132. static name1[32], name2[32]
  8133. get_user_name(id, name1, sizeof name1 - 1)
  8134. get_user_name(player, name2, sizeof name2 - 1)
  8135.  
  8136. // Show activity?
  8137. switch (get_pcvar_num(cvar_showactivity))
  8138. {
  8139. case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_SURVIVAL")
  8140. case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_SURVIVAL")
  8141. }
  8142.  
  8143. // Log to Zombie Plague log file?
  8144. if (get_pcvar_num(cvar_logcommands))
  8145. {
  8146. static logdata[100], authid[32], ip[16]
  8147. get_user_authid(id, authid, sizeof authid - 1)
  8148. get_user_ip(id, ip, sizeof ip - 1, 1)
  8149. formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %s %L (Players: %d/%d)", name1, authid, ip, name2, LANG_SERVER,"CMD_SURVIVAL", fnGetPlaying(), g_maxplayers)
  8150. log_to_file("zombieplague.log", logdata)
  8151. }
  8152.  
  8153. // Turn into a Survivor
  8154. remove_task(TASK_MAKEZOMBIE)
  8155. make_a_zombie(MODE_SURVIVOR, player)
  8156. }
  8157.  
  8158. // Admin Command. zp_nemesis
  8159. command_nemesis(id, player)
  8160. {
  8161. static name1[32], name2[32]
  8162. get_user_name(id, name1, sizeof name1 - 1)
  8163. get_user_name(player, name2, sizeof name2 - 1)
  8164.  
  8165. // Show activity?
  8166. switch (get_pcvar_num(cvar_showactivity))
  8167. {
  8168. case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_NEMESIS")
  8169. case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_NEMESIS")
  8170. }
  8171.  
  8172. // Log to Zombie Plague log file?
  8173. if (get_pcvar_num(cvar_logcommands))
  8174. {
  8175. static logdata[100], authid[32], ip[16]
  8176. get_user_authid(id, authid, sizeof authid - 1)
  8177. get_user_ip(id, ip, sizeof ip - 1, 1)
  8178. formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %s %L (Players: %d/%d)", name1, authid, ip, name2, LANG_SERVER,"CMD_NEMESIS", fnGetPlaying(), g_maxplayers)
  8179. log_to_file("zombieplague.log", logdata)
  8180. }
  8181.  
  8182. // Turn into a Nemesis
  8183. remove_task(TASK_MAKEZOMBIE)
  8184. make_a_zombie(MODE_NEMESIS, player)
  8185. }
  8186.  
  8187. // Admin Command. zp_respawn
  8188. command_respawn(id, player)
  8189. {
  8190. static name1[32], name2[32]
  8191. get_user_name(id, name1, sizeof name1 - 1)
  8192. get_user_name(player, name2, sizeof name2 - 1)
  8193.  
  8194. // Show activity?
  8195. switch (get_pcvar_num(cvar_showactivity))
  8196. {
  8197. case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_RESPAWN")
  8198. case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_RESPAWN")
  8199. }
  8200.  
  8201. // Log to Zombie Plague log file?
  8202. if (get_pcvar_num(cvar_logcommands))
  8203. {
  8204. static logdata[100], authid[32], ip[16]
  8205. get_user_authid(id, authid, sizeof authid - 1)
  8206. get_user_ip(id, ip, sizeof ip - 1, 1)
  8207. formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %s %L (Players: %d/%d)", name1, authid, ip, name2, LANG_SERVER, "CMD_RESPAWN", fnGetPlaying(), g_maxplayers)
  8208. log_to_file("zombieplague.log", logdata)
  8209. }
  8210.  
  8211. // Get deathmatch mode status
  8212. static deathmatch
  8213. deathmatch = get_pcvar_num(cvar_deathmatch)
  8214.  
  8215. // Respawn as zombie?
  8216. if (deathmatch == 2 || (deathmatch == 3 && random_num(0, 1)) || (deathmatch == 4 && fnGetZombies() < fnGetAlive()/2))
  8217. g_respawn_as_zombie[player] = true
  8218.  
  8219. respawn_player(player+TASK_SPAWN);
  8220. }
  8221.  
  8222. // Admin Command. zp_swarm
  8223. command_swarm(id)
  8224. {
  8225. static name1[32]
  8226. get_user_name(id, name1, sizeof name1 - 1)
  8227.  
  8228. // Show activity?
  8229. switch (get_pcvar_num(cvar_showactivity))
  8230. {
  8231. case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_SWARM")
  8232. case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_SWARM")
  8233. }
  8234.  
  8235. // Log to Zombie Plague log file?
  8236. if (get_pcvar_num(cvar_logcommands))
  8237. {
  8238. static logdata[100], authid[32], ip[16]
  8239. get_user_authid(id, authid, sizeof authid - 1)
  8240. get_user_ip(id, ip, sizeof ip - 1, 1)
  8241. formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %L (Players: %d/%d)", name1, authid, ip, LANG_SERVER, "CMD_SWARM", fnGetPlaying(), g_maxplayers)
  8242. log_to_file("zombieplague.log", logdata)
  8243. }
  8244.  
  8245. // Call Swarm Mode
  8246. remove_task(TASK_MAKEZOMBIE)
  8247. make_a_zombie(MODE_SWARM, 0)
  8248. }
  8249.  
  8250. command_armagedon(id)
  8251. {
  8252. static name1[32]
  8253. get_user_name(id, name1, sizeof name1 - 1)
  8254.  
  8255. // Show activity?
  8256. switch (get_pcvar_num(cvar_showactivity))
  8257. {
  8258. case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_ARMAGEDON")
  8259. case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_ARMAGEDON")
  8260. }
  8261.  
  8262. // Log to Zombie Plague log file?
  8263. if (get_pcvar_num(cvar_logcommands))
  8264. {
  8265. static logdata[100], authid[32], ip[16]
  8266. get_user_authid(id, authid, sizeof authid - 1)
  8267. get_user_ip(id, ip, sizeof ip - 1, 1)
  8268. formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %L (Players: %d/%d)", name1, authid, ip, LANG_SERVER, "CMD_ARMAGEDON", fnGetPlaying(), g_maxplayers)
  8269. log_to_file("zombieplague.log", logdata)
  8270. }
  8271.  
  8272. // Call Swarm Mode
  8273. remove_task(TASK_MAKEZOMBIE)
  8274. make_a_zombie(MODE_ARMAGEDON, 0)
  8275. }
  8276.  
  8277.  
  8278. // Admin Command. zp_multi
  8279. command_multi(id)
  8280. {
  8281. static name1[32]
  8282. get_user_name(id, name1, sizeof name1 - 1)
  8283.  
  8284. // Show activity?
  8285. switch (get_pcvar_num(cvar_showactivity))
  8286. {
  8287. case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_MULTI")
  8288. case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_MULTI")
  8289. }
  8290.  
  8291. // Log to Zombie Plague log file?
  8292. if (get_pcvar_num(cvar_logcommands))
  8293. {
  8294. static logdata[100], authid[32], ip[16]
  8295. get_user_authid(id, authid, sizeof authid - 1)
  8296. get_user_ip(id, ip, sizeof ip - 1, 1)
  8297. formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %L (Players: %d/%d)", name1, authid, ip, LANG_SERVER,"CMD_MULTI", fnGetPlaying(), g_maxplayers)
  8298. log_to_file("zombieplague.log", logdata)
  8299. }
  8300.  
  8301. // Call Multi Infection
  8302. remove_task(TASK_MAKEZOMBIE)
  8303. make_a_zombie(MODE_MULTI, 0)
  8304. }
  8305.  
  8306. // Admin Command. zp_plague
  8307. command_plague(id)
  8308. {
  8309. static name1[32]
  8310. get_user_name(id, name1, sizeof name1 - 1)
  8311.  
  8312. // Show activity?
  8313. switch (get_pcvar_num(cvar_showactivity))
  8314. {
  8315. case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_PLAGUE")
  8316. case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_PLAGUE")
  8317. }
  8318.  
  8319. // Log to Zombie Plague log file?
  8320. if (get_pcvar_num(cvar_logcommands))
  8321. {
  8322. static logdata[100], authid[32], ip[16]
  8323. get_user_authid(id, authid, sizeof authid - 1)
  8324. get_user_ip(id, ip, sizeof ip - 1, 1)
  8325. formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %L (Players: %d/%d)", name1, authid, ip, LANG_SERVER,"CMD_PLAGUE", fnGetPlaying(), g_maxplayers)
  8326. log_to_file("zombieplague.log", logdata)
  8327. }
  8328.  
  8329. // Call Plague Mode
  8330. remove_task(TASK_MAKEZOMBIE)
  8331. make_a_zombie(MODE_PLAGUE, 0)
  8332. }
  8333.  
  8334. /*================================================================================
  8335. [Custom Natives]
  8336. =================================================================================*/
  8337.  
  8338. // Native: zp_get_user_zombie
  8339. public native_get_user_zombie(id)
  8340. {
  8341. return g_zombie[id];
  8342. }
  8343.  
  8344. // Native: zp_get_user_nemesis
  8345. public native_get_user_nemesis(id)
  8346. {
  8347. return g_nemesis[id];
  8348. }
  8349.  
  8350. // Native: zp_get_user_survivor
  8351. public native_get_user_survivor(id)
  8352. {
  8353. return g_survivor[id];
  8354. }
  8355.  
  8356. public native_get_user_first_zombie(id)
  8357. {
  8358. return g_firstzombie[id];
  8359. }
  8360.  
  8361. // Native: zp_get_user_armagedon
  8362. public native_get_user_armagedon(id)
  8363. {
  8364. return g_armagedon[id];
  8365. }
  8366.  
  8367. // Native: zp_is_armagedon_round
  8368. public native_is_armagedon_round()
  8369. {
  8370. return g_armagedonround;
  8371. }
  8372.  
  8373. // Native: zp_get_user_last_zombie
  8374. public native_get_user_last_zombie(id)
  8375. {
  8376. return g_lastzombie[id];
  8377. }
  8378.  
  8379. // Native: zp_get_user_last_human
  8380. public native_get_user_last_human(id)
  8381. {
  8382. return g_lasthuman[id];
  8383. }
  8384.  
  8385. // Native: zp_get_user_zombie_class
  8386. public native_get_user_zombie_class(id)
  8387. {
  8388. return g_zombieclass[id];
  8389. }
  8390.  
  8391. // Native: zp_set_user_zombie_class
  8392. public native_set_user_zombie_class(id, classid)
  8393. {
  8394. g_zombieclassnext[id] = classid
  8395. }
  8396.  
  8397. // Native: zp_get_user_human_class
  8398. public native_get_user_human_class(id)
  8399. {
  8400. return g_humanclass[id];
  8401. }
  8402.  
  8403. // Native: zp_set_user_human_class
  8404. public native_set_user_human_class(id, classid)
  8405. {
  8406. g_humanclassnext[id] = classid
  8407. }
  8408.  
  8409. // Native: zp_get_user_ammo_packs
  8410. public native_get_user_ammo_packs(id)
  8411. {
  8412. return g_ammopacks[id];
  8413. }
  8414.  
  8415. // Native: zp_set_user_ammo_packs
  8416. public native_set_user_ammo_packs(id, amount)
  8417. {
  8418. return update_ap(id, 0 - g_ammopacks[id] + amount, 0)
  8419. }
  8420.  
  8421. // Native: zp_get_user_level
  8422. public native_get_user_level(id)
  8423. {
  8424. return g_level[id]; //donde dice variable de lvl pongan su variable
  8425. }
  8426.  
  8427. // Native: zp_set_user_level
  8428. public native_set_user_level(id, amount)
  8429. {
  8430. return g_level[id] = amount; //donde dice variable de lvl pongan su variable
  8431. }
  8432. // Native: zp_get_zombie_maxhealth
  8433. public native_get_zombie_maxhealth(id)
  8434. {
  8435. if (g_zombie[id] && !g_nemesis[id])
  8436. {
  8437. if (g_firstzombie[id])
  8438. return floatround(g_zclass_hp[g_zombieclass[id]]*get_pcvar_float(cvar_zombiefirsthp));
  8439. else
  8440. return g_zclass_hp[g_zombieclass[id]];
  8441. }
  8442. return -1;
  8443. }
  8444.  
  8445. // Native: zp_get_user_batteries
  8446. public native_get_user_batteries(id)
  8447. {
  8448. return g_flashbattery[id];
  8449. }
  8450.  
  8451. // Native: zp_set_user_batteries
  8452. public native_set_user_batteries(id, value)
  8453. {
  8454. g_flashbattery[id] = value;
  8455. }
  8456.  
  8457. // Native: zp_infect_user
  8458. public native_infect_user(id, infector)
  8459. {
  8460. // Not allowed to be zombie or round not started yet
  8461. if (!allowed_zombie(id) || g_newround)
  8462. return 0;
  8463.  
  8464. // Infect
  8465. zombieme(id, infector, 0, 0)
  8466. return 1;
  8467. }
  8468.  
  8469. // Native: zp_disinfect_user
  8470. public native_disinfect_user(id)
  8471. {
  8472. // Not allowed to be human
  8473. if (!allowed_human(id))
  8474. return 0;
  8475.  
  8476. // Turn to human
  8477. humanme(id, 0)
  8478. return 1;
  8479. }
  8480.  
  8481. // Native: zp_respawn_user
  8482. public native_respawn_user(id, team)
  8483. {
  8484. // Respawn not allowed
  8485. if (!allowed_respawn(id))
  8486. return 0;
  8487.  
  8488. // Respawn as zombie?
  8489. g_respawn_as_zombie[id] = (team == ZP_TEAM_ZOMBIE) ? true : false
  8490.  
  8491. // Respawnish!
  8492. respawn_player(id+TASK_SPAWN)
  8493. return 1;
  8494. }
  8495.  
  8496. // Native: zp_has_round_started
  8497. public native_has_round_started()
  8498. {
  8499. return !g_newround;
  8500. }
  8501.  
  8502. // Native: zp_is_nemesis_round
  8503. public native_is_nemesis_round()
  8504. {
  8505. return g_nemround;
  8506. }
  8507.  
  8508. // Native: zp_is_survivor_round
  8509. public native_is_survivor_round()
  8510. {
  8511. return g_survround;
  8512. }
  8513.  
  8514. // Native: zp_is_swarm_round
  8515. public native_is_swarm_round()
  8516. {
  8517. return g_swarmround;
  8518. }
  8519.  
  8520. // Native: zp_is_plague_round
  8521. public native_is_plague_round()
  8522. {
  8523. return g_plagueround;
  8524. }
  8525.  
  8526. // Native: zp_register_extra_item
  8527. public native_register_extra_item(const name[], cost, team)
  8528. {
  8529. // Reached extra items limit
  8530. if (g_extraitem_i >= sizeof g_extraitem_name)
  8531. return -1;
  8532.  
  8533. // Strings passed byref
  8534. param_convert(1)
  8535.  
  8536. // Add the item
  8537. copy(g_extraitem_name[g_extraitem_i], sizeof g_extraitem_name[] - 1, name)
  8538. g_extraitem_cost[g_extraitem_i] = cost
  8539. g_extraitem_team[g_extraitem_i] = team
  8540.  
  8541. // Increase registered items counter
  8542. g_extraitem_i++
  8543.  
  8544. // Return id under which we registered the item
  8545. return g_extraitem_i-1;
  8546. }
  8547.  
  8548. // Function: zp_register_extra_item (to be used within this plugin only)
  8549. native_register_extra_item2(const name[], cost, team)
  8550. {
  8551. // Reached extra items limit
  8552. if (g_extraitem_i >= sizeof g_extraitem_name)
  8553. return;
  8554.  
  8555. // Add the item
  8556. copy(g_extraitem_name[g_extraitem_i], sizeof g_extraitem_name[] - 1, name)
  8557. g_extraitem_cost[g_extraitem_i] = cost
  8558. g_extraitem_team[g_extraitem_i] = team
  8559.  
  8560. // Increase registered items counter
  8561. g_extraitem_i++
  8562. }
  8563.  
  8564. // Native: zp_register_zombie_class
  8565. public native_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback, level)
  8566. {
  8567. // Reached zombie classes limit
  8568. if (g_zclass_i >= sizeof g_zclass_name)
  8569. return -1;
  8570.  
  8571. // Strings passed byref
  8572. param_convert(1)
  8573. param_convert(2)
  8574. param_convert(3)
  8575. param_convert(4)
  8576.  
  8577. // Add the class
  8578. copy(g_zclass_name[g_zclass_i], sizeof g_zclass_name[] - 1, name)
  8579. copy(g_zclass_info[g_zclass_i], sizeof g_zclass_info[] - 1, info)
  8580. copy(g_zclass_model[g_zclass_i], sizeof g_zclass_model[] - 1, model)
  8581. copy(g_zclass_clawmodel[g_zclass_i], sizeof g_zclass_clawmodel[] - 1, clawmodel)
  8582. g_zclass_lvl[g_zclass_i] = level
  8583. g_zclass_hp[g_zclass_i] = hp
  8584. g_zclass_spd[g_zclass_i] = speed
  8585. g_zclass_grav[g_zclass_i] = gravity
  8586. g_zclass_kb[g_zclass_i] = knockback
  8587.  
  8588. // Precache custom models and retrieve the modelindex
  8589. new prec_mdl[100]
  8590. formatex(prec_mdl, sizeof prec_mdl - 1, "models/player/%s/%s.mdl", model, model)
  8591. g_zclass_modelindex[g_zclass_i] = engfunc(EngFunc_PrecacheModel, prec_mdl)
  8592. formatex(prec_mdl, sizeof prec_mdl - 1, "models/[VG]/%s", clawmodel)
  8593. engfunc(EngFunc_PrecacheModel, prec_mdl)
  8594.  
  8595. // Increase registered classes counter
  8596. g_zclass_i++
  8597.  
  8598. // Return id under which we registered the class
  8599. return g_zclass_i-1;
  8600. }
  8601.  
  8602. // Native: zp_register_human_class
  8603. public native_register_human_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, level, armadura)
  8604. {
  8605. // Reached human classes limit
  8606. if (g_hclass_i >= sizeof g_hclass_name)
  8607. return -1;
  8608.  
  8609. // Strings passed byref
  8610. param_convert(1)
  8611. param_convert(2)
  8612. param_convert(3)
  8613. param_convert(4)
  8614.  
  8615. // Add the class
  8616. copy(g_hclass_name[g_hclass_i], sizeof g_hclass_name[] - 1, name)
  8617. copy(g_hclass_info[g_hclass_i], sizeof g_hclass_info[] - 1, info)
  8618. copy(g_hclass_model[g_hclass_i], sizeof g_hclass_model[] - 1, model)
  8619. copy(g_hclass_clawmodel[g_hclass_i], sizeof g_hclass_clawmodel[] - 1, clawmodel)
  8620. g_hclass_hp[g_hclass_i] = hp
  8621. g_hclass_spd[g_hclass_i] = speed
  8622. g_hclass_grav[g_hclass_i] = gravity
  8623. g_hclass_lvl[g_hclass_i] = level
  8624. g_hclass_ar[g_hclass_i] = armadura
  8625.  
  8626. // Precache custom models and retrieve the modelindex
  8627. new prec_mdl[100]
  8628. formatex(prec_mdl, sizeof prec_mdl - 1, "models/player/%s/%s.mdl", model, model)
  8629. g_hclass_modelindex[g_zclass_i] = engfunc(EngFunc_PrecacheModel, prec_mdl)
  8630. formatex(prec_mdl, sizeof prec_mdl - 1, "models/[VG]/%s", clawmodel)
  8631. engfunc(EngFunc_PrecacheModel, prec_mdl)
  8632.  
  8633. // Increase registered classes counter
  8634. g_hclass_i++
  8635.  
  8636. // Return id under which we registered the class
  8637. return g_hclass_i-1;
  8638. }
  8639.  
  8640. /*================================================================================
  8641. [Custom Messages]
  8642. =================================================================================*/
  8643.  
  8644. // Custom Night Vision
  8645. public set_user_nvision(taskid)
  8646. {
  8647. // Not meant to have nvision or not enabled
  8648. if (!g_nvision[ID_NVISION] || !g_nvisionenabled[ID_NVISION])
  8649. {
  8650. // Task not needed anymore
  8651. remove_task(taskid);
  8652. return;
  8653. }
  8654.  
  8655. // Get player origin and alive status
  8656. static Float:originF[3], alive
  8657. pev(ID_NVISION, pev_origin, originF)
  8658. alive = is_user_alive(ID_NVISION)
  8659.  
  8660. // Nightvision message
  8661. message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, ID_NVISION)
  8662. write_byte(TE_DLIGHT) // TE id
  8663. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8664. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8665. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8666. write_byte(get_pcvar_num(cvar_nvgsize)) // radius
  8667.  
  8668. // Nemesis / Madness / Spectator in nemesis round
  8669. if (g_nemesis[ID_NVISION] || (g_zombie[ID_NVISION] && g_nodamage[ID_NVISION]) || (!alive && g_nemround))
  8670. {
  8671. write_byte(get_pcvar_num(cvar_nemnvgcolor[0])) // r
  8672. write_byte(get_pcvar_num(cvar_nemnvgcolor[1])) // g
  8673. write_byte(get_pcvar_num(cvar_nemnvgcolor[2])) // b
  8674. }
  8675. // Human / Spectator in normal round
  8676. else if (!g_zombie[ID_NVISION] || !alive)
  8677. {
  8678. write_byte(get_pcvar_num(cvar_humnvgcolor[0])) // r
  8679. write_byte(get_pcvar_num(cvar_humnvgcolor[1])) // g
  8680. write_byte(get_pcvar_num(cvar_humnvgcolor[2])) // b
  8681. }
  8682. // Zombie
  8683. else
  8684. {
  8685. write_byte(get_pcvar_num(cvar_nvgcolor[0])) // r
  8686. write_byte(get_pcvar_num(cvar_nvgcolor[1])) // g
  8687. write_byte(get_pcvar_num(cvar_nvgcolor[2])) // b
  8688. }
  8689.  
  8690. write_byte(2) // life
  8691. write_byte(0) // decay rate
  8692. message_end()
  8693. }
  8694.  
  8695. // Game Nightvision
  8696. set_user_gnvision(id, toggle)
  8697. {
  8698. // Toggle NVG message
  8699. message_begin(MSG_ONE, g_msgNVGToggle, _, id)
  8700. write_byte(toggle) // toggle
  8701. message_end()
  8702. }
  8703.  
  8704. // Custom Flashlight
  8705. public set_user_flashlight(taskid)
  8706. {
  8707. // Not meant to have flashlight / not enabled / depleted
  8708. if (!g_flashlight[ID_FLASH] || g_flashbattery[ID_FLASH] <= 0 || !get_pcvar_num(cvar_cflash))
  8709. {
  8710. // Task not needed anymore
  8711. remove_task(taskid);
  8712. return;
  8713. }
  8714.  
  8715. // Disable flashlight if it shouldn't be available
  8716. if (g_zombie[ID_FLASH] || g_survivor[ID_FLASH] || !is_user_alive(ID_FLASH))
  8717. {
  8718. // Turn it off
  8719. g_flashlight[ID_FLASH] = false;
  8720.  
  8721. // Update flashlight HUD
  8722. message_begin(MSG_ONE, g_msgFlashlight, _, ID_FLASH)
  8723. write_byte(0) // toggle
  8724. write_byte(100) // battery
  8725. message_end()
  8726.  
  8727. // Task not needed anymore
  8728. remove_task(taskid);
  8729. return;
  8730. }
  8731.  
  8732. // Get player and aiming origins
  8733. static Float:originF[3], Float:destoriginF[3]
  8734. pev(ID_FLASH, pev_origin, originF)
  8735. fm_get_aim_origin(ID_FLASH, destoriginF)
  8736.  
  8737. // Make sure it's within the max distance
  8738. if (get_distance_f(originF, destoriginF) > get_pcvar_float(cvar_flashdist))
  8739. return;
  8740.  
  8741. // Send to every player?
  8742. if (get_pcvar_num(cvar_flashshowall))
  8743. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, destoriginF, 0)
  8744. else
  8745. message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, ID_FLASH)
  8746.  
  8747. // Flashlight
  8748. write_byte(TE_DLIGHT) // TE id
  8749. engfunc(EngFunc_WriteCoord, destoriginF[0]) // x
  8750. engfunc(EngFunc_WriteCoord, destoriginF[1]) // y
  8751. engfunc(EngFunc_WriteCoord, destoriginF[2]) // z
  8752. write_byte(get_pcvar_num(cvar_flashsize)) // radius
  8753. write_byte(get_pcvar_num(cvar_flashcolor[0])) // r
  8754. write_byte(get_pcvar_num(cvar_flashcolor[1])) // g
  8755. write_byte(get_pcvar_num(cvar_flashcolor[2])) // b
  8756. write_byte(3) // life
  8757. write_byte(0) // decay rate
  8758. message_end()
  8759. }
  8760.  
  8761. // Infection special effects
  8762. infection_effects(id)
  8763. {
  8764. // Screen fade?
  8765. if (get_pcvar_num(cvar_infectionscreenfade))
  8766. {
  8767. message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id)
  8768. write_short(UNIT_SECOND*1) // duration
  8769. write_short(UNIT_SECOND*0) // hold time
  8770. write_short(FFADE_IN) // fade type
  8771. write_byte((g_nemesis[id]) ? get_pcvar_num(cvar_nemnvgcolor[0]) : get_pcvar_num(cvar_nvgcolor[0])) // r
  8772. write_byte((g_nemesis[id]) ? get_pcvar_num(cvar_nemnvgcolor[1]) : get_pcvar_num(cvar_nvgcolor[1])) // g
  8773. write_byte((g_nemesis[id]) ? get_pcvar_num(cvar_nemnvgcolor[2]) : get_pcvar_num(cvar_nvgcolor[2])) // b
  8774. write_byte (255) // alpha
  8775. message_end()
  8776. }
  8777.  
  8778. // Screen shake?
  8779. if (get_pcvar_num(cvar_infectionscreenshake))
  8780. {
  8781. message_begin(MSG_ONE_UNRELIABLE, g_msgScreenShake, _, id)
  8782. write_short(UNIT_SECOND*4) // amplitude
  8783. write_short(UNIT_SECOND*2) // duration
  8784. write_short(UNIT_SECOND*10) // frequency
  8785. message_end()
  8786. }
  8787.  
  8788. // Infection icon?
  8789. if (get_pcvar_num(cvar_hudicons))
  8790. {
  8791. message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, id)
  8792. write_byte(0) // damage save
  8793. write_byte(0) // damage take
  8794. write_long(DMG_NERVEGAS) // damage type - DMG_RADIATION
  8795. write_coord(0) // x
  8796. write_coord(0) // y
  8797. write_coord(0) // z
  8798. message_end()
  8799. }
  8800.  
  8801. // Get player origin
  8802. static Float:originF[3]
  8803. pev(id, pev_origin, originF)
  8804.  
  8805. // Tracers?
  8806. if (get_pcvar_num(cvar_infectiontracers))
  8807. {
  8808. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8809. write_byte(TE_IMPLOSION) // TE id
  8810. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8811. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8812. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8813. write_byte(128) // radius
  8814. write_byte(20) // count
  8815. write_byte(3) // duration
  8816. message_end()
  8817. }
  8818.  
  8819. // Particle burst?
  8820. if (get_pcvar_num(cvar_infectionparticles))
  8821. {
  8822. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8823. write_byte(TE_PARTICLEBURST) // TE id
  8824. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8825. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8826. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8827. write_short(50) // radius
  8828. write_byte(70) // color
  8829. write_byte(3) // duration (will be randomized a bit)
  8830. message_end()
  8831. }
  8832.  
  8833. // Light sparkle?
  8834. if (get_pcvar_num(cvar_infectionsparkle))
  8835. {
  8836. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8837. write_byte(TE_DLIGHT) // TE id
  8838. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8839. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8840. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8841. write_byte(20) // radius
  8842. write_byte(get_pcvar_num(cvar_nvgcolor[0])) // r
  8843. write_byte(get_pcvar_num(cvar_nvgcolor[1])) // g
  8844. write_byte(get_pcvar_num(cvar_nvgcolor[2])) // b
  8845. write_byte(2) // life
  8846. write_byte(0) // decay rate
  8847. message_end()
  8848. }
  8849. }
  8850.  
  8851. // Nemesis/madness aura task
  8852. public zombie_aura(taskid)
  8853. {
  8854. // Not nemesis, not in zombie madness
  8855. if (!g_nemesis[ID_BLOOD] && !g_nodamage[ID_BLOOD])
  8856. return;
  8857.  
  8858. // Get player origin
  8859. static Float:originF[3]
  8860. pev(ID_BLOOD, pev_origin, originF)
  8861.  
  8862. // Colored Aura
  8863. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8864. write_byte(TE_DLIGHT) // TE id
  8865. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8866. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8867. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8868. write_byte(20) // radius
  8869. write_byte(get_pcvar_num(cvar_nemnvgcolor[0])) // r
  8870. write_byte(get_pcvar_num(cvar_nemnvgcolor[1])) // g
  8871. write_byte(get_pcvar_num(cvar_nemnvgcolor[2])) // b
  8872. write_byte(2) // life
  8873. write_byte(0) // decay rate
  8874. message_end()
  8875.  
  8876. // Keep sending aura messages
  8877. set_task(0.1, "zombie_aura", taskid)
  8878. }
  8879.  
  8880. // Make zombies leave footsteps and bloodstains on the floor
  8881. public make_blood(taskid)
  8882. {
  8883. // Only bleed when moving on ground
  8884. if (fm_get_speed(ID_BLOOD) < 80 || !(pev(ID_BLOOD, pev_flags) & FL_ONGROUND))
  8885. return;
  8886.  
  8887. // Get user origin
  8888. static Float:originF[3]
  8889. pev(ID_BLOOD, pev_origin, originF);
  8890.  
  8891. // If ducking set a little lower
  8892. if (pev(ID_BLOOD, pev_bInDuck))
  8893. originF[2] -= 18.0
  8894. else
  8895. originF[2] -= 36.0
  8896.  
  8897. // Send the decal message
  8898. engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0)
  8899. write_byte(TE_WORLDDECAL) // TE id
  8900. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8901. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8902. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8903. write_byte(zombie_decals[random_num(0, sizeof zombie_decals - 1)] + (g_czero*12)) // random decal number (offsets +12 for CZ)
  8904. message_end()
  8905. }
  8906.  
  8907. // Flare Lighting
  8908. public flare_lighting(args[5])
  8909. {
  8910. // Unexistant flare entity?
  8911. if (!pev_valid(FLARE_ENTITY))
  8912. return;
  8913.  
  8914. // Flare depleted -clean up the mess-
  8915. if (FLARE_DURATION <= 0)
  8916. {
  8917. engfunc(EngFunc_RemoveEntity, FLARE_ENTITY)
  8918. return;
  8919. }
  8920.  
  8921. // Get origin
  8922. static Float:originF[3]
  8923. pev(FLARE_ENTITY, pev_origin, originF)
  8924.  
  8925. // Lighting
  8926. engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0)
  8927. write_byte(TE_DLIGHT) // TE id
  8928. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8929. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8930. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8931. write_byte(get_pcvar_num(cvar_flaresize)) // radius
  8932. write_byte(FLARE_R) // r
  8933. write_byte(FLARE_G) // g
  8934. write_byte(FLARE_B) // b
  8935. write_byte(51) //life
  8936. write_byte((FLARE_DURATION < 2) ? 3 : 0) //decay rate
  8937. message_end()
  8938.  
  8939. // Sparks
  8940. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8941. write_byte(TE_SPARKS) // TE id
  8942. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8943. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8944. engfunc(EngFunc_WriteCoord, originF[2]) // z
  8945. message_end()
  8946.  
  8947. // Decrease task cycle counter
  8948. FLARE_DURATION -= 1;
  8949.  
  8950. // Keep sending flare messaegs
  8951. set_task(5.0, "flare_lighting", TASK_NADES, args, sizeof args)
  8952. }
  8953.  
  8954. // Burning Flames
  8955. public burning_flame(args[1], taskid)
  8956. {
  8957. // Get player origin and flags
  8958. static Float:originF[3], flags
  8959. pev(ID_BLOOD, pev_origin, originF)
  8960. flags = pev(ID_BLOOD, pev_flags)
  8961.  
  8962. // Madness mode - in water - burning stopped
  8963. if (g_nodamage[ID_BLOOD] || (flags & FL_INWATER) || FLAME_DURATION < 1)
  8964. {
  8965. // Smoke sprite
  8966. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  8967. write_byte(TE_SMOKE) // TE id
  8968. engfunc(EngFunc_WriteCoord, originF[0]) // x
  8969. engfunc(EngFunc_WriteCoord, originF[1]) // y
  8970. engfunc(EngFunc_WriteCoord, originF[2]-50.0) // z
  8971. write_short(g_smokeSpr) // sprite
  8972. write_byte(random_num(15, 20)) // scale
  8973. write_byte(random_num(10, 20)) // framerate
  8974. message_end()
  8975.  
  8976. return;
  8977. }
  8978.  
  8979. // Randomly play burning zombie scream sounds (not for nemesis)
  8980. if (!random_num(0, 20) && !g_nemesis[ID_BLOOD])
  8981. 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)
  8982.  
  8983. // Get fire slow down setting
  8984. static Float:slowdown
  8985. slowdown = get_pcvar_float(cvar_fireslowdown)
  8986.  
  8987. // Fire slow down, unless nemesis
  8988. if (slowdown > 0.0 && !g_nemesis[ID_BLOOD] && (flags & FL_ONGROUND))
  8989. {
  8990. static Float:velocity[3]
  8991. pev(ID_BLOOD, pev_velocity, velocity)
  8992. xs_vec_mul_scalar(velocity, slowdown, velocity)
  8993. set_pev(ID_BLOOD, pev_velocity, velocity)
  8994. }
  8995.  
  8996. // Get health and fire damage setting
  8997. static health, firedamage
  8998. health = pev(ID_BLOOD, pev_health)
  8999. firedamage = get_pcvar_num(cvar_firedamage)
  9000.  
  9001. // Take damage from the fire
  9002. if (health > firedamage)
  9003. fm_set_user_health(ID_BLOOD, health - firedamage)
  9004.  
  9005. // Flame sprite
  9006. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9007. write_byte(TE_SPRITE) // TE id
  9008. engfunc(EngFunc_WriteCoord, originF[0]+random_float(-5.0, 5.0)) // x
  9009. engfunc(EngFunc_WriteCoord, originF[1]+random_float(-5.0, 5.0)) // y
  9010. engfunc(EngFunc_WriteCoord, originF[2]+random_float(-10.0, 10.0)) // z
  9011. write_short(g_flameSpr) // sprite
  9012. write_byte(random_num(5, 10)) // scale
  9013. write_byte(200) // brightness
  9014. message_end()
  9015.  
  9016. // Decrease task cycle counter
  9017. FLAME_DURATION -= 1;
  9018.  
  9019. // Keep sending flame messaegs
  9020. set_task(0.2, "burning_flame", taskid, args, sizeof args)
  9021. }
  9022.  
  9023. // Infection Grenade: Green Blast
  9024. create_blast(const Float:originF[3])
  9025. {
  9026. // Smallest ring
  9027. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9028. write_byte(TE_BEAMCYLINDER) // TE id
  9029. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9030. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9031. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9032. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9033. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9034. engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
  9035. write_short(g_exploSpr) // sprite
  9036. write_byte(0) // startframe
  9037. write_byte(0) // framerate
  9038. write_byte(4) // life
  9039. write_byte(60) // width
  9040. write_byte(0) // noise
  9041. write_byte(0) // red
  9042. write_byte(200) // green
  9043. write_byte(0) // blue
  9044. write_byte(200) // brightness
  9045. write_byte(0) // speed
  9046. message_end()
  9047.  
  9048. // Medium ring
  9049. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9050. write_byte(TE_BEAMCYLINDER) // TE id
  9051. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9052. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9053. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9054. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9055. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9056. engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  9057. write_short(g_exploSpr) // sprite
  9058. write_byte(0) // startframe
  9059. write_byte(0) // framerate
  9060. write_byte(4) // life
  9061. write_byte(60) // width
  9062. write_byte(0) // noise
  9063. write_byte(0) // red
  9064. write_byte(200) // green
  9065. write_byte(0) // blue
  9066. write_byte(200) // brightness
  9067. write_byte(0) // speed
  9068. message_end()
  9069.  
  9070. // Largest ring
  9071. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9072. write_byte(TE_BEAMCYLINDER) // TE id
  9073. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9074. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9075. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9076. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9077. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9078. engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  9079. write_short(g_exploSpr) // sprite
  9080. write_byte(0) // startframe
  9081. write_byte(0) // framerate
  9082. write_byte(4) // life
  9083. write_byte(60) // width
  9084. write_byte(0) // noise
  9085. write_byte(0) // red
  9086. write_byte(200) // green
  9087. write_byte(0) // blue
  9088. write_byte(200) // brightness
  9089. write_byte(0) // speed
  9090. message_end()
  9091. }
  9092.  
  9093. // Fire Grenade: Fire Blast
  9094. create_blast2(const Float:originF[3])
  9095. {
  9096. // Smallest ring
  9097. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9098. write_byte(TE_BEAMCYLINDER) // TE id
  9099. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9100. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9101. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9102. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9103. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9104. engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
  9105. write_short(g_exploSpr) // sprite
  9106. write_byte(0) // startframe
  9107. write_byte(0) // framerate
  9108. write_byte(4) // life
  9109. write_byte(60) // width
  9110. write_byte(0) // noise
  9111. write_byte(200) // red
  9112. write_byte(100) // green
  9113. write_byte(0) // blue
  9114. write_byte(200) // brightness
  9115. write_byte(0) // speed
  9116. message_end()
  9117.  
  9118. // Medium ring
  9119. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9120. write_byte(TE_BEAMCYLINDER) // TE id
  9121. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9122. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9123. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9124. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9125. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9126. engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  9127. write_short(g_exploSpr) // sprite
  9128. write_byte(0) // startframe
  9129. write_byte(0) // framerate
  9130. write_byte(4) // life
  9131. write_byte(60) // width
  9132. write_byte(0) // noise
  9133. write_byte(200) // red
  9134. write_byte(50) // green
  9135. write_byte(0) // blue
  9136. write_byte(200) // brightness
  9137. write_byte(0) // speed
  9138. message_end()
  9139.  
  9140. // Largest ring
  9141. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9142. write_byte(TE_BEAMCYLINDER) // TE id
  9143. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9144. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9145. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9146. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9147. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9148. engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  9149. write_short(g_exploSpr) // sprite
  9150. write_byte(0) // startframe
  9151. write_byte(0) // framerate
  9152. write_byte(4) // life
  9153. write_byte(60) // width
  9154. write_byte(0) // noise
  9155. write_byte(200) // red
  9156. write_byte(0) // green
  9157. write_byte(0) // blue
  9158. write_byte(200) // brightness
  9159. write_byte(0) // speed
  9160. message_end()
  9161. }
  9162.  
  9163. // Frost Grenade: Freeze Blast
  9164. create_blast3(const Float:originF[3])
  9165. {
  9166. // Smallest ring
  9167. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9168. write_byte(TE_BEAMCYLINDER) // TE id
  9169. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9170. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9171. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9172. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9173. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9174. engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
  9175. write_short(g_exploSpr) // sprite
  9176. write_byte(0) // startframe
  9177. write_byte(0) // framerate
  9178. write_byte(4) // life
  9179. write_byte(60) // width
  9180. write_byte(0) // noise
  9181. write_byte(0) // red
  9182. write_byte(100) // green
  9183. write_byte(200) // blue
  9184. write_byte(200) // brightness
  9185. write_byte(0) // speed
  9186. message_end()
  9187.  
  9188. // Medium ring
  9189. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9190. write_byte(TE_BEAMCYLINDER) // TE id
  9191. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9192. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9193. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9194. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9195. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9196. engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  9197. write_short(g_exploSpr) // sprite
  9198. write_byte(0) // startframe
  9199. write_byte(0) // framerate
  9200. write_byte(4) // life
  9201. write_byte(60) // width
  9202. write_byte(0) // noise
  9203. write_byte(0) // red
  9204. write_byte(100) // green
  9205. write_byte(200) // blue
  9206. write_byte(200) // brightness
  9207. write_byte(0) // speed
  9208. message_end()
  9209.  
  9210. // Largest ring
  9211. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  9212. write_byte(TE_BEAMCYLINDER) // TE id
  9213. engfunc(EngFunc_WriteCoord, originF[0]) // x
  9214. engfunc(EngFunc_WriteCoord, originF[1]) // y
  9215. engfunc(EngFunc_WriteCoord, originF[2]) // z
  9216. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  9217. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  9218. engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  9219. write_short(g_exploSpr) // sprite
  9220. write_byte(0) // startframe
  9221. write_byte(0) // framerate
  9222. write_byte(4) // life
  9223. write_byte(60) // width
  9224. write_byte(0) // noise
  9225. write_byte(0) // red
  9226. write_byte(100) // green
  9227. write_byte(200) // blue
  9228. write_byte(200) // brightness
  9229. write_byte(0) // speed
  9230. message_end()
  9231. }
  9232.  
  9233. // Fix Dead Attrib on scoreboard
  9234. FixDeadAttrib(id)
  9235. {
  9236. message_begin(MSG_BROADCAST, g_msgScoreAttrib)
  9237. write_byte(id) // id
  9238. write_byte(0) // attrib
  9239. message_end()
  9240. }
  9241.  
  9242. // Send Death Message for infections
  9243. SendDeathMsg(attacker, victim)
  9244. {
  9245. message_begin(MSG_BROADCAST, g_msgDeathMsg)
  9246. write_byte(attacker) // killer
  9247. write_byte(victim) // victim
  9248. write_byte(1) // headshot flag
  9249. write_string("infection") // killer's weapon
  9250. message_end()
  9251. }
  9252.  
  9253. // Update Player Frags and Deaths
  9254. UpdateFrags(attacker, victim, frags, deaths, scoreboard)
  9255. {
  9256. // Set attacker frags
  9257. set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) + frags))
  9258.  
  9259. // Set victim deaths
  9260. fm_set_user_deaths(victim, fm_get_user_deaths(victim) + deaths)
  9261.  
  9262. // Update scoreboard with attacker and victim info
  9263. if (scoreboard)
  9264. {
  9265. message_begin(MSG_BROADCAST, g_msgScoreInfo)
  9266. write_byte(attacker) // id
  9267. write_short(pev(attacker, pev_frags)) // frags
  9268. write_short(fm_get_user_deaths(attacker)) // deaths
  9269. write_short(0) // class?
  9270. write_short(fm_get_user_team(attacker)) // team
  9271. message_end()
  9272.  
  9273. message_begin(MSG_BROADCAST, g_msgScoreInfo)
  9274. write_byte(victim) // id
  9275. write_short(pev(victim, pev_frags)) // frags
  9276. write_short(fm_get_user_deaths(victim)) // deaths
  9277. write_short(0) // class?
  9278. write_short(fm_get_user_team(victim)) // team
  9279. message_end()
  9280. }
  9281. }
  9282.  
  9283. // Remove Player Frags (when Nemesis/Survivor ignore_frags cvar is enabled)
  9284. RemoveFrags(attacker, victim)
  9285. {
  9286. // Remove attacker frags
  9287. set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) - 1))
  9288.  
  9289. // Remove victim deaths
  9290. fm_set_user_deaths(victim, fm_get_user_deaths(victim) - 1)
  9291. }
  9292.  
  9293.  
  9294. // Plays a sound on clients
  9295. PlaySound(const sound[])
  9296. {
  9297. client_cmd(0, "spk ^"%s^"", sound)
  9298. }
  9299.  
  9300. // Prints a colored message to target (use 0 for everyone), supports ML formatting.
  9301. // Note: I still need to make something like gungame's LANG_PLAYER_C to avoid unintended
  9302. // argument replacement when a function passes -1 (it will be considered a LANG_PLAYER)
  9303. zp_colored_print(target, const message[], any:...)
  9304. {
  9305. static buffer[512], i, argscount
  9306. argscount = numargs()
  9307.  
  9308. // Send to everyone
  9309. if (!target)
  9310. {
  9311. static player
  9312. for (player = 1; player <= g_maxplayers; player++)
  9313. {
  9314. // Not connected
  9315. if (!is_user_connected(player))
  9316. continue;
  9317.  
  9318. // Remember changed arguments
  9319. static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
  9320. changedcount = 0
  9321.  
  9322. // Replace LANG_PLAYER with player id
  9323. for (i = 2; i < argscount; i++)
  9324. {
  9325. if (getarg(i) == LANG_PLAYER)
  9326. {
  9327. setarg(i, 0, player)
  9328. changed[changedcount] = i
  9329. changedcount++
  9330. }
  9331. }
  9332.  
  9333. // Format message for player
  9334. vformat(buffer, sizeof buffer - 1, message, 3)
  9335.  
  9336. // Send it
  9337. message_begin(MSG_ONE, g_msgSayText, _, player)
  9338. write_byte(player)
  9339. write_string(buffer)
  9340. message_end()
  9341.  
  9342. // Replace back player id's with LANG_PLAYER
  9343. for (i = 0; i < changedcount; i++)
  9344. setarg(changed[i], 0, LANG_PLAYER)
  9345. }
  9346. }
  9347.  
  9348. // Send to specific target
  9349. else
  9350. {
  9351. /*
  9352. // Replace LANG_PLAYER with player id
  9353. for (i = 2; i < argscount; i++)
  9354. {
  9355. if (getarg(i) == LANG_PLAYER)
  9356. setarg(i, 0, target)
  9357. }
  9358. */
  9359.  
  9360. // Format message for player
  9361. vformat(buffer, sizeof buffer - 1, message, 3)
  9362.  
  9363. // Send it
  9364. message_begin(MSG_ONE, g_msgSayText, _, target)
  9365. write_byte(target)
  9366. write_string(buffer)
  9367. message_end()
  9368. }
  9369. }
  9370.  
  9371. /*================================================================================
  9372. [Stocks]
  9373. =================================================================================*/
  9374.  
  9375. // Set an entity's key value (from fakemeta_util)
  9376. stock fm_set_kvd(entity, const key[], const value[], const classname[])
  9377. {
  9378. set_kvd(0, KV_ClassName, classname)
  9379. set_kvd(0, KV_KeyName, key)
  9380. set_kvd(0, KV_Value, value)
  9381. set_kvd(0, KV_fHandled, 0)
  9382.  
  9383. dllfunc(DLLFunc_KeyValue, entity, 0)
  9384. }
  9385.  
  9386. // Set entity's rendering type (from fakemeta_util)
  9387. stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
  9388. {
  9389. static Float:color[3]
  9390. color[0] = float(r)
  9391. color[1] = float(g)
  9392. color[2] = float(b)
  9393.  
  9394. set_pev(entity, pev_renderfx, fx)
  9395. set_pev(entity, pev_rendercolor, color)
  9396. set_pev(entity, pev_rendermode, render)
  9397. set_pev(entity, pev_renderamt, float(amount))
  9398. }
  9399.  
  9400. // Get entity's speed (from fakemeta_util)
  9401. stock fm_get_speed(entity)
  9402. {
  9403. static Float:velocity[3]
  9404. pev(entity, pev_velocity, velocity)
  9405.  
  9406. return floatround(vector_length(velocity));
  9407. }
  9408.  
  9409. // Get entity's aim origins (from fakemeta_util)
  9410. stock fm_get_aim_origin(id, Float:origin[3])
  9411. {
  9412. static Float:origin1F[3], Float:origin2F[3]
  9413. pev(id, pev_origin, origin1F)
  9414. pev(id, pev_view_ofs, origin2F)
  9415. xs_vec_add(origin1F, origin2F, origin1F)
  9416.  
  9417. pev(id, pev_v_angle, origin2F);
  9418. engfunc(EngFunc_MakeVectors, origin2F)
  9419. global_get(glb_v_forward, origin2F)
  9420. xs_vec_mul_scalar(origin2F, 9999.0, origin2F)
  9421. xs_vec_add(origin1F, origin2F, origin2F)
  9422.  
  9423. engfunc(EngFunc_TraceLine, origin1F, origin2F, 0, id, 0)
  9424. get_tr2(0, TR_vecEndPos, origin)
  9425. }
  9426.  
  9427. // Find entity by its owner (from fakemeta_util)
  9428. stock fm_find_ent_by_owner(entity, const classname[], owner)
  9429. {
  9430. while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
  9431.  
  9432. return entity;
  9433. }
  9434.  
  9435. // Set player's health (from fakemeta_util)
  9436. stock fm_set_user_health(id, health)
  9437. {
  9438. (health > 0) ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id);
  9439. }
  9440.  
  9441. // Give an item to a player (from fakemeta_util)
  9442. stock fm_give_item(id, const item[])
  9443. {
  9444. static ent
  9445. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
  9446. if (!pev_valid(ent)) return;
  9447.  
  9448. static Float:originF[3]
  9449. pev(id, pev_origin, originF)
  9450. set_pev(ent, pev_origin, originF)
  9451. set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
  9452. dllfunc(DLLFunc_Spawn, ent)
  9453.  
  9454. static save
  9455. save = pev(ent, pev_solid)
  9456. dllfunc(DLLFunc_Touch, ent, id)
  9457. if (pev(ent, pev_solid) != save)
  9458. return;
  9459.  
  9460. engfunc(EngFunc_RemoveEntity, ent)
  9461. }
  9462.  
  9463. // Strip user weapons (from fakemeta_util)
  9464. stock fm_strip_user_weapons(id)
  9465. {
  9466. static ent
  9467. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
  9468. if (!pev_valid(ent)) return;
  9469.  
  9470. dllfunc(DLLFunc_Spawn, ent)
  9471. dllfunc(DLLFunc_Use, ent, id)
  9472. engfunc(EngFunc_RemoveEntity, ent)
  9473. }
  9474.  
  9475. // Collect random spawn points
  9476. stock load_spawns()
  9477. {
  9478. // Check for CSDM spawns of the current map
  9479. new cfgdir[32], mapname[32], filepath[100], linedata[64]
  9480. get_configsdir(cfgdir, sizeof cfgdir - 1)
  9481. get_mapname(mapname, sizeof mapname - 1)
  9482. formatex(filepath, sizeof filepath - 1, "%s/csdm/%s.spawns.cfg", cfgdir, mapname)
  9483.  
  9484. // Load CSDM spawns if present
  9485. if (file_exists(filepath))
  9486. {
  9487. new csdmdata[10][6], file = fopen(filepath,"rt")
  9488.  
  9489. while (file && !feof(file))
  9490. {
  9491. fgets(file, linedata, sizeof linedata - 1)
  9492.  
  9493. // invalid spawn
  9494. if(!linedata[0] || str_count(linedata,' ') < 2) continue;
  9495.  
  9496. // get spawn point data
  9497. 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)
  9498.  
  9499. // origin
  9500. g_spawns[g_spawnCount][0] = floatstr(csdmdata[0])
  9501. g_spawns[g_spawnCount][1] = floatstr(csdmdata[1])
  9502. g_spawns[g_spawnCount][2] = floatstr(csdmdata[2])
  9503.  
  9504. // increase spawn count
  9505. g_spawnCount++
  9506. if (g_spawnCount >= sizeof g_spawns) break;
  9507. }
  9508. if (file) fclose(file)
  9509. }
  9510. else
  9511. {
  9512. // if not, collect regular spawns
  9513. collect_spawns_ent("info_player_start")
  9514. collect_spawns_ent("info_player_deathmatch")
  9515. }
  9516. }
  9517.  
  9518. // Collect spawn points from entity origins
  9519. stock collect_spawns_ent(const classname[])
  9520. {
  9521. new ent = -1
  9522.  
  9523. while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", classname)) != 0)
  9524. {
  9525. // get origin
  9526. new Float:originF[3]
  9527. pev(ent, pev_origin, originF)
  9528. g_spawns[g_spawnCount][0] = originF[0]
  9529. g_spawns[g_spawnCount][1] = originF[1]
  9530. g_spawns[g_spawnCount][2] = originF[2]
  9531.  
  9532. // increase spawn count
  9533. g_spawnCount++
  9534. if (g_spawnCount >= sizeof g_spawns) break;
  9535. }
  9536. }
  9537.  
  9538. // Drop primary/secondary weapons
  9539. stock drop_weapons(id, dropwhat)
  9540. {
  9541. // Get user weapons
  9542. static weapons[32], num, i, weaponid
  9543. num = 0 // reset passed weapons count (bugfix)
  9544. get_user_weapons(id, weapons, num)
  9545.  
  9546. // Loop through them and drop primaries or secondaries
  9547. for (i = 0; i < num; i++)
  9548. {
  9549. // Prevent re-indexing the array
  9550. weaponid = weapons[i]
  9551.  
  9552. if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
  9553. {
  9554. // Get the weapon entity
  9555. static wname[32], weapon_ent
  9556. get_weaponname(weaponid, wname, sizeof wname - 1)
  9557. weapon_ent = fm_find_ent_by_owner(-1, wname, id);
  9558.  
  9559. // Hack: store weapon bpammo on PEV_ADDITIONAL_AMMO
  9560. set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, fm_get_user_bpammo(id, weaponid))
  9561.  
  9562. // Player drops the weapon and looses his bpammo
  9563. engclient_cmd(id, "drop", wname)
  9564. fm_set_user_bpammo(id, weaponid, 0)
  9565. }
  9566. }
  9567. }
  9568.  
  9569. // Stock by (probably) Twilight Suzuka -counts number of chars in a string
  9570. stock str_count(const str[], searchchar)
  9571. {
  9572. new count, i
  9573. //count = 0
  9574.  
  9575. for (i = 0; i <= strlen(str); i++)
  9576. {
  9577. if(str[i] == searchchar)
  9578. count++
  9579. }
  9580.  
  9581. return count;
  9582. }
  9583.  
  9584. // Checks if a space is vacant (credits to VEN)
  9585. stock is_hull_vacant(Float:origin[3], hull)
  9586. {
  9587. engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, 0)
  9588.  
  9589. if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen))
  9590. return true;
  9591.  
  9592. return false;
  9593. }
  9594.  
  9595. // Check if a player is stuck (credits to VEN)
  9596. stock is_player_stuck(id)
  9597. {
  9598. static Float:originF[3]
  9599. pev(id, pev_origin, originF)
  9600.  
  9601. engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0)
  9602.  
  9603. if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
  9604. return true;
  9605.  
  9606. return false;
  9607. }
  9608.  
  9609. // Get User BP Ammo
  9610. stock fm_get_user_bpammo(id, weapon)
  9611. {
  9612. return get_pdata_int(id, AMMOOFFSET[weapon], OFFSET_LINUX);
  9613. }
  9614.  
  9615. // Set User BP Ammo
  9616. stock fm_set_user_bpammo(id, weapon, amount)
  9617. {
  9618. set_pdata_int(id, AMMOOFFSET[weapon], amount, OFFSET_LINUX)
  9619. }
  9620.  
  9621. // Set Weapon Clip Ammo
  9622. stock fm_set_weapon_ammo(entity, amount)
  9623. {
  9624. set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS)
  9625. }
  9626.  
  9627. // Get Weapon Clip Ammo
  9628. stock fm_get_weapon_ammo(entity)
  9629. {
  9630. return get_pdata_int(entity, OFFSET_CLIPAMMO, OFFSET_LINUX_WEAPONS);
  9631. }
  9632.  
  9633. // Set User Zoom
  9634. stock fm_remove_user_zoom(id)
  9635. {
  9636. set_pdata_int(id, OFFSET_ZOOMTYPE, CS_NO_ZOOM, OFFSET_LINUX)
  9637. }
  9638.  
  9639. // Get User Deaths
  9640. stock fm_get_user_deaths(id)
  9641. {
  9642. return get_pdata_int(id, OFFSET_CSDEATHS, OFFSET_LINUX);
  9643. }
  9644.  
  9645. // Set User Deaths
  9646. stock fm_set_user_deaths(id, value)
  9647. {
  9648. set_pdata_int(id, OFFSET_CSDEATHS, value, OFFSET_LINUX)
  9649. }
  9650.  
  9651. // Set User NVG for Bots
  9652. stock fm_set_bot_nvg(id, toggle)
  9653. {
  9654. if (toggle)
  9655. {
  9656. g_nvision[id] = true
  9657. set_pdata_int(id, OFFSET_NVGOGGLES, get_pdata_int(id, OFFSET_NVGOGGLES, OFFSET_LINUX) | HAS_NVGOGGLES, OFFSET_LINUX)
  9658. }
  9659. else
  9660. {
  9661. g_nvision[id] = false
  9662. set_pdata_int(id, OFFSET_NVGOGGLES, get_pdata_int(id, OFFSET_NVGOGGLES, OFFSET_LINUX) &~ HAS_NVGOGGLES, OFFSET_LINUX)
  9663. }
  9664. }
  9665.  
  9666. // Get User Team
  9667. stock fm_get_user_team(id)
  9668. {
  9669. return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX);
  9670. }
  9671.  
  9672. // Set a Player's Team
  9673. stock fm_set_user_team(id, team)
  9674. {
  9675. set_pdata_int(id, OFFSET_CSTEAMS, team, OFFSET_LINUX)
  9676. }
  9677.  
  9678. // Update Player's Team on all clients (adding needed delays)
  9679. stock fm_user_team_update(id)
  9680. {
  9681. static Float:current_time
  9682. current_time = get_gametime()
  9683.  
  9684. if (current_time - g_teams_targettime >= 0.1)
  9685. {
  9686. set_task(0.1, "fm_set_user_team_msg", id+TASK_TEAM)
  9687. g_teams_targettime = current_time + 0.1
  9688. }
  9689. else
  9690. {
  9691. set_task(((g_teams_targettime + 0.1) - current_time), "fm_set_user_team_msg", id+TASK_TEAM)
  9692. g_teams_targettime = g_teams_targettime + 0.1
  9693. }
  9694. }
  9695.  
  9696. // Send User Team Message
  9697. public fm_set_user_team_msg(taskid)
  9698. {
  9699. // Beware: this message can now be picked up by other metamod
  9700. // plugins (yeah, that includes AMXX plugins as well)
  9701.  
  9702. // Set the switching team flag
  9703. g_switchingteam[ID_TEAM] = true
  9704.  
  9705. // Tell everyone my new team
  9706. emessage_begin(MSG_ALL, g_msgTeamInfo)
  9707. ewrite_byte(ID_TEAM) // player
  9708. ewrite_string(TEAMNAMES[fm_get_user_team(ID_TEAM)]) // team
  9709. emessage_end()
  9710.  
  9711. // Done switching team
  9712. g_switchingteam[ID_TEAM] = false
  9713. }
  9714.  
  9715. #if defined SET_MODELINDEX_OFFSET
  9716. // Set the precached model index (updates hitboxes server side)
  9717. stock fm_set_user_model_index(id, value)
  9718. {
  9719. set_pdata_int(id, OFFSET_MODELINDEX, value, OFFSET_LINUX)
  9720. }
  9721. #endif
  9722.  
  9723. #if defined HANDLE_MODELS_ON_SEPARATE_ENT
  9724. // Set Player Model on Entity
  9725. stock fm_set_playermodel_ent(id)
  9726. {
  9727. // Make original player entity invisible
  9728. // but without hiding shadows or firing effects
  9729. fm_set_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
  9730.  
  9731. // Format model string
  9732. static model[100]
  9733. formatex(model, sizeof model - 1, "models/player/%s/%s.mdl", g_playermodel[id], g_playermodel[id])
  9734.  
  9735. // Set model on entity or make a new one if unexistant
  9736. if (!pev_valid(g_ent_playermodel[id]))
  9737. {
  9738. g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  9739. if (!pev_valid(g_ent_playermodel[id])) return;
  9740.  
  9741. set_pev(g_ent_playermodel[id], pev_classname, MODEL_ENT_CLASSNAME)
  9742. set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
  9743. set_pev(g_ent_playermodel[id], pev_aiment, id)
  9744. set_pev(g_ent_playermodel[id], pev_owner, id)
  9745. }
  9746.  
  9747. engfunc(EngFunc_SetModel, g_ent_playermodel[id], model)
  9748. }
  9749.  
  9750. // Set Weapon Model on Entity
  9751. stock fm_set_weaponmodel_ent(id)
  9752. {
  9753. // Get player's p_ weapon model
  9754. static model[100]
  9755. pev(id, pev_weaponmodel2, model, sizeof model - 1)
  9756.  
  9757. // Set model on entity or make a new one if unexistant
  9758. if (!pev_valid(g_ent_weaponmodel[id]))
  9759. {
  9760. g_ent_weaponmodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  9761. if (!pev_valid(g_ent_weaponmodel[id])) return;
  9762.  
  9763. set_pev(g_ent_weaponmodel[id], pev_classname, WEAPON_ENT_CLASSNAME)
  9764. set_pev(g_ent_weaponmodel[id], pev_movetype, MOVETYPE_FOLLOW)
  9765. set_pev(g_ent_weaponmodel[id], pev_aiment, id)
  9766. set_pev(g_ent_weaponmodel[id], pev_owner, id)
  9767. }
  9768.  
  9769. engfunc(EngFunc_SetModel, g_ent_weaponmodel[id], model)
  9770. }
  9771.  
  9772. // Remove Custom Model Entities
  9773. stock fm_remove_model_ents(id)
  9774. {
  9775. // Remove "playermodel" ent if present
  9776. if (pev_valid(g_ent_playermodel[id]))
  9777. {
  9778. engfunc(EngFunc_RemoveEntity, g_ent_playermodel[id])
  9779. g_ent_playermodel[id] = 0
  9780. }
  9781. // Remove "weaponmodel" ent if present
  9782. if (pev_valid(g_ent_weaponmodel[id]))
  9783. {
  9784. engfunc(EngFunc_RemoveEntity, g_ent_weaponmodel[id])
  9785. g_ent_weaponmodel[id] = 0
  9786. }
  9787. }
  9788. #else
  9789. // Set User Model
  9790. public fm_set_user_model(taskid)
  9791. {
  9792. set_user_info(ID_MODEL, "model", g_playermodel[ID_MODEL])
  9793. }
  9794.  
  9795. // Get User Model -model passed byref-
  9796. stock fm_get_user_model(player, model[], len)
  9797. {
  9798. get_user_info(player, "model", model, len)
  9799. }
  9800.  
  9801. // Update Player's Model on all clients (adding needed delays)
  9802. public fm_user_model_update(taskid)
  9803. {
  9804. static Float:current_time
  9805. current_time = get_gametime()
  9806.  
  9807. if (current_time - g_models_targettime >= MODELCHANGE_DELAY)
  9808. {
  9809. fm_set_user_model(taskid)
  9810. g_models_targettime = current_time
  9811. }
  9812. else
  9813. {
  9814. set_task(((g_models_targettime + MODELCHANGE_DELAY) - current_time), "fm_set_user_model", taskid)
  9815. g_models_targettime = g_models_targettime + MODELCHANGE_DELAY
  9816. }
  9817. }
  9818. #endif
  9819. public update_ap(id, amount, check)
  9820. {
  9821. 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".
  9822.  
  9823. // Aca detectamos que si es Nivel Maximo no suba mas.
  9824. if (g_ammopacks[id] + amount > NIVELES[sizeof NIVELES - 1] - 1)
  9825. return PLUGIN_HANDLED
  9826.  
  9827. // Le damos los APs correspondientes.
  9828. g_ammopacks[id] += amount
  9829.  
  9830. // Ya lo dijimos antes ^^.
  9831. check2:
  9832. if(amount < 0)
  9833. {
  9834. if(g_ammopacks[id] < NIVELES[g_level[id]] )
  9835. {
  9836. g_level[id]--
  9837. update_ap(id, -1, 1)
  9838. }
  9839.  
  9840. }
  9841. else
  9842. {
  9843. if(g_ammopacks[id] >= NIVELES[g_level[id]] )
  9844. {
  9845. g_level[id]++
  9846. update_ap(id, 0, 1)
  9847. }
  9848. }
  9849.  
  9850. return PLUGIN_HANDLED
  9851. }
  9852.  
  9853. public menu_reset(id, key)
  9854. {
  9855.  
  9856. if (key >= 1)
  9857. {
  9858. if (key != MENU_KEY_EXIT)
  9859. show_menu_reset(id)
  9860.  
  9861. return PLUGIN_HANDLED;
  9862. }
  9863.  
  9864.  
  9865. if (is_user_bot(id))
  9866. {
  9867. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Para resetear tienes que estar muerto")
  9868. return PLUGIN_HANDLED;
  9869. }
  9870.  
  9871. if (g_reset[id] >= 30)
  9872. {
  9873. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Llegastes al level maximo de resets")
  9874. return PLUGIN_HANDLED;
  9875. }
  9876.  
  9877. switch (key)
  9878. {
  9879. case 0:
  9880. {
  9881. if (g_level[id] >= 1000)
  9882. {
  9883. g_level[id] = 1
  9884. g_reset[id]++
  9885. g_ammopacks[id] = 0
  9886. g_skill_points[id][0][0] += 1 // 5 sumadas a daño humana
  9887. g_skill_points[id][0][1] += 1 // 5 a vida humana
  9888. g_skill_points[id][0][4] += 1 // 5 sumadas a chaleco humana
  9889. g_skill_points[id][1][0] += 1 // 5 a speed zombie
  9890. g_skill_points[id][1][1] += 1 // 5 a algo
  9891. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Acabas de resetear, ahora tenes^x03 %d reset!", g_reset[id])
  9892. WPN_AUTO_ON = 0
  9893. g_zombieclassnext[id] = -1
  9894. g_humanclassnext[id] = -1
  9895. }
  9896. else
  9897. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 To do a reset you need to be level: 1000")
  9898. }
  9899. }
  9900. return PLUGIN_HANDLED
  9901. }
  9902. public menu_usuario(id)
  9903. {
  9904. new menu = menu_create("\r User Configuracion\r:", "menu_usuarioo")
  9905.  
  9906. menu_additem(menu, "\wReset \wMenu" , "1", 0);
  9907. menu_additem(menu, "\wSuper Reset Menu" , "2", 0);
  9908. menu_additem(menu, "\rAccount Stats" , "3", 0);
  9909.  
  9910.  
  9911. menu_setprop(menu, MPROP_EXITNAME, "\yExit")
  9912. menu_display(id, menu, 0)
  9913. }
  9914.  
  9915. public menu_usuarioo(id, menu, key)
  9916. {
  9917. switch(key)
  9918. {
  9919. case 0: show_menu_reset(id);
  9920. case 1: show_menu_grand_reset(id);
  9921. case 2: Datos1(id);
  9922.  
  9923. }
  9924.  
  9925. return PLUGIN_HANDLED;
  9926. }
  9927.  
  9928. public oldmenu_handle( msgid, dest, id )
  9929. {
  9930. client_print( id, print_chat, "You cannot choose your team, This is just the VGUI Menu" )
  9931. return PLUGIN_HANDLED
  9932. }
  9933.  
  9934. public show_menu_grand_reset(id)
  9935. {
  9936. static menu[800], len
  9937. len = 0
  9938.  
  9939. len += formatex(menu[len], charsmax(menu) - len, "\y%L^n^n\r- \rRequierements^n\y- Reset:\w30^n\y- Human Points:\w200^n\y- Zombie Points:\w200^n\r- Benefits:^n\y- Human: \wMore Health,Damage, Armor^n\y- Zombie: \wmore Health, Speed^n^n", id, "MENU_GRAND_RESET_TITLE")
  9940.  
  9941. if (g_reset[id] >= 30 && g_points[id][0] >= 200 && g_points[id][1] >= 200)
  9942. len += formatex(menu[len], charsmax(menu) - len, "\r1.\w Super Reset^n^n^n^n")
  9943. else
  9944. len += formatex(menu[len], charsmax(menu) - len, "\r1.\d Super Reset^n- You have %d resets - out of 30^n- You have %d Human points^n- You have %d Zombie Points^n^n^n^n", g_reset[id], g_points[id][0], g_points[id][1])
  9945.  
  9946.  
  9947. len += formatex(menu[len], charsmax(menu) - len, "\r0.\w %L", id, "MENU_EXIT")
  9948.  
  9949. show_menu(id, KEYSMENU, menu, -1, "Menu Super Reset")
  9950. }
  9951.  
  9952. //Grand Reseteo
  9953. public menu_grand_reset(id, key)
  9954. {
  9955. if (key >= 1)
  9956. {
  9957. if (key != MENU_KEY_EXIT)
  9958. show_menu_grand_reset(id)
  9959.  
  9960. return PLUGIN_HANDLED;
  9961. }
  9962.  
  9963. if (is_user_bot(id))
  9964. {
  9965. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Para poder hacer super reset tienes que estar muerto")
  9966. return PLUGIN_HANDLED;
  9967. }
  9968.  
  9969. if (g_grandreset[id] >= 30)
  9970. {
  9971. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Llegastes al level maximo de super resets")
  9972. return PLUGIN_HANDLED;
  9973. }
  9974.  
  9975. switch (key)
  9976. {
  9977. case 0:
  9978. {
  9979. if (g_reset[id] == 30 && g_points[id][0] >= 200 && g_points[id][1] >= 200)
  9980. {
  9981. g_level[id] = 1
  9982. g_reset[id] = 0
  9983. g_grandreset[id]++
  9984. g_ammopacks[id] = 0
  9985. g_points[id][0] -= 200
  9986. g_points[id][1] -= 200
  9987. g_skill_points[id][0][0] += 1 // 5 sumadas a daño humana
  9988. g_skill_points[id][0][1] += 1 // 5 a vida humana
  9989. g_skill_points[id][0][4] += 1 // 5 sumadas a chaleco humana
  9990. g_skill_points[id][1][0] += 1 // 5 a speed zombie
  9991. g_skill_points[id][1][1] += 1 // 5 a algo
  9992. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Acabas de super resetear, ahora tenes^x03 %d super resets!", g_grandreset[id])
  9993. WPN_AUTO_ON = 0
  9994. g_zombieclassnext[id] = -1
  9995. g_humanclassnext[id] = -1
  9996. }
  9997. else
  9998. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Para super resetear necesitas ser reset 30")
  9999. }
  10000. }
  10001. return PLUGIN_HANDLED
  10002. }
  10003. // Happy Hour
  10004. public happyhour(id)
  10005. {
  10006. new data[12]
  10007. get_time("%H", data, 12)
  10008. new Tiempo = str_to_num(data)
  10009.  
  10010. for(new i=0;i <= sizeof horas - 1;i++)
  10011. {
  10012. if(Tiempo != horas[i]) continue
  10013. g_happytime = true
  10014. break;
  10015. }
  10016. if(g_happytime)
  10017. {
  10018. zp_colored_print(0, "^x04[sG]^x01 -^x03 Happy Hour:^x01 Has Started!! / ENJOY!!")
  10019. }
  10020. }
  10021.  
  10022. // menu granadasds
  10023. public show_menu_granades(id)
  10024. {
  10025. new menu = menu_create("\yGrenade Selections \r[1-4]", "menu_handler")
  10026.  
  10027. if(g_level[id] >= 0)
  10028. menu_additem(menu, "\y1 Fuego", "1", 0);
  10029. else
  10030. menu_additem(menu, "\d1 Fire \r[Blocked]", "1", 0);
  10031. if(g_level[id] >= 30)
  10032. menu_additem(menu, "\y1 Fire || 1 Ice", "2", 0);
  10033. else
  10034. menu_additem(menu, "\d1 Fire || 1 Ice \r[Level: 30]", "2", 0);
  10035. if(g_level[id] >= 70)
  10036. menu_additem(menu, "\y3 Ice", "3", 0);
  10037. else
  10038. menu_additem(menu, "\d3 Ice \r[Level: 70]", "3", 0);
  10039. if(g_level[id] >= 145)
  10040. menu_additem(menu, "\y2 Fire || 2 Ice", "4", 0);
  10041. else
  10042. menu_additem(menu, "\d2 Fire || 2 Ice \r[Level: 145]", "4", 0);
  10043. if(g_level[id] >= 200)
  10044. menu_additem(menu, "\y1 Fire || 1 Ice || 1 Bubble", "5", 0);
  10045. else
  10046. menu_additem(menu, "\d1 Fire || 1 Ice || 1 Bubble \r[Level: 200]", "5", 0);
  10047. if(g_level[id] >= 260)
  10048. menu_additem(menu, "\y1 Fire || 2 Ice || 1 Bubble", "6", 0);
  10049. else
  10050. menu_additem(menu, "\d1 Fire || 2 Ice || 1 Bubble \r[Level: 260]", "6", 0);
  10051. if(g_level[id] >= 330)
  10052. menu_additem(menu, "\y2 Fire || 2 Ice || 1 Bubble", "7", 0);
  10053. else
  10054. menu_additem(menu, "\d2 Fire || 2 Ice || 1 Bubble\r[Level: 330]", "7", 0);
  10055.  
  10056. menu_display(id, menu, 0)
  10057. }
  10058. // Menu Grenades
  10059. public menu_handler(id, menu, key)
  10060. {
  10061. if(g_zombie[id])
  10062. {
  10063. menu_destroy(menu)
  10064. return PLUGIN_HANDLED
  10065. }
  10066.  
  10067. switch(key)
  10068. {
  10069. case 0:
  10070. {
  10071. if (g_level[id] >= 0)
  10072. {
  10073. give_item(id, "weapon_hegrenade");
  10074. }
  10075. else
  10076. {
  10077. show_menu_granades(id);
  10078. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
  10079. return PLUGIN_HANDLED;
  10080. }
  10081. }
  10082. case 1:
  10083. {
  10084. if (g_level[id] >= 30)
  10085. {
  10086. give_item(id, "weapon_hegrenade");
  10087. give_item(id, "weapon_flashbang");
  10088. }
  10089. else
  10090. {
  10091. show_menu_granades(id);
  10092. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
  10093. return PLUGIN_HANDLED;
  10094. }
  10095. }
  10096. case 2:
  10097. {
  10098. if (g_level[id] >= 70)
  10099. {
  10100. give_item(id, "weapon_flashbang");
  10101. give_item(id, "weapon_flashbang");
  10102. give_item(id, "weapon_flashbang");
  10103. cs_set_user_bpammo(id, CSW_FLASHBANG, 3);
  10104. }
  10105. else
  10106. {
  10107. show_menu_granades(id);
  10108. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
  10109. return PLUGIN_HANDLED;
  10110. }
  10111. }
  10112. case 3:
  10113. {
  10114. if (g_level[id] >= 145)
  10115. {
  10116. give_item(id, "weapon_flashbang");
  10117. give_item(id, "weapon_flashbang");
  10118. give_item(id, "weapon_hegrenade");
  10119. cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
  10120. }
  10121. else
  10122. {
  10123. show_menu_granades(id);
  10124. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
  10125. return PLUGIN_HANDLED;
  10126. }
  10127. }
  10128. case 4:
  10129. {
  10130. if (g_level[id] >= 200)
  10131. {
  10132. g_bubble_bomb[id] = true
  10133. g_bubble_bomb[id]++
  10134. fm_give_item(id, "weapon_hegrenade")
  10135. fm_give_item(id, "weapon_flashbang")
  10136. fm_give_item(id, "weapon_smokegrenade")
  10137. fm_set_user_bpammo(id, CSW_SMOKEGRENADE, 1)
  10138. }
  10139. else
  10140. {
  10141. show_menu_granades(id);
  10142. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
  10143. return PLUGIN_HANDLED;
  10144. }
  10145. }
  10146. case 5:
  10147. {
  10148. if (g_level[id] >= 260)
  10149. {
  10150. g_bubble_bomb[id] = true
  10151. g_bubble_bomb[id] ++
  10152. fm_give_item(id, "weapon_hegrenade");
  10153. fm_give_item(id, "weapon_flashbang");
  10154. fm_give_item(id, "weapon_flashbang");
  10155. fm_give_item(id, "weapon_smokegrenade");
  10156. fm_set_user_bpammo(id, CSW_SMOKEGRENADE, 1)
  10157. }
  10158. else
  10159. {
  10160. show_menu_granades(id);
  10161. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
  10162. return PLUGIN_HANDLED;
  10163. }
  10164. }
  10165. case 6:
  10166. {
  10167. if (g_level[id] >= 330)
  10168. {
  10169. g_bubble_bomb[id] = true
  10170. g_bubble_bomb[id] += 2
  10171. fm_give_item(id, "weapon_hegrenade");
  10172. fm_give_item(id, "weapon_hegrenade");
  10173. fm_give_item(id, "weapon_flashbang");
  10174. fm_give_item(id, "weapon_flashbang");
  10175. fm_give_item(id, "weapon_smokegrenade");
  10176. fm_set_user_bpammo(id, CSW_SMOKEGRENADE, 2)
  10177. fm_set_user_bpammo(id, CSW_HEGRENADE, 2)
  10178. }
  10179. else
  10180. {
  10181. show_menu_granades(id);
  10182. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
  10183. return PLUGIN_HANDLED;
  10184. }
  10185. }
  10186. }
  10187. return PLUGIN_HANDLED
  10188. }
  10189.  
  10190. // Bubble Grenade Explosion
  10191. public bubble_explode(id)
  10192. {
  10193. // Get origin
  10194. static Float:originF[3] // originF para llamar la entidad de create_blast4
  10195. pev(id, pev_origin, originF) // ...
  10196.  
  10197. // Create Blast
  10198. create_blast4(originF) // entidad de los anillos de explocion
  10199.  
  10200. set_pcvar_num(cvar_flaregrenades,1) // tomamos las cvar de la flare, para usarla como activador y desactivador de esta bomba.
  10201.  
  10202. // Create entitity
  10203. new iEntity = create_entity("info_target") // creamo la entidad con su determinado objetivo
  10204.  
  10205. if(!is_valid_ent(iEntity)) // determinamos que la entidad esta en false
  10206. return PLUGIN_HANDLED // tramitamos nuevamente
  10207.  
  10208. new Float: Origin[3] // origen
  10209. entity_get_vector(id, EV_VEC_origin, Origin)
  10210.  
  10211. entity_set_string(iEntity, EV_SZ_classname, entclas) // llamamos ala clase de entidad
  10212.  
  10213. entity_set_vector(iEntity,EV_VEC_origin, Origin) // no se que es
  10214. entity_set_model(iEntity,model) // modelo dela burbuja
  10215. entity_set_int(iEntity, EV_INT_solid, SOLID_TRIGGER) // no se que es
  10216. 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
  10217. entity_set_int(iEntity, EV_INT_renderfx, kRenderFxGlowShell) // le damos el glow
  10218. entity_set_int(iEntity, EV_INT_rendermode, kRenderTransAlpha) // hacemos que sea transparente
  10219. entity_set_float(iEntity, EV_FL_renderamt, 50.0) // le damos la intensidad
  10220.  
  10221. // Colored Aura / aura cuando explota la granada
  10222. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  10223. write_byte(TE_DLIGHT) // aura
  10224. engfunc(EngFunc_WriteCoord, originF[0]) // x position
  10225. engfunc(EngFunc_WriteCoord, originF[1]) // y position
  10226. engfunc(EngFunc_WriteCoord, originF[2]) // z position
  10227. write_byte(15) // radius / radio
  10228. write_byte(255) // red: rojo
  10229. write_byte(255) // green: verde
  10230. write_byte(255) // blue: azul
  10231. write_byte(2) // life
  10232. write_byte(0) // decay rate / desintegración de la tasa
  10233. message_end() // cerramos la entidad
  10234.  
  10235. #if defined RANDOM_COLOR // color por default
  10236. if(is_valid_ent(iEntity)) // entidad valida
  10237. {
  10238. new Float:vColor[3] // variable vColor defaul / por defecto
  10239.  
  10240. for(new i; i < 3; i++) // nose que es
  10241. vColor[i] = random_float(0.0, 255.0) // color r, g, b
  10242.  
  10243. entity_set_vector(iEntity, EV_VEC_rendercolor, vColor) // el glow de la burbuja
  10244. }
  10245. #endif
  10246.  
  10247. #if defined ONE_COLOR
  10248. entity_set_vector(iEntity, EV_VEC_rendercolor, colour_force_shield) // declaramos el color cuztomizable al principio
  10249. #endif
  10250.  
  10251. #if defined CAMPO_TASK
  10252. set_task(15.0, "DeleteEntity", iEntity) // tiempo que demora en removerse el campo
  10253. #endif
  10254.  
  10255. return PLUGIN_CONTINUE;
  10256. }
  10257.  
  10258. // Bubble Grenade: Yellow Blast
  10259. create_blast4(const Float:originF[3])
  10260. {
  10261. // Smallest ring / anillo de explcion 1
  10262. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  10263. write_byte(TE_BEAMCYLINDER) // TE id
  10264. engfunc(EngFunc_WriteCoord, originF[0]) // x
  10265. engfunc(EngFunc_WriteCoord, originF[1]) // y
  10266. engfunc(EngFunc_WriteCoord, originF[2]) // z
  10267. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  10268. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  10269. engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
  10270. write_short(g_exploSpr) // sprite de los anillos
  10271. write_byte(0) // startframe / fotograma inicial
  10272. write_byte(0) // framerate / imágenes por segundo
  10273. write_byte(4) // life
  10274. write_byte(60) // width / ancho
  10275. write_byte(0) // noise / ruido
  10276. write_byte(255) // red: rojo
  10277. write_byte(255) // green: verde
  10278. write_byte(255) // blue: azul
  10279. write_byte(200) // brightness / brillo
  10280. write_byte(0) // speed / rapidez
  10281. message_end()
  10282.  
  10283. // Medium ring
  10284. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  10285. write_byte(TE_BEAMCYLINDER) // TE id
  10286. engfunc(EngFunc_WriteCoord, originF[0]) // x
  10287. engfunc(EngFunc_WriteCoord, originF[1]) // y
  10288. engfunc(EngFunc_WriteCoord, originF[2]) // z
  10289. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  10290. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  10291. engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  10292. write_short(g_exploSpr) // sprite
  10293. write_byte(0) // startframe / fotograma inicial
  10294. write_byte(0) // framerate / imágenes por segundo
  10295. write_byte(4) // life
  10296. write_byte(60) // width / ancho
  10297. write_byte(0) // noise / ruido
  10298. write_byte(255) // red: rojo
  10299. write_byte(255) // green: verde
  10300. write_byte(255) // blue: azul
  10301. write_byte(200) // brightness / brillo
  10302. write_byte(0) // speed / rapidez
  10303. message_end()
  10304.  
  10305. // Largest ring
  10306. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  10307. write_byte(TE_BEAMCYLINDER) // TE id
  10308. engfunc(EngFunc_WriteCoord, originF[0]) // x
  10309. engfunc(EngFunc_WriteCoord, originF[1]) // y
  10310. engfunc(EngFunc_WriteCoord, originF[2]) // z
  10311. engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  10312. engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  10313. engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  10314. write_short(g_exploSpr) // sprite
  10315. write_byte(0) // startframe / fotograma inicial
  10316. write_byte(0) // framerate / imágenes por segundo
  10317. write_byte(4) // life
  10318. write_byte(60) // width / ancho
  10319. write_byte(0) // noise / ruido
  10320. write_byte(255) // red: rojo
  10321. write_byte(255) // green: verde
  10322. write_byte(255) // blue: azul
  10323. write_byte(200) // brightness / brillo
  10324. write_byte(0) // speed / rapidez
  10325. message_end()
  10326. }
  10327.  
  10328. // Touch bomb bubble
  10329. public entity_touch(touched, toucher) // entidad cuando un zombie o nemesis la toca
  10330. {
  10331.  
  10332. if(g_zombie[toucher] || g_nemesis[toucher]) // los nemesis y zombies no pueden pasar
  10333. {
  10334. new Float:pos_ptr[3], Float:pos_ptd[3], Float:push_power = get_pcvar_float(cvar_bubblepush) // intensidad de rechazo
  10335.  
  10336. pev(touched, pev_origin, pos_ptr) // nose que es
  10337. pev(toucher, pev_origin, pos_ptd) // nose que es
  10338.  
  10339. for(new i = 0; i < 3; i++)
  10340. {
  10341. pos_ptd[i] -= pos_ptr[i] // nose que es
  10342. pos_ptd[i] *= push_power // poder cuando lo tocamos y nos rechaza
  10343. }
  10344. set_pev(toucher, pev_velocity, pos_ptd) // velocidad del rechazo
  10345. set_pev(toucher, pev_impulse, pos_ptd) // impulso del rechazo
  10346. }
  10347. }
  10348.  
  10349. // Hook bubble bomb
  10350. public hook_curwpn(id)
  10351. {
  10352. if(!is_user_alive(id)) // cliente muerto no recibe =D
  10353. return PLUGIN_CONTINUE;
  10354.  
  10355. if(g_bubble_bomb[id] && !g_zombie[id]) // la bomba solo la puede adquirir un humano
  10356. {
  10357. new wID = read_data(2)
  10358. if(wID == CSW_SMOKEGRENADE) // toma el lugar de la smoke grenade
  10359. set_pev(id, pev_viewmodel2, model_grenade) // modelo de la grana
  10360. }
  10361.  
  10362. return PLUGIN_CONTINUE;
  10363. }
  10364.  
  10365. // Give bubble item / hacemos que nos de el campo
  10366. public give_item_bubble(id)
  10367. {
  10368. g_bubble_bomb[id] = true // seteamos la variable a true
  10369. give_item(id,"weapon_smokegrenade") // le pedimos una smoke ya que el campo la remplaza
  10370. }
  10371.  
  10372. // Remove Entity / removemos la entidad con el task
  10373. public DeleteEntity(entity)
  10374. {
  10375. if(is_valid_ent(entity )) // hacemos valida la entidad
  10376. remove_entity(entity) // la removemos...
  10377. }
  10378.  
  10379. // luego abajo de todo el plugin agregamos esto
  10380.  
  10381. public Combo_Terminado(id)
  10382. {
  10383. id -= TASK_COMBO
  10384. for(new i = 0 ; i < sizeof Combo ; i++)
  10385. {
  10386. if (g_combo[id] >= Combo[i][Combos] && g_combo[id] < Combo[i+1][Combos])
  10387. {
  10388. set_hudmessage(255, 255, 255, -1.0, 0.29, 0, 0.1, 4.5, 0.01, 0.01, -1)
  10389. ShowSyncHudMsg(id, g_MsgSync4, "Combo de (%d) Ammo-pack^nBonus Multiplication x%d^nTotal ammo packs won(%d)", g_combo[id], Combo[i][Multiplicado], g_combo[id] * Combo[i][Multiplicado])
  10390. g_ammopacks[id] += g_combo[id] * Combo[i][Multiplicado]
  10391. }
  10392. }
  10393.  
  10394. g_damage[id] = g_total[id] = g_combo[id] = 0;
  10395. update_ap(id, 0, 1); // esto lo pueden cambiar segun como lo tengan en public de levels o simplemente lo sacan esto sirve para que cada vez que termina el combo y le da su bonificacion de ammo packs chekea si suben o no al siguiente nivel dependiendo de la cantidad que ganen
  10396. }
  10397.  
  10398. // CAMBIO DE NOMBRE NO PERMITIDO
  10399. public fwdCliUserInfoChanged(id, buffer)
  10400. {
  10401. static name[32]
  10402. if(g_names[id][0])
  10403. {
  10404. engfunc(EngFunc_InfoKeyValue, buffer, "name", name, charsmax(name))
  10405. if(!equal(name, g_names[id]))
  10406. {
  10407. client_print(id, print_center, "Para cambiar tu nombre, Desconectate del servidor PRIMERO")
  10408. engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", g_names[id])
  10409. return FMRES_SUPERCEDE
  10410. }
  10411. }
  10412. return FMRES_IGNORED
  10413. }
  10414.  
  10415. // Menu: Habilidades
  10416. public menu_upgrade(id)
  10417. {
  10418. new menu = menu_create("\yAbilities \yMenu", "menu_upgrade_handler")
  10419.  
  10420. menu_additem(menu, "\wZombie Abilities", "1", 0)
  10421. menu_additem(menu, "\wHuman Abilities", "2", 0)
  10422.  
  10423. menu_setprop(menu, MPROP_EXITNAME, "\rExit")
  10424. menu_display(id, menu, 0)
  10425. return PLUGIN_HANDLED
  10426. }
  10427.  
  10428. public menu_upgrade_handler(id, menu, item)
  10429. {
  10430. if (item == MENU_EXIT) return PLUGIN_HANDLED
  10431.  
  10432. new data[6], iName[64], access, callback;
  10433. menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback);
  10434.  
  10435. switch (str_to_num(data))
  10436. {
  10437. case 1: menu_zomupgrade(id)
  10438. case 2: menu_humupgrade(id)
  10439. }
  10440.  
  10441. return PLUGIN_HANDLED;
  10442. }
  10443.  
  10444. // Menu: Mejoras de zombie
  10445. public menu_zomupgrade(id)
  10446. {
  10447. new menu[999], num[8], i
  10448.  
  10449. static item[150]
  10450. formatex(item, charsmax(item),"\rZombie \yAbilities^n^n\yYou have \w%d\y points to use^nTotal points used \w%d", g_points[id][1],g_usedpoints[id][1])
  10451. new menu2 = menu_create(item, "menu_zomupgrade_handler")
  10452.  
  10453. for (i = 0; i < 4; i++)
  10454. {
  10455. if (g_skill_points[id][1][i] < g_upgrade_max[1][i])
  10456. {
  10457. if (g_points[id][1] >= upgrade_cost(g_skill_points[id][1][i]))
  10458. {
  10459. formatex(menu, charsmax(menu), "\wIncrease \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])
  10460. num_to_str(i, num, 7)
  10461. menu_additem(menu2, menu, num)
  10462. }
  10463. else
  10464. {
  10465. formatex(menu, charsmax(menu), "\dIncrease %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])
  10466. num_to_str(i, num, 7)
  10467. menu_additem(menu2, menu, num)
  10468. }
  10469. }
  10470. else
  10471. {
  10472. formatex(menu, charsmax(menu), "\d%s \d[\r Full \d]" , g_upgrades_names[1][i])
  10473. num_to_str(i, num, 7)
  10474. menu_additem(menu2, menu, num)
  10475. }
  10476. }
  10477.  
  10478. menu_setprop(menu2, MPROP_EXITNAME, "\rExit")
  10479. menu_display(id, menu2)
  10480. return PLUGIN_HANDLED;
  10481. }
  10482.  
  10483. public menu_zomupgrade_handler(id, menu, item)
  10484. {
  10485. if (item == MENU_EXIT) return PLUGIN_HANDLED;
  10486.  
  10487. new Key, Data[5], Name[33], access, callback
  10488. menu_item_getinfo(menu, item, access, Data, 4, Name, 32, callback)
  10489. Key = str_to_num(Data)
  10490.  
  10491. if (g_skill_points[id][1][Key] < g_upgrade_max[1][Key])
  10492. {
  10493. if (g_points[id][1] >= upgrade_cost(g_skill_points[id][1][Key]))
  10494. {
  10495. g_points[id][1] -= upgrade_cost(g_skill_points[id][1][Key])
  10496. g_usedpoints[id][1] += upgrade_cost(g_skill_points[id][1][Key])
  10497. g_skill_points[id][1][Key]++
  10498. }
  10499. }
  10500.  
  10501. menu_zomupgrade(id)
  10502. return PLUGIN_HANDLED;
  10503. }
  10504.  
  10505. // Menu: Mejoras de humano
  10506. public menu_humupgrade(id)
  10507. {
  10508. new menu[999], num[8], i
  10509.  
  10510. static item[150]
  10511. formatex(item, charsmax(item),"\rHuman \yAbilities^n^n\yYou have \w%d\y points to use^nTotal points used \w%d", g_points[id][0],g_usedpoints[id][0])
  10512. new menu2 = menu_create(item, "menu_humupgrade_handler")
  10513.  
  10514. for (i = 0; i < 5; i++)
  10515. {
  10516. if (g_skill_points[id][0][i] < g_upgrade_max[0][i])
  10517. {
  10518. if (g_points[id][0] >= upgrade_cost(g_skill_points[id][0][i]))
  10519. {
  10520. formatex(menu, charsmax(menu), "\wIncrease \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])
  10521. num_to_str(i, num, 7)
  10522. menu_additem(menu2, menu, num)
  10523. }
  10524. else
  10525. {
  10526. formatex(menu, charsmax(menu), "\dIncrease %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])
  10527. num_to_str(i, num, 7)
  10528. menu_additem(menu2, menu, num)
  10529. }
  10530. }
  10531. else
  10532. {
  10533. formatex(menu, charsmax(menu), "\d%s \d[ \rFull \d]" , g_upgrades_names[0][i])
  10534. num_to_str(i, num, 7)
  10535. menu_additem(menu2, menu, num)
  10536. }
  10537. }
  10538.  
  10539. menu_setprop(menu2, MPROP_EXITNAME, "\rExit")
  10540. menu_display(id, menu2)
  10541. return PLUGIN_HANDLED;
  10542. }
  10543.  
  10544. public menu_humupgrade_handler(id, menu, item)
  10545. {
  10546. if (item == MENU_EXIT) return PLUGIN_HANDLED;
  10547.  
  10548. new Key, Data[5], Name[33], access, callback
  10549. menu_item_getinfo(menu, item, access, Data, 4, Name, 32, callback)
  10550. Key = str_to_num(Data)
  10551.  
  10552. if (g_skill_points[id][0][Key] < g_upgrade_max[0][Key])
  10553. {
  10554. if (g_points[id][0] >= upgrade_cost(g_skill_points[id][0][Key]))
  10555. {
  10556. g_points[id][0] -= upgrade_cost(g_skill_points[id][0][Key])
  10557. g_usedpoints[id][0] += upgrade_cost(g_skill_points[id][0][Key])
  10558. g_skill_points[id][0][Key]++
  10559. }
  10560. }
  10561.  
  10562. menu_humupgrade(id)
  10563. return PLUGIN_HANDLED;
  10564. }
  10565.  
  10566. public bugvelocidad(id)
  10567. {
  10568. if (is_user_alive(id))
  10569. {
  10570. give_item(id, "weapon_knife")
  10571. client_cmd(id, "cl_backspeed 10000")
  10572. client_cmd(id, "cl_forwardspeed 10000")
  10573. client_cmd(id, "cl_sidespeed 10000")
  10574. }
  10575. else
  10576. {
  10577. return;
  10578. }
  10579. }
  10580.  
  10581. public cmdParty(id) {
  10582.  
  10583. if(g_PartyData[id][In_Party])
  10584. show_party_info_menu(id)
  10585. else
  10586. show_party_menu(id)
  10587.  
  10588. return PLUGIN_HANDLED
  10589. }
  10590.  
  10591. public show_party_menu(id) {
  10592.  
  10593. new iMenu = menu_create("[sG]Silent Gamerz - \rParty Menu:","party_menu"), BlockParty[50]
  10594.  
  10595. menu_additem(iMenu, "\yCreate Party", "0")
  10596.  
  10597. formatex(BlockParty, charsmax(BlockParty), "\yBlock Party invitations: \w%s",g_PartyData[id][Block_Party] ? "Yes" : "No")
  10598.  
  10599. menu_additem(iMenu, BlockParty, "1")
  10600.  
  10601. menu_setprop(iMenu, MPROP_EXITNAME, "Exit")
  10602. menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  10603.  
  10604. menu_display(id, iMenu, 0)
  10605. }
  10606.  
  10607. public show_party_info_menu(id) {
  10608.  
  10609. new iMenu = menu_create("[sG]Silent Gamerz - \rMenu Party:","party_info_menu")
  10610.  
  10611. menu_additem(iMenu, "Add Members", .callback = g_MenuCallback[MASTER])
  10612. menu_additem(iMenu, "Kick Members", .callback = g_MenuCallback[MASTER])
  10613. menu_additem(iMenu, "Destroy Party", .callback = g_MenuCallback[MASTER])
  10614. menu_additem(iMenu, "Leave Party", .callback = g_MenuCallback[USER])
  10615.  
  10616. menu_setprop(iMenu, MPROP_EXITNAME, "Exit")
  10617. menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  10618.  
  10619. menu_display(id, iMenu)
  10620. }
  10621.  
  10622. public show_party_add_menu(id) {
  10623.  
  10624. new iMenu = menu_create(g_PartyData[id][In_Party] ? "\rAgregar Integrante:" : "\rCreate Party:", "party_create_menu"), Poss[3], Name[32]
  10625.  
  10626. for(new i = 1; i <= g_maxplayers; i++) {
  10627.  
  10628. if(!is_available_to_party(i) || id == i)
  10629. continue;
  10630.  
  10631. get_user_name(i, Name, charsmax(Name))
  10632. num_to_str(i, Poss, charsmax(Poss))
  10633. menu_additem(iMenu, Name, Poss)
  10634. }
  10635.  
  10636. menu_setprop(iMenu, MPROP_EXITNAME, "Exit")
  10637. menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  10638.  
  10639. menu_display(id, iMenu)
  10640. }
  10641.  
  10642. public show_party_kick_menu(id) {
  10643.  
  10644. new iMenu = menu_create("\rKick Party Menu:","party_kick_menu"), Players[32], Poss[3], user
  10645.  
  10646. get_party_index(id, Players)
  10647.  
  10648. for(new i; i < g_PartyData[id][Amount_In_Party]; i++) {
  10649. user = Players[i]
  10650. num_to_str(user, Poss, charsmax(Poss))
  10651. menu_additem(iMenu, g_PartyData[user][UserName], Poss)
  10652. }
  10653.  
  10654. menu_setprop(iMenu, MPROP_EXITNAME, "Exit")
  10655.  
  10656. menu_display(id, iMenu)
  10657. }
  10658.  
  10659. public show_party_invite_menu(id2, MasterId) {
  10660.  
  10661. new MenuTitle[128], iMenu, Str_MasterId[3]
  10662.  
  10663. set_player_party_name(MasterId)
  10664. set_player_party_name(id2)
  10665.  
  10666. client_print(MasterId, print_chat, "%s Request sent to %s", TAG, g_PartyData[id2][UserName])
  10667.  
  10668. formatex(MenuTitle, charsmax(MenuTitle), "%s Sent you an invitation to %s Party", g_PartyData[MasterId][UserName], g_PartyData[MasterId][In_Party] ? "unirte al" : "create a")
  10669.  
  10670. new UserTaskArgs[3]
  10671.  
  10672. UserTaskArgs[0] = iMenu = menu_create( MenuTitle , "party_invite_menu")
  10673. UserTaskArgs[1] = MasterId
  10674.  
  10675. num_to_str(MasterId, Str_MasterId, charsmax(Str_MasterId))
  10676.  
  10677. menu_additem( iMenu , "Accept", Str_MasterId)
  10678. menu_additem( iMenu , "Deny", Str_MasterId)
  10679.  
  10680. if(is_user_bot(id2) && get_pcvar_num(cvar_allow_bots)) {
  10681. party_invite_menu(id2, iMenu, 0)
  10682. return
  10683. }
  10684.  
  10685. menu_setprop(iMenu, MPROP_EXIT, MEXIT_NEVER)
  10686.  
  10687. menu_display(id2, iMenu)
  10688.  
  10689. remove_task_acept(id2)
  10690.  
  10691. set_task(get_pcvar_float(cvar_time_acept), "Time_Acept", id2+TASK_ACEPT, UserTaskArgs, 2)
  10692. }
  10693.  
  10694.  
  10695. public party_menu(id, menu, item) {
  10696.  
  10697. if(item == MENU_EXIT) {
  10698. menu_destroy(menu)
  10699. return
  10700. }
  10701.  
  10702. if(item) {
  10703. g_PartyData[id][Block_Party] = g_PartyData[id][Block_Party] ? false : true
  10704. show_party_menu(id)
  10705. }
  10706. else
  10707. show_party_add_menu(id)
  10708.  
  10709. menu_destroy(menu)
  10710.  
  10711. }
  10712.  
  10713. public party_create_menu(id, menu, item) {
  10714.  
  10715. if(item == MENU_EXIT) {
  10716. menu_destroy(menu)
  10717. return
  10718. }
  10719.  
  10720. new iKey[6], iAccess, iCallback, id2
  10721.  
  10722. menu_item_getinfo(menu, item, iAccess, iKey, charsmax(iKey), _, _, iCallback)
  10723.  
  10724. id2 = str_to_num(iKey)
  10725.  
  10726. if(!is_available_to_party(id2))
  10727. return
  10728.  
  10729. show_party_invite_menu(id2, id)
  10730.  
  10731. menu_destroy(menu)
  10732. }
  10733.  
  10734. public party_invite_menu(id, menu, item) {
  10735.  
  10736. if(item == MENU_EXIT) {
  10737. menu_destroy(menu)
  10738. remove_task_acept(id)
  10739. return
  10740. }
  10741.  
  10742. new iKey[6], iAccess, iCallback, id_master
  10743.  
  10744. menu_item_getinfo(menu, item, iAccess, iKey, charsmax(iKey), _, _, iCallback)
  10745.  
  10746. id_master = str_to_num(iKey)
  10747.  
  10748. switch(item) {
  10749. case 0: {
  10750.  
  10751. if(!g_PartyData[id_master][In_Party]) {
  10752. create_party(id_master, id)
  10753. set_task_party_hud(id_master)
  10754. set_task_party_hud(id)
  10755. }
  10756. else {
  10757. if(g_PartyData[id_master][Amount_In_Party] == get_pcvar_num(cvar_max_players)) {
  10758.  
  10759. client_print(id, print_chat, "%s Ya se alcanzo el numero maximo de integrantes en la party", TAG)
  10760. client_print(id_master, print_chat, "%s Ya alcanzaste el numero maximo de integrantes en la party", TAG)
  10761.  
  10762. remove_task_acept(id)
  10763.  
  10764. menu_destroy(menu)
  10765. return
  10766. }
  10767.  
  10768. add_party_user(id_master, id)
  10769. set_task_party_hud(id)
  10770. }
  10771.  
  10772. client_print(id_master, print_chat, "%s %s has joined the party", TAG, g_PartyData[id][UserName])
  10773. }
  10774. case 1: client_print(id_master, print_chat, "%s %s Cancelled the party invitation", TAG, g_PartyData[id][UserName])
  10775. }
  10776.  
  10777. remove_task_acept(id)
  10778.  
  10779. menu_destroy(menu)
  10780. }
  10781.  
  10782. public party_kick_menu(id, menu, item) {
  10783.  
  10784. if(item == MENU_EXIT) {
  10785. menu_destroy(menu)
  10786. return
  10787. }
  10788.  
  10789. new iKey[6], iAccess, iCallback, id2
  10790.  
  10791. menu_item_getinfo(menu, item, iAccess, iKey, charsmax(iKey), _, _, iCallback)
  10792.  
  10793. id2 = str_to_num(iKey)
  10794.  
  10795. if(is_user_connected(id2))
  10796. g_PartyData[id][Amount_In_Party] == 2 ? destoy_party(id) : remove_party_user(id2)
  10797.  
  10798. menu_destroy(menu)
  10799. }
  10800.  
  10801. public party_info_menu(id, menu,item) {
  10802.  
  10803. if(item == MENU_EXIT) {
  10804. menu_destroy(menu)
  10805. return
  10806. }
  10807.  
  10808. switch(item) {
  10809. case 0: {
  10810. if(g_PartyData[id][Amount_In_Party] < get_pcvar_num(cvar_max_players))
  10811. show_party_add_menu(id)
  10812. else
  10813. client_print(id, print_chat, "%s Ya alcanzaste el numero maximo de integrantes en la party", TAG)
  10814. }
  10815. case 1: show_party_kick_menu(id)
  10816. case 2: destoy_party(id)
  10817. case 3: remove_party_user(id)
  10818. }
  10819.  
  10820. menu_destroy(menu)
  10821. }
  10822.  
  10823. public PartyHud(taskid) {
  10824.  
  10825. static id
  10826. id = ID_HUD
  10827.  
  10828. if(!is_user_connected(id)) {
  10829. remove_task(taskid)
  10830. return
  10831. }
  10832.  
  10833. static CountParty, PartyMsg[256], Players[32], id2
  10834.  
  10835. CountParty = 0
  10836. PartyMsg[0] = 0
  10837.  
  10838. get_party_index(id, Players)
  10839. for(new i; i < g_PartyData[id][Amount_In_Party]; i++)
  10840. {
  10841. id2 = Players[i]
  10842.  
  10843. if(CountParty)
  10844. add(PartyMsg, charsmax(PartyMsg), "^n^n")
  10845.  
  10846. format(PartyMsg, charsmax(PartyMsg), "%s%s ^nLevel: %d^nAmmopacsk: %d", strlen(PartyMsg) ? PartyMsg : "^t^t^tParty Members^n", g_PartyData[id2][UserName], g_level[id2], g_ammopacks[id2])
  10847. CountParty++
  10848. }
  10849.  
  10850. set_hudmessage(255, 0, 0, 0.75, 0.34, 0, 6.0, 1.0);
  10851. show_hudmessage(id, PartyMsg)
  10852. }
  10853.  
  10854. public Time_Acept(UserTaskArgs[], taskid) {
  10855.  
  10856. taskid -= TASK_ACEPT;
  10857.  
  10858. if(!g_PartyData[taskid][In_Party]) {
  10859.  
  10860. client_print(UserTaskArgs[1], print_chat, "%s %s Cancelled the party invitation", TAG, g_PartyData[taskid][UserName])
  10861. menu_destroy(UserTaskArgs[0])
  10862. show_menu(taskid, 0, "^n", 1)
  10863. }
  10864. }
  10865.  
  10866. stock create_party(master, guest) {
  10867.  
  10868. set_party_member(master, master)
  10869. set_party_member(master, guest)
  10870. set_party_member(guest, master)
  10871. set_party_member(guest, guest)
  10872.  
  10873. set_party_vars(master, Start_Amount)
  10874. set_party_vars(guest, ++g_PartyData[master][Amount_In_Party])
  10875. }
  10876.  
  10877. stock add_party_user(master, guest) {
  10878.  
  10879. new Players[32], member, amount = g_PartyData[master][Amount_In_Party]
  10880.  
  10881. get_party_index(master, Players)
  10882.  
  10883. for(new i; i < amount; i++) {
  10884.  
  10885. member = Players[i]
  10886.  
  10887. set_party_member(guest, member)
  10888. set_party_member(member, guest)
  10889. g_PartyData[member][Amount_In_Party]++
  10890.  
  10891. }
  10892.  
  10893. set_party_member(guest, guest)
  10894. set_party_vars(guest, amount+1)
  10895. }
  10896.  
  10897. stock set_party_member(id, id2)
  10898. ArrayPushCell(Party_Ids[id], id2)
  10899.  
  10900. stock set_party_vars(id, amount) {
  10901.  
  10902. g_PartyData[id][In_Party] = true
  10903. g_PartyData[id][Position] = amount-1
  10904. g_PartyData[id][Amount_In_Party] = amount
  10905.  
  10906. }
  10907.  
  10908. stock destoy_party(id) {
  10909.  
  10910. new Players[32], id2, Amount = g_PartyData[id][Amount_In_Party]
  10911. get_party_index(id, Players)
  10912.  
  10913. for(new i; i < Amount; i++) {
  10914. id2 = Players[i]
  10915. clear_party_user(id2)
  10916. client_print(id2, print_chat, "%s The party is destroyed", TAG)
  10917.  
  10918. }
  10919. }
  10920.  
  10921. stock remove_party_user(user) {
  10922.  
  10923. new Players[32], id, Amount = g_PartyData[user][Amount_In_Party]
  10924.  
  10925. get_party_index(user, Players)
  10926.  
  10927. clear_party_user(user)
  10928.  
  10929. for(new i; i < Amount; i++) {
  10930.  
  10931. id = Players[i]
  10932.  
  10933. if(id != user) {
  10934.  
  10935. ArrayClear(Party_Ids[id])
  10936.  
  10937. for(new z; z < Amount; z++)
  10938. if(Players[z] != user)
  10939. set_party_member(id, Players[z])
  10940.  
  10941. g_PartyData[id][Position] = i
  10942. g_PartyData[id][Amount_In_Party] = Amount-1
  10943. client_print(id, print_chat, "%s %s left the party", TAG, g_PartyData[user][UserName])
  10944. }
  10945. }
  10946. }
  10947.  
  10948. stock clear_party_user(id) {
  10949.  
  10950. ArrayClear(Party_Ids[id])
  10951. g_PartyData[id][In_Party] = false
  10952. g_PartyData[id][Position] = NONE
  10953. g_PartyData[id][Amount_In_Party] = NONE
  10954. remove_task_party_hud(id)
  10955.  
  10956. }
  10957.  
  10958. stock set_task_party_hud(id)
  10959. set_task(1.0, "PartyHud", id+TASK_HUD, _, _, "b")
  10960.  
  10961. stock remove_task_party_hud(id)
  10962. remove_task(id+TASK_HUD)
  10963.  
  10964. stock remove_task_acept(id)
  10965. if(task_exists(id+TASK_ACEPT))
  10966. remove_task(id+TASK_ACEPT)
  10967.  
  10968.  
  10969. stock set_player_party_name(id) {
  10970.  
  10971. if(g_PartyData[id][UserName][0])
  10972. return 0
  10973.  
  10974. get_user_name(id, g_PartyData[id][UserName], charsmax(g_PartyData[][UserName]))
  10975.  
  10976. return 1
  10977. }
  10978.  
  10979. stock is_available_to_party(id) {
  10980.  
  10981. if(!is_user_connected(id) || g_PartyData[id][In_Party] || g_PartyData[id][Block_Party])
  10982. return false
  10983.  
  10984. return true
  10985. }
  10986.  
  10987. stock get_party_index(id, players[]) {
  10988.  
  10989. for(new i; i < g_PartyData[id][Amount_In_Party]; i++)
  10990. players[i] = ArrayGetCell(Party_Ids[id], i)
  10991.  
  10992. return players[0] ? 1 : 0
  10993. }
  10994.  
  10995. public check_master(id)
  10996. return g_PartyData[id][Position] ? ITEM_DISABLED : ITEM_ENABLED
  10997.  
  10998. public check_user(id)
  10999. return g_PartyData[id][Position] ? ITEM_ENABLED : ITEM_DISABLED
  11000.  
  11001. public cmdSayTeam(id) {
  11002.  
  11003. static Text[192]
  11004. read_args(Text, charsmax(Text))
  11005. remove_quotes(Text)
  11006.  
  11007. replace_all(Text, charsmax(Text), "%", "")
  11008.  
  11009. if(!ValidMessage(Text) || !g_PartyData[id][In_Party]) {
  11010.  
  11011. client_print(id, print_chat,"%s Tu Mensaje es invalido o no te encuentras en un Party", TAG)
  11012. return PLUGIN_HANDLED;
  11013. }
  11014.  
  11015. static Message[192], Players[32], id2, Amount
  11016. Amount = g_PartyData[id][Amount_In_Party]
  11017.  
  11018. get_party_index(id, Players)
  11019.  
  11020. formatex(Message, charsmax(Message), "^x04%s ^x03%s^x01 : %s", TAG, g_PartyData[id][UserName], Text)
  11021.  
  11022. for(new i; i < Amount; i++) {
  11023.  
  11024. id2 = Players[i]
  11025.  
  11026. message_begin(MSG_ONE_UNRELIABLE, g_MsgSayText, _, id2)
  11027. write_byte(id)
  11028. write_string(Message)
  11029. message_end()
  11030. }
  11031.  
  11032. return PLUGIN_HANDLED;
  11033. }
  11034.  
  11035. ValidMessage(text[]) {
  11036. static len, i
  11037. len = strlen(text)
  11038.  
  11039. if(!len)
  11040. return false
  11041.  
  11042. for(i = 0; i < len; i++) {
  11043. if( text[i] != ' ' ) {
  11044. return true
  11045. }
  11046. }
  11047.  
  11048. return false
  11049. }
  11050.  
  11051. show_menu_especiales(id)
  11052. {
  11053. if (g_survivor[id])
  11054. return;
  11055.  
  11056. new menu = menu_create("\yModified Guns:", "menu_especiala")
  11057.  
  11058. if(g_level[id] >= 330 && g_reset[id] >= 0)
  11059. menu_additem(menu, "\wAk Destruction \r[\yHabilitada Level: 330\r]", "1", 0);
  11060. else
  11061. menu_additem(menu, "\dAk Destruction \r[\dLevel\r: \d330 \r| \dReset\r: \d0\r]", "1", 0);
  11062. if(g_level[id] >= 400 && g_reset[id] >= 0)
  11063. menu_additem(menu, "\wsG Ultimate \r[\yHabilitada Level: 400\r]", "2", 0);
  11064. else
  11065. menu_additem(menu, "\dsG Ultimate \r[\dLevel\r: \d400 \r| \dReset\r: \d0\r]", "2", 0);
  11066. if(g_level[id] >= 450 && g_reset[id] >= 0)
  11067. menu_additem(menu, "\wSVT 40 Atomic \r[\yHabilitada Level: 450\r]", "3", 0);
  11068. else
  11069. menu_additem(menu, "\dSVT 40 Atomic \r[\dLevel\r: \d450 \r| \dReset\r: \d0\r]", "3", 0);
  11070. if(g_level[id] >= 510 && g_reset[id] >= 0)
  11071. menu_additem(menu, "\wDP- 31 Massive \r[\yHabilitada Level: 510\r]", "4", 0);
  11072. else
  11073. menu_additem(menu, "\dDP- 31 Massive \r[\dLevel\r: \d510 \r| \dReset\r: \d0\r]", "4", 0);
  11074. if(g_level[id] >= 600 && g_reset[id] >= 0)
  11075. menu_additem(menu, "\wNavi Strike \r[\yHabilitada Level: 600\r]", "5", 0);
  11076. else
  11077. menu_additem(menu, "\dNavi Strike \r[\dLevel\r: \d600 \r| \dReset\r: \d0\r]", "5", 0);
  11078. if(g_level[id] >= 651 && g_reset[id] >= 0)
  11079. menu_additem(menu, "\wXM1014 Overpower \r[\yHabilitada Level: 651\r]", "5", 0);
  11080. else
  11081. menu_additem(menu, "\dXM1014 Overpower \r[\dLevel\r: \d651 \r| \dReset\r: \d0\r]", "5", 0);
  11082. if(g_level[id] >= 700 && g_reset[id] >= 0)
  11083. menu_additem(menu, "\wSTFU 69 \r[\yHabilitada Level: 700\r]", "6", 0);
  11084. else
  11085. menu_additem(menu, "\dSTFU 69 \r[\dLevel\r: \d700 \r| \dReset\r: \d0\r]", "6", 0);
  11086. if(g_level[id] >= 730 && g_reset[id] >= 0)
  11087. menu_additem(menu, "\wRLP 17 \r[\yHabilitada Level: 730\r]", "7", 0);
  11088. else
  11089. menu_additem(menu, "\dRLP 17 \r[\dLevel\r: \d730 \r| \dReset\r: \d0\r]", "7", 0);
  11090. if(g_level[id] >= 770 && g_reset[id] >= 0)
  11091. menu_additem(menu, "\wM4 Extreme \r[\yHabilitada Level: 770\r]", "8", 0);
  11092. else
  11093. menu_additem(menu, "\dM4 Extreme \r[\dLevel\r: \d770 \r| \dReset\r: \d0\r]", "8", 0);
  11094. if(g_level[id] >= 800 && g_reset[id] >= 0)
  11095. menu_additem(menu, "\wBarret 5.0 \r[\yHabilitada Level: 800\r]", "9", 0);
  11096. else
  11097. menu_additem(menu, "\dBarret 5.0 \r[\dLevel\r: \d800 \r| \dReset\r: \d0\r]", "9", 0);
  11098. if(g_level[id] >= 860 && g_reset[id] >= 0)
  11099. menu_additem(menu, "\wDevil Strike \r[\yHabilitada Level: 860\r]", "10", 0);
  11100. else
  11101. menu_additem(menu, "\dDevil Strike \r[\dLevel\r: \d860 \r| \dReset\r: \d0\r]", "10", 0);
  11102. if(g_level[id] >= 950 && g_reset[id] >= 0)
  11103. menu_additem(menu, "\wM16 Rampage \r[\yHabilitada Level: 950\r]", "11", 0);
  11104. else
  11105. menu_additem(menu, "\dM16 Rampage \r[\dLevel\r: \d950 \r| \dReset\r: \d0\r]", "11", 0);
  11106. if(g_level[id] >= 400 && g_reset[id] >= 1)
  11107. menu_additem(menu, "\wSupermide \r[\wHabilitada \rLevel: \w400 \rReset: \w1\r]", "12", 0);
  11108. else
  11109. menu_additem(menu, "\dSupermide \r[\dLevel\r: \d400 \r| \dReset\r: \d1\r]", "12", 0);
  11110. if(g_level[id] >= 650 && g_reset[id] >= 3)
  11111. menu_additem(menu, "\wFarger \r[\wHabilitada \rLevel: \w650 \rReset: \w3\r]", "13", 0);
  11112. else
  11113. menu_additem(menu, "\dFarger \r[\dLevel\r: \d650 \r| \dReset\r: \d3\r]", "13", 0);
  11114. if(g_level[id] >= 500 && g_reset[id] >= 6)
  11115. menu_additem(menu, "\wStorm \r[\wHabilitada \rLevel: \w500 \rReset: \w6\r]", "14", 0);
  11116. else
  11117. menu_additem(menu, "\dStorm \r[\dLevel\r: \d500 \r| \dReset\r: \d6\r]", "14", 0);
  11118. if(g_level[id] >= 450 && g_reset[id] >= 10)
  11119. menu_additem(menu, "\wADGE-777 \r[\wHabilitada \rLevel: \w450 \rReset: \w10\r]", "15", 0);
  11120. else
  11121. menu_additem(menu, "\dADGE-777 \r[\dLevel\r: \d450 \r| \dReset\r: \d10\r]", "15", 0);
  11122. if(g_level[id] >= 601 && g_reset[id] >= 15)
  11123. menu_additem(menu, "\wXM10 Ultrapower \r[\wHabilitada \rLevel: \w601 \rReset: \w15\r]", "16", 0);
  11124. else
  11125. menu_additem(menu, "\dXM10 Ultrapower \r[\dLevel\r: \d601 \r| \dReset\r: \d15\r]", "16", 0);
  11126. if(g_level[id] >= 550 && g_reset[id] >= 20)
  11127. menu_additem(menu, "\wNule Strike \r[\wHabilitada \rLevel: \w550 \rReset: \w20\r]", "17", 0);
  11128. else
  11129. menu_additem(menu, "\dNule Strike \r[\dLevel\r: \d550 \r| \dReset\r: \d20\r]", "17", 0);
  11130. if(g_level[id] >= 490 && g_reset[id] >= 24)
  11131. menu_additem(menu, "\wSuper Strike \r[\wHabilitada \rLevel: \w490 \rReset: \w24\r]", "18", 0);
  11132. else
  11133. menu_additem(menu, "\dSuper Strike \r[\dLevel\r: \d490 \r| \dReset\r: \d24\r]", "18", 0);
  11134. if(g_level[id] >= 501 && g_reset[id] >= 26)
  11135. menu_additem(menu, "\wUltra Killer \r[\wHabilitada \rLevel: \w501 \rReset: \w26\r]", "19", 0);
  11136. else
  11137. menu_additem(menu, "\dUltra Killer \r[\dLevel\r: \d501 \r| \dReset\r: \d26\r]", "19", 0);
  11138. if(g_level[id] >= 1 && g_reset[id] >= 30)
  11139. menu_additem(menu, "\wRampage \r[\wHabilitada \rLevel: \w1 \rReset: \w30\r]", "20", 0);
  11140. else
  11141. menu_additem(menu, "\dRampage \r[\dLevel\r: \d1 \r| \dReset\r: \d30\r]", "20", 0);
  11142. if(g_level[id] >= 1 && g_grandreset[id] >= 1)
  11143. menu_additem(menu, "\wZpr350 \r[\wHabilitada \rLevel: \w1 \rSReset: \w1\r]", "21", 0);
  11144. else
  11145. menu_additem(menu, "\dZpr350 \r[\dLevel\r: \d1 \r| \dSReset\r: \d1\r]", "21", 0);
  11146. if(g_level[id] >= 1 && g_grandreset[id] >= 3)
  11147. menu_additem(menu, "\wRpg17 \r[\wHabilitada \rLevel: \w1 \rSReset: \w3\r]", "22", 0);
  11148. else
  11149. menu_additem(menu, "\dRpg17 \r[\dLevel\r: \d1 \r| \dSReset\r: \d3\r]", "22", 0);
  11150. if(g_level[id] >= 1 && g_grandreset[id] >= 5)
  11151. menu_additem(menu, "\wAr-u \r[\wHabilitada \rLevel: \w1 \rSReset: \w5\r]", "23", 0);
  11152. else
  11153. menu_additem(menu, "\dAr-u \r[\dLevel\r: \d1 \r| \dSReset\r: \d30\r]", "5", 0);
  11154. if(g_level[id] >= 1 && g_grandreset[id] >= 8)
  11155. menu_additem(menu, "\wXh500w \r[\wHabilitada \rLevel: \w1 \rSReset: \w8\r]", "24", 0);
  11156. else
  11157. menu_additem(menu, "\dXh500w \r[\dLevel\r: \d1 \r| \dSReset\r: \d8\r]", "24", 0);
  11158. if(g_level[id] >= 1 && g_grandreset[id] >= 11)
  11159. menu_additem(menu, "\wDvls-xx \r[\wHabilitada \rLevel: \w1 \rSReset: \w11\r]", "25", 0);
  11160. else
  11161. menu_additem(menu, "\dDvls-xx \r[\dLevel\r: \d1 \r| \dSReset\r: \d11\r]", "25", 0);
  11162. if(g_level[id] >= 1 && g_grandreset[id] >= 14)
  11163. menu_additem(menu, "\wThunderstorm \r[\wHabilitada \rLevel: \w1 \rSReset: \w14\r]", "26", 0);
  11164. else
  11165. menu_additem(menu, "\dThunderstorm \r[\dLevel\r: \d1 \r| \dSReset\r: \d14\r]", "26", 0);
  11166. if(g_level[id] >= 1 && g_grandreset[id] >= 19)
  11167. menu_additem(menu, "\w101000xx \r[\wHabilitada \rLevel: \w1 \rSReset: \w19\r]", "27", 0);
  11168. else
  11169. menu_additem(menu, "\d101000xx \r[\dLevel\r: \d1 \r| \dSReset\r: \d19\r]", "27", 0);
  11170. if(g_level[id] >= 1 && g_grandreset[id] >= 22)
  11171. menu_additem(menu, "\w101000Cannon \r[\wHabilitada \rLevel: \w1 \rSReset: \w22\r]", "28", 0);
  11172. else
  11173. menu_additem(menu, "\d101000Cannon \r[\dLevel\r: \d1 \r| \dSReset\r: \d22\r]", "28", 0);
  11174. if(g_level[id] >= 1 && g_grandreset[id] >= 25)
  11175. menu_additem(menu, "\wTmp2-xx \r[\wHabilitada \rLevel: \w1 \rSReset: \w25\r]", "29", 0);
  11176. else
  11177. menu_additem(menu, "\dTmp2-xx \r[\dLevel\r: \d1 \r| \dSReset\r: \d25\r]", "29", 0);
  11178. if(g_level[id] >= 1 && g_grandreset[id] >= 27)
  11179. menu_additem(menu, "\wColdTorment \r[\wHabilitada \rLevel: \w1 \rSReset: \w27\r]", "30", 0);
  11180. else
  11181. menu_additem(menu, "\dColdTorment \r[\dLevel\r: \d1 \r| \dSReset\r: \d27\r]", "30", 0);
  11182. if(g_level[id] >= 1 && g_grandreset[id] >= 30)
  11183. menu_additem(menu, "\wShredder \r[\wHabilitada \rLevel: \w1 \rSReset: \w30\r]", "31", 0);
  11184. else
  11185. menu_additem(menu, "\dShredder \r[\dLevel\r: \d1 \r| \dSReset\r: \d30\r]", "31", 0);
  11186.  
  11187.  
  11188. menu_setprop(menu, MPROP_EXITNAME, "\yExit")
  11189. menu_display(id, menu, 0)
  11190. }
  11191.  
  11192. public menu_especiala(id, menu, key)
  11193. {
  11194. switch(key)
  11195. {
  11196. case 0:
  11197. {
  11198. if(g_level[id] >= 330 && g_reset[id] >= 0)
  11199. {
  11200. g_akdestruction[id] = true
  11201. give_item(id, "weapon_ak47")
  11202. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AK47], AMMOTYPE[CSW_AK47], MAXBPAMMO[CSW_AK47])
  11203. g_canbuy[id] = 0;
  11204. show_menu_buy2(id);
  11205. }
  11206. else
  11207. {
  11208. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 330 y Reset: 0");
  11209. show_menu_especiales(id);
  11210. return PLUGIN_HANDLED;
  11211. }
  11212. }
  11213. case 1:
  11214. {
  11215. if(g_level[id] >= 400 && g_reset[id] >= 0)
  11216. {
  11217. g_ultimate[id] = true
  11218. give_item(id, "weapon_sg552")
  11219. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_SG552], AMMOTYPE[CSW_SG552], MAXBPAMMO[CSW_SG552])
  11220. g_canbuy[id] = 0;
  11221. show_menu_buy2(id);
  11222. }
  11223. else
  11224. {
  11225. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 400 y Reset: 0");
  11226. show_menu_especiales(id);
  11227. return PLUGIN_HANDLED;
  11228. }
  11229. }
  11230. case 2:
  11231. {
  11232. if(g_level[id] >= 450 && g_reset[id] >= 0)
  11233. {
  11234. g_atomic[id] = true
  11235. give_item(id, "weapon_famas")
  11236. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_FAMAS], AMMOTYPE[CSW_FAMAS], MAXBPAMMO[CSW_FAMAS])
  11237. g_canbuy[id] = 0;
  11238. show_menu_buy2(id);
  11239. }
  11240. else
  11241. {
  11242. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 450 y Reset: 0");
  11243. show_menu_especiales(id);
  11244. return PLUGIN_HANDLED;
  11245. }
  11246. }
  11247. case 3:
  11248. {
  11249. if(g_level[id] >= 510 && g_reset[id] >= 0)
  11250. {
  11251. g_masive[id] = true
  11252. give_item(id, "weapon_p90")
  11253. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_P90], AMMOTYPE[CSW_P90], MAXBPAMMO[CSW_P90])
  11254. g_canbuy[id] = 0;
  11255. show_menu_buy2(id);
  11256. }
  11257. else
  11258. {
  11259. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 510 y Reset: 0");
  11260. show_menu_especiales(id);
  11261. return PLUGIN_HANDLED;
  11262. }
  11263. }
  11264. case 4:
  11265. {
  11266. if(g_level[id] >= 600 && g_reset[id] >= 0)
  11267. {
  11268. g_navi[id] = true
  11269. give_item(id, "weapon_mp5navy")
  11270. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_MP5NAVY], AMMOTYPE[CSW_MP5NAVY], MAXBPAMMO[CSW_MP5NAVY])
  11271. g_canbuy[id] = 0;
  11272. show_menu_buy2(id);
  11273. }
  11274. else
  11275. {
  11276. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 600 y Reset: 0");
  11277. show_menu_especiales(id);
  11278. return PLUGIN_HANDLED;
  11279. }
  11280. }
  11281. case 5:
  11282. {
  11283. if(g_level[id] >= 651 && g_reset[id] >= 0)
  11284. {
  11285. g_power[id] = true
  11286. give_item(id, "weapon_xm1014")
  11287. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_XM1014], AMMOTYPE[CSW_XM1014], MAXBPAMMO[CSW_XM1014])
  11288. g_canbuy[id] = 0;
  11289. show_menu_buy2(id);
  11290. }
  11291. else
  11292. {
  11293. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 651 y Reset: 0");
  11294. show_menu_especiales(id);
  11295. return PLUGIN_HANDLED;
  11296. }
  11297. }
  11298. case 6:
  11299. {
  11300. if(g_level[id] >= 700 && g_reset[id] >= 0)
  11301. {
  11302. g_stfu[id] = true
  11303. give_item(id, "weapon_g3sg1")
  11304. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_G3SG1], AMMOTYPE[CSW_G3SG1], MAXBPAMMO[CSW_G3SG1])
  11305. g_canbuy[id] = 0;
  11306. show_menu_buy2(id);
  11307. }
  11308. else
  11309. {
  11310. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 700 y Reset: 0");
  11311. show_menu_especiales(id);
  11312. return PLUGIN_HANDLED;
  11313. }
  11314. }
  11315. case 7:
  11316. {
  11317. if(g_level[id] >= 730 && g_reset[id] >= 0)
  11318. {
  11319. g_rlp[id] = true
  11320. give_item(id, "weapon_ump45")
  11321. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_UMP45], AMMOTYPE[CSW_UMP45], MAXBPAMMO[CSW_UMP45])
  11322. g_canbuy[id] = 0;
  11323. show_menu_buy2(id);
  11324. }
  11325. else
  11326. {
  11327. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 730 y Reset: 0");
  11328. show_menu_especiales(id);
  11329. return PLUGIN_HANDLED;
  11330. }
  11331. }
  11332. case 8:
  11333. {
  11334. if(g_level[id] >= 770 && g_reset[id] >= 0)
  11335. {
  11336. g_m4[id] = true
  11337. give_item(id, "weapon_m4a1")
  11338. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M4A1], AMMOTYPE[CSW_M4A1], MAXBPAMMO[CSW_M4A1])
  11339. g_canbuy[id] = 0;
  11340. show_menu_buy2(id);
  11341. }
  11342. else
  11343. {
  11344. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 770 y Reset: 0");
  11345. show_menu_especiales(id);
  11346. return PLUGIN_HANDLED;
  11347. }
  11348. }
  11349. case 9:
  11350. {
  11351. if(g_level[id] >= 800 && g_reset[id] >= 0)
  11352. {
  11353. g_barret[id] = true
  11354. give_item(id, "weapon_m3")
  11355. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M3], AMMOTYPE[CSW_M3], MAXBPAMMO[CSW_M3])
  11356. g_canbuy[id] = 0;
  11357. show_menu_buy2(id);
  11358. }
  11359. else
  11360. {
  11361. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 800 y Reset: 0");
  11362. show_menu_especiales(id);
  11363. return PLUGIN_HANDLED;
  11364. }
  11365. }
  11366. case 10:
  11367. {
  11368. if(g_level[id] >= 860 && g_reset[id] >= 0)
  11369. {
  11370. g_devil[id] = true
  11371. give_item(id, "weapon_galil")
  11372. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_GALIL], AMMOTYPE[CSW_GALIL], MAXBPAMMO[CSW_GALIL])
  11373. g_canbuy[id] = 0;
  11374. show_menu_buy2(id);
  11375. }
  11376. else
  11377. {
  11378. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 860 y Reset: 0");
  11379. show_menu_especiales(id);
  11380. return PLUGIN_HANDLED;
  11381. }
  11382. }
  11383. case 11:
  11384. {
  11385. if(g_level[id] >= 950 && g_reset[id] >= 0)
  11386. {
  11387. g_rampage[id] = true
  11388. give_item(id, "weapon_aug")
  11389. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AUG], AMMOTYPE[CSW_AUG], MAXBPAMMO[CSW_AUG])
  11390. g_canbuy[id] = 0;
  11391. show_menu_buy2(id);
  11392. }
  11393. else
  11394. {
  11395. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 950 y Reset: 0");
  11396. show_menu_especiales(id);
  11397. return PLUGIN_HANDLED;
  11398. }
  11399. }
  11400. case 12:
  11401. {
  11402. if(g_level[id] >= 400 && g_reset[id] >= 1)
  11403. {
  11404. g_supermide[id] = true
  11405. give_item(id, "weapon_ak47")
  11406. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AK47], AMMOTYPE[CSW_AK47], MAXBPAMMO[CSW_AK47])
  11407. g_canbuy[id] = 0;
  11408. show_menu_buy2(id);
  11409. }
  11410. else
  11411. {
  11412. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 400 y Reset: 1");
  11413. show_menu_especiales(id);
  11414. return PLUGIN_HANDLED;
  11415. }
  11416. }
  11417. case 13:
  11418. {
  11419. if(g_level[id] >= 650 && g_reset[id] >= 3)
  11420. {
  11421. g_farger[id] = true
  11422. give_item(id, "weapon_m4a1")
  11423. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M4A1], AMMOTYPE[CSW_M4A1], MAXBPAMMO[CSW_M4A1])
  11424. g_canbuy[id] = 0;
  11425. show_menu_buy2(id);
  11426. }
  11427. else
  11428. {
  11429. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 650 y Reset: 3");
  11430. show_menu_especiales(id);
  11431. return PLUGIN_HANDLED;
  11432. }
  11433. }
  11434. case 14:
  11435. {
  11436. if(g_level[id] >= 500 && g_reset[id] >= 6)
  11437. {
  11438. g_storm[id] = true
  11439. give_item(id, "weapon_galil")
  11440. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_GALIL], AMMOTYPE[CSW_GALIL], MAXBPAMMO[CSW_GALIL])
  11441. g_canbuy[id] = 0;
  11442. show_menu_buy2(id);
  11443. }
  11444. else
  11445. {
  11446. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 500 y Reset: 6");
  11447. show_menu_especiales(id);
  11448. return PLUGIN_HANDLED;
  11449. }
  11450. }
  11451. case 15:
  11452. {
  11453. if(g_level[id] >= 450 && g_reset[id] >= 10)
  11454. {
  11455. g_adge[id] = true
  11456. give_item(id, "weapon_famas")
  11457. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_FAMAS], AMMOTYPE[CSW_FAMAS], MAXBPAMMO[CSW_FAMAS])
  11458. g_canbuy[id] = 0;
  11459. show_menu_buy2(id);
  11460. }
  11461. else
  11462. {
  11463. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 450 y Reset: 10");
  11464. show_menu_especiales(id);
  11465. return PLUGIN_HANDLED;
  11466. }
  11467. }
  11468. case 16:
  11469. {
  11470. if(g_level[id] >= 601 && g_reset[id] >= 15)
  11471. {
  11472. g_ultra[id] = true
  11473. give_item(id, "weapon_xm1014")
  11474. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_XM1014], AMMOTYPE[CSW_XM1014], MAXBPAMMO[CSW_XM1014])
  11475. g_canbuy[id] = 0;
  11476. show_menu_buy2(id);
  11477. }
  11478. else
  11479. {
  11480. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 601 y Reset: 15");
  11481. show_menu_especiales(id);
  11482. return PLUGIN_HANDLED;
  11483. }
  11484. }
  11485. case 17:
  11486. {
  11487. if(g_level[id] >= 550 && g_reset[id] >= 20)
  11488. {
  11489. g_nule[id] = true
  11490. give_item(id, "weapon_aug")
  11491. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AUG], AMMOTYPE[CSW_AUG], MAXBPAMMO[CSW_AUG])
  11492. g_canbuy[id] = 0;
  11493. show_menu_buy2(id);
  11494. }
  11495. else
  11496. {
  11497. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 550 y Reset: 20");
  11498. show_menu_especiales(id);
  11499. return PLUGIN_HANDLED;
  11500. }
  11501. }
  11502. case 18:
  11503. {
  11504. if(g_level[id] >= 490 && g_reset[id] >= 24)
  11505. {
  11506. g_super[id] = true
  11507. give_item(id, "weapon_m3")
  11508. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M3], AMMOTYPE[CSW_M3], MAXBPAMMO[CSW_M3])
  11509. g_canbuy[id] = 0;
  11510. show_menu_buy2(id);
  11511. }
  11512. else
  11513. {
  11514. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 490 y Reset: 24");
  11515. show_menu_especiales(id);
  11516. return PLUGIN_HANDLED;
  11517. }
  11518. }
  11519. case 19:
  11520. {
  11521. if(g_level[id] >= 501 && g_reset[id] >= 26)
  11522. {
  11523. g_ultrak[id] = true
  11524. give_item(id, "weapon_sg552")
  11525. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_SG552], AMMOTYPE[CSW_SG552], MAXBPAMMO[CSW_SG552])
  11526. g_canbuy[id] = 0;
  11527. show_menu_buy2(id);
  11528. }
  11529. else
  11530. {
  11531. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 501 y Reset: 26");
  11532. show_menu_especiales(id);
  11533. return PLUGIN_HANDLED;
  11534. }
  11535. }
  11536. case 20:
  11537. {
  11538. if(g_level[id] >= 1 && g_reset[id] >= 30)
  11539. {
  11540. g_raampage[id] = true
  11541. give_item(id, "weapon_g3sg1")
  11542. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_G3SG1], AMMOTYPE[CSW_G3SG1], MAXBPAMMO[CSW_G3SG1])
  11543. g_canbuy[id] = 0;
  11544. show_menu_buy2(id);
  11545. }
  11546. else
  11547. {
  11548. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y Reset: 30");
  11549. show_menu_especiales(id);
  11550. return PLUGIN_HANDLED;
  11551. }
  11552. }
  11553. case 21:
  11554. {
  11555. if(g_level[id] >= 1 && g_grandreset[id] >= 1)
  11556. {
  11557. g_zpr350[id] = true
  11558. give_item(id, "weapon_m3")
  11559. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M3], AMMOTYPE[CSW_M3], MAXBPAMMO[CSW_M3])
  11560. g_canbuy[id] = 0;
  11561. show_menu_buy2(id);
  11562. }
  11563. else
  11564. {
  11565. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 1");
  11566. show_menu_especiales(id);
  11567. return PLUGIN_HANDLED;
  11568. }
  11569. }
  11570. case 22:
  11571. {
  11572. if(g_level[id] >= 1 && g_grandreset[id] >= 3)
  11573. {
  11574. g_rpg17[id] = true
  11575. give_item(id, "weapon_m249")
  11576. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M249], AMMOTYPE[CSW_M249], MAXBPAMMO[CSW_M249])
  11577. g_canbuy[id] = 0;
  11578. show_menu_buy2(id);
  11579. }
  11580. else
  11581. {
  11582. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 3");
  11583. show_menu_especiales(id);
  11584. return PLUGIN_HANDLED;
  11585. }
  11586. }
  11587. case 23:
  11588. {
  11589. if(g_level[id] >= 1 && g_grandreset[id] >= 5)
  11590. {
  11591. g_aru[id] = true
  11592. give_item(id, "weapon_famas")
  11593. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_FAMAS], AMMOTYPE[CSW_FAMAS], MAXBPAMMO[CSW_FAMAS])
  11594. g_canbuy[id] = 0;
  11595. show_menu_buy2(id);
  11596. }
  11597. else
  11598. {
  11599. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 5");
  11600. show_menu_especiales(id);
  11601. return PLUGIN_HANDLED;
  11602. }
  11603. }
  11604. case 24:
  11605. {
  11606. if(g_level[id] >= 1 && g_grandreset[id] >= 8)
  11607. {
  11608. g_xh500w[id] = true
  11609. give_item(id, "weapon_galil")
  11610. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_GALIL], AMMOTYPE[CSW_GALIL], MAXBPAMMO[CSW_GALIL])
  11611. g_canbuy[id] = 0;
  11612. show_menu_buy2(id);
  11613. }
  11614. else
  11615. {
  11616. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 8");
  11617. show_menu_especiales(id);
  11618. return PLUGIN_HANDLED;
  11619. }
  11620. }
  11621. case 25:
  11622. {
  11623. if(g_level[id] >= 1 && g_grandreset[id] >= 11)
  11624. {
  11625. g_dvlsxx[id] = true
  11626. give_item(id, "weapon_awp")
  11627. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AWP], AMMOTYPE[CSW_AWP], MAXBPAMMO[CSW_AWP])
  11628. g_canbuy[id] = 0;
  11629. show_menu_buy2(id);
  11630. }
  11631. else
  11632. {
  11633. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 11");
  11634. show_menu_especiales(id);
  11635. return PLUGIN_HANDLED;
  11636. }
  11637. }
  11638. case 26:
  11639. {
  11640. if(g_level[id] >= 1 && g_grandreset[id] >= 14)
  11641. {
  11642. g_thunderstorm[id] = true
  11643. give_item(id, "weapon_aug")
  11644. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AUG], AMMOTYPE[CSW_AUG], MAXBPAMMO[CSW_AUG])
  11645. g_canbuy[id] = 0;
  11646. show_menu_buy2(id);
  11647. }
  11648. else
  11649. {
  11650. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 14");
  11651. show_menu_especiales(id);
  11652. return PLUGIN_HANDLED;
  11653. }
  11654. }
  11655. case 27:
  11656. {
  11657. if(g_level[id] >= 1 && g_grandreset[id] >= 19)
  11658. {
  11659. g_101000xx[id] = true
  11660. give_item(id, "weapon_aug")
  11661. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AUG], AMMOTYPE[CSW_AUG], MAXBPAMMO[CSW_AUG])
  11662. g_canbuy[id] = 0;
  11663. show_menu_buy2(id);
  11664. }
  11665. else
  11666. {
  11667. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 19");
  11668. show_menu_especiales(id);
  11669. return PLUGIN_HANDLED;
  11670. }
  11671. }
  11672. case 28:
  11673. {
  11674. if(g_level[id] >= 1 && g_grandreset[id] >= 22)
  11675. {
  11676. g_101000cannon[id] = true
  11677. give_item(id, "weapon_ump45")
  11678. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_UMP45], AMMOTYPE[CSW_UMP45], MAXBPAMMO[CSW_UMP45])
  11679. g_canbuy[id] = 0;
  11680. show_menu_buy2(id);
  11681. }
  11682. else
  11683. {
  11684. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 22");
  11685. show_menu_especiales(id);
  11686. return PLUGIN_HANDLED;
  11687. }
  11688. }
  11689. case 29:
  11690. {
  11691. if(g_level[id] >= 1 && g_grandreset[id] >= 25)
  11692. {
  11693. g_tmp2xx[id] = true
  11694. give_item(id, "weapon_m4a1")
  11695. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M4A1], AMMOTYPE[CSW_M4A1], MAXBPAMMO[CSW_M4A1])
  11696. g_canbuy[id] = 0;
  11697. show_menu_buy2(id);
  11698. }
  11699. else
  11700. {
  11701. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 25");
  11702. show_menu_especiales(id);
  11703. return PLUGIN_HANDLED;
  11704. }
  11705. }
  11706. case 30:
  11707. {
  11708. if(g_level[id] >= 1 && g_grandreset[id] >= 27)
  11709. {
  11710. g_coldtorment[id] = true
  11711. give_item(id, "weapon_sg552")
  11712. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_SG552], AMMOTYPE[CSW_SG552], MAXBPAMMO[CSW_SG552])
  11713. g_canbuy[id] = 0;
  11714. show_menu_buy2(id);
  11715. }
  11716. else
  11717. {
  11718. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 27");
  11719. show_menu_especiales(id);
  11720. return PLUGIN_HANDLED;
  11721. }
  11722. }
  11723. case 31:
  11724. {
  11725. if(g_level[id] >= 1 && g_grandreset[id] >= 30)
  11726. {
  11727. g_shredder[id] = true
  11728. give_item(id, "weapon_xm1014")
  11729. ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_XM1014], AMMOTYPE[CSW_XM1014], MAXBPAMMO[CSW_XM1014])
  11730. g_canbuy[id] = 0;
  11731. show_menu_buy2(id);
  11732. }
  11733. else
  11734. {
  11735. zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 30");
  11736. show_menu_especiales(id);
  11737. return PLUGIN_HANDLED;
  11738. }
  11739. }
  11740. }
  11741. return PLUGIN_HANDLED;
  11742. }
  11743.  
  11744. show_menu_eleccion(id)
  11745. {
  11746. new menu = menu_create("\yWeapon Menu:", "menu_eleccion")
  11747.  
  11748. menu_additem(menu, "\wRegular Weapons", "1", 0);
  11749. menu_additem(menu, "\rModified Weapons", "2", 0);
  11750.  
  11751. menu_setprop(menu, MPROP_EXITNAME, "\yExit")
  11752. menu_display(id, menu, 0)
  11753. }
  11754.  
  11755. public menu_eleccion(id, menu, key)
  11756. {
  11757. switch(key)
  11758. {
  11759. case 0: show_menu_buy1(id);
  11760. case 1: show_menu_especiales(id);
  11761.  
  11762. }
  11763. return PLUGIN_HANDLED;
  11764. }
  11765.  
  11766. // En 'Notice_One' estamos haciendo un Hud Message, con colores y en un lugar, todo configurado.
  11767. public Notice_One()
  11768. {
  11769. set_hudmessage(141, 63, 158, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
  11770. ShowSyncHudMsg(0, g_MsgSync, "El Fin De Los Tiempos Se Acerca!!!")
  11771.  
  11772. set_task(6.0, "Notice_Two") // Llamamos a 'Notice_Two' luego de 4.3 Segundos que aparecio 'Notice_One'
  11773. }
  11774.  
  11775. // En 'Notice_Two' estamos haciendo un Hud Message, con colores y en un lugar, todo configurado.
  11776. public Notice_Two()
  11777. {
  11778. set_hudmessage(141, 63, 158, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
  11779. ShowSyncHudMsg(0, g_MsgSync, "Modo Armagedon!!")
  11780. }
  11781.  
  11782. public EffectModeEnd()
  11783. {
  11784. message_begin(MSG_BROADCAST, g_msgScreenFade) // Open The Function
  11785. write_short((1<<12)*4) // Duration
  11786. write_short(floatround((1<<12)*1.0)) // Hold Time
  11787. write_short(0x0000) // Fade Type
  11788. write_byte(0) // Color Red
  11789. write_byte(0) // Color Green
  11790. write_byte(0) // Color Blue
  11791. write_byte(250) // Alpha
  11792. message_end() // Close The Function
  11793. }
  11794.  
  11795. // En este Efecto, diran que es el mismo que hizimos antes, pero no es asi.
  11796. // Si se fijan bien, tiene otras configuraciones.
  11797. // Lo que estamos haciendo, es que el ScreenFade desaparesca de a poquito y no de Golpe.
  11798. // Seria como un Estilo mas realista.
  11799.  
  11800. public set_sombrero(id)
  11801. {
  11802. if(!g_reset[id])
  11803. return
  11804.  
  11805. if(is_user_alive(id))
  11806. {
  11807. if(g_reset[id] >= 1) g_sombrero[id] = 0
  11808. if(g_reset[id] >= 3) g_sombrero[id] = 1
  11809. if(g_reset[id] >= 5) g_sombrero[id] = 2
  11810. if(g_reset[id] >= 7) g_sombrero[id] = 3
  11811. if(g_reset[id] >= 9) g_sombrero[id] = 4
  11812. if(g_reset[id] >= 11) g_sombrero[id] = 5
  11813. if(g_reset[id] >= 13) g_sombrero[id] = 6
  11814. if(g_reset[id] >= 15) g_sombrero[id] = 7
  11815. if(g_reset[id] >= 17) g_sombrero[id] = 8
  11816. if(g_reset[id] >= 19) g_sombrero[id] = 9
  11817. if(g_reset[id] >= 21) g_sombrero[id] = 10
  11818. if(g_reset[id] >= 23) g_sombrero[id] = 11
  11819. if(g_reset[id] >= 25) g_sombrero[id] = 12
  11820. if(g_reset[id] >= 27) g_sombrero[id] = 13
  11821. if(g_reset[id] >= 30) g_sombrero[id] = 14
  11822. }
  11823.  
  11824. if(!g_sombrero_ent[id] || !is_valid_ent(g_sombrero_ent[id]))
  11825. {
  11826. new ent = create_entity("info_target")
  11827. entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
  11828. entity_set_edict(ent, EV_ENT_aiment, id)
  11829. g_sombrero_ent[id] = ent
  11830. }
  11831.  
  11832. entity_set_model(g_sombrero_ent[id], g_sombretos_modes[g_sombrero[id]])
  11833. }
  11834.  
  11835. public del_sombrero(id)
  11836. {
  11837. if(is_valid_ent(g_sombrero_ent[id]))
  11838. remove_entity(g_sombrero_ent[id])
  11839.  
  11840. g_sombrero_ent[id] = 0
  11841. }
  11842.  
  11843. public Datos(id)
  11844. {
  11845. if (get_user_flags(id) & ADMIN_LEVEL_E && ADMIN_LEVEL_H)
  11846. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Admin^x03 x12", g_playername[id])
  11847. else if (get_user_flags(id) & ADMIN_LEVEL_E)
  11848. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Vip^x03 x12", g_playername[id])
  11849. else if (get_user_flags(id) & ADMIN_LEVEL_H && ADMIN_LEVEL_G)
  11850. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Admin^x03 x9", g_playername[id])
  11851. else if (get_user_flags(id) & ADMIN_LEVEL_H)
  11852. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Vip^x03 x9", g_playername[id])
  11853. else if (get_user_flags(id) & ADMIN_LEVEL_G && ADMIN_LEVEL_F)
  11854. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Admin^x03 x6", g_playername[id])
  11855. else if (get_user_flags(id) & ADMIN_LEVEL_G)
  11856. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Vip^x03 x6", g_playername[id])
  11857. else if (get_user_flags(id) & ADMIN_LEVEL_F && ADMIN_KICK)
  11858. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Admin^x03 x3", g_playername[id])
  11859. else if (get_user_flags(id) & ADMIN_LEVEL_F)
  11860. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Vip^x03 x3", g_playername[id])
  11861. else
  11862. zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01No Posee Ninguna Membresia", g_playername[id])
  11863. }
  11864.  
  11865. public HookSay(id)
  11866. {
  11867. static message[190]
  11868. read_args(message, charsmax(message))
  11869. remove_quotes(message)
  11870.  
  11871. if (equal(message, ""))
  11872. return PLUGIN_HANDLED;
  11873.  
  11874. if (is_user_alive(id))
  11875. zp_colored_print(0, "^x04[-Level %d] [-Reset %d] [-SReset %d]^x03 %s^x01 : %s", g_level[id], g_reset[id], g_grandreset[id], g_playername[id], message)
  11876. else
  11877. zp_colored_print(0, "^x04[Muerto]^x03 %s^x01 : %s", g_playername[id], message)
  11878.  
  11879. return PLUGIN_HANDLED;
  11880. }
  11881.  
  11882. // Update say /give_ammopacks
  11883. public update_ammopacks(id)
  11884. {
  11885. if (!(get_user_flags(id) & ADMIN_IMMUNITY))
  11886. {
  11887. zp_colored_print(0, "^x04[ZP]^x01 El acceso a este comando es para ADMINES")
  11888. console_print(id,"[ZP] El acceso a este comando es para ADMINES")
  11889. return PLUGIN_HANDLED
  11890. }
  11891.  
  11892. show_menu_adicionalap(id)
  11893. return PLUGIN_HANDLED
  11894. }
  11895.  
  11896. // Adicional Ammo Packs
  11897. public show_menu_adicionalap(id)
  11898. {
  11899. new menu7 = menu_create("\yGive Ammo Packs^n^n- Give 170000 Ammo Packs to", "menu_adicionalap")
  11900.  
  11901. new players[32], pnum, tempid
  11902.  
  11903. new szName[32], szTempid[10]
  11904.  
  11905. get_players(players, pnum)
  11906.  
  11907. for(new i;i < pnum;i++)
  11908. {
  11909. tempid = players[i]
  11910.  
  11911. get_user_name(tempid, szName, charsmax(szName))
  11912. num_to_str(tempid, szTempid, charsmax(szTempid))
  11913.  
  11914. menu_additem(menu7, szName, szTempid, 0)
  11915. }
  11916.  
  11917. menu_display(id, menu7, 0)
  11918. }
  11919.  
  11920. // Adicional Ammo Packs
  11921. public menu_adicionalap(id, menu7, item)
  11922. {
  11923. if(item == MENU_EXIT)
  11924. {
  11925. menu_destroy(menu7)
  11926. return PLUGIN_HANDLED
  11927. }
  11928.  
  11929. new data[6], iName[64]
  11930. new access, callback
  11931. menu_item_getinfo(menu7, item, access, data,5, iName, 63, callback)
  11932.  
  11933. new tempid = str_to_num(data)
  11934.  
  11935. new szAdminName[32]
  11936.  
  11937. get_user_name(id,szAdminName,31)
  11938.  
  11939. g_ammopacks[tempid] += 170000
  11940. update_ap(id, 0, 1)
  11941.  
  11942. client_print(id, print_center, "Admin gave you ammo packs")
  11943.  
  11944. menu_destroy(menu7)
  11945. return PLUGIN_HANDLED
  11946. }
  11947.  
  11948. public HandMenu(id, keys, menu) //los parametros deben ir en este orden
  11949. {
  11950. switch(keys) //hacemos un swicheo de los posibles resultados:
  11951. {
  11952. case 0:
  11953. {
  11954. zp_colored_print(id, "Account: %s", g_playername[id])
  11955. Datos1(id)
  11956. }
  11957. case 1:
  11958. {
  11959. zp_colored_print(id, "AmmoPacks: %d", g_ammopacks[id])
  11960. Datos1(id)
  11961. }
  11962. case 2:
  11963. {
  11964. zp_colored_print(id, "Level: %d", g_level[id])
  11965. Datos1(id)
  11966. }
  11967. case 3:
  11968. {
  11969. zp_colored_print(id, "Reset: %d", g_reset[id])
  11970. Datos1(id)
  11971. }
  11972. case 4:
  11973. {
  11974. zp_colored_print(id, "SuperReset: %d", g_grandreset[id])
  11975. Datos1(id)
  11976. }
  11977. case 5:
  11978. {
  11979. zp_colored_print(id, "Password: ***Protected***")
  11980. Datos1(id)
  11981. }
  11982. case 6..7:
  11983. {
  11984. Datos1(id)
  11985. }
  11986. case 9: menu_destroy(menu)
  11987. }
  11988. }
  11989.  
  11990. public Datos1(id)
  11991. {
  11992. new menu[350], len;
  11993. len = 0;
  11994.  
  11995. len += formatex(menu[len], sizeof menu - 1 - len, "\r1. \yAccount: \w%s^n", g_playername[id]);
  11996. len += formatex(menu[len], sizeof menu - 1 - len, "\r2. \yAmmoPacks: \w%d^n", g_ammopacks[id]);
  11997. len += formatex(menu[len], sizeof menu - 1 - len, "\r3. \yLevel: \w%d^n", g_level[id]);
  11998. len += formatex(menu[len], sizeof menu - 1 - len, "\r4. \yReset: \w%d^n", g_reset[id]);
  11999. len += formatex(menu[len], sizeof menu - 1 - len, "\r5. \ySuperResets: \w%d^n", g_grandreset[id]);
  12000. len += formatex(menu[len], sizeof menu - 1 - len, "\r6. \yPassword: \w***PROTECTED***^n");
  12001. len += formatex(menu[len], sizeof menu - 1 - len, "\r7. \yHuman Abilities ^n\w- Damage: %d - Health: %d - Speed: %d^n- Gravity: %d - Armor: %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]);
  12002. len += formatex(menu[len], sizeof menu - 1 - len, "\r8. \yZombie Abilities ^n\w- Damage: %d - Health: %d^n- Speed: %d - Gravity: %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]);
  12003. len += formatex(menu[len], sizeof menu - 1 - len, "\r0. \wExit");
  12004.  
  12005. show_menu(id, KEYSMENU, menu, -1, "Menu");
  12006. //mostramos el menu al 'id' deseado, con las teclas ya definidas, el menu 'menu'
  12007. //el timpo es lo que tarda el menu en cerrarse en este caso -1 que es infinito, como lo registre en el init 'Menu')
  12008. }
  12009.  
  12010. public info(id)
  12011. {
  12012. new motd[999] // maximo de 998 caracteres as
  12013. static len; len = 0
  12014. len += formatex(motd[len], charsmax(motd) - len, "<meta charset=UTF-8><body bgcolor=#000000><font color=#5CACEE>Reglas del server:")
  12015. len += formatex(motd[len], charsmax(motd) - len, "<br><br> No Campear en modo Armageddon y Survivor")
  12016. len += formatex(motd[len], charsmax(motd) - len, "<br> No Reparar Lasermine")
  12017. len += formatex(motd[len], charsmax(motd) - len, "<br> No matar en city")
  12018. len += formatex(motd[len], charsmax(motd) - len, "<br> No dejarse matar (free)")
  12019. len += formatex(motd[len], charsmax(motd) - len, "<br> Respetar admins y players")
  12020.  
  12021. show_motd(id, motd, "Reglas del servidor:")
  12022. }
  12023.  
  12024. public Spawn(iEnt)
  12025. {
  12026. if(pev_valid(iEnt))
  12027. {
  12028. static szClassName[32]
  12029. pev(iEnt, pev_classname, szClassName, charsmax(szClassName))
  12030.  
  12031. if(!TrieKeyExists(g_tClass, szClassName))
  12032. {
  12033. RegisterHam(Ham_TraceAttack, szClassName, "TraceAttack", 1)
  12034. TrieSetCell(g_tClass, szClassName, 1)
  12035. }
  12036. }
  12037. }
  12038.  
  12039. public plugin_end()
  12040. {
  12041. TrieDestroy(g_tClass)
  12042. }
  12043.  
  12044. // Ham Trace Attack Forward
  12045. public TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type)
  12046. {
  12047. // Non-player damage or self damage
  12048. if (!is_user_connected(attacker))
  12049. return HAM_IGNORED
  12050.  
  12051. if(g_zombie[attacker])
  12052. return HAM_SUPERCEDE
  12053.  
  12054. if(get_user_weapon(attacker) == CSW_KNIFE)
  12055. return HAM_IGNORED
  12056.  
  12057. if(g_tmp2xx[attacker] && get_user_weapon(attacker) == CSW_M4A1)
  12058. {
  12059. new Float:vecEndPos[3]
  12060. get_tr2(tracehandle, TR_vecEndPos, vecEndPos)
  12061.  
  12062. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecEndPos, 0)
  12063. write_byte(TE_BEAMENTPOINT)
  12064. write_short(attacker | 0x1000)
  12065. engfunc(EngFunc_WriteCoord, vecEndPos[0]) // x
  12066. engfunc(EngFunc_WriteCoord, vecEndPos[1]) // x
  12067. engfunc(EngFunc_WriteCoord, vecEndPos[2]) // x
  12068. write_short(gTracerSpr)
  12069. write_byte(1) // framerate
  12070. write_byte(5) // framerate
  12071. write_byte(2) // framerate
  12072. write_byte(60) // framerate
  12073. write_byte(15) // framerate
  12074. write_byte(193) // red
  12075. write_byte(214) // red
  12076. write_byte(217) // red
  12077. write_byte(255) // brightness
  12078. write_byte(100) // brightness
  12079. message_end()
  12080.  
  12081. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecEndPos, 0)
  12082. write_byte(TE_BEAMENTPOINT)
  12083. write_short(attacker | 0x1000)
  12084. engfunc(EngFunc_WriteCoord, vecEndPos[0]) // x
  12085. engfunc(EngFunc_WriteCoord, vecEndPos[1]) // x
  12086. engfunc(EngFunc_WriteCoord, vecEndPos[2]) // x
  12087. write_short(gTracerSpr1)
  12088. write_byte(1) // framerate
  12089. write_byte(5) // framerate
  12090. write_byte(2) // framerate
  12091. write_byte(50) // framerate
  12092. write_byte(12) // framerate
  12093. write_byte(215) // red
  12094. write_byte(203) // red
  12095. write_byte(64) // red
  12096. write_byte(200) // brightness
  12097. write_byte(100) // brightness
  12098. message_end()
  12099. }
  12100. return HAM_HANDLED
  12101. }
  12102. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  12103. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang11274\\ f0\\ fs16 \n\\ par }
  12104. */
Add Comment
Please, Sign In to add comment