Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <fakemeta>
- #include <hamsandwich>
- #include <xs>
- #include <fun>
- #include <cstrike>
- #include <engine>
- #include <fvault>
- /*================================================================================
- [Plugin Customization]
- =================================================================================*/
- // Access Flags Required (check CMDACCESS.INI for console commands)
- const ACCESS_FLAG = ADMIN_BAN // to access the admin menu
- const ACCESS_FLAG2 = ADMIN_RCON // to turn the mod on/off
- const ACCESS_FLAG3 = ADMIN_BAN // to get admin models
- new const horas[] = { 0,2,4,6,8,10,12,14,16,18,20,22,24}
- new bool: g_happytime
- new const AMMOTYPE[][] = { "", "357sig", "", "762nato", "", "buckshot", "", "45acp", "556nato", "", "9mm", "57mm", "45acp",
- "556nato", "556nato", "556nato", "45acp", "9mm", "338magnum", "9mm", "556natobox", "buckshot",
- "556nato", "9mm", "762nato", "", "50ae", "556nato", "762nato", "", "57mm" }
- // ganancia admin
- enum _:ganancia
- {
- Admin,
- Ganancia,
- HH
- }
- new const admganancia[][ganancia] =
- {
- {ADMIN_LEVEL_E, 12, 24},
- {ADMIN_LEVEL_H, 9, 18},
- {ADMIN_LEVEL_G, 6, 12},
- {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.
- }
- #define ONE_COLOR // color de la burbuja.
- #define CAMPO_TASK // task = cuanto dura el campo de fuerza y lo elimina.
- //#define RANDOM_COLOR // color por default.
- #if defined ONE_COLOR
- new Float:colour_force_shield[3] = { 50.0 , 50.0 , 250.0 } // color de la burbuja ( red, gree, blue ).
- #endif
- new g_bubble_bomb[33] // variable del campo
- new const model_grenade[] = "models/zombie_plague/v_auragren.mdl" // model "v_".
- new const model[] = "models/zombie_plague/aura8.mdl" // model de la burbuja.
- new const w_model[] = "models/zombie_plague/w_aura.mdl" // model "w_".
- new const entclas[] = "campo_grenade_forze" // nombre de la clase de entidad.
- // Player Models (randomly chosen if more than one)
- new const model_nemesis[][] = { "[VG]Nemesis" } // Nemesis
- new const model_survivor[][] = { "[VG]Survivor" } // Survivor
- new const model_admin[][] = { "vip" } // Admin (human)
- new const model_admin_zombie[][] = { "zombie_source" } // Admin (zombie)
- 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,
- 1568, 1682, 1800, 1922, 2048, 2178, 2312, 2450, 2592, 2738, 2888, 3042, 3200, 3362, 3528, 3692, 3872, 4050, 4232, 4418, 4608,
- 4802, 5000, 5202, 5408, 5618, 5832, 6050, 6272, 6498, 6728, 6962, 7200, 7442, 7688, 7938, 8192, 8450, 8712, 8978,
- 9248, 9522, 9800, 10082, 10368, 10658, 10952, 11250, 11552, 11858, 12168, 12482, 12800, 13122, 13448, 13778, 14112, 14450,
- 14792, 15138, 15488, 15842, 16200, 16562, 16928, 17298, 17672, 18050, 18432, 18818, 19208, 19602, 20000, 20402, 20808, 21218,
- 21632, 22050, 22472, 22898, 23328, 23762, 24200, 24642, 25088, 25538, 25992, 26450, 26912, 27378, 27848, 28322, 28800, 29282,
- 29768, 30258, 30752, 31250, 31752, 32258, 32768, 33282, 33800, 34322, 34848, 35378, 35912, 36450, 36992, 37538, 38088,
- 38642, 39200, 39762, 40328, 40898, 41472, 42050, 42632, 43218, 43808, 44402, 45000, 45602, 46208, 46818, 47432,
- 48050, 48672, 49298, 49928, 50562, 51200, 51842, 52488, 53138, 53792, 54450, 55112, 55778, 56448, 57122, 57800,
- 58482, 59168, 59858, 60552, 61250, 61952, 62658, 63368, 64082, 64800, 65522, 66248, 66978, 67712, 68450, 69192,
- 69938, 70688, 71442, 72200, 72962, 73728, 74498, 75272, 76050, 76832, 77618, 78408, 79202, 80000, 80802, 81608,
- 82418, 83232, 84050, 84872, 85698, 86528, 87362, 88200, 89042, 89888, 90738, 91592, 92450, 93312, 94178, 95048,
- 95922, 96800, 97682, 98568, 99458, 100352, 101250, 102152, 103058, 103968, 104882, 105800, 106722, 107648, 108578, 109512,
- 110450, 111392, 112338, 113288, 114242, 115200, 116162, 117128, 118098, 119072, 120050, 121032, 122018, 123008, 124002, 125000,
- 126002, 127008, 128018, 129032, 130050, 131072, 132098, 133128, 134162, 135200, 136242, 137288, 138338, 139392, 140450, 141512,
- 142578, 143648, 144722, 145800, 146882, 147968, 149058, 150152, 151250, 152352, 153458, 154568, 155682, 156800, 157922, 159048,
- 160178, 161312, 162450, 163592, 164738, 165888, 167042, 168200, 169362, 170528, 171698, 172872, 174050, 175232, 176418, 177608,
- 178802, 180000, 181202, 182408, 183618, 184832, 186050, 187272, 188498, 189728, 190962, 192200, 193442, 194688, 195938, 197192,
- 198450, 199712, 200978, 202248, 203522, 204800, 206082, 207368, 208658, 209952, 211250, 212552, 213858, 215168, 216482, 217800,
- 219122, 220448, 221778, 223112, 224450, 225792, 227138, 228488, 229842, 231200, 232562, 233928, 235298, 236672, 238050, 239432,
- 240818, 242208, 243602, 245000, 246402, 247808, 249218, 250632, 252050, 253472, 254898, 256328, 257762, 259200, 260652, 262088,
- 263538, 264992, 266450, 267912, 269378, 270848, 272322, 273800, 275282, 276768, 278258, 281250, 282752, 284258, 285768, 287282,
- 288800, 290332, 291848, 293378, 294912, 296450, 297992, 299538, 301088, 302642, 304200, 305762, 307328, 308898, 310472, 312050,
- 313632, 315218, 316808, 318402, 320000, 321602, 323208, 324818, 326432, 328050, 329672, 331298, 332928, 334562, 336200, 337842,
- 339488, 341138, 342792, 344450, 346112, 347778, 349448, 351122, 352800, 354482, 356168, 357858, 359552, 361250, 362952, 364652,
- 366368, 368082, 369800, 371522, 373248, 374978, 376712, 378450, 380192, 381938, 383688, 385442, 387200, 388962, 390728, 392498,
- 384272, 396050, 397832, 399618, 401408, 403202, 406000, 406802, 408608, 410418, 412232, 414050, 415872, 417698, 419529, 421362,
- 423200, 425042, 426888, 428738, 430592, 432450, 434312, 436178, 438048, 439922, 441800, 443682, 445568, 447458, 449352, 451250,
- 453152, 455058, 456968, 458882, 460800, 462722, 464648, 466578, 468512, 470450, 472392, 474338, 476288, 478242, 480200, 482162,
- 484128, 486098, 488072, 490050, 492032, 494018, 496008, 498002, 500000, 502002, 504008, 506018, 508032, 510050, 512072, 514098,
- 516128, 518162, 520200, 522242, 524288, 526338, 528392, 530450, 532512, 534578, 536648, 538722, 540800, 542882, 544968, 547058,
- 549152, 551250, 553352, 555458, 557568, 559682, 561800, 563922, 566048, 568178, 570312, 572450, 574592, 576738, 578888, 581042,
- 583200, 585362, 587528, 589698, 591872, 594050, 596232, 598418, 600608, 602802, 605000, 607202, 609408, 611618, 613832, 616050,
- 620498, 622728, 624962, 627200, 629442, 631688, 633938, 636192, 638450, 640712, 642978, 645248, 647522, 649800, 652082, 654360,
- 656658, 658952, 661250, 663552, 665858, 668168, 670482, 672800, 675122, 677448, 679778, 682112, 684450, 686792, 689138, 691488,
- 693842, 696200, 698562, 700928, 703298, 705672, 708050, 710432, 712818, 715208, 717602, 720000, 722402, 724808, 727218, 729632,
- 732050, 734472, 736898, 739328, 741762, 744200, 746642, 749088, 751538, 753992, 756452, 758912, 761378, 763848, 766322, 768800,
- 771282, 773768, 776258, 778752, 781250, 783752, 786258, 788768, 791282, 793800, 796322, 798848, 801378, 803912, 806450, 808992,
- 811538, 814088, 816642, 819200, 821762, 824328, 826898, 829472, 832050, 834632, 837218, 839808, 842402, 845000, 847602, 850208,
- 852818, 855432, 858050, 860672, 863298, 865928, 868562, 871200, 873842, 876488, 879138, 881792, 884450, 887112, 889778, 892448,
- 895122, 897800, 900482, 903168, 905858, 908552, 911250, 913952, 916658, 919368, 922082, 924800, 927522, 930248, 932978, 935712,
- 938450, 941192, 943938, 946688, 949442, 952200, 954962, 957728, 960498, 963272, 966050, 968832, 971618, 977202, 980000, 982802,
- 985608, 988418, 991232, 994050, 996872, 999698, 1002528, 1005362, 1008200, 1011042, 1013888, 1016738, 1019592, 1022450, 1025312, 1028178, 1031048,
- 1033922, 1036800, 1039682, 1042568, 1045458, 1048352, 1051250, 1054152, 1057058, 1059968, 1062882, 1065800, 1068722, 1071648, 1074578, 1077512, 1080450,
- 1083392, 1086338, 1089288, 1092242, 1095200, 1098162, 1101128, 1104098, 1107072, 1110050, 1113032, 1116018, 1119008, 1122002, 1125000, 1128002, 1131008,
- 1134018, 1137032, 1140050, 1143072, 1146098, 1149128, 1152162, 1155200, 1158242, 1161288, 1164338, 1167392, 1170450, 1173512, 1176578, 1179648, 1182722,
- 1185800, 1188882, 1191968, 1195058, 1198152, 1201250, 1204352, 1207458, 1210568, 1213682, 1216800, 1219922, 1223048, 1226178, 1229312, 1232450, 1235592,
- 1238738, 1241888, 1245042, 1248200, 1251362, 1254528, 1257698, 1260872, 1264050, 1267232, 1270418, 1273608, 1276802, 1280000, 1283202, 1286408, 1289618,
- 1292832, 1296050, 1299272, 1302498, 1305728, 1308962, 1312200, 1315442, 1318688, 1321938, 1325192, 1328450, 1331712, 1334978, 1338248, 1341522, 1344800,
- 1348082, 1351386, 1351368, 1354658, 1357952, 1361250, 1364552, 1367858, 1371168, 1374482, 1377800, 1381122, 1384448, 1387778, 1391112, 1394450, 1397792,
- 1401138, 1404488, 1407842, 1411200, 1414562, 1417928, 1421298, 1424672, 1428050, 1431432, 1434818, 1438208, 1455218, 1458632, 1462050, 1465472, 1468898,
- 1472328, 1475762, 1479200, 1482642, 1486088, 1489538, 1492992, 1496450, 1499912, 1503378, 1506848, 1510322, 1513800, 1517282, 1520768, 1524258, 1527752,
- 1531250, 1534752, 1538258, 1541768, 1545282, 1548800, 1552322, 1555848, 1557389, 1562712, 1566450, 1569992, 1573538, 1577088, 1580642, 1584200, 1587762,
- 1591328, 1594898, 1598472, 1602050, 1605632, 1608218, 1612808, 1616402, 1620000, 1623602, 1627202, 1630818, 1634432, 1638050, 1641672, 1645298, 1648928,
- 1652562, 1656200, 1659842, 1663488, 1667138, 1670792, 1674450, 1678112, 1681778, 1685448, 1689122, 1692800, 1696482, 1700168, 1703858, 1707552, 1701125,
- 1711250, 1714952, 1718658, 1722368, 1726082, 1729800, 1733522, 1737248, 1740978, 1744712, 1748450, 1752192, 1755938, 1759688, 1763442, 1767200, 1770962,
- 1774728, 1778498, 1782272, 1786050, 1789832, 1793618, 1797408, 1801202, 1805000, 1808802, 1812608, 1816418, 1820232, 1824050, 1827872, 1831698, 1835528,
- 1839362, 1843200, 1847042, 1850888, 1854738, 1858592, 1862450, 1866312, 1870178, 1874048, 1877922, 1881800, 1885682, 1889568, 1893458, 1897352, 1901250,
- 1905152, 1909058, 1912968, 1916882, 1920800, 1924722, 1928648, 1932578, 1936512, 1940450, 1944392, 1948338, 1952288, 1956242, 1960200, 1964162, 1968128,
- 1972098, 1976072, 1980050, 1984032, 1988018, 1992008, 1996002, 2000000, 2004002, 2008006, 2012012, 2016024, 2020048, 99999999 }
- // Weapon Models
- new const model_vknife_nemesis[] = { "models/[VG]/v_nemesis.mdl" }
- new const model_vm249_survivor[] = { "models/[VG]/v_survivor.mdl" }
- new const model_pm249_survivor[] = { "models/[VG]/p_survivor.mdl" }
- new const model_grenade_infect[] = { "models/zombie_plague/v_grenade_infect.mdl" }
- new const model_grenade_fire[] = { "models/zombie_plague/v_grenade_fire.mdl" }
- new const model_grenade_frost[] = { "models/zombie_plague/v_grenade_frost.mdl" }
- new const model_grenade_flare[] = { "models/zombie_plague/v_grenade_flare.mdl" }
- new const model_akdestruction_human[] = { "models/[VG]/v_akdestruction.mdl" }
- new const model_akdestruction_human1[] = { "models/[VG]/p_akdestruction.mdl" }
- new const model_ultimate_human[] = { "models/[VG]/v_ultimate.mdl" }
- new const model_ultimate_human1[] = { "models/[VG]/p_ultimate.mdl" }
- new const model_atomic_human[] = { "models/[VG]/v_atomic.mdl" }
- new const model_atomic_human1[] = { "models/[VG]/p_atomic.mdl" }
- new const model_masive_human[] = { "models/[VG]/v_masive.mdl" }
- new const model_masive_human1[] = { "models/[VG]/p_masive.mdl" }
- new const model_navi_human[] = { "models/[VG]/v_navi.mdl" }
- new const model_navi_human1[] = { "models/[VG]/p_navi.mdl" }
- new const model_overpower_human[] = { "models/[VG]/v_overpower.mdl" }
- new const model_overpower_human1[] = { "models/[VG]/p_overpower.mdl" }
- new const model_stfu_human[] = { "models/[VG]/v_stfu.mdl" }
- new const model_stfu_human1[] = { "models/[VG]/p_stfu.mdl" }
- new const model_rlp_human[] = { "models/[VG]/v_rlp.mdl" }
- new const model_rlp_human1[] = { "models/[VG]/p_rlp.mdl" }
- new const model_m4_human[] = { "models/[VG]/v_m4.mdl" }
- new const model_m4_human1[] = { "models/[VG]/p_m4.mdl" }
- new const model_barret_human[] = { "models/[VG]/v_barret.mdl" }
- new const model_barret_human1[] = { "models/[VG]/p_barret.mdl" }
- new const model_devil_human[] = { "models/[VG]/v_devil.mdl" }
- new const model_devil_human1[] = { "models/[VG]/p_devil.mdl" }
- new const model_rampage_human[] = { "models/[VG]/v_rampage.mdl" }
- new const model_rampage_human1[] = { "models/[VG]/p_rampage.mdl" }
- new const model_supermide_human[] = { "models/[VG]/v_supermide.mdl" }
- new const model_supermide_human1[] = { "models/[VG]/p_supermide.mdl" }
- new const model_farger_human[] = { "models/[VG]/v_farger.mdl" }
- new const model_farger_human1[] = { "models/[VG]/p_farger.mdl" }
- new const model_storm_human[] = { "models/[VG]/v_storm.mdl" }
- new const model_storm_human1[] = { "models/[VG]/p_storm.mdl" }
- new const model_adge_human[] = { "models/[VG]/v_adge.mdl" }
- new const model_adge_human1[] = { "models/[VG]/p_adge.mdl" }
- new const model_ultra_human[] = { "models/[VG]/v_ultra.mdl" }
- new const model_ultra_human1[] = { "models/[VG]/p_ultra.mdl" }
- new const model_nule_human[] = { "models/[VG]/v_nule.mdl" }
- new const model_nule_human1[] = { "models/[VG]/p_nule.mdl" }
- new const model_super_human[] = { "models/[VG]/v_super.mdl" }
- new const model_super_human1[] = { "models/[VG]/p_super.mdl" }
- new const model_ultrak_human[] = { "models/[VG]/v_ultrak.mdl" }
- new const model_ultrak_human1[] = { "models/[VG]/p_ultrak.mdl" }
- new const model_raampage_human[] = { "models/[VG]/v_raampage.mdl" }
- new const model_raampage_human1[] = { "models/[VG]/p_raampage.mdl" }
- new const model_zpr350_human[] = { "models/[VG]/v_zpr350.mdl" }
- new const model_zpr350_human1[] = { "models/[VG]/p_zpr350.mdl" }
- new const model_rpg17_human[] = { "models/[VG]/v_rpg17.mdl" }
- new const model_rpg17_human1[] = { "models/[VG]/p_rpg17.mdl" }
- new const model_aru_human[] = { "models/[VG]/v_ar-u.mdl" }
- new const model_aru_human1[] = { "models/[VG]/p_ar-u.mdl" }
- new const model_xh500w_human[] = { "models/[VG]/v_xh500w.mdl" }
- new const model_xh500w_human1[] = { "models/[VG]/p_xh500w.mdl" }
- new const model_dvlsxx_human[] = { "models/[VG]/v_dvls-xx.mdl" }
- new const model_dvlsxx_human1[] = { "models/[VG]/p_dvls-xx.mdl" }
- new const model_thunderstorm_human[] = { "models/[VG]/v_thunderstorm.mdl" }
- new const model_thunderstorm_human1[] = { "models/[VG]/p_thunderstorm.mdl" }
- new const model_101000xx_human[] = { "models/[VG]/v_101000xx.mdl" }
- new const model_101000xx_human1[] = { "models/[VG]/p_101000xx.mdl" }
- new const model_101000cannon_human[] = { "models/[VG]/v_101000cannon.mdl" }
- new const model_101000cannon_human1[] = { "models/[VG]/p_101000cannon.mdl" }
- new const model_tmp2xx_human[] = { "models/[VG]/v_tmp2-xx.mdl" }
- new const model_tmp2xx_human1[] = { "models/[VG]/p_tmp2-xx.mdl" }
- new const model_coldtorment_human[] = { "models/[VG]/v_coldtorment.mdl" }
- new const model_coldtorment_human1[] = { "models/[VG]/p_coldtorment.mdl" }
- new const model_shredder_human[] = { "models/[VG]/v_shredder.mdl" }
- new const model_shredder_human1[] = { "models/[VG]/p_shredder.mdl" }
- new const model_nemesis2[] = { "models/player/[VG]Nemesis/[VG]NemesisT.mdl" }
- new const model_esqueleto[] = { "models/player/[VG]Esqueleto/[VG]EsqueletoT.mdl" }
- new const model_general[] = { "models/player/[VG]General/[VG]GeneralT.mdl" }
- new const model_gusano[] = { "models/player/[VG]Gusano/[VG]GusanoT.mdl" }
- new const model_subteniente[] = { "models/player/[VG]Subteniente/[VG]SubtenienteT.mdl" }
- new const model_supersoldado[] = { "models/player/[VG]Supersoldado/[VG]SupersoldadoT.mdl" }
- // Grenade Sprites
- new const sprite_grenade_trail[] = { "sprites/laserbeam.spr" }
- new const sprite_grenade_ring[] = { "sprites/shockwave.spr" }
- new const sprite_grenade_fire[] = { "sprites/flame.spr" }
- new const sprite_grenade_smoke[] = { "sprites/black_smoke3.spr" }
- new const sprite_grenade_glass[] = { "models/glassgibs.mdl" }
- // Sounds (randomly chosen if more than one)
- new const sound_win_zombies[][] = { "[VG]Sonidos/[VG]ZombieWin.wav" }
- new const sound_win_humans[][] = { "[VG]Sonidos/[VG]HumanWin.wav" }
- new const sound_win_no_one[][] = { "[VG]Sonidos/[VG]NadieGana.wav" }
- new const zombie_infect[][] = { "[VG]Sonidos/[VG]OtroZombie.wav" }
- 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" }
- new const nemesis_pain[][] = { "[VG]Sonidos/[VG]NemeDolor.wav" }
- 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" }
- new const zombie_fall[][] = { "zombie_plague/zombie_fall1.wav" }
- new const zombie_miss_slash[][] = { "weapons/knife_slash1.wav", "weapons/knife_slash2.wav" }
- new const zombie_miss_wall[][] = { "weapons/knife_hitwall1.wav" }
- new const zombie_hit_normal[][] = { "weapons/knife_hit1.wav", "weapons/knife_hit2.wav", "weapons/knife_hit3.wav", "weapons/knife_hit4.wav" }
- new const zombie_hit_stab[][] = { "weapons/knife_stab.wav" }
- 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" }
- new const zombie_idle_last[][] = { "nihilanth/nil_thelast.wav" }
- new const zombie_madness[][] = { "zombie_plague/zombie_madness1.wav" }
- new const sound_nemesis[][] = { "[VG]Sonidos/Evolution.wav" }
- new const sound_survivor[][] = { "[VG]Sonidos/Evolution.wav" }
- new const sound_swarm[][] = { "[VG]Sonidos/[VG]StartSwarmPlague.wav" }
- new const sound_multi[][] = { "[VG]Sonidos/[VG]StartSwarmPlague.wav" }
- new const sound_plague[][] = { "[VG]Sonidos/[VG]StartSwarmPlague.wav" }
- new const grenade_infect[][] = { "zombie_plague/grenade_infect.wav" }
- new const grenade_infect_player[][] = { "scientist/scream20.wav", "scientist/scream22.wav", "scientist/scream05.wav" }
- new const grenade_fire[][] = { "zombie_plague/grenade_explode.wav" }
- 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" }
- new const grenade_frost[][] = { "warcraft3/frostnova.wav" }
- new const grenade_frost_player[][] = { "warcraft3/impalehit.wav" }
- new const grenade_frost_break[][] = { "warcraft3/impalelaunch1.wav" }
- new const grenade_flare[][] = { "items/nvg_on.wav" }
- new const sound_antidote[][] = { "items/smallmedkit1.wav" }
- new const sound_thunder[][] = { "zombie_plague/thunder1.wav", "zombie_plague/thunder2.wav" }
- // Uncomment the following line to enable ambience sounds
- #define AMBIENCE_SOUNDS
- #if defined AMBIENCE_SOUNDS // Ambience Sounds List (only .wav and .mp3 formats supported)
- // Infection Rounds
- new const sound_ambience1[][] = { "[VG]Sonidos/[VG]Infeccion.mp3" } // sounds (played randomly)
- new const Float:sound_ambience1_duration[] = { 380.0 } // duration in seconds of each sound
- // Nemesis Rounds
- new const sound_ambience2[][] = { "[VG]Sonidos/[VG]Nemesis.mp3" }
- new const Float:sound_ambience2_duration[] = { 150.0 }
- // Survivor Rounds
- new const sound_ambience3[][] = { "[VG]Sonidos/[VG]Survivor.mp3" }
- new const Float:sound_ambience3_duration[] = { 147.0 }
- // Swarm Rounds
- new const sound_ambience4[][] = { "[VG]Sonidos/[VG]SwarmPlague.mp3" }
- new const Float:sound_ambience4_duration[] = { 195.0 }
- // Plague Rounds
- new const sound_ambience5[][] = { "[VG]Sonidos/[VG]SwarmPlague.mp3" }
- new const Float:sound_ambience5_duration[] = { 195.0 }
- #endif
- // Buy Menu: Primary and Secondary Weapons
- new bool: g_akdestruction[33]
- new bool: g_ultimate[33]
- new bool: g_atomic[33]
- new bool: g_masive[33]
- new bool: g_navi[33]
- new bool: g_power[33]
- new bool: g_stfu[33]
- new bool: g_rlp[33]
- new bool: g_m4[33]
- new bool: g_barret[33]
- new bool: g_devil[33]
- new bool: g_rampage[33]
- new bool: g_supermide[33]
- new bool: g_farger[33]
- new bool: g_storm[33]
- new bool: g_adge[33]
- new bool: g_ultra[33]
- new bool: g_nule[33]
- new bool: g_super[33]
- new bool: g_ultrak[33]
- new bool: g_raampage[33]
- new bool: g_zpr350[33]
- new bool: g_rpg17[33]
- new bool: g_aru[33]
- new bool: g_xh500w[33]
- new bool: g_dvlsxx[33]
- new bool: g_thunderstorm[33]
- new bool: g_101000xx[33]
- new bool: g_101000cannon[33]
- new bool: g_tmp2xx[33]
- new bool: g_coldtorment[33]
- new bool: g_shredder[33]
- 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
- new const resetarmas[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } // reset armas
- 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
- new const g_primary_items[][] = { "weapon_tmp", "weapon_mac10", "weapon_ump45", "weapon_mp5navy", "weapon_p90", "weapon_m3", "weapon_scout",
- "weapon_famas", "weapon_galil", "weapon_aug", "weapon_sg552", "weapon_m4a1", "weapon_ak47", "weapon_xm1014"}
- new const g_secondary_items[][] = { "weapon_p228", "weapon_fiveseven", "weapon_glock18", "weapon_elite", "weapon_deagle", "weapon_usp" }
- // Extra Items: Weapons and their costs
- new const g_extra_names[][] = { "Napalm Nade", "Frost Nade" }
- new const g_extra_items[][] = { "weapon_hegrenade", "weapon_flashbang" }
- new const g_extra_costs[] = { 3, 3 }
- // Extra Items: costs for Night Vision, Antidote, Zombie Madness, and Infection Bomb
- new const g_extra_costs2[] = { 5, 7, 4, 12 }
- // Weather Effects: uncomment a line to have the desired effect
- //#define AMBIENCE_RAIN // Rain
- //#define AMBIENCE_SNOW // Snow
- //#define AMBIENCE_FOG // Fog
- #if defined AMBIENCE_FOG // Fog Customization (if enabled)
- new const FOG_DENSITY[] = "0.0018" // Density
- new const FOG_COLOR[] = "128 128 128" // Color: Red Green Blue
- #endif
- // Sky Names (randomly chosen if more than one)
- new const skynames[][] = { "space" }
- // Uncomment if you don't want the sky to be changed
- //#define DONT_CHANGE_SKY
- // Lightning Lights Cycle
- 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"}
- 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"}
- 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"}
- // Decal List for Zombie Bloodstains/Footsteps
- new const zombie_decals[] = { 99, 107, 108, 184, 185, 186, 187, 188, 189 }
- // Knockback Power values for weapons
- // Note: negative values will disable knockback power for the weapon
- new const Float:kb_weapon_power[] =
- {
- -1.0, // ---
- 2.4, // P228
- -1.0, // ---
- 6.5, // SCOUT
- -1.0, // ---
- 8.0, // XM1014
- -1.0, // ---
- 2.3, // MAC10
- 5.0, // AUG
- -1.0, // ---
- 2.4, // ELITE
- 2.0, // FIVESEVEN
- 2.4, // UMP45
- 5.3, // SG550
- 5.5, // GALIL
- 5.5, // FAMAS
- 2.2, // USP
- 2.0, // GLOCK18
- 10.0, // AWP
- 2.5, // MP5NAVY
- 5.2, // M249
- 8.0, // M3
- 5.0, // M4A1
- 2.4, // TMP
- 6.5, // G3SG1
- -1.0, // ---
- 5.3, // DEAGLE
- 5.0, // SG552
- 6.0, // AK47
- -1.0, // ---
- 2.0 // P90
- }
- // Dynamic Stuff Limiters (increase if needed)
- const MAX_EXTRA_ITEMS = 30
- const MAX_ZOMBIE_CLASSSES = 50
- const MAX_HUMAN_CLASSSES = 50
- const MAX_CSDM_SPAWNS = 128
- const MAX_STATS_SAVED = 64
- const MAX_MODELS_NEMESIS = 10
- const MAX_MODELS_SURVIVOR = 10
- const MAX_MODELS_HUMAN = 50
- const MAX_MODELS_ADM_HUMAN = 10
- const MAX_MODELS_ADM_ZOMBIE = 10
- // Objective entites and anything that would affect plugin gameplay
- new const g_objective_ents[][] = { "func_bomb_target", "info_bomb_target", "info_vip_start", "func_vip_safetyzone", "func_escapezone", "hostage_entity",
- "monster_scientist", "func_hostage_rescue", "info_hostage_rescue", "env_fog", "env_rain", "env_snow", "item_longjump", "func_vehicle" }
- // ***************************************************************
- // *** If you experience many SVC_BAD kicks, try the following ***
- // ***************************************************************
- // 1. Increase the delay between model changes here: (e.g. set it to 0.5)
- const Float:MODELCHANGE_DELAY = 0.2
- // 2. If the above doesn't help, uncomment the following line: (experimental!)
- //#define HANDLE_MODELS_ON_SEPARATE_ENT
- // Alternate: This makes the plugin set the model index serverside offset
- // for accurate hitboxes and might also help with svc_bad (untested)
- // Note: Make sure your models don't have messed up hitboxes, otherwise
- // this setting may cause your server insane cpu usage and LAG!
- //#define SET_MODELINDEX_OFFSET
- // ---------------------------------------------------------------
- // ------------------ Customization ends here!! ------------------
- // ---------------------------------------------------------------
- /*================================================================================
- [Offsets and Constants]
- =================================================================================*/
- // Plugin Version
- new const PLUGIN_VERSION[] = ""
- // Task offsets
- enum (+= 100)
- {
- TASK_MODEL = 2000,
- TASK_TEAM,
- TASK_SPAWN,
- TASK_BLOOD,
- TASK_NVISION,
- TASK_FLASH,
- TASK_CHARGE,
- TASK_SHOWHUD,
- TASK_NADES,
- TASK_MAKEZOMBIE,
- TASK_WELCOMEMSG,
- TASK_THUNDER_PRE,
- TASK_THUNDER,
- TASK_AMBIENCESOUNDS,
- TASK_LIGHTING,
- TASK_COMBO
- }
- // IDs inside tasks
- #define ID_MODEL (taskid - TASK_MODEL)
- #define ID_TEAM (taskid - TASK_TEAM)
- #define ID_SPAWN (taskid - TASK_SPAWN)
- #define ID_BLOOD (taskid - TASK_BLOOD)
- #define ID_NVISION (taskid - TASK_NVISION)
- #define ID_FLASH (taskid - TASK_FLASH)
- #define ID_CHARGE (taskid - TASK_CHARGE)
- #define ID_SHOWHUD (taskid - TASK_SHOWHUD)
- // Flare and flame tasks
- #define FLARE_ENTITY args[0]
- #define FLARE_DURATION args[1]
- #define FLARE_R args[2]
- #define FLARE_G args[3]
- #define FLARE_B args[4]
- #define FLAME_DURATION args[0]
- // For player list menu handlers
- #define PL_STARTID g_menu_data[id][0]
- #define PL_ACTION g_menu_data[id][1]
- #define PL_SELECTION (g_menu_data[id][0]+key+1)
- // For weapon buy menu handlers
- #define WPN_STARTID g_menu_data[id][2]
- #define WPN_MAXIDS (sizeof g_primary_items)
- #define WPN_SELECTION (g_menu_data[id][2]+key)
- #define WPN_AUTO_ON g_menu_data[id][3]
- #define WPN_AUTO_PRI g_menu_data[id][4]
- #define WPN_AUTO_SEC g_menu_data[id][5]
- // For extra items menu handlers
- #define EXTRAS_STARTID g_menu_data[id][6]
- #define EXTRAS_SELECTION (g_menu_data[id][6]+key)
- #define EXTRAS_CUSTOM_STARTID (4+sizeof g_extra_names)
- // For zombie class menu handlers
- #define ZCLASSES_STARTID g_menu_data[id][7]
- #define ZCLASSES_SELECTION (g_menu_data[id][7]+key)
- // For human class menu handlers
- #define HCLASSES_STARTID g_menu_data[id][8]
- #define HCLASSES_SELECTION (g_menu_data[id][8]+key)
- // Menu selections
- const MENU_KEY_AUTOSELECT = 7
- const MENU_KEY_BACK = 7
- const MENU_KEY_NEXT = 8
- const MENU_KEY_EXIT = 9
- // Hard coded extra items
- enum
- {
- EXTRA_NVISION = 0,
- EXTRA_ANTIDOTE,
- EXTRA_MADNESS,
- EXTRA_INFBOMB,
- EXTRA_WEAPONS_STARTID
- }
- // Game modes
- enum
- {
- MODE_NONE = 0,
- MODE_INFECTION,
- MODE_NEMESIS,
- MODE_SURVIVOR,
- MODE_SWARM,
- MODE_MULTI,
- MODE_PLAGUE,
- MODE_ARMAGEDON
- }
- // ZP Teams
- enum
- {
- ZP_TEAM_ANY = 0,
- ZP_TEAM_ZOMBIE,
- ZP_TEAM_HUMAN
- }
- // Zombie classes
- const ZCLASS_NONE = -1
- // Human classes
- const HCLASS_NONE = -1
- // HUD messages
- const Float:HUD_EVENT_X = -1.0
- const Float:HUD_EVENT_Y = 0.17
- const Float:HUD_INFECT_X = 0.05
- const Float:HUD_INFECT_Y = 0.45
- const Float:HUD_SPECT_X = 0.6
- const Float:HUD_SPECT_Y = 0.17
- const Float:HUD_STATS_X = 0.02
- const Float:HUD_STATS_Y = 0.05
- // CS Offsets (win32)
- const OFFSET_CSTEAMS = 114
- const OFFSET_CSMONEY = 115
- const OFFSET_NVGOGGLES = 129
- const OFFSET_ZOOMTYPE = 363
- const OFFSET_CSDEATHS = 444
- const OFFSET_AWM_AMMO = 377
- const OFFSET_SCOUT_AMMO = 378
- const OFFSET_PARA_AMMO = 379
- const OFFSET_FAMAS_AMMO = 380
- const OFFSET_M3_AMMO = 381
- const OFFSET_USP_AMMO = 382
- const OFFSET_FIVESEVEN_AMMO = 383
- const OFFSET_DEAGLE_AMMO = 384
- const OFFSET_P228_AMMO = 385
- const OFFSET_GLOCK_AMMO = 386
- const OFFSET_FLASH_AMMO = 387
- const OFFSET_HE_AMMO = 388
- const OFFSET_SMOKE_AMMO = 389
- const OFFSET_C4_AMMO = 390
- const OFFSET_CLIPAMMO = 51
- const OFFSET_MODELINDEX = 491 // by Orangutanz
- const OFFSET_LINUX = 5 // offsets 5 higher in Linux builds
- const OFFSET_LINUX_WEAPONS = 4 // weapon offsets are only 4 steps higher on Linux
- // CS Teams
- enum
- {
- CS_TEAM_UNASSIGNED = 0,
- CS_TEAM_T,
- CS_TEAM_CT,
- CS_TEAM_SPECTATOR
- }
- new const TEAMNAMES[][] = { "UNASSIGNED", "TERRORIST", "CT", "SPECTATOR" }
- // Some constants
- const HIDE_MONEY = (1<<5|1<<3)
- const ATTRIB_BOMB = (1<<1)
- const UNIT_SECOND = (1<<12)
- const DMG_HEGRENADE = (1<<24)
- const CS_NO_ZOOM = 0x5A
- const HAS_NVGOGGLES = (1<<0)
- const IMPULSE_FLASHLIGHT = 100
- const USE_USING = 2
- const USE_STOPPED = 0
- const STEPTIME_SILENT = 999
- const BREAK_GLASS = 0x01
- const FFADE_IN = 0x0000
- const PEV_SPEC_TARGET = pev_iuser2
- // Max BP ammo for weapons
- new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120,
- 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
- // Max Clip for weapons
- new const MAXCLIP[] = { -1, 13, -1, 10, -1, 7, -1, 30, 30, -1, 30, 20, 25, 30, 35, 25, 12, 20,
- 10, 30, 100, 8, 30, 30, 20, -1, 7, 30, 30, -1, 50 }
- // Amount of ammo to give when buying additional clips for weapons
- new const BUYAMMO[] = { -1, 13, -1, 30, -1, 8, -1, 12, 30, -1, 30, 50, 12, 30, 30, 30, 12, 30,
- 10, 30, 30, 8, 30, 30, 30, -1, 7, 30, 30, -1, 50 }
- // Ammo IDs for weapons
- new const AMMOID[] = { -1, 9, -1, 2, 12, 5, 14, 6, 4, 13, 10, 7, 6, 4, 4, 4, 6, 10,
- 1, 10, 3, 5, 4, 10, 2, 11, 8, 4, 2, -1, 7 }
- // Weapon IDs for ammo types
- new const AMMOWEAPON[] = { 0, CSW_AWP, CSW_SCOUT, CSW_M249, CSW_AUG, CSW_XM1014, CSW_MAC10, CSW_FIVESEVEN, CSW_DEAGLE,
- CSW_P228, CSW_ELITE, CSW_FLASHBANG, CSW_HEGRENADE, CSW_SMOKEGRENADE, CSW_C4 }
- // Ammo Offsets for weapons
- new const AMMOOFFSET[] = { -1, OFFSET_P228_AMMO, -1, OFFSET_SCOUT_AMMO, OFFSET_HE_AMMO, OFFSET_M3_AMMO, OFFSET_C4_AMMO,
- OFFSET_USP_AMMO, OFFSET_FAMAS_AMMO, OFFSET_SMOKE_AMMO, OFFSET_GLOCK_AMMO, OFFSET_FIVESEVEN_AMMO,
- OFFSET_USP_AMMO, OFFSET_FAMAS_AMMO, OFFSET_FAMAS_AMMO, OFFSET_FAMAS_AMMO, OFFSET_USP_AMMO,
- OFFSET_GLOCK_AMMO, OFFSET_AWM_AMMO, OFFSET_GLOCK_AMMO, OFFSET_PARA_AMMO, OFFSET_M3_AMMO,
- OFFSET_FAMAS_AMMO, OFFSET_GLOCK_AMMO, OFFSET_SCOUT_AMMO, OFFSET_FLASH_AMMO, OFFSET_DEAGLE_AMMO,
- OFFSET_FAMAS_AMMO, OFFSET_SCOUT_AMMO, -1, OFFSET_FIVESEVEN_AMMO }
- // Primary and Secondary Weapon Names
- new const WEAPONNAMES[][] = { "", "P228 Compact", "", "Schmidt Scout", "", "XM1014 M4", "", "Ingram MAC-10", "Steyr AUG A1",
- "", "Dual Elite Berettas", "FiveseveN", "UMP 45", "SG-550 Auto-Sniper", "IMI Galil", "Famas",
- "USP .45 ACP Tactical", "Glock 18C", "AWP Magnum Sniper", "MP5 Navy", "M249 Para Machinegun",
- "M3 Super 90", "M4A1 Carbine", "Schmidt TMP", "G3SG1 Auto-Sniper", "", "Desert Eagle .50 AE",
- "SG-552 Commando", "AK-47 Kalashnikov", "", "ES P90" }
- // CS sounds
- new const sound_flashlight[] = "items/flashlight1.wav"
- new const sound_buyammo[] = "items/9mmclip1.wav"
- new const sound_armorhit[] = "player/bhit_helmet-1.wav"
- // Explosion radius for custom grenades
- const Float:NADE_EXPLOSION_RADIUS = 240.0
- // pev_ field used to store additional ammo on weapons
- const PEV_ADDITIONAL_AMMO = pev_iuser1
- // pev_ field used to store custom nade types and their values
- const PEV_NADE_TYPE = pev_flTimeStepSound
- const NADE_TYPE_INFECTION = 1111
- const NADE_TYPE_NAPALM = 2222
- const NADE_TYPE_FROST = 3333
- const NADE_TYPE_FLARE = 4444
- const NADE_TYPE_CAMPO = 5555
- const PEV_FLARE_COLOR = pev_punchangle
- // Weapon bitsums
- 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)
- const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
- // Allowed weapons for zombies (added grenades/bomb for sub-plugin support, since they shouldn't be getting them aynway)
- const ZOMBIE_ALLOWED_WEAPONS_BITSUM = (1<<CSW_KNIFE)|(1<<CSW_HEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_C4)
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- // Classnames for separate model entities
- new const MODEL_ENT_CLASSNAME[] = "player_model"
- new const WEAPON_ENT_CLASSNAME[] = "weapon_model"
- #endif
- // Menu keys
- const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
- /*================================================================================
- [Global Variables]
- =================================================================================*/
- // Stupid compiler
- #pragma unused g_models_targettime
- // human and zombie upgrades names
- new const g_upgrades_names[2][5][] =
- {
- { "Damage", "Health", "Speed", "Gravity", "Armor" }, // HUMANS
- { "Damage", "Health", "Speed", "Gravity", "" } // ZOMBIES
- }
- // Human and zombie max skills
- new const g_upgrade_max[][] =
- {
- { 45, 25, 25, 15, 25 }, // HUMANS
- { 45, 40, 35, 15, 0 } // ZOMBIES
- }
- // Upgrades here!
- #define upgrade_cost(%1) (%1 * 2) + 1 // cost of upgrades
- #define H_DAMAGE(%1) (%1 + 3) * 0.2 // upgrade human damage
- #define H_SALUD(%1) (%1 * 30) // upgrade human health
- #define H_SPEED(%1) (%1 * 10) // upgrade human speed
- #define H_GRAVITY(%1) ((%1 * 0.005) * 2) // upgrade human gravity
- #define H_ARMOR(%1) (%1 * 20) // upgrade human armor
- #define Z_DAMAGE(%1) (%1 * 3)
- #define Z_SALUD(%1) (%1 * 80000) // upgrade zombie health
- #define Z_SPEED(%1) (%1 * 5) // upgrade zombie speed
- #define Z_GRAVITY(%1) ((%1 * 0.005) * 2) // upgrade zombie gravity
- // creamos variables multidimensionales
- new g_points[33][2] // human and zombie points
- new g_usedpoints[33][2] // human and zombie points used
- new g_skill_points[33][2][5] // upgrade data
- enum // Player state
- {
- OFFLINE, // Player offline
- ONLINE // Player online
- }
- enum _:g_cm
- {
- Combos, //Cantidades de combos
- Msj[33], // Mensajes que va dependiendo del combo
- Rojo, // esto no creo q sea nesesario que lo explique
- Verde, // ""
- Azul, // ""
- Multiplicado // Multiplica el combo obtenido
- }
- new const Combo[][g_cm] =
- {
- { 0, "Good!", 255, 255, 255, 1 },
- { 25, "Better!", 0, 255, 255, 2 },
- { 60, "Very Good!", 0, 255, 255, 3 },
- { 127, "Excelent!", 255, 255, 0, 4 },
- { 200, "Perfect!", 255, 255, 0, 5 },
- { 345, "Amazing!", 255, 0, 255, 6 },
- { 99999999999, "", 255, 255, 255, 0 }
- }
- #define TAG "[sG|Party]"
- #define ID_HUD (taskid - TASK_HUD)
- enum (+= 77) {
- TASK_HUD = 777,
- TASK_ACEPT
- }
- enum {
- NONE = -1,
- Master,
- Start_Amount
- }
- enum _:pdata {
- In_Party,
- Position,
- Amount_In_Party,
- Block_Party,
- UserName[32]
- }
- enum _:DataCallBack {
- MASTER,
- USER
- }
- new g_PartyData[33][pdata], Array:Party_Ids[33], g_MenuCallback[DataCallBack], g_MsgSayText
- new cvar_time_acept, cvar_max_players, cvar_allow_bots
- new const g_sombretos_modes[][] =
- {
- "models/[VG]/reset1.mdl",
- "models/[VG]/reset3.mdl",
- "models/[VG]/reset5.mdl",
- "models/[VG]/reset7.mdl",
- "models/[VG]/reset9.mdl",
- "models/[VG]/reset11.mdl",
- "models/[VG]/reset13.mdl",
- "models/[VG]/reset15.mdl",
- "models/[VG]/reset17.mdl",
- "models/[VG]/reset19.mdl",
- "models/[VG]/reset21.mdl",
- "models/[VG]/reset23.mdl",
- "models/[VG]/reset25.mdl",
- "models/[VG]/reset27.mdl",
- "models/[VG]/reset30.mdl"
- }
- // Player vars
- new g_level[33] // son los niveles
- new g_reset[33] // resets
- new g_grandreset[33] // gran reset
- new g_playername[33][32] // Nombre del jugador
- new g_names[33][32] // no cambia nombre
- new g_password[33][24] // contrasena
- new g_estado[33] // conectado?
- new Registrado[33] // registrado??
- new BadPassword[33] // contrasena mala
- new g_MsgSync3 // mensaje de hud
- new g_sombrero[33] // los hats
- new g_sombrero_ent[33] // donde van los hats
- new const SaveData[] = "Data"
- new g_combo[33] // variable del combo que vamos asiendo
- new g_MsgSync4 // mensaje de hud
- // new g_ExpSpr, g_lightingSpr, sprite_flare, sprite_beam, ic_particles, model_gibs, g_bubbles
- new Trie:g_tClass, gTracerSpr, gTracerSpr1 // efecto para armas de sreset
- new g_damage[33] // daño para level combo
- new g_total[33] // daño total del combo
- new g_ganancia[33] // ganacia de admin y vips
- new g_zombie[33] // is zombie
- new g_nemesis[33] // is nemesis
- new g_armagedon[33] // is armagedon
- new g_survivor[33] // is surivor
- new g_firstzombie[33] // is the first zombie
- new g_lastzombie[33] // is last zombie
- new g_lasthuman[33] // is last human
- new g_frozen[33] // is frozen (can't move)
- new g_nodamage[33] // has spawn protection/zombie madness
- new g_respawn_as_zombie[33] // should respawn as zombie
- new g_nvision[33] // has night vision
- new g_nvisionenabled[33] // has night vision turned on
- new g_zombieclass[33] // zombie class
- new g_zombieclassnext[33] // zombie class for next infection
- new g_humanclass[33] // clases humanas
- new g_humanclassnext[33] // siguiente clase de humano
- new g_flashlight[33] // has custom flashlight turned on
- new g_flashbattery[33] = { 100, ... } // custom flashlight battery
- new g_currentweapon[33] // current weapon the player is holding
- new g_canbuy[33] // is allowed to buy a new weapon through the menu
- new g_ammopacks[33] // ammo pack count
- new g_damagedealt[33] // damage dealt to zombies (used to calculate ammo packs reward)
- new g_restorevel[33], Float:g_velocity[33][3] // Pain Shock Free vars
- new Float:g_lastleaptime[33] // time leap was last used
- new Float:g_lastflashtime[33] // time flashlight was last turned on/off
- new g_switchingteam[33] // is switching team
- new g_playermodel[33][32] // current model's short name [player][model]
- new g_menu_data[33][9] // data for various menus
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- new g_ent_playermodel[33] // player model entity
- new g_ent_weaponmodel[33] // weapon model entity
- #endif
- // Game vars
- new g_pluginenabled // ZP plugin enabled
- new g_newround // new round starting
- new g_endround // round ended
- new g_nemround // nemesis round
- new g_armagedonround // armageddon round
- new g_survround // survivor round
- new g_swarmround // swarm round
- new g_plagueround // plague round
- new g_lastmode // last played mode
- new g_scorezombies, g_scorehumans // team scores
- new g_spawnCount // available spawn points counter
- new Float:g_spawns[MAX_CSDM_SPAWNS][3] // spawn points data
- new g_lights_i // lightning current lights counter
- new Float:g_models_targettime // for adding delays between Model Change messages
- new Float:g_teams_targettime // for adding delays between Team Change messages
- new g_MsgSync, g_MsgSync2 // message sync objects
- new g_trailSpr, g_exploSpr, g_flameSpr, g_smokeSpr, g_glassSpr // grenade sprites
- new g_modname[32] // for formating the mod name
- new g_freezetime // whether it's freeze time
- new g_maxplayers // max players counter
- new g_czero // whether we are running on a CZ server
- new g_hamczbots // whether ham forwards are registered for CZ bots
- new g_fwSpawn // spawn forward handle
- new g_infbombcounter // to limit buying infection bombs
- // Precached model indexes
- new g_modelindex_nemesis[MAX_MODELS_NEMESIS]
- new g_modelindex_survivor[MAX_MODELS_SURVIVOR]
- new g_modelindex_admin[MAX_MODELS_ADM_HUMAN]
- new g_modelindex_admin_zombie[MAX_MODELS_ADM_ZOMBIE]
- // Some forward handlers
- new g_fwRoundStart, g_fwRoundEnd, g_fwUserInfected_pre, g_fwUserInfected_post,
- g_fwUserHumanized_pre, g_fwUserHumanized_post, g_fwExtraItemSelected, g_fwDummyResult
- // Temporary Database vars (used to restore players stats in case they get disconnected)
- new db_name[MAX_STATS_SAVED][32] // player name
- new db_ammopacks[MAX_STATS_SAVED] // ammo pack count
- new db_zombieclass[MAX_STATS_SAVED] // zombie class
- new db_humanclass[MAX_STATS_SAVED] // human class
- new db_slot_i // additional saved slots counter (should start on maxplayers+1)
- // Extra Items vars
- new g_extraitem_name[MAX_EXTRA_ITEMS][32] // caption
- new g_extraitem_cost[MAX_EXTRA_ITEMS] // cost
- new g_extraitem_team[MAX_EXTRA_ITEMS] // team
- new g_extraitem_i // loaded extra items counter
- // Zombie Classes vars
- new g_zclass_name[MAX_ZOMBIE_CLASSSES][32] // name
- new g_zclass_info[MAX_ZOMBIE_CLASSSES][32] // description
- new g_zclass_model[MAX_ZOMBIE_CLASSSES][32] // player model
- new g_zclass_modelindex[MAX_ZOMBIE_CLASSSES] // model index
- new g_zclass_clawmodel[MAX_ZOMBIE_CLASSSES][32] // claw model
- new g_zclass_hp[MAX_ZOMBIE_CLASSSES] // health
- new g_zclass_spd[MAX_ZOMBIE_CLASSSES] // speed
- new Float:g_zclass_grav[MAX_ZOMBIE_CLASSSES] // gravity
- new Float:g_zclass_kb[MAX_ZOMBIE_CLASSSES] // knockback
- new g_zclass_lvl[MAX_ZOMBIE_CLASSSES] // niveles
- new g_zclass_i // loaded zombie classes counter
- // Human Classes vars
- new g_hclass_name[MAX_HUMAN_CLASSSES][32] // name
- new g_hclass_info[MAX_HUMAN_CLASSSES][32] // description
- new g_hclass_model[MAX_HUMAN_CLASSSES][32] // player model
- new g_hclass_modelindex[MAX_HUMAN_CLASSSES] // model index
- new g_hclass_clawmodel[MAX_HUMAN_CLASSSES][32] // claw model
- new g_hclass_hp[MAX_HUMAN_CLASSSES] // health
- new g_hclass_spd[MAX_HUMAN_CLASSSES] // speed
- new Float:g_hclass_grav[MAX_HUMAN_CLASSSES] // gravity
- new g_hclass_lvl[MAX_HUMAN_CLASSSES] // level
- new g_hclass_ar[MAX_HUMAN_CLASSSES] // armadura
- new g_hclass_i // loaded human classes counter
- // Message IDs vars
- new g_msgScoreInfo, g_msgNVGToggle, g_msgScoreAttrib, g_msgAmmoPickup, g_msgScreenFade,
- g_msgDeathMsg, g_msgSetFOV, g_msgFlashlight, g_msgFlashBat, g_msgTeamInfo, g_msgDamage,
- g_msgHideWeapon, g_msgCrosshair, g_msgSayText, g_msgScreenShake, g_msgCurWeapon
- // CVAR pointers
- new cvar_lighting, cvar_zombiefov, cvar_plague, cvar_plaguechance, cvar_zombiefirsthp,
- cvar_removemoney, cvar_thunder, cvar_zombiebonushp, cvar_nemhp, cvar_nem, cvar_surv,
- cvar_nemchance, cvar_deathmatch, cvar_nemglow, cvar_cnvg, cvar_hitzones,
- cvar_nemgravity, cvar_flashsize, cvar_ammodamage, cvar_zombiearmor, cvar_survpainfree,
- cvar_nempainfree, cvar_nemspd, cvar_survchance, cvar_survhp, cvar_survspd,
- cvar_swarmchance, cvar_flashdrain, cvar_zombiebleeding, cvar_removedoors, cvar_cflash,
- cvar_randspawn, cvar_multi, cvar_multichance, cvar_infammo, cvar_swarm, cvar_ammoinfect,
- cvar_toggle, cvar_knockbackpower, cvar_freezeduration, cvar_triggered, cvar_flashcharge,
- cvar_firegrenades, cvar_frostgrenades, cvar_survgravity, cvar_logcommands, cvar_survglow,
- cvar_spawnprotection, cvar_nvgsize, cvar_flareduration, cvar_zclasses,
- cvar_extraitems, cvar_showactivity, cvar_humanlasthp, cvar_nemignorefrags, cvar_warmup,
- cvar_flashdist, cvar_flarecolor, cvar_survignorefrags, cvar_fireduration, cvar_firedamage,
- cvar_flaregrenades, cvar_knockbackducking, cvar_knockbackdamage, cvar_knockbackzvel,
- cvar_multiratio, cvar_flaresize, cvar_spawndelay, cvar_extraantidote, cvar_extramadness,
- cvar_extraweapons, cvar_extranvision, cvar_nvggive, cvar_preventconsecutive, cvar_botquota,
- cvar_buycustom, cvar_zombiepainfree, cvar_fireslowdown, cvar_survbasehp, cvar_survaura,
- cvar_nemignoreammo, cvar_survignoreammo, cvar_nemaura, cvar_extrainfbomb, cvar_knockback,
- cvar_fragsinfect, cvar_fragskill, cvar_zombiesilent, cvar_removedropped,
- cvar_plagueratio, cvar_blocksuicide, cvar_knockbackdist, cvar_nemdamage, cvar_leapzombies,
- cvar_leapzombiesforce, cvar_leapzombiesheight, cvar_leapzombiescooldown, cvar_leapnemesis,
- cvar_leapnemesisforce, cvar_leapnemesisheight, cvar_leapnemesiscooldown, cvar_leapsurvivor,
- cvar_leapsurvivorforce, cvar_leapsurvivorheight, cvar_nemminplayers, cvar_survminplayers,
- cvar_respawnonsuicide, cvar_respawnafterlast, cvar_leapsurvivorcooldown, cvar_statssave,
- cvar_swarmminplayers, cvar_multiminplayers, cvar_plagueminplayers, cvar_adminmodelshuman,
- cvar_adminmodelszombie, cvar_nembasehp, cvar_blockpushables, cvar_respawnworldspawnkill,
- cvar_madnessduration, cvar_plaguenemnum, cvar_plaguenemhpmulti, cvar_plaguesurvhpmulti,
- cvar_survweapon, cvar_plaguesurvnum, cvar_infectionscreenfade, cvar_infectionscreenshake,
- cvar_infectionsparkle, cvar_infectiontracers, cvar_infectionparticles, cvar_infbomblimit,
- cvar_hudicons, cvar_flashshowall, cvar_hclasses, cvar_bubblepush, cvar_armagedonratio,
- cvar_armagedon, cvar_armagedonchance, cvar_armagedonminplayers, cvar_armagedonhpsurvi, cvar_armagedonhpneme,
- cvar_nvgcolor[3], cvar_nemnvgcolor[3], cvar_humnvgcolor[3], cvar_flashcolor[3]
- /*================================================================================
- [Natives, Precache and Init]
- =================================================================================*/
- public plugin_natives()
- {
- // Player specific natives
- register_native("zp_get_user_zombie", "native_get_user_zombie", 1)
- register_native("zp_get_user_nemesis", "native_get_user_nemesis", 1)
- register_native("zp_get_user_armagedon", "native_get_user_armagedon", 1)
- register_native("zp_get_user_survivor", "native_get_user_survivor", 1)
- register_native("zp_get_user_first_zombie", "native_get_user_first_zombie", 1)
- register_native("zp_get_user_last_zombie", "native_get_user_last_zombie", 1)
- register_native("zp_get_user_last_human", "native_get_user_last_human", 1)
- register_native("zp_get_user_zombie_class", "native_get_user_zombie_class", 1)
- register_native("zp_set_user_zombie_class", "native_set_user_zombie_class", 1)
- register_native("zp_get_user_human_class", "native_get_user_human_class", 1)
- register_native("zp_set_user_human_class", "native_set_user_human_class", 1)
- register_native("zp_get_user_ammo_packs", "native_get_user_ammo_packs", 1)
- register_native("zp_set_user_ammo_packs", "native_set_user_ammo_packs", 1)
- register_native("zp_get_user_level", "native_get_user_level", 1)
- register_native("zp_set_user_level", "native_set_user_level", 1)
- register_native("zp_get_zombie_maxhealth", "native_get_zombie_maxhealth", 1)
- register_native("zp_get_user_batteries", "native_get_user_batteries", 1)
- register_native("zp_set_user_batteries", "native_set_user_batteries", 1)
- register_native("zp_infect_user", "native_infect_user", 1)
- register_native("zp_disinfect_user", "native_disinfect_user", 1)
- register_native("zp_respawn_user", "native_respawn_user", 1)
- // Round natives
- register_native("zp_has_round_started", "native_has_round_started", 1)
- register_native("zp_is_nemesis_round", "native_is_nemesis_round", 1)
- register_native("zp_is_armagedon_round", "native_is_armagedon_round", 1)
- register_native("zp_is_survivor_round", "native_is_survivor_round", 1)
- register_native("zp_is_swarm_round", "native_is_swarm_round", 1)
- register_native("zp_is_plague_round", "native_is_plague_round", 1)
- // External additions natives
- register_native("zp_register_extra_item", "native_register_extra_item", 1)
- register_native("zp_register_zombie_class", "native_register_zombie_class", 1)
- register_native("zp_register_human_class", "native_register_human_class", 1)
- // Load up the hard coded extra items
- native_register_extra_item2("nvision", g_extra_costs2[0], ZP_TEAM_HUMAN)
- native_register_extra_item2("antidote", g_extra_costs2[1], ZP_TEAM_ZOMBIE)
- native_register_extra_item2("madness", g_extra_costs2[2], ZP_TEAM_ZOMBIE)
- native_register_extra_item2("infbomb", g_extra_costs2[3], ZP_TEAM_ZOMBIE)
- for (new i = 0; i < sizeof g_extra_names; i++) // weapons
- native_register_extra_item2(g_extra_names[i], g_extra_costs[i], ZP_TEAM_HUMAN)
- }
- public plugin_precache()
- {
- // To switch plugin on/off
- register_concmd("zp_toggle", "cmd_toggle", ACCESS_FLAG2, "<1/0> - Enable/Disable Zombie Plague (will restart the current map)")
- cvar_toggle = register_cvar("zp_on", "1")
- // Plugin disabled?
- if (!get_pcvar_num(cvar_toggle)) return;
- g_pluginenabled = true
- g_tClass = TrieCreate()
- RegisterHam(Ham_TraceAttack, "worldspawn", "TraceAttack", 1)
- TrieSetCell(g_tClass, "worldspawn", 1)
- RegisterHam(Ham_TraceAttack, "player", "TraceAttack", 1)
- TrieSetCell(g_tClass, "player", 1)
- register_forward(FM_Spawn, "Spawn", 1)
- gTracerSpr = engfunc(EngFunc_PrecacheModel, "sprites/lvlupvg.spr") // Sprite Default Half Life
- gTracerSpr1 = engfunc(EngFunc_PrecacheModel, "sprites/lvlupvg.spr") // Sprite Default Half Life
- new i, playermodel[100]
- // Custom player models
- for (i = 0; i < sizeof model_nemesis; i++)
- {
- formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_nemesis[i], model_nemesis[i])
- g_modelindex_nemesis[i] = engfunc(EngFunc_PrecacheModel, playermodel)
- }
- for (i = 0; i < sizeof model_survivor; i++)
- {
- formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_survivor[i], model_survivor[i])
- g_modelindex_survivor[i] = engfunc(EngFunc_PrecacheModel, playermodel)
- }
- for (i = 0; i < sizeof model_admin; i++)
- {
- formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_admin[i], model_admin[i])
- g_modelindex_admin[i] = engfunc(EngFunc_PrecacheModel, playermodel)
- }
- for (i = 0; i < sizeof model_admin_zombie; i++)
- {
- formatex(playermodel, sizeof playermodel - 1, "models/player/%s/%s.mdl", model_admin_zombie[i], model_admin_zombie[i])
- g_modelindex_admin_zombie[i] = engfunc(EngFunc_PrecacheModel, playermodel)
- }
- {
- static i
- for (i = 0; i < sizeof g_sombretos_modes; i++)
- precache_model(g_sombretos_modes[i])
- }
- // Custom weapon models
- engfunc(EngFunc_PrecacheModel, model_vknife_nemesis)
- engfunc(EngFunc_PrecacheModel, model_vm249_survivor)
- engfunc(EngFunc_PrecacheModel, model_pm249_survivor)
- engfunc(EngFunc_PrecacheModel, model_grenade_infect)
- engfunc(EngFunc_PrecacheModel, model_grenade_fire)
- engfunc(EngFunc_PrecacheModel, model_grenade_frost)
- engfunc(EngFunc_PrecacheModel, model_grenade_flare)
- engfunc(EngFunc_PrecacheModel, model_akdestruction_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_akdestruction_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_ultimate_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_ultimate_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_atomic_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_atomic_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_masive_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_masive_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_navi_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_navi_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_overpower_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_overpower_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_stfu_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_stfu_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_rlp_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_rlp_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_m4_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_m4_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_barret_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_barret_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_devil_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_devil_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_rampage_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_rampage_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_supermide_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_supermide_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_farger_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_farger_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_storm_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_storm_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_adge_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_adge_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_ultra_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_ultra_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_nule_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_nule_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_super_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_super_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_ultrak_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_ultrak_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_raampage_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_raampage_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_zpr350_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_zpr350_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_rpg17_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_rpg17_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_aru_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_aru_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_xh500w_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_xh500w_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_dvlsxx_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_dvlsxx_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_thunderstorm_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_thunderstorm_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_101000xx_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_101000xx_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_101000cannon_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_101000cannon_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_tmp2xx_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_tmp2xx_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_coldtorment_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_coldtorment_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_shredder_human) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_shredder_human1) // Precacheamos
- engfunc(EngFunc_PrecacheModel, model_grenade) // precacheamos el model "v_".
- engfunc(EngFunc_PrecacheModel, model) // precacheamos el model de la burbuja.
- engfunc(EngFunc_PrecacheModel, w_model) // precacheamos el model "w_".
- engfunc(EngFunc_PrecacheModel, model_nemesis2)
- engfunc(EngFunc_PrecacheModel, model_esqueleto)
- engfunc(EngFunc_PrecacheModel, model_general)
- engfunc(EngFunc_PrecacheModel, model_gusano)
- engfunc(EngFunc_PrecacheModel, model_subteniente)
- engfunc(EngFunc_PrecacheModel, model_supersoldado)
- // Custom sounds
- for (i = 0; i < sizeof sound_win_zombies; i++)
- engfunc(EngFunc_PrecacheSound, sound_win_zombies[i])
- for (i = 0; i < sizeof sound_win_humans; i++)
- engfunc(EngFunc_PrecacheSound, sound_win_humans[i])
- for (i = 0; i < sizeof sound_win_no_one; i++)
- engfunc(EngFunc_PrecacheSound, sound_win_no_one[i])
- for (i = 0; i < sizeof zombie_infect; i++)
- engfunc(EngFunc_PrecacheSound, zombie_infect[i])
- for (i = 0; i < sizeof zombie_pain; i++)
- engfunc(EngFunc_PrecacheSound, zombie_pain[i])
- for (i = 0; i < sizeof nemesis_pain; i++)
- engfunc(EngFunc_PrecacheSound, nemesis_pain[i])
- for (i = 0; i < sizeof zombie_die; i++)
- engfunc(EngFunc_PrecacheSound, zombie_die[i])
- for (i = 0; i < sizeof zombie_fall; i++)
- engfunc(EngFunc_PrecacheSound, zombie_fall[i])
- for (i = 0; i < sizeof zombie_miss_slash; i++)
- engfunc(EngFunc_PrecacheSound, zombie_miss_slash[i])
- for (i = 0; i < sizeof zombie_miss_wall; i++)
- engfunc(EngFunc_PrecacheSound, zombie_miss_wall[i])
- for (i = 0; i < sizeof zombie_hit_normal; i++)
- engfunc(EngFunc_PrecacheSound, zombie_hit_normal[i])
- for (i = 0; i < sizeof zombie_hit_stab; i++)
- engfunc(EngFunc_PrecacheSound, zombie_hit_stab[i])
- for (i = 0; i < sizeof zombie_idle; i++)
- engfunc(EngFunc_PrecacheSound, zombie_idle[i])
- for (i = 0; i < sizeof zombie_idle_last; i++)
- engfunc(EngFunc_PrecacheSound, zombie_idle_last[i])
- for (i = 0; i < sizeof zombie_madness; i++)
- engfunc(EngFunc_PrecacheSound, zombie_madness[i])
- for (i = 0; i < sizeof sound_nemesis; i++)
- engfunc(EngFunc_PrecacheSound, sound_nemesis[i])
- for (i = 0; i < sizeof sound_survivor; i++)
- engfunc(EngFunc_PrecacheSound, sound_survivor[i])
- for (i = 0; i < sizeof sound_swarm; i++)
- engfunc(EngFunc_PrecacheSound, sound_swarm[i])
- for (i = 0; i < sizeof sound_multi; i++)
- engfunc(EngFunc_PrecacheSound, sound_multi[i])
- for (i = 0; i < sizeof sound_plague; i++)
- engfunc(EngFunc_PrecacheSound, sound_plague[i])
- for (i = 0; i < sizeof grenade_infect; i++)
- engfunc(EngFunc_PrecacheSound, grenade_infect[i])
- for (i = 0; i < sizeof grenade_infect_player; i++)
- engfunc(EngFunc_PrecacheSound, grenade_infect_player[i])
- for (i = 0; i < sizeof grenade_fire; i++)
- engfunc(EngFunc_PrecacheSound, grenade_fire[i])
- for (i = 0; i < sizeof grenade_fire_player; i++)
- engfunc(EngFunc_PrecacheSound, grenade_fire_player[i])
- for (i = 0; i < sizeof grenade_frost; i++)
- engfunc(EngFunc_PrecacheSound, grenade_frost[i])
- for (i = 0; i < sizeof grenade_frost_player; i++)
- engfunc(EngFunc_PrecacheSound, grenade_frost_player[i])
- for (i = 0; i < sizeof grenade_frost_break; i++)
- engfunc(EngFunc_PrecacheSound, grenade_frost_break[i])
- for (i = 0; i < sizeof grenade_flare; i++)
- engfunc(EngFunc_PrecacheSound, grenade_flare[i])
- for (i = 0; i < sizeof sound_antidote; i++)
- engfunc(EngFunc_PrecacheSound, sound_antidote[i])
- for (i = 0; i < sizeof sound_thunder; i++)
- engfunc(EngFunc_PrecacheSound, sound_thunder[i])
- #if defined AMBIENCE_SOUNDS
- for (i = 0; i < sizeof sound_ambience1; i++)
- {
- if (equal(sound_ambience1[i][strlen(sound_ambience1[i])-4], ".mp3"))
- {
- formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience1[i])
- engfunc(EngFunc_PrecacheGeneric, playermodel)
- }
- else
- {
- engfunc(EngFunc_PrecacheSound, sound_ambience1[i])
- }
- }
- for (i = 0; i < sizeof sound_ambience2; i++)
- {
- if (equal(sound_ambience2[i][strlen(sound_ambience2[i])-4], ".mp3"))
- {
- formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience2[i])
- engfunc(EngFunc_PrecacheGeneric, playermodel)
- }
- else
- {
- engfunc(EngFunc_PrecacheSound, sound_ambience2[i])
- }
- }
- for (i = 0; i < sizeof sound_ambience3; i++)
- {
- if (equal(sound_ambience3[i][strlen(sound_ambience3[i])-4], ".mp3"))
- {
- formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience3[i])
- engfunc(EngFunc_PrecacheGeneric, playermodel)
- }
- else
- {
- engfunc(EngFunc_PrecacheSound, sound_ambience3[i])
- }
- }
- for (i = 0; i < sizeof sound_ambience4; i++)
- {
- if (equal(sound_ambience4[i][strlen(sound_ambience4[i])-4], ".mp3"))
- {
- formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience4[i])
- engfunc(EngFunc_PrecacheGeneric, playermodel)
- }
- else
- {
- engfunc(EngFunc_PrecacheSound, sound_ambience4[i])
- }
- }
- for (i = 0; i < sizeof sound_ambience5; i++)
- {
- if (equal(sound_ambience5[i][strlen(sound_ambience5[i])-5], ".mp3"))
- {
- formatex(playermodel, sizeof playermodel - 1, "sound/%s", sound_ambience5[i])
- engfunc(EngFunc_PrecacheGeneric, playermodel)
- }
- else
- {
- engfunc(EngFunc_PrecacheSound, sound_ambience5[i])
- }
- }
- #endif
- // CS sounds (just in case)
- engfunc(EngFunc_PrecacheSound, sound_flashlight)
- engfunc(EngFunc_PrecacheSound, sound_buyammo)
- engfunc(EngFunc_PrecacheSound, sound_armorhit)
- // Custom models/sprites for grenades
- g_trailSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_trail)
- g_exploSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_ring)
- g_flameSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_fire)
- g_smokeSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_smoke)
- g_glassSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_glass)
- new ent
- // Fake Hostage (to force round ending)
- ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "hostage_entity"))
- if (pev_valid(ent))
- {
- engfunc(EngFunc_SetOrigin, ent, Float:{8192.0 ,8192.0 ,8192.0})
- dllfunc(DLLFunc_Spawn, ent)
- }
- #if defined AMBIENCE_FOG
- ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_fog"))
- if (pev_valid(ent))
- {
- fm_set_kvd(ent, "density", FOG_DENSITY, "env_fog")
- fm_set_kvd(ent, "rendercolor", FOG_COLOR, "env_fog")
- }
- #endif
- #if defined AMBIENCE_RAIN
- engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_rain"))
- #endif
- #if defined AMBIENCE_SNOW
- engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_snow"))
- #endif
- // Prevent some entities from spawning
- g_fwSpawn = register_forward(FM_Spawn, "fw_Spawn")
- }
- public plugin_init()
- {
- // Register plugin call
- register_plugin("SilentGamerz", PLUGIN_VERSION, "Shady")
- // Plugin disabled?
- if (!g_pluginenabled) return;
- // No zombie classes?
- if (!g_zclass_i) set_fail_state("No zombie classes loaded!")
- // No human classes?
- if (!g_hclass_i) set_fail_state("No human classes loaded!")
- // Language files
- register_dictionary("zombie_plague.txt")
- // Events
- register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
- register_logevent("logevent_round_start",2, "1=Round_Start")
- register_logevent("logevent_round_end", 2, "1=Round_End")
- #if defined AMBIENCE_SOUNDS
- register_event("30", "event_intermission", "a")
- #endif
- register_event("CurWeapon", "event_cur_weapon", "b", "1=1")
- register_event("35", "event_weapon_anim", "b")
- register_clcmd("BUBBLEBOMB", "give_item_bubble") // podemos llamar a la bomba. console_cmd(id, "BUBBLEBOMB")
- register_event("CurWeapon", "hook_curwpn", "be", "1=1", "2!29");
- cvar_bubblepush = register_cvar("zp_bubble_push", "2.0") // es la cvar, que al tocar al campo nos retira de el.
- register_touch(entclas, "player", "entity_touch") // nose bien que es, por lo que entiendo llamamos a la entidad
- // Forwards
- RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
- RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
- RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
- RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack")
- RegisterHam(Ham_Use, "func_tank", "fw_UseStationary")
- RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary")
- RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary")
- RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary")
- RegisterHam(Ham_Use, "func_pushable", "fw_UsePushable")
- RegisterHam(Ham_Touch, "weaponbox", "fw_TouchWeapon")
- RegisterHam(Ham_Touch, "armoury_entity", "fw_TouchWeapon")
- RegisterHam(Ham_Touch, "weapon_shield", "fw_TouchWeapon")
- RegisterHam(Ham_AddPlayerItem, "player", "fw_AddPlayerItem")
- register_forward(FM_ClientKill, "fw_ClientKill")
- register_forward(FM_EmitSound, "fw_EmitSound")
- #if !defined HANDLE_MODELS_ON_SEPARATE_ENT
- register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")
- register_forward(FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged")
- register_forward(FM_ClientUserInfoChanged, "fwdCliUserInfoChanged")
- #endif
- register_forward(FM_GetGameDescription, "fw_GetGameDescription")
- register_forward(FM_CmdStart, "fw_CmdStart")
- register_forward(FM_SetModel, "fw_SetModel")
- RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
- register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
- register_forward(FM_PlayerPreThink, "fw_PlayerPreThink_Post", 1)
- unregister_forward(FM_Spawn, g_fwSpawn)
- // Client commands
- register_clcmd("say zpmenu", "clcmd_saymenu")
- register_clcmd("say /zpmenu", "clcmd_saymenu")
- register_clcmd("say unstuck", "clcmd_sayunstuck")
- register_clcmd("say /unstuck", "clcmd_sayunstuck")
- register_clcmd("nightvision", "clcmd_nightvision")
- register_clcmd("drop", "clcmd_drop")
- register_clcmd("buyammo1", "clcmd_buyammo")
- register_clcmd("buyammo2", "clcmd_buyammo")
- register_clcmd("chooseteam", "clcmd_changeteam")
- register_clcmd("jointeam", "clcmd_jointeam")
- register_clcmd("Create_Password", "clcmd_register")
- register_clcmd("Login_Password", "clcmd_login")
- register_clcmd("say /party", "cmdParty")
- register_clcmd("say /reglas", "info")
- register_clcmd("say_team", "cmdSayTeam")
- register_clcmd("say /account", "Datos")
- register_clcmd("say /aps", "update_ammopacks")
- register_clcmd("say /yo", "Datos1")
- register_clcmd("say", "HookSay")
- // Menus
- register_menu("Buy Menu 1", KEYSMENU, "menu_buy1")
- register_menu("Buy Menu 2", KEYSMENU, "menu_buy2")
- register_menu("Zombie Class Menu", KEYSMENU, "menu_zclass")
- register_menu("Human Class Menu", KEYSMENU, "menu_hclass")
- register_menu("Game Menu", KEYSMENU, "menu_game")
- register_menu("Extra Items", KEYSMENU, "menu_extras")
- register_menu("Admin Menu", KEYSMENU, "menu_admin")
- register_menu("Player List Menu", KEYSMENU, "menu_player_list")
- register_menu("Menu Reset", KEYSMENU, "menu_reset")
- register_menu("Menu Super Reset", KEYSMENU, "menu_grand_reset")
- register_menu("Habilidades", KEYSMENU, "menu_upgrade_handler")
- register_menu("Menu Register", KEYSMENU, "menu_registro")
- register_menu("Datos1", KEYSMENU, "HandMenu")
- // Admin commands
- register_concmd("zp_zombie", "cmd_zombie", ACCESS_FLAG, "<target> - Turn someone into a Zombie")
- register_concmd("zp_human", "cmd_human", ACCESS_FLAG, "<target> - Turn someone back to Human")
- register_concmd("zp_nemesis", "cmd_nemesis", ACCESS_FLAG, "<target> - Turn someone into a Nemesis")
- register_concmd("zp_survivor", "cmd_survivor", ACCESS_FLAG, "<target> - Turn someone into a Survivor")
- register_concmd("zp_respawn", "cmd_respawn", ACCESS_FLAG, "<target> - Respawn someone")
- register_concmd("zp_swarm", "cmd_swarm", ACCESS_FLAG, " - Start Swarm Mode")
- register_concmd("zp_multi", "cmd_multi", ACCESS_FLAG, " - Start Multi Infection")
- register_concmd("zp_plague", "cmd_plague", ACCESS_FLAG, " - Start Plague Mode")
- register_concmd("zp_armagedon", "cmd_armagedon", ACCESS_FLAG, " - Start Mode Armagedon")
- // Message IDs
- g_msgScoreInfo = get_user_msgid("ScoreInfo")
- g_msgTeamInfo = get_user_msgid("TeamInfo")
- g_msgDeathMsg = get_user_msgid("DeathMsg")
- g_msgScoreAttrib = get_user_msgid("ScoreAttrib")
- g_msgSetFOV = get_user_msgid("SetFOV")
- g_msgScreenFade = get_user_msgid("ScreenFade")
- g_msgScreenShake = get_user_msgid("ScreenShake")
- g_msgNVGToggle = get_user_msgid("NVGToggle")
- g_msgFlashlight = get_user_msgid("Flashlight")
- g_msgFlashBat = get_user_msgid("FlashBat")
- g_msgAmmoPickup = get_user_msgid("AmmoPickup")
- g_msgDamage = get_user_msgid("Damage")
- g_msgHideWeapon = get_user_msgid("HideWeapon")
- g_msgCrosshair = get_user_msgid("Crosshair")
- g_msgSayText = get_user_msgid("SayText")
- g_msgCurWeapon = get_user_msgid("CurWeapon")
- // Message hooks
- register_message(g_msgCurWeapon, "message_cur_weapon")
- register_message(get_user_msgid("AmmoX"), "message_ammo_x")
- register_message(get_user_msgid("Money"), "message_money")
- register_message(get_user_msgid("Health"), "message_health")
- register_message(g_msgFlashBat, "message_flashbat")
- register_message(g_msgScreenFade, "message_screenfade")
- register_message(g_msgNVGToggle, "message_nvgtoggle")
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- register_message(get_user_msgid("ClCorpse"), "message_clcorpse")
- #endif
- register_message(get_user_msgid("WeapPickup"), "message_weappickup")
- register_message(g_msgAmmoPickup, "message_ammopickup")
- register_message(get_user_msgid("Scenario"), "message_scenario")
- register_message(get_user_msgid("HostagePos"), "message_hostagepos")
- register_message(get_user_msgid("TextMsg"), "message_textmsg")
- register_message(get_user_msgid("SendAudio"), "message_sendaudio")
- register_message(get_user_msgid("TeamScore"), "message_teamscore")
- register_message(g_msgTeamInfo, "message_teaminfo")
- register_message(get_user_msgid("ShowMenu"), "oldmenu_handle")
- // CVARS - General Purpose
- cvar_warmup = register_cvar("zp_delay", "10")
- cvar_lighting = register_cvar("zp_lighting", "a")
- cvar_thunder = register_cvar("zp_thunderclap", "90")
- cvar_triggered = register_cvar("zp_triggered_lights", "1")
- cvar_removedoors = register_cvar("zp_remove_doors", "0")
- cvar_blockpushables = register_cvar("zp_blockuse_pushables", "1")
- cvar_blocksuicide = register_cvar("zp_block_suicide", "1")
- cvar_deathmatch = register_cvar("zp_deathmatch", "0")
- cvar_spawndelay = register_cvar("zp_spawn_delay", "5")
- cvar_spawnprotection = register_cvar("zp_spawn_protection", "5")
- cvar_respawnonsuicide = register_cvar("zp_respawn_on_suicide", "1")
- cvar_respawnafterlast = register_cvar("zp_respawn_after_last_human", "1")
- cvar_respawnworldspawnkill = register_cvar("zp_respawn_on_worldspawn_kill", "1")
- cvar_randspawn = register_cvar("zp_random_spawn", "1")
- cvar_removedropped = register_cvar("zp_remove_dropped", "0")
- cvar_removemoney = register_cvar("zp_remove_money", "1")
- cvar_buycustom = register_cvar("zp_buy_custom", "1")
- cvar_adminmodelshuman = register_cvar("zp_admin_models_human", "0")
- cvar_adminmodelszombie = register_cvar("zp_admin_models_zombie", "0")
- cvar_zclasses = register_cvar("zp_zombie_classes", "1")
- cvar_hclasses = register_cvar("zp_human_classes", "1")
- cvar_statssave = register_cvar("zp_stats_save", "1")
- cvar_preventconsecutive = register_cvar("zp_prevent_consecutive_modes", "1")
- cvar_time_acept = register_cvar("party_time_acept","15")
- cvar_max_players = register_cvar("party_max_players","3")
- cvar_allow_bots = register_cvar("party_allow_bots","0")
- // CVARS - Extra Items
- cvar_extraitems = register_cvar("zp_extra_items", "1")
- cvar_extraweapons = register_cvar("zp_extra_weapons", "1")
- cvar_extranvision = register_cvar("zp_extra_nvision", "0")
- cvar_extraantidote = register_cvar("zp_extra_antidote", "1")
- cvar_extramadness = register_cvar("zp_extra_madness", "1")
- cvar_madnessduration = register_cvar("zp_extra_madness_duration", "5.0")
- cvar_extrainfbomb = register_cvar("zp_extra_infbomb", "1")
- cvar_infbomblimit = register_cvar("zp_extra_infbomb_limit", "1")
- // CVARS - Flashlight and Nightvision
- cvar_nvggive = register_cvar("zp_nvg_give", "0")
- cvar_cnvg = register_cvar("zp_nvg_custom", "1")
- cvar_nvgsize = register_cvar("zp_nvg_size", "80")
- cvar_nvgcolor[0] = register_cvar("zp_nvg_color_R", "0")
- cvar_nvgcolor[1] = register_cvar("zp_nvg_color_G", "150")
- cvar_nvgcolor[2] = register_cvar("zp_nvg_color_B", "0")
- cvar_humnvgcolor[0] = register_cvar("zp_nvg_hum_color_R", "0")
- cvar_humnvgcolor[1] = register_cvar("zp_nvg_hum_color_G", "150")
- cvar_humnvgcolor[2] = register_cvar("zp_nvg_hum_color_B", "0")
- cvar_nemnvgcolor[0] = register_cvar("zp_nvg_nem_color_R", "150")
- cvar_nemnvgcolor[1] = register_cvar("zp_nvg_nem_color_G", "0")
- cvar_nemnvgcolor[2] = register_cvar("zp_nvg_nem_color_B", "0")
- cvar_cflash = register_cvar("zp_flash_custom", "0")
- cvar_flashsize = register_cvar("zp_flash_size", "10")
- cvar_flashdrain = register_cvar("zp_flash_drain", "1")
- cvar_flashcharge = register_cvar("zp_flash_charge", "5")
- cvar_flashdist = register_cvar("zp_flash_distance", "1000")
- cvar_flashcolor[0] = register_cvar("zp_flash_color_R", "100")
- cvar_flashcolor[1] = register_cvar("zp_flash_color_G", "100")
- cvar_flashcolor[2] = register_cvar("zp_flash_color_B", "100")
- cvar_flashshowall = register_cvar("zp_flash_show_all", "1")
- // CVARS - Knockback
- cvar_knockback = register_cvar("zp_knockback", "0")
- cvar_knockbackdamage = register_cvar("zp_knockback_damage", "1")
- cvar_knockbackpower = register_cvar("zp_knockback_power", "1")
- cvar_knockbackzvel = register_cvar("zp_knockback_zvel", "0")
- cvar_knockbackducking = register_cvar("zp_knockback_ducking", "0.25")
- cvar_knockbackdist = register_cvar("zp_knockback_distance", "500")
- // CVARS - Leap
- cvar_leapzombies = register_cvar("zp_leap_zombies", "0")
- cvar_leapzombiesforce = register_cvar("zp_leap_zombies_force", "500")
- cvar_leapzombiesheight = register_cvar("zp_leap_zombies_height", "300")
- cvar_leapzombiescooldown = register_cvar("zp_leap_zombies_cooldown", "5.0")
- cvar_leapnemesis = register_cvar("zp_leap_nemesis", "1")
- cvar_leapnemesisforce = register_cvar("zp_leap_nemesis_force", "500")
- cvar_leapnemesisheight = register_cvar("zp_leap_nemesis_height", "300")
- cvar_leapnemesiscooldown = register_cvar("zp_leap_nemesis_cooldown", "0.5")
- cvar_leapsurvivor = register_cvar("zp_leap_survivor", "0")
- cvar_leapsurvivorforce = register_cvar("zp_leap_survivor_force", "500")
- cvar_leapsurvivorheight = register_cvar("zp_leap_survivor_height", "300")
- cvar_leapsurvivorcooldown = register_cvar("zp_leap_survivor_cooldown", "5.0")
- // CVARS - Humans
- cvar_humanlasthp = register_cvar("zp_human_last_extrahp", "0")
- cvar_infammo = register_cvar("zp_human_unlimited_ammo", "1")
- cvar_ammodamage = register_cvar("zp_human_damage_fuck", "450")
- cvar_fragskill = register_cvar("zp_human_frags_for_kill", "1")
- // CVARS - Custom Grenades
- cvar_firegrenades = register_cvar("zp_fire_grenades", "1")
- cvar_fireduration = register_cvar("zp_fire_duration", "10")
- cvar_firedamage = register_cvar("zp_fire_damage", "5")
- cvar_fireslowdown = register_cvar("zp_fire_slowdown", "0.5")
- cvar_frostgrenades = register_cvar("zp_frost_grenades", "1")
- cvar_freezeduration = register_cvar("zp_frost_duration", "4")
- cvar_flaregrenades = register_cvar("zp_flare_grenades","1")
- cvar_flareduration = register_cvar("zp_flare_duration", "0")
- cvar_flaresize = register_cvar("zp_flare_size", "0")
- cvar_flarecolor = register_cvar("zp_flare_color", "0")
- // CVARS - Zombies
- cvar_zombiefirsthp = register_cvar("zp_zombie_first_hp", "2.0")
- cvar_zombiearmor = register_cvar("zp_zombie_armor", "0.75")
- cvar_hitzones = register_cvar("zp_zombie_hitzones", "0")
- cvar_zombiebonushp = register_cvar("zp_zombie_infect_health", "100")
- cvar_zombiefov = register_cvar("zp_zombie_fov", "110")
- cvar_zombiesilent = register_cvar("zp_zombie_silent", "1")
- cvar_zombiepainfree = register_cvar("zp_zombie_painfree", "2")
- cvar_zombiebleeding = register_cvar("zp_zombie_bleeding", "1")
- cvar_ammoinfect = register_cvar("zp_zombie_infect_reward", "250")
- cvar_fragsinfect = register_cvar("zp_zombie_frags_for_infect", "1")
- // CVARS - Special Effects
- cvar_infectionscreenfade = register_cvar("zp_infection_screenfade", "1")
- cvar_infectionscreenshake = register_cvar("zp_infection_screenshake", "1")
- cvar_infectionsparkle = register_cvar("zp_infection_sparkle", "1")
- cvar_infectiontracers = register_cvar("zp_infection_tracers", "1")
- cvar_infectionparticles = register_cvar("zp_infection_particles", "1")
- cvar_hudicons = register_cvar("zp_hud_icons", "1")
- // CVARS - Nemesis
- cvar_nem = register_cvar("zp_nem_enabled", "1")
- cvar_nemchance = register_cvar("zp_nem_chance", "20")
- cvar_nemminplayers = register_cvar("zp_nem_min_players", "0")
- cvar_nemhp = register_cvar("zp_nem_health", "150000")
- cvar_nembasehp = register_cvar("zp_nem_base_health", "0")
- cvar_nemspd = register_cvar("zp_nem_speed", "300")
- cvar_nemgravity = register_cvar("zp_nem_gravity", "0.5")
- cvar_nemdamage = register_cvar("zp_nem_damage", "250")
- cvar_nemglow = register_cvar("zp_nem_glow", "1")
- cvar_nemaura = register_cvar("zp_nem_aura", "0")
- cvar_nempainfree = register_cvar("zp_nem_painfree", "1")
- cvar_nemignorefrags = register_cvar("zp_nem_ignore_frags", "1")
- cvar_nemignoreammo = register_cvar("zp_nem_ignore_rewards", "1")
- // CVARS - Survivor
- cvar_surv = register_cvar("zp_surv_enabled", "1")
- cvar_survchance = register_cvar("zp_surv_chance", "20")
- cvar_survminplayers = register_cvar("zp_surv_min_players", "0")
- cvar_survhp = register_cvar("zp_surv_health", "2500")
- cvar_survbasehp = register_cvar("zp_surv_base_health", "0")
- cvar_survspd = register_cvar("zp_surv_speed", "400")
- cvar_survgravity = register_cvar("zp_surv_gravity", "0.6")
- cvar_survglow = register_cvar("zp_surv_glow", "1")
- cvar_survaura = register_cvar("zp_surv_aura", "0")
- cvar_survpainfree = register_cvar("zp_surv_painfree", "1")
- cvar_survignorefrags = register_cvar("zp_surv_ignore_frags", "1")
- cvar_survignoreammo = register_cvar("zp_surv_ignore_rewards", "1")
- cvar_survweapon = register_cvar("zp_surv_weapon", "weapon_m249")
- // CVARS - Swarm Mode
- cvar_swarm = register_cvar("zp_swarm_enabled", "1")
- cvar_swarmchance = register_cvar("zp_swarm_chance", "20")
- cvar_swarmminplayers = register_cvar("zp_swarm_min_players", "0")
- // CVARS - Armagedon Mode
- cvar_armagedon = register_cvar("zp_armagedon_enabled", "1")
- cvar_armagedonchance = register_cvar("zp_armagedon_chance", "15")
- cvar_armagedonminplayers = register_cvar("zp_armagedon_min_players", "0")
- cvar_armagedonhpsurvi = register_cvar("zp_armagedon_survihp", "1.0")
- cvar_armagedonhpneme = register_cvar("zp_armagedon_nemehp", "1.0")
- cvar_armagedonratio = register_cvar("zp_armagedon_ratio", "0.5")
- // CVARS - Multi Infection
- cvar_multi = register_cvar("zp_multi_enabled", "1")
- cvar_multichance = register_cvar("zp_multi_chance", "20")
- cvar_multiminplayers = register_cvar("zp_multi_min_players", "0")
- cvar_multiratio = register_cvar("zp_multi_ratio", "0.15")
- // CVARS - Plague Mode
- cvar_plague = register_cvar("zp_plague_enabled", "1")
- cvar_plaguechance = register_cvar("zp_plague_chance", "30")
- cvar_plagueminplayers = register_cvar("zp_plague_min_players", "0")
- cvar_plagueratio = register_cvar("zp_plague_ratio", "0.5")
- cvar_plaguenemnum = register_cvar("zp_plague_nem_number", "1")
- cvar_plaguenemhpmulti = register_cvar("zp_plague_nem_hp_multi", "0.5")
- cvar_plaguesurvnum = register_cvar("zp_plague_surv_number", "1")
- cvar_plaguesurvhpmulti = register_cvar("zp_plague_surv_hp_multi", "0.5")
- // CVARS - Others
- cvar_logcommands = register_cvar("zp_logcommands", "1")
- cvar_showactivity = get_cvar_pointer("amx_show_activity")
- cvar_botquota = get_cvar_pointer("bot_quota")
- register_cvar("zp_version", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
- set_cvar_string("zp_version", PLUGIN_VERSION)
- // Custom Forwards
- g_fwRoundStart = CreateMultiForward("zp_round_started", ET_IGNORE, FP_CELL, FP_CELL)
- g_fwRoundEnd = CreateMultiForward("zp_round_ended", ET_IGNORE, FP_CELL)
- g_fwUserInfected_pre = CreateMultiForward("zp_user_infected_pre", ET_IGNORE, FP_CELL, FP_CELL)
- g_fwUserInfected_post = CreateMultiForward("zp_user_infected_post", ET_IGNORE, FP_CELL, FP_CELL)
- g_fwUserHumanized_pre = CreateMultiForward("zp_user_humanized_pre", ET_IGNORE, FP_CELL)
- g_fwUserHumanized_post = CreateMultiForward("zp_user_humanized_post", ET_IGNORE, FP_CELL)
- g_fwExtraItemSelected = CreateMultiForward("zp_extra_item_selected", ET_IGNORE, FP_CELL, FP_CELL)
- g_MsgSayText = get_user_msgid("SayText")
- g_MenuCallback[MASTER] = menu_makecallback("check_master")
- g_MenuCallback[USER] = menu_makecallback("check_user")
- // Collect random spawn points
- load_spawns()
- #if !defined DONT_CHANGE_SKY
- // Set a random skybox
- set_cvar_string("sv_skyname", skynames[random_num(0, sizeof skynames - 1)])
- #endif
- // Disable sky lighting so it doesn't mess up our custom lighting
- set_cvar_num("sv_skycolor_r", 0)
- set_cvar_num("sv_skycolor_g", 0)
- set_cvar_num("sv_skycolor_b", 0)
- // Create the HUD Sync Objects
- g_MsgSync = CreateHudSyncObj()
- g_MsgSync2 = CreateHudSyncObj()
- g_MsgSync3 = CreateHudSyncObj()
- g_MsgSync4 = CreateHudSyncObj()
- // Format mod name
- formatex(g_modname, sizeof g_modname - 1, "SilentGamerz%s", PLUGIN_VERSION)
- // Get Max Players
- g_maxplayers = get_maxplayers()
- // Reserved saving slots starts on maxplayers+1
- db_slot_i = g_maxplayers+1
- // Check if it's a CZ server
- new mymod[6]
- get_modname(mymod, sizeof mymod - 1)
- if (equal(mymod, "czero")) g_czero = 1
- // Lighting task
- set_task(5.0, "lighting_effects", TASK_LIGHTING, _, _, "b")
- // Call Round Start
- set_task(1.0, "event_round_start")
- }
- public plugin_cfg()
- {
- for(new i = 1; i <= g_maxplayers; i++)
- Party_Ids[i] = ArrayCreate(1, 1)
- // Get configs dir
- new cfgdir[32]
- get_configsdir(cfgdir, sizeof cfgdir - 1);
- // Execute config file (zombieplague.cfg)
- server_cmd("exec %s/zombieplague.cfg", cfgdir)
- }
- /*================================================================================
- [Main Events]
- =================================================================================*/
- // Event Round Start
- public event_round_start()
- {
- set_task(5.0,"happyhour")
- // Remove any tasks bound to custom nades (since they're removed at roundstart)
- remove_task(TASK_NADES)
- // Remove doors/lights?
- set_task(0.2, "remove_stuff")
- // New round starting
- g_newround = true
- g_endround = false
- g_survround = false
- g_nemround = false
- g_armagedonround = false
- g_swarmround = false
- g_plagueround = false
- // Reset bought infection bombs counter
- g_infbombcounter = 0
- // Freezetime begins
- g_freezetime = true
- // Show welcome message and T-Virus notice
- remove_task(TASK_WELCOMEMSG)
- set_task(2.0, "welcome_msg", TASK_WELCOMEMSG)
- // Set a new "Make Zombie Task"
- remove_task(TASK_MAKEZOMBIE)
- set_task(2.0+random_float(get_pcvar_float(cvar_warmup), get_pcvar_float(cvar_warmup)+3.0), "make_zombie_task", TASK_MAKEZOMBIE)
- }
- // Log Event Round Start
- public logevent_round_start()
- {
- // Freezetime ends
- g_freezetime = false
- }
- // Log Event Round End
- public logevent_round_end()
- {
- // Ganancia admin
- for(new id=1; id<=get_maxplayers();id++)
- {
- if (is_user_admin(id))
- {
- static flags; flags = get_user_flags(id)
- for (new i = 0; i < sizeof(admganancia); i++)
- {
- if (flags & admganancia[i][Admin])
- {
- g_ganancia[id] = admganancia[i][Ganancia]
- break;
- }
- }
- }
- }
- // Prevent this from getting called twice when restarting (bugfix)
- static Float:lastendtime
- if (get_gametime() - lastendtime < 0.5) return;
- lastendtime = get_gametime()
- // Temporarily save player stats?
- if (get_pcvar_num(cvar_statssave))
- {
- static id, team
- for (id = 1; id <= g_maxplayers; id++)
- {
- // Not connected
- if (!is_user_connected(id))
- continue;
- team = fm_get_user_team(id)
- // Not playing
- if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
- continue;
- save_stats(id)
- }
- }
- // Round ended
- g_endround = true
- // Stop old tasks (if any)
- remove_task(TASK_WELCOMEMSG)
- remove_task(TASK_MAKEZOMBIE)
- #if defined AMBIENCE_SOUNDS
- // Stop ambience sounds
- remove_task(TASK_AMBIENCESOUNDS)
- ambience_sound_stop()
- #endif
- // Balance the teams
- set_task(0.1, "balance_teams")
- // Show HUD notice, play win sound, update team scores...
- if (!fnGetZombies())
- {
- // Human team wins
- set_hudmessage(0, 0, 200, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_HUMAN")
- // Play win sound and increase score
- PlaySound(sound_win_humans[random_num(0, sizeof sound_win_humans -1)])
- g_scorehumans++
- // Round end forward
- ExecuteForward(g_fwRoundEnd, g_fwDummyResult, 2);
- }
- else if (!fnGetHumans())
- {
- // Zombie team wins
- set_hudmessage(200, 0, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_ZOMBIE")
- // Play win sound and increase score
- PlaySound(sound_win_zombies[random_num(0, sizeof sound_win_zombies -1)])
- g_scorezombies++
- // Round end forward
- ExecuteForward(g_fwRoundEnd, g_fwDummyResult, 1);
- }
- else
- {
- // No one wins
- set_hudmessage(0, 200, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_NO_ONE")
- PlaySound(sound_win_no_one[random_num(0, sizeof sound_win_no_one -1)])
- // Round end forward
- ExecuteForward(g_fwRoundEnd, g_fwDummyResult, 0);
- }
- }
- #if defined AMBIENCE_SOUNDS
- // Event Map Ended
- public event_intermission()
- {
- // Remove ambience sounds task
- remove_task(TASK_AMBIENCESOUNDS)
- }
- #endif
- // Current Weapon Event
- public event_cur_weapon(id)
- {
- // Not alive
- if (!is_user_alive(id))
- return;
- // Zombie not holding an allowed weapon for some reason
- if (g_zombie[id] && !((1<<read_data(2)) & ZOMBIE_ALLOWED_WEAPONS_BITSUM))
- {
- // Switch to knife
- engclient_cmd(id, "weapon_knife")
- // Update the HUD and let other plugins know
- emessage_begin(MSG_ONE, g_msgCurWeapon, _, id)
- ewrite_byte(1) // active
- ewrite_byte(CSW_KNIFE) // weapon
- ewrite_byte(MAXCLIP[CSW_KNIFE]) // clip
- emessage_end()
- }
- }
- // Weapon Animation Event
- public event_weapon_anim()
- {
- // Because of a weird bug within the AMXX event system, we need to
- // hook this message to prevent some weird behavior when calling
- // engclient_cmd(id, "weapon_knife") in the CurWeapon Event forward.
- // http://forums.alliedmods.net/showthread.php?t=85161&page=2
- }
- /*================================================================================
- [Main Forwards]
- =================================================================================*/
- // Client joins the game
- public client_putinserver(id)
- {
- get_user_name(id, g_names[id], 31)
- g_ganancia[id] = 1
- if (is_user_admin(id))
- {
- static flags; flags = get_user_flags(id)
- for (new i = 0; i < sizeof(admganancia); i++)
- {
- if (flags & admganancia[i][Admin])
- {
- g_ganancia[id] = admganancia[i][Ganancia]
- break;
- }
- }
- }
- g_level[id] = 0
- g_reset[id] = 0
- g_grandreset[id] = 0
- Registrado[id] = 0
- BadPassword[id] = 0
- g_estado[id] = OFFLINE
- get_user_name(id, g_playername[id], charsmax(g_playername[]))
- // Plugin disabled?
- if (!g_pluginenabled) return;
- // Initialize player vars
- reset_vars(id, 1)
- // Load player stats?
- if (get_pcvar_num(cvar_statssave)) load_stats(id)
- // Set some tasks for humans only
- if (!is_user_bot(id))
- {
- // Set the custom HUD display task
- set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b")
- // Disable minmodels for clients to see zombies properly
- set_task(5.0, "disable_minmodels", id)
- }
- else
- {
- // CZ bots seem to use a different "classtype" for player entities
- // (or something like that) which needs to be hooked separately
- if (!g_hamczbots && cvar_botquota)
- {
- // Set a task to let the private data initialize
- set_task(0.1, "register_ham_czbots", id)
- }
- }
- }
- // Client disconnect
- public client_disconnect(id)
- {
- if(g_PartyData[id][In_Party])
- g_PartyData[id][Position] ? g_PartyData[id][Amount_In_Party] == 2 ? destoy_party(id) : remove_party_user(id) : destoy_party(id)
- g_PartyData[id][UserName][0] = 0
- g_PartyData[id][Block_Party] = false
- del_sombrero(id)
- client_cmd(id, "cl_backspeed 400")
- client_cmd(id, "cl_forwardspeed 400")
- client_cmd(id, "cl_sidespeed 400")
- g_names[id][0] = 0
- // Plugin disabled?
- if (!g_pluginenabled) return;
- // Check that we still have both humans and zombies to keep the round going
- if (is_user_alive(id)) check_round(id)
- // Temporarily save player stats?
- if (get_pcvar_num(cvar_statssave)) save_stats(id)
- // Remove previous tasks
- remove_task(id+TASK_TEAM)
- remove_task(id+TASK_MODEL)
- remove_task(id+TASK_FLASH)
- remove_task(id+TASK_CHARGE)
- remove_task(id+TASK_SPAWN)
- remove_task(id+TASK_BLOOD)
- remove_task(id+TASK_NVISION)
- remove_task(id+TASK_SHOWHUD)
- remove_task(id+TASK_COMBO)
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- // Remove custom model entities
- fm_remove_model_ents(id)
- #endif
- // Last Zombie Check
- set_task(0.1, "fnCheckLastZombie")
- if (!is_user_bot(id))
- Save(id)
- }
- // Entity Spawn Forward
- public fw_Spawn(entity)
- {
- // Invalid entity
- if (!pev_valid(entity)) return FMRES_IGNORED;
- // Get classname
- new classname[32]
- pev(entity, pev_classname, classname, sizeof classname - 1)
- // Check whether it needs to be removed
- for (new i = 0; i < sizeof g_objective_ents; i++)
- {
- if (equal(classname, g_objective_ents[i]))
- {
- engfunc(EngFunc_RemoveEntity, entity)
- return FMRES_SUPERCEDE;
- }
- }
- return FMRES_IGNORED;
- }
- // Ham Player Spawn Post Forward
- public fw_PlayerSpawn_Post(id)
- {
- // Not alive or didn't join a team yet
- if (!is_user_alive(id) || !fm_get_user_team(id))
- return;
- set_task(0.5, "bugvelocidad", id); // debug para la velocidad humana y zm
- g_akdestruction[id] = false
- g_ultimate[id] = false
- g_atomic[id] = false
- g_masive[id] = false
- g_navi[id] = false
- g_power[id] = false
- g_stfu[id] = false
- g_rlp[id] = false
- g_m4[id] = false
- g_barret[id] = false
- g_devil[id] = false
- g_rampage[id] = false
- g_supermide[id] = false
- g_farger[id] = false
- g_storm[id] = false
- g_adge[id] = false
- g_ultra[id] = false
- g_nule[id] = false
- g_super[id] = false
- g_ultrak[id] = false
- g_raampage[id] = false
- g_zpr350[id] = false
- g_rpg17[id] = false
- g_aru[id] = false
- g_xh500w[id] = false
- g_dvlsxx[id] = false
- g_thunderstorm[id] = false
- g_101000xx[id] = false
- g_101000cannon[id] = false
- g_tmp2xx[id] = false
- g_coldtorment[id] = false
- g_shredder[id] = false
- strip_user_weapons(id)
- set_sombrero(id)
- // Remove previous tasks
- remove_task(id+TASK_SPAWN)
- remove_task(id+TASK_TEAM)
- remove_task(id+TASK_MODEL)
- remove_task(id+TASK_BLOOD)
- // Spawn randomly?
- if (get_pcvar_num(cvar_randspawn)) do_random_spawn(id)
- // Hide money?
- if (get_pcvar_num(cvar_removemoney))
- set_task(0.2, "task_hide_money", id+TASK_SPAWN)
- // Respawn player if he dies because of a worldspawn kill?
- if (get_pcvar_num(cvar_respawnworldspawnkill))
- set_task(2.0, "respawn_player", id+TASK_SPAWN)
- // Spawn as zombie?
- if (g_respawn_as_zombie[id] && !g_newround)
- {
- reset_vars(id, 0) // reset player vars
- zombieme(id, 0, 0, 0) // make him zombie right away
- return;
- }
- // Reset player vars
- reset_vars(id, 0)
- // Set selected human class
- g_humanclass[id] = g_humanclassnext[id]
- if (g_humanclass[id] == HCLASS_NONE) g_humanclass[id] = 0
- // Set health and gravity
- fm_set_user_health(id, g_hclass_hp[g_humanclass[id]] + H_SALUD(g_skill_points[id][0][1]))
- set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]] - H_GRAVITY(g_skill_points[id][0][3]))
- set_user_armor(id, g_hclass_ar[g_humanclass[id]] + H_ARMOR(g_skill_points[id][0][4]))
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- // Set the right model
- if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[random_num(0, sizeof model_admin -1)])
- else
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
- // Set model on player model entity
- fm_set_playermodel_ent(id)
- // Remove glow on player model entity
- fm_set_rendering(g_ent_playermodel[id])
- #else
- // Set the right model, after checking that we don't already have it
- static currentmodel[32], already_has_model, i, iRand
- already_has_model = false
- // Get current model and compare it with current one
- fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
- if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
- {
- for (i = 0; i < sizeof model_admin; i++)
- if (equal(model_admin[i], currentmodel)) already_has_model = true
- if (!already_has_model)
- {
- iRand = random_num(0, sizeof model_admin -1)
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[iRand])
- #if defined SET_MODELINDEX_OFFSET
- fm_set_user_model_index(id, g_modelindex_admin[iRand])
- #endif
- }
- }
- else
- {
- if (equal(g_hclass_model[g_humanclass[id]], currentmodel)) already_has_model = true;
- if (!already_has_model)
- {
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
- #if defined SET_MODELINDEX_OFFSET
- fm_set_user_model_index(id, g_hclass_modelindex[g_humanclass[id]])
- #endif
- }
- }
- // Need to change the model?
- if (!already_has_model)
- {
- // An additional delay is offset at round start
- // since SVC_BAD is more likely to be triggered there
- if (g_newround)
- set_task(5.0*MODELCHANGE_DELAY, "fm_user_model_update", id+TASK_MODEL)
- else
- fm_user_model_update(id+TASK_MODEL)
- }
- // Remove glow
- fm_set_rendering(id)
- #endif
- // Bots stuff
- if (is_user_bot(id))
- {
- // Turn off NVG for bots
- fm_set_bot_nvg(id, 0)
- // Automatically buy extra items/weapons after first zombie is chosen
- if (get_pcvar_num(cvar_extraitems))
- {
- if (g_newround) set_task(10.0+get_pcvar_float(cvar_warmup), "bot_buy_extras", id+TASK_SPAWN)
- else set_task(10.0, "bot_buy_extras", id+TASK_SPAWN)
- }
- }
- // Show custom buy menu?
- show_menu_eleccion(id)
- // Get spawn protection time
- static Float:sptime
- sptime = get_pcvar_float(cvar_spawnprotection)
- // Enable spawn protection for humans spawning mid-round
- if (!g_newround && sptime > 0.0)
- {
- // Dont take any damage
- g_nodamage[id] = true
- // Make temporarily invisible
- set_pev(id, pev_effects, pev(id, pev_effects) | EF_NODRAW)
- // Set task to remove it
- set_task(sptime, "remove_spawn_protection", id+TASK_SPAWN)
- }
- // Last Zombie Check
- set_task(0.1, "fnCheckLastZombie")
- }
- // Ham Player Killed Forward
- public fw_PlayerKilled(victim, attacker, shouldgib)
- {
- // Last Zombie Check
- set_task(0.1, "fnCheckLastZombie")
- // Enable dead players nightvision
- set_task(0.2, "spec_nvision", victim)
- static name[33]; get_user_name(attacker, name, charsmax(name));
- if(!g_zombie[attacker] && g_nemesis[victim])
- {
- if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
- {
- g_points[attacker][0]+= 12
- 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)
- }
- else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
- {
- g_points[attacker][0]+= 24
- 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)
- }
- else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
- {
- g_points[attacker][0]+= 9
- 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)
- }
- else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
- {
- g_points[attacker][0]+= 18
- 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)
- }
- else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
- {
- g_points[attacker][0]+= 6
- 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)
- }
- else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
- {
- g_points[attacker][0]+= 12
- 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)
- }
- else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
- {
- g_points[attacker][0]+= 3
- 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)
- }
- else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
- {
- g_points[attacker][0]+= 6
- 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)
- }
- else if (g_happytime)
- {
- g_points[attacker][0]+= 4
- 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)
- }
- else
- {
- g_points[attacker][0]+= 2
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 2^x01 points for killing a^x03 Nemesis", name)
- }
- }
- if(g_zombie[attacker] && g_survivor[victim])
- {
- if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
- {
- g_points[attacker][1] += 12
- 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)
- }
- else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_E)
- {
- g_points[attacker][1]+= 24
- 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)
- }
- else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
- {
- g_points[attacker][1]+= 9
- 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)
- }
- else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_H)
- {
- g_points[attacker][1]+= 18
- 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)
- }
- else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
- {
- g_points[attacker][1]+= 6
- 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)
- }
- else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_G)
- {
- g_points[attacker][1]+= 12
- 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)
- }
- else if (!g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
- {
- g_points[attacker][1]+= 3
- 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)
- }
- else if (g_happytime && get_user_flags(attacker) & ADMIN_LEVEL_F)
- {
- g_points[attacker][1]+= 6
- 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)
- }
- else if (g_happytime)
- {
- g_points[attacker][1]+= 4
- 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)
- }
- else
- {
- g_points[attacker][1]+= 2
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01 won^x03 2^x01 point for killing a^x03 Survivor", name)
- }
- }
- // Get nightvision give setting
- static nvggive
- nvggive = get_pcvar_num(cvar_nvggive)
- // Disable nightvision when killed (bugfix)
- if (nvggive == 0 && g_nvision[victim])
- {
- if (g_nvisionenabled[victim] && !get_pcvar_num(cvar_cnvg)) set_user_gnvision(victim, 0)
- g_nvision[victim] = false
- g_nvisionenabled[victim] = false
- }
- // Turn off nightvision when killed (bugfix)
- if (nvggive == 2 && g_nvision[victim] && g_nvisionenabled[victim])
- {
- if (!get_pcvar_num(cvar_cnvg)) set_user_gnvision(victim, 0)
- g_nvisionenabled[victim] = false
- }
- // Stop bleeding/burning when killed
- if (g_zombie[victim])
- remove_task(victim+TASK_BLOOD)
- // Nemesis explodes!
- if (g_nemesis[victim])
- SetHamParamInteger(3, 2)
- // Get deathmatch mode status and whether the player killed himself
- static deathmatch, selfkill
- deathmatch = get_pcvar_num(cvar_deathmatch)
- selfkill = (victim == attacker || !is_user_connected(attacker)) ? true : false
- // Respawn if deathmatch is enabled
- if (deathmatch)
- {
- // Respawn on suicide?
- if (selfkill && !get_pcvar_num(cvar_respawnonsuicide))
- return;
- // Respawn if only the last human is left?
- if (!get_pcvar_num(cvar_respawnafterlast) && fnGetHumans() == 1)
- return;
- // Respawn as zombie?
- if (deathmatch == 2 || (deathmatch == 3 && random_num(0, 1)) || (deathmatch == 4 && fnGetZombies() < fnGetAlive()/2))
- g_respawn_as_zombie[victim] = true
- // Set the respawn task
- set_task(get_pcvar_float(cvar_spawndelay), "respawn_player", victim+TASK_SPAWN)
- }
- // Killed by a non-player entity or self killed
- if (selfkill) return;
- // Ignore Nemesis/Survivor Frags?
- if ((g_nemesis[attacker] && get_pcvar_num(cvar_nemignorefrags)) || (g_survivor[attacker] && get_pcvar_num(cvar_survignorefrags)))
- RemoveFrags(attacker, victim)
- // Zombie/nemesis killed human, reward ammo packs
- if (g_zombie[attacker] && (!g_nemesis[attacker] || !get_pcvar_num(cvar_nemignoreammo)))
- update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0)
- // Get frag rewards for humans and zombies
- static fragskill, fragsinfect
- fragskill = get_pcvar_num(cvar_fragskill)
- fragsinfect = get_pcvar_num(cvar_fragsinfect)
- // Human killed zombie, add up the extra frags for kill
- if (!g_zombie[attacker] && fragskill > 1)
- UpdateFrags(attacker, victim, fragskill-1, 0, 0)
- // Zombie killed human, add up the extra frags for kill
- if (g_zombie[attacker] && fragsinfect > 1)
- UpdateFrags(attacker, victim, fragsinfect-1, 0, 0)
- }
- // Ham Take Damage Forward (inflictor = weapon)
- public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
- {
- // Non-player damage or self damage
- if (victim == attacker || !is_user_connected(attacker))
- return HAM_IGNORED;
- // New round starting or round ended
- if (g_newround || g_endround)
- return HAM_SUPERCEDE;
- // Victim shouldn't take damage or victim is frozen
- if( g_nodamage[ victim ] || g_frozen[ attacker ] )
- return HAM_SUPERCEDE;
- // Prevent friendly fire
- if (g_zombie[attacker] == g_zombie[victim])
- return HAM_SUPERCEDE;
- // Attacker is human...
- if (!g_zombie[attacker])
- {
- if (g_akdestruction[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 3.0)
- }
- else if (g_ultimate[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 3.5)
- }
- else if (g_atomic[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 4.0)
- }
- else if (g_masive[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 5.0)
- }
- else if (g_navi[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 5.5)
- }
- else if (g_power[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4,damage *= 7.0)
- }
- else if (g_stfu[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 7.5)
- }
- else if (g_rlp[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 8.0)
- }
- else if (g_m4[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 8.5)
- }
- else if (g_barret[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 9.0)
- }
- else if (g_devil[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 9.5)
- }
- else if (g_rampage[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 10.0)
- }
- else if (g_supermide[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 10.5)
- }
- else if (g_farger[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 11.0)
- }
- else if (g_storm[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 12.0)
- }
- else if (g_adge[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 13.0)
- }
- else if (g_ultra[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 14.0)
- }
- else if (g_nule[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 15.0)
- }
- else if (g_super[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 17.0)
- }
- else if (g_ultrak[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 20.0)
- }
- else if (g_raampage[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 25.0)
- }
- else if (g_zpr350[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 29.0)
- }
- else if (g_rpg17[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 35.0)
- }
- else if (g_aru[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 40.0)
- }
- else if (g_xh500w[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 45.0)
- }
- else if (g_dvlsxx[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 50.0)
- }
- else if (g_thunderstorm[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 55.0)
- }
- else if (g_101000xx[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 60.0)
- }
- else if (g_101000cannon[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 65.0)
- }
- else if (g_tmp2xx[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 70.0)
- }
- else if (g_coldtorment[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 75.0)
- }
- else if (g_shredder[attacker] && !g_nemesis[victim] && !g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 85.0)
- }
- // Armor multiplier for the final damage on normal zombies
- if (!g_nemesis[victim])
- {
- damage *= H_DAMAGE(g_skill_points[attacker][0][0])
- SetHamParamFloat(4, damage)
- }
- if (g_survivor[attacker])
- {
- SetHamParamFloat(4, damage *= 80)
- }
- // Reward ammo packs
- if (!g_survivor[attacker] || !get_pcvar_num(cvar_survignoreammo))
- {
- // Store damage dealt
- g_damagedealt[attacker] += floatround(damage)
- g_damage[attacker] += floatround(damage)
- g_total[attacker] += floatround(damage)
- remove_task(attacker+TASK_COMBO)
- // Get damage required to get an ammo pack
- static ammodamage
- ammodamage = get_pcvar_num(cvar_ammodamage)
- // Reward ammo packs for every [ammo damage] dealt
- while (g_damagedealt[attacker] >= (ammodamage / (g_happytime + 1)) )
- {
- if(g_PartyData[attacker][In_Party])
- {
- new Players[32], user
- get_party_index(attacker, Players)
- for(new i; i < g_PartyData[attacker][Amount_In_Party]; i++) {
- user = Players[i]
- if (!g_zombie[user])
- {
- update_ap(user, g_ganancia[attacker]/g_PartyData[attacker][Amount_In_Party] +1, 0)
- }
- }
- g_damagedealt[attacker] -= ammodamage
- }
- else
- {
- update_ap(attacker, g_ganancia[attacker], 0)
- g_damagedealt[attacker] -= ammodamage
- }
- }
- while (g_damage[attacker] >= 450)
- {
- g_ammopacks[attacker]++
- g_combo[attacker] ++
- g_damage[attacker] -= 450
- }
- for(new i = 0 ; i < sizeof Combo ; i++)
- {
- if (g_combo[attacker] >= Combo[i][Combos])
- {
- set_hudmessage(Combo[i][Rojo], Combo[i][Verde], Combo[i][Azul], -1.0, 0.27, 1, 4.5, 4.5, 0.01, 0.01)
- ShowSyncHudMsg(attacker, g_MsgSync4, "[Combo of: %d AmmoPacks]^n[Combo: %s]^n[Total Damage: %d]", g_combo[attacker], Combo[i][Msj], g_total[attacker])
- }
- }
- set_task(4.0, "Combo_Terminado", attacker+TASK_COMBO)
- }
- return HAM_IGNORED;
- }
- // Attacker is zombie...
- if (g_zombie[attacker])
- {
- SetHamParamFloat(4, damage + Z_DAMAGE(g_skill_points[attacker][1][0]))
- }
- // Prevent infection by HE grenade (bugfix)
- if (damage_type & DMG_HEGRENADE)
- return HAM_SUPERCEDE;
- // Nemesis?
- if (g_nemesis[attacker])
- {
- // Set nemesis damage
- SetHamParamFloat(4, get_pcvar_float(cvar_nemdamage))
- return HAM_IGNORED;
- }
- // Last human or swarm round or plague round
- if (g_swarmround || g_plagueround || g_armagedonround || fnGetHumans() == 1)
- return HAM_IGNORED; // human is killed
- // Does human armor need to be reduced before infecting?
- if (g_hclass_ar[g_humanclass[attacker]])
- {
- // Get victim armor
- static Float:armor
- pev(victim, pev_armorvalue, armor)
- // Block the attack if he has some
- if (armor > 0.0)
- {
- engfunc(EngFunc_EmitSound, victim, CHAN_BODY, sound_armorhit, 1.0, ATTN_NORM, 0, PITCH_NORM)
- set_pev(victim, pev_armorvalue, floatmax(0.0, armor - damage-Z_DAMAGE(g_skill_points[attacker][1][0])))
- return HAM_SUPERCEDE;
- }
- }
- // Infection allowed
- SendDeathMsg(attacker, victim) // send death notice
- FixDeadAttrib(victim) // fix the "dead" attrib on scoreboard
- UpdateFrags(attacker, victim, get_pcvar_num(cvar_fragsinfect), 1, 1) // add corresponding frags and deaths
- zombieme(victim, attacker, 0, 0) // turn into zombie
- update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0) // ammo packs given to zombie for infection
- fm_set_user_health(attacker, pev(attacker, pev_health)+get_pcvar_num(cvar_zombiebonushp)) // attacker gets bonus HP for the infection
- return HAM_SUPERCEDE;
- }
- // Ham Trace Attack Forward
- public fw_TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type)
- {
- // Non-player damage or self damage
- if (victim == attacker || !is_user_connected(attacker))
- return HAM_IGNORED;
- // New round starting or round ended
- if (g_newround || g_endround)
- return HAM_SUPERCEDE;
- // Victim shouldn't take damage or victim is frozen
- if( g_nodamage[ victim ] || g_frozen[ attacker ] )
- return HAM_SUPERCEDE;
- // Prevent friendly fire
- if (g_zombie[attacker] == g_zombie[victim])
- return HAM_SUPERCEDE;
- // Victim isn't a normal zombie
- if (!g_zombie[victim] || g_nemesis[victim])
- return HAM_IGNORED;
- // Get custom hitzones setting
- static hitzones
- hitzones = get_pcvar_num(cvar_hitzones)
- // Check if we hit an allowed one
- if (hitzones && !(hitzones & (1<<get_tr2(tracehandle, TR_iHitgroup))))
- return HAM_SUPERCEDE;
- // Knockback disabled or not bullet damage
- if (!(damage_type & DMG_BULLET) || !get_pcvar_num(cvar_knockback))
- return HAM_IGNORED;
- // Get victim flags and knockback while ducking setting
- static victimflags, Float:knockduck
- victimflags = pev(victim, pev_flags)
- knockduck = get_pcvar_float(cvar_knockbackducking)
- // Zombie is ducking on ground
- if (knockduck == 0.0 && (victimflags & FL_DUCKING) && (victimflags & FL_ONGROUND))
- return HAM_IGNORED;
- // Get distance between players
- static Float:origin1F[3], Float:origin2F[3]
- pev(victim, pev_origin, origin1F)
- pev(attacker, pev_origin, origin2F)
- // Max distance exceeded
- if (get_distance_f(origin1F, origin2F) > get_pcvar_float(cvar_knockbackdist))
- return HAM_IGNORED;
- // Get victim's velocity
- static Float:velocity[3]
- pev(victim, pev_velocity, velocity)
- // Use damage on knockback calculation
- if (get_pcvar_num(cvar_knockbackdamage))
- xs_vec_mul_scalar(direction, damage, direction)
- // Use weapon power on knockback calculation
- if (kb_weapon_power[g_currentweapon[attacker]] > 0.0 && get_pcvar_num(cvar_knockbackpower))
- xs_vec_mul_scalar(direction, kb_weapon_power[g_currentweapon[attacker]], direction)
- // Apply ducking knockback multiplier
- if ((victimflags & FL_DUCKING) && (victimflags & FL_ONGROUND))
- xs_vec_mul_scalar(direction, knockduck, direction)
- // Apply zombie class knockback multiplier
- xs_vec_mul_scalar(direction, g_zclass_kb[g_zombieclass[victim]], direction)
- // Add up the new vector
- xs_vec_add(velocity, direction, direction)
- // Should knockback also affect vertical velocity?
- if (!get_pcvar_num(cvar_knockbackzvel))
- direction[2] = velocity[2]
- // Set the knockback'd victim's velocity
- set_pev(victim, pev_velocity, direction)
- return HAM_IGNORED;
- }
- // Ham Use Stationary Gun Forward
- public fw_UseStationary(entity, caller, activator, use_type)
- {
- // Not a player
- if (!is_user_connected(caller))
- return HAM_IGNORED;
- // Prevent zombies from using stationary guns
- if (use_type == USE_USING && g_zombie[caller])
- return HAM_SUPERCEDE;
- // Someone stopped using a stationary gun
- if (use_type == USE_STOPPED)
- set_task(0.1, "replace_models", caller) // replace weapon models (bugfix)
- return HAM_IGNORED;
- }
- // Ham Use Pushable Forward
- public fw_UsePushable()
- {
- // Prevent speed bug with pushables?
- if (get_pcvar_num(cvar_blockpushables))
- return HAM_SUPERCEDE;
- return HAM_IGNORED;
- }
- // Ham Weapon Touch Forward
- public fw_TouchWeapon(weapon, id)
- {
- // Not a player
- if (!is_user_connected(id))
- return HAM_IGNORED;
- // Dont pickup weapons if zombie or survivor (+PODBot MM fix)
- if (g_zombie[id] || (g_survivor[id] && !is_user_bot(id)))
- return HAM_SUPERCEDE;
- return HAM_IGNORED;
- }
- // Ham Weapon Pickup Forward
- public fw_AddPlayerItem(id, weapon_ent)
- {
- // Retrieve our custom extra ammo from the weapon
- static extra_ammo
- extra_ammo = pev(weapon_ent, PEV_ADDITIONAL_AMMO)
- // If present, add to player's bpammo (dont exceed max capacity though)
- if (extra_ammo)
- {
- static wname[32], weapon
- pev(weapon_ent, pev_classname, wname, sizeof wname - 1)
- weapon = get_weaponid(wname)
- fm_set_user_bpammo(id, weapon, min(fm_get_user_bpammo(id, weapon)+extra_ammo, MAXBPAMMO[weapon]))
- set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, 0)
- }
- }
- // Client Kill Forward
- public fw_ClientKill()
- {
- // Prevent players from killing themselves?
- if (get_pcvar_num(cvar_blocksuicide))
- return FMRES_SUPERCEDE;
- return FMRES_IGNORED;
- }
- // Emit Sound Forward
- public fw_EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch)
- {
- // Replace these sounds for zombies only
- if (!is_user_connected(id) || !g_zombie[id])
- return FMRES_IGNORED;
- // Zombie being hit
- if (equal(sample[7], "bhit", 4))
- {
- if (g_nemesis[id])
- engfunc(EngFunc_EmitSound, id, channel, nemesis_pain[random_num(0, sizeof nemesis_pain - 1)], volume, attn, flags, pitch)
- else
- engfunc(EngFunc_EmitSound, id, channel, zombie_pain[random_num(0, sizeof zombie_pain - 1)], volume, attn, flags, pitch)
- return FMRES_SUPERCEDE;
- }
- // Zombie attacks with knife
- if (equal(sample[8], "kni", 3))
- {
- if (equal(sample[14], "sla", 3)) // slash
- {
- engfunc(EngFunc_EmitSound, id, channel, zombie_miss_slash[random_num(0, sizeof zombie_miss_slash - 1)], volume, attn, flags, pitch)
- return FMRES_SUPERCEDE;
- }
- if (equal(sample[14], "hit", 3))
- {
- if (sample[17] == 'w') // wall
- {
- engfunc(EngFunc_EmitSound, id, channel, zombie_miss_wall[random_num(0, sizeof zombie_miss_wall - 1)], volume, attn, flags, pitch)
- return FMRES_SUPERCEDE;
- }
- else // hit
- {
- engfunc(EngFunc_EmitSound, id, channel, zombie_hit_normal[random_num(0, sizeof zombie_hit_normal - 1)], volume, attn, flags, pitch)
- return FMRES_SUPERCEDE;
- }
- }
- if (equal(sample[14], "sta", 3)) // stab
- {
- engfunc(EngFunc_EmitSound, id, channel, zombie_hit_stab[random_num(0, sizeof zombie_hit_stab - 1)], volume, attn, flags, pitch)
- return FMRES_SUPERCEDE;
- }
- }
- // Zombie dies
- if (equal(sample[7], "die", 3) || equal(sample[7], "dea", 3))
- {
- engfunc(EngFunc_EmitSound, id, channel, zombie_die[random_num(0, sizeof zombie_die - 1)], volume, attn, flags, pitch)
- return FMRES_SUPERCEDE;
- }
- // Zombie falls off
- if (equal(sample[10], "fall", 4))
- {
- engfunc(EngFunc_EmitSound, id, channel, zombie_fall[random_num(0, sizeof zombie_fall - 1)], volume, attn, flags, pitch)
- return FMRES_SUPERCEDE;
- }
- return FMRES_IGNORED;
- }
- #if !defined HANDLE_MODELS_ON_SEPARATE_ENT
- // Forward Set ClientKey Value -prevent CS from changing player models-
- public fw_SetClientKeyValue(id, const infobuffer[], const key[])
- {
- // Block CS model changes
- if (equal(key, "model"))
- return FMRES_SUPERCEDE;
- return FMRES_IGNORED;
- }
- // Forward Client User Info Changed -prevent players from changing models-
- public fw_ClientUserInfoChanged(id)
- {
- // Get current model
- static currentmodel[32]
- fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
- // If they're different, set model again
- if (!equal(currentmodel, g_playermodel[id]) && !task_exists(id+TASK_MODEL))
- fm_set_user_model(id+TASK_MODEL)
- }
- #endif
- // Forward Get Game Description
- public fw_GetGameDescription()
- {
- // Return the mod name so it can be easily identified
- forward_return(FMV_STRING, g_modname)
- return FMRES_SUPERCEDE;
- }
- // Forward CmdStart
- public fw_CmdStart(id, handle)
- {
- // Check if it's a flashlight impulse
- if (get_uc(handle, UC_Impulse) != IMPULSE_FLASHLIGHT)
- return;
- // Not alive
- if (!is_user_alive(id))
- return;
- // Block it for zombies, survivor (and override it for humans when custom flashlight is on)
- if (g_zombie[id] || g_survivor[id] || (!g_zombie[id] && get_pcvar_num(cvar_cflash)))
- {
- // Human's custom flashlight should be turned on instead
- if (!g_zombie[id] && !g_survivor[id] && get_gametime() - g_lastflashtime[id] > 1.1)
- {
- // Prevent turning the flashlight on/off too quickly (bugfix)
- g_lastflashtime[id] = get_gametime()
- // Turn custom flashlight on/off
- g_flashlight[id] = !(g_flashlight[id])
- // Set the flashlight charge task
- remove_task(id+TASK_CHARGE)
- set_task(1.0, "flashlight_charge", id+TASK_CHARGE, _, _, "b")
- // Update flashlight status on the HUD
- message_begin(MSG_ONE, g_msgFlashlight, _, id)
- write_byte(g_flashlight[id]) // toggle
- write_byte(g_flashbattery[id]) // battery
- message_end()
- // Turn off original flashlight if active
- set_pev(id, pev_effects, pev(id, pev_effects) & ~EF_DIMLIGHT)
- // Play flashlight toggle sound
- engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_flashlight, 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Finally call our custom flashlight task
- remove_task(id+TASK_FLASH)
- set_task(0.1, "set_user_flashlight", id+TASK_FLASH, _, _, "b")
- }
- // Block the impulse
- set_uc(handle, UC_Impulse, 0)
- }
- }
- // Forward Set Model
- public fw_SetModel(entity, const model[])
- {
- // Get remove dropped weapons setting
- static Float:removeweapons
- removeweapons = get_pcvar_float(cvar_removedropped)
- // Remove weapons?
- if (removeweapons > 0.0)
- {
- // Get entity's classname
- static class[10]
- pev(entity, pev_classname, class, sizeof class - 1)
- // Check if it's a weapon box
- if (equal(class, "weaponbox"))
- {
- // They get automatically removed when thinking
- set_pev(entity, pev_nextthink, get_gametime() + removeweapons)
- return;
- }
- }
- // Get damage time of grenade
- static Float:dmgtime
- pev(entity, pev_dmgtime, dmgtime)
- // Grenade not yet thrown
- if (dmgtime == 0.0)
- return;
- if (equal(model[7], "w_he", 4))
- {
- if (g_zombie[pev(entity, pev_owner)]) // [ZOMBIE] - Infection Grenade
- {
- // Give it a glow
- fm_set_rendering(entity, kRenderFxGlowShell, 0, 200, 0, kRenderNormal, 16);
- // And a colored trail
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMFOLLOW) // TE id
- write_short(entity) // entity
- write_short(g_trailSpr) // sprite
- write_byte(10) // life
- write_byte(10) // width
- write_byte(0) // r
- write_byte(200) // g
- write_byte(0) // b
- write_byte(200) // brightness
- message_end()
- // Set grenade type on the thrown grenade entity
- set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_INFECTION)
- }
- else if (get_pcvar_num(cvar_firegrenades)) // [HUMAN] - Fire Grenade
- {
- // Give it a glow
- fm_set_rendering(entity, kRenderFxGlowShell, 200, 0, 0, kRenderNormal, 16);
- // And a colored trail
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMFOLLOW) // TE id
- write_short(entity) // entity
- write_short(g_trailSpr) // sprite
- write_byte(10) // life
- write_byte(10) // width
- write_byte(200) // r
- write_byte(0) // g
- write_byte(0) // b
- write_byte(200) // brightness
- message_end()
- // Set grenade type on the thrown grenade entity
- set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_NAPALM)
- }
- }
- else if (equal(model[7], "w_fl", 4) && get_pcvar_num(cvar_frostgrenades)) // Frost Grenade
- {
- // Give it a glow
- fm_set_rendering(entity, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 16);
- // And a colored trail
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMFOLLOW) // TE id
- write_short(entity) // entity
- write_short(g_trailSpr) // sprite
- write_byte(10) // life
- write_byte(10) // width
- write_byte(0) // r
- write_byte(100) // g
- write_byte(200) // b
- write_byte(200) // brightness
- message_end()
- // Set grenade type on the thrown grenade entity
- set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FROST)
- }
- 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
- {
- if(!g_zombie[pev(entity, pev_owner)] && g_bubble_bomb[pev(entity, pev_owner)]) // aca determinamos que la bomba es solo para humanos.
- {
- fm_set_rendering(entity, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 16) // aca determinamos el color de glow de la granada.
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY) // ni idea.
- write_byte(TE_BEAMFOLLOW) // aca determinamos que es un trail la entidad
- write_short(entity) // declaramos que es una entidad
- write_short(g_trailSpr) // el sprite correspondiente al trail.
- write_byte(10) // life. ( nose que es )
- write_byte(10) // width: esto quiere decir el ancho del trail
- write_byte(255) // red: color rojo
- write_byte(255) // green: color verde
- write_byte(255) // blue: color azul
- write_byte(500) // brightness: brillo
- message_end()
- set_pev(entity, pev_flTimeStepSound, NADE_TYPE_CAMPO) // tipo de bomba ( NADE_TYPE_CAMPO )
- entity_set_model(entity, w_model) // llamamos al model de la granada en el piso "w_".
- }
- else
- {
- // Make the flare color
- static rgb[3]
- switch (get_pcvar_num(cvar_flarecolor))
- {
- case 0: // white
- {
- rgb[0] = 255 // red: rojo
- rgb[1] = 255 // green: verde
- rgb[2] = 255 // blue: azul
- }
- case 1: // red
- {
- rgb[0] = random_num(50,255) // rer: rojo con un random_num, eso quiere decir que saldra desde el 50 al 255
- rgb[1] = 0 // green: verde
- rgb[2] = 0 // blue: azul
- }
- case 2: // green
- {
- rgb[0] = 0 // red: rojo
- rgb[1] = random_num(50,255) // green: verde con un random_num, eso quiere decir que saldra desde el 50 al 255
- rgb[2] = 0 // blue: azul
- }
- case 3: // blue
- {
- rgb[0] = 0 // red: rojo
- rgb[1] = 0 // green: verde
- rgb[2] = random_num(50,255) // blue: azul con un random_num, eso quiere decir que saldra desde el 50 al 255
- }
- case 4: // random (all colors): quiere decir que pueden salir varios colores por que los combina
- {
- rgb[0] = random_num(50,200) // red: rojo con un random_num, eso quiere decir que saldra desde el 50 al 255
- rgb[1] = random_num(50,200) // green: verde con un random_num, eso quiere decir que saldra desde el 50 al 255
- rgb[2] = random_num(50,200) // blue: azul con un random_num, eso quiere decir que saldra desde el 50 al 255
- }
- case 5: // random (r,g,b): al azar entre rojo, verde, azul
- {
- switch (random_num(1, 3))
- {
- case 1: // red
- {
- rgb[0] = random_num(50,255) // red: rojo con un random_num, eso quiere decir que saldra desde el 50 al 255
- rgb[1] = 0 // green: verde
- rgb[2] = 0 // blue: azul
- }
- case 2: // green
- {
- rgb[0] = 0 // red: rojo
- rgb[1] = random_num(50,255) // green: verde con un random_num, eso quiere decir que saldra desde el 50 al 255
- rgb[2] = 0 // blue: azul
- }
- case 3: // blue
- {
- rgb[0] = 0 // red: rojo
- rgb[1] = 0 // green: verde
- rgb[2] = random_num(50,255) // blue: azul con un random_num, eso quiere decir que saldra desde el 50 al 255
- }
- }
- }
- }
- // Give it a glow / toma el glow color, si la bomba fuese de color rojo, el glow de la grana sera rojo...
- fm_set_rendering(entity, kRenderFxGlowShell, rgb[0], rgb[1], rgb[2], kRenderNormal, 16);
- // And a colored trail / le damos un trail
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMFOLLOW) // entidad del trail
- write_short(entity) // decimos que es una entidad
- write_short(g_trailSpr) // sprite correspondiente al trail
- write_byte(10) // life ( nose que es )
- write_byte(10) // width: ancho del trail
- write_byte(rgb[0]) // red: rojo -- depende de que color sea la bomba (rgb[0] = 1)
- write_byte(rgb[1]) // green: verde -- depende de que color sea la bomba (rgb[1] = 2)
- write_byte(rgb[2]) // blue: azul -- depende de que color sea la bomba (rgb[2] = 3)
- write_byte(200) // brightness: brillo del trail
- message_end() // terminamos la entidad
- // Set grenade type on the thrown grenade entity
- set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FLARE) // tipo de granada ( flare bomb )
- // Set flare color on the thrown grenade entity
- set_pev(entity, PEV_FLARE_COLOR, rgb) // Establecer color bengala en la entidad granada lanzada
- }
- }
- }
- // Ham Grenade Think Forward
- public fw_ThinkGrenade(entity)
- {
- // Invalid entity
- if (!pev_valid(entity)) return FMRES_IGNORED;
- // Get damage time of grenade
- static Float:dmgtime
- pev(entity, pev_dmgtime, dmgtime)
- // Check if it's time to go off
- if (dmgtime > get_gametime())
- return HAM_IGNORED;
- // Check if it's one of our custom nades
- switch (pev(entity, PEV_NADE_TYPE))
- {
- case NADE_TYPE_INFECTION: // Infection Bomb
- {
- infection_explode(entity)
- }
- case NADE_TYPE_NAPALM: // Napalm Grenade
- {
- fire_explode(entity)
- }
- case NADE_TYPE_FROST: // Frost Grenade
- {
- frost_explode(entity)
- }
- case NADE_TYPE_CAMPO: // Bubble Grenade / tipo de bomba bubble ( campo )
- {
- bubble_explode(entity) // llamamos a la entidad del campo
- return HAM_SUPERCEDE;
- }
- case NADE_TYPE_FLARE: // Flare
- {
- // Light up when it's stopped on ground
- if ((pev(entity, pev_flags) & FL_ONGROUND) && fm_get_speed(entity) < 10)
- {
- // Flare sound
- engfunc(EngFunc_EmitSound, entity, CHAN_WEAPON, grenade_flare[random_num(0, sizeof grenade_flare - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Our task params
- static params[5]
- params[0] = entity // entity id
- params[1] = get_pcvar_num(cvar_flareduration)/5 // duration
- // Retrieve flare color from entity
- pev(entity, PEV_FLARE_COLOR, params[2]) // params[2] r - params[3] g - params[4] b
- // Call our lighting task
- set_task(0.1, "flare_lighting", TASK_NADES, params, sizeof params)
- }
- else
- {
- // Delay the explosion until we hit ground
- set_pev(entity, pev_dmgtime, get_gametime() + 0.5)
- return HAM_IGNORED;
- }
- }
- default: return HAM_IGNORED;
- }
- return HAM_SUPERCEDE;
- }
- // Forward Player PreThink
- public fw_PlayerPreThink(id)
- {
- // Not alive
- if (!is_user_alive(id))
- return;
- // Silent footsteps for zombies?
- if (g_zombie[id] && !g_nemesis[id] && get_pcvar_num(cvar_zombiesilent))
- set_pev(id, pev_flTimeStepSound, STEPTIME_SILENT)
- // Set Player MaxSpeed
- if (g_frozen[id])
- {
- set_pev(id, pev_velocity, Float:{0.0,0.0,0.0}) // stop motion
- set_pev(id, pev_maxspeed, 1.0) // prevent from moving
- }
- else if (!g_freezetime)
- {
- if (g_zombie[id])
- {
- if (g_nemesis[id])
- set_pev(id, pev_maxspeed, get_pcvar_float(cvar_nemspd))
- else
- set_pev(id, pev_maxspeed, float(g_zclass_spd[g_zombieclass[id]] + Z_SPEED(g_skill_points[id][1][2])))
- }
- else
- {
- if (g_survivor[id])
- set_pev(id, pev_maxspeed, get_pcvar_float(cvar_survspd))
- else
- set_pev(id, pev_maxspeed, float(g_hclass_spd[g_humanclass[id]] + H_SPEED(g_skill_points[id][0][2])))
- }
- }
- // Should Leap?
- if (allowed_leap(id))
- {
- // Get force and height cvars
- static force, height, Float:velocity[3]
- force = g_survivor[id] ? get_pcvar_num(cvar_leapsurvivorforce) : g_nemesis[id] ? get_pcvar_num(cvar_leapnemesisforce) : get_pcvar_num(cvar_leapzombiesforce)
- height = g_survivor[id] ? get_pcvar_num(cvar_leapsurvivorheight) : g_nemesis[id] ? get_pcvar_num(cvar_leapnemesisheight) : get_pcvar_num(cvar_leapzombiesheight)
- // Make velocity vector
- velocity_by_aim(id, force, velocity)
- // Set custom height
- velocity[2] = float(height)
- // Apply the new velocity
- set_pev(id, pev_velocity, velocity)
- // Set the current leap time
- g_lastleaptime[id] = get_gametime()
- }
- // Should be Pain Shock Free?
- if (allowed_painshockfree(id))
- {
- // Remember his velocity
- pev(id, pev_velocity, g_velocity[id])
- g_restorevel[id] = true
- }
- }
- // Forward Player PreThink Post
- public fw_PlayerPreThink_Post(id)
- {
- // Pain Shock Free: need to restore velocity?
- if (!g_restorevel[id])
- return FMRES_IGNORED;
- g_restorevel[id] = false
- // Not alive
- if (!is_user_alive(id))
- return FMRES_IGNORED;
- // Driving a vehicle
- if (pev(id, pev_flags) & FL_ONTRAIN)
- return FMRES_IGNORED;
- // NOTE: within DLL PlayerPreThink Jump() function is called;
- // there is a conveyor velocity addiction we should care of
- static groundent
- groundent = pev(id, pev_groundentity)
- if (pev_valid(groundent) && (pev(groundent, pev_flags) & FL_CONVEYOR))
- {
- // Add pev_basevelocity to our stored velocity
- static Float:tempvel[3]
- pev(id, pev_basevelocity, tempvel)
- xs_vec_add(g_velocity[id], tempvel, g_velocity[id])
- }
- // Restore previous velocity
- set_pev(id, pev_velocity, g_velocity[id])
- return FMRES_HANDLED;
- }
- /*================================================================================
- [Client Commands]
- =================================================================================*/
- // Say "/zpmenu"
- public clcmd_saymenu(id)
- {
- show_menu_game(id) // show game menu
- }
- // Say "/unstuck"
- public clcmd_sayunstuck(id)
- {
- menu_game(id, 3) // try to get unstuck
- }
- // Nightvision toggle
- public clcmd_nightvision(id)
- {
- if (g_nvision[id])
- {
- // Enable-disable
- g_nvisionenabled[id] = !(g_nvisionenabled[id])
- // Custom nvg?
- if (get_pcvar_num(cvar_cnvg))
- {
- remove_task(id+TASK_NVISION);
- set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
- }
- else
- set_user_gnvision(id, g_nvisionenabled[id])
- }
- return PLUGIN_HANDLED;
- }
- // Weapon Drop
- public clcmd_drop(id)
- {
- return PLUGIN_HANDLED
- client_print(id, print_center, "No puedes botar tu arma")
- }
- // Buy BP Ammo
- public clcmd_buyammo(id)
- {
- // Not alive or infinite ammo setting enabled
- if (get_pcvar_num(cvar_infammo) || !is_user_alive(id))
- return PLUGIN_HANDLED;
- // Not human
- if (g_zombie[id])
- {
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_HUMAN_ONLY")
- return PLUGIN_HANDLED;
- }
- // Not enough ammo packs
- if (g_ammopacks[id] < 1)
- {
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "NOT_ENOUGH_AMMO")
- return PLUGIN_HANDLED;
- }
- // Get user weapons
- static weapons[32], num, i, currentammo, weaponid, refilled
- num = 0 // reset passed weapons count (bugfix)
- refilled = false
- get_user_weapons(id, weapons, num)
- // Loop through them and give the right ammo type
- for (i = 0; i < num; i++)
- {
- // Prevents re-indexing the array
- weaponid = weapons[i]
- // Primary and secondary only
- if (MAXBPAMMO[weaponid] > 2)
- {
- // Get current ammo of the weapon
- currentammo = fm_get_user_bpammo(id, weaponid)
- // Check if we are close to the BP ammo limit
- if (currentammo < MAXBPAMMO[weaponid]-BUYAMMO[weaponid])
- {
- // Flash ammo in hud
- message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
- write_byte(AMMOID[weaponid]) // ammo id
- write_byte(BUYAMMO[weaponid]) // ammo amount
- message_end()
- // Increase BP ammo
- fm_set_user_bpammo(id, weaponid, currentammo + BUYAMMO[weaponid])
- refilled = true
- }
- else if (currentammo < MAXBPAMMO[weaponid])
- {
- // Flash ammo in hud
- message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
- write_byte(AMMOID[weaponid]) // ammo id
- write_byte(MAXBPAMMO[weaponid]-currentammo) // ammo amount
- message_end()
- // Reached the limit
- fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
- refilled = true
- }
- }
- }
- // Weapons already have full ammo
- if (!refilled) return PLUGIN_HANDLED;
- // Deduce ammo packs, play clip purchase sound, and notify the player
- update_ap(id, -1, 0)
- engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "AMMO_BOUGHT")
- return PLUGIN_HANDLED;
- }
- // Block Team Change
- public clcmd_changeteam(id)
- {
- static team
- team = fm_get_user_team(id)
- if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
- return PLUGIN_CONTINUE;
- if (g_estado[id] != ONLINE)
- return PLUGIN_CONTINUE;
- show_menu_game(id)
- return PLUGIN_HANDLED;
- }
- // Block changeteam
- public clcmd_jointeam(id)
- {
- if(g_estado[id] == ONLINE)
- return PLUGIN_CONTINUE;
- show_menu_registro(id)
- return PLUGIN_HANDLED;
- }
- /*================================================================================
- [Menus]
- =================================================================================*/
- // Game Menu
- show_menu_game(id)
- {
- static menu[250], len
- len = 0
- // Title
- len += formatex(menu[len], sizeof menu - 1 - len, "\y%s^n^n", g_modname)
- // 1. Buy weapons
- if (get_pcvar_num(cvar_buycustom))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\w %L^n", id, "MENU_BUY")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d1. %L^n", id, "MENU_BUY")
- // 2. Extra items
- if (!g_survivor[id] && !g_nemesis[id] && get_pcvar_num(cvar_extraitems) && is_user_alive(id))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\w %L^n^n", id, "MENU_EXTRABUY")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d2. %L^n^n", id, "MENU_EXTRABUY")
- // 3. Zombie class || Human class
- if (g_zombie[id])
- len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w %L^n", id,"MENU_ZCLASS")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w %L^n", id,"MENU_HCLASS")
- // 4. Unstuck
- if (is_user_alive(id))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r4.\w %L^n^n", id, "MENU_UNSTUCK")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d4. %L^n^n", id, "MENU_UNSTUCK")
- // 5. Help and join spec
- len += formatex(menu[len], sizeof menu - 1 - len, "\r5.\w %L^n", id, "MENU_SPECTATOR")
- // 6. Reset
- len += formatex(menu[len], charsmax(menu) - len, "^n\r6.\r Account Configuration^n^n")
- // 7. Habilidades
- len += formatex(menu[len], sizeof menu - 1 - len, "\r7.\w Abilities^n")
- len += formatex(menu[len], sizeof menu - 1 - len, "\r8.\w Party^n^n")
- // 9. Admin menu
- if (get_user_flags(id) & ACCESS_FLAG)
- len += formatex(menu[len], sizeof menu - 1 - len, "\r9.\w %L", id, "MENU_ADMIN")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d9. %L", id, "MENU_ADMIN")
- // 0. Exit
- len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
- show_menu(id, KEYSMENU, menu, -1, "Game Menu")
- }
- // Buy Menu 1
- public show_menu_buy1(taskid)
- {
- // Get player id
- static id
- (taskid > g_maxplayers) ? (id = ID_SPAWN) : (id = taskid);
- // Zombies or survivors get no guns
- if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
- return;
- // Bots pick their weapons randomly
- if (is_user_bot(id))
- {
- buy_primary_weapon(id, random_num(0, sizeof g_primary_items - 1))
- menu_buy2(id, random_num(0, sizeof g_secondary_items - 1))
- return;
- }
- // Automatic selection enabled for player and menu called on spawn event
- if (WPN_AUTO_ON && taskid > g_maxplayers)
- {
- buy_primary_weapon(id, WPN_AUTO_PRI)
- menu_buy2(id, WPN_AUTO_SEC)
- return;
- }
- static menu[999], len, weap
- len = 0
- // Title
- 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))
- // 1-7. Weapon List
- for (weap = WPN_STARTID; weap < min(WPN_STARTID+7, WPN_MAXIDS); weap++)
- if (g_level[id] >= lvlarmas[weap] && g_reset[id] >= resetarmas[weap])
- len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", weap-WPN_STARTID+1, ArmasName[weap])
- else
- 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])
- // 8. Auto Select
- 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")
- // 9. Next/Back - 0. Exit
- 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")
- show_menu(id, KEYSMENU, menu, -1, "Buy Menu 1")
- }
- // Buy Menu 2
- show_menu_buy2(id)
- {
- static menu[250], len, weap
- len = 0
- // Title
- len += formatex(menu[len], sizeof menu - 1 - len, "\y%L^n", id, "MENU_BUY2_TITLE")
- // 1-6. Weapon List
- for (weap = 0; weap < sizeof g_secondary_items; weap++)
- len += formatex(menu[len], sizeof menu - 1 - len, "^n\r%d.\w %s", weap+1, WEAPONNAMES[get_weaponid(g_secondary_items[weap])])
- // 8. Auto Select
- 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")
- // 0. Exit
- len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
- show_menu(id, KEYSMENU, menu, -1, "Buy Menu 2")
- }
- // Extra Items Menu
- show_menu_extras(id)
- {
- static menu[400], len, item
- len = 0
- // Title
- 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))
- // 1-7. Item List
- for (item = EXTRAS_STARTID; item < min(EXTRAS_STARTID+7, g_extraitem_i); item++)
- {
- // Unavailable item
- if ((g_zombie[id] && g_extraitem_team[item] == ZP_TEAM_HUMAN) || (!g_zombie[id] && g_extraitem_team[item] == ZP_TEAM_ZOMBIE) || (item == EXTRA_NVISION && !get_pcvar_num(cvar_extranvision)) || (item == EXTRA_ANTIDOTE && !get_pcvar_num(cvar_extraantidote)) || (item == EXTRA_MADNESS && !get_pcvar_num(cvar_extramadness))
- || (item == EXTRA_INFBOMB && (!get_pcvar_num(cvar_extrainfbomb) || g_infbombcounter >= get_pcvar_num(cvar_infbomblimit))) || (item >= EXTRA_WEAPONS_STARTID && item <= EXTRAS_CUSTOM_STARTID-1 && !get_pcvar_num(cvar_extraweapons)))
- {
- // Check if it's one of the hardcoded items and set the correct caption
- switch (item)
- {
- case EXTRA_NVISION: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA1")
- case EXTRA_ANTIDOTE: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA2")
- case EXTRA_MADNESS: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA3")
- case EXTRA_INFBOMB: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA4")
- default: len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s", item-EXTRAS_STARTID+1, g_extraitem_name[item])
- }
- // Item Cost
- len += formatex(menu[len], sizeof menu - 1 - len, " %d Ammopacks^n", g_extraitem_cost[item] * g_level[id])
- }
- else
- {
- // Check if it's one of the hardcoded items and set the correct caption
- switch (item)
- {
- case EXTRA_NVISION: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA1")
- case EXTRA_ANTIDOTE: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA2")
- case EXTRA_MADNESS: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA3")
- case EXTRA_INFBOMB: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %L", item-EXTRAS_STARTID+1, id, "MENU_EXTRA4")
- default: len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s", item-EXTRAS_STARTID+1, g_extraitem_name[item])
- }
- // Item Cost
- len += formatex(menu[len], sizeof menu - 1 - len, " %d Ammopacks^n", g_extraitem_cost[item] * g_level[id])
- }
- }
- // 8. Back - 9. Next - 0. Exit
- 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")
- show_menu(id, KEYSMENU, menu, -1, "Extra Items")
- }
- // Zombie Class Menu
- public show_menu_zclass(id)
- {
- // Player disconnected
- if (!is_user_connected(id))
- return;
- // Bots pick their zombie class randomly
- if (is_user_bot(id))
- {
- g_zombieclassnext[id] = random_num(0, g_zclass_i - 1)
- return;
- }
- static menu[999], len, class
- len = 0
- // Title
- 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))
- // 1-7. Class List
- for (class = ZCLASSES_STARTID; class < min(ZCLASSES_STARTID+6, g_zclass_i); class++)
- {
- if (g_level[id] >= g_zclass_lvl[class])
- {
- if (class == g_zombieclassnext[id])
- 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])
- else
- 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])
- }
- else
- 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])
- }
- // 8. Back - 9. Next - 0. Exit
- 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")
- show_menu(id, KEYSMENU, menu, -1, "Zombie Class Menu")
- }
- // Human Class Menu
- public show_menu_hclass(id)
- {
- // Player disconnected
- if (!is_user_connected(id))
- return;
- // Bots pick their zombie class randomly
- if (is_user_bot(id))
- {
- g_humanclassnext[id] = random_num(0, g_hclass_i - 1)
- return;
- }
- static menu[400], len, class
- len = 0
- // Title
- 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))
- // 1-7. Class List
- for (class = HCLASSES_STARTID; class < min(HCLASSES_STARTID+6, g_hclass_i); class++)
- {
- if (g_level[id] >= g_hclass_lvl[class])
- {
- if (class == g_humanclassnext[id])
- 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])
- else
- 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])
- }
- else
- 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])
- }
- // 8. Back - 9. Next - 0. Exit
- 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")
- show_menu(id, KEYSMENU, menu, -1, "Human Class Menu")
- }
- // Help Menu
- public show_menu_info(id)
- {
- // Player disconnected
- if (!is_user_connected(id))
- return;
- static menu[150]
- 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")
- show_menu(id, KEYSMENU, menu, -1, "Mod Info")
- }
- // Reset Menu
- public show_menu_reset(id)
- {
- static menu[800], len, lvl
- lvl = 1000 - g_level[id]
- len = 0
- 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
- if (g_level[id] >= 1000)
- len += formatex(menu[len], charsmax(menu) - len, "\r1.\w Reset^n^n^n^n")
- else
- 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])
- len += formatex(menu[len], charsmax(menu) - len, "\r0.\w %L", id, "MENU_EXIT")
- show_menu(id, KEYSMENU, menu, -1, "Menu Reset")
- }
- // Admin Menu
- show_menu_admin(id)
- {
- static menu[250], len
- len = 0
- // Title
- len += formatex(menu[len], sizeof menu - 1 - len, "\y%L^n^n", id, "MENU_ADMIN_TITLE")
- // 1. Zombiefy/Humanize command
- if (!g_endround && !g_swarmround && !g_nemround && !g_survround && !g_plagueround && !task_exists(TASK_WELCOMEMSG))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\w %L^n", id, "MENU_ADMIN1")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d1. %L^n", id, "MENU_ADMIN1")
- // 2. Nemesis command
- if (g_newround && !g_endround && get_pcvar_num(cvar_nem) && !task_exists(TASK_WELCOMEMSG))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\w %L^n", id, "MENU_ADMIN2")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d2. %L^n", id, "MENU_ADMIN2")
- // 3. Survivor command
- if (g_newround && !g_endround && get_pcvar_num(cvar_surv) && !task_exists(TASK_WELCOMEMSG))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w %L^n", id, "MENU_ADMIN3")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d3. %L^n", id, "MENU_ADMIN3")
- // 4. Respawn command
- if (!g_endround && !g_survround && !g_swarmround && !g_nemround && !g_plagueround)
- len += formatex(menu[len], sizeof menu - 1 - len, "\r4.\w %L^n", id, "MENU_ADMIN4")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d4. %L^n", id, "MENU_ADMIN4")
- // 5. Swarm mode command
- if (allowed_swarm())
- len += formatex(menu[len], sizeof menu - 1 - len, "\r5.\w %L^n", id, "MENU_ADMIN5")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d5. %L^n", id, "MENU_ADMIN5")
- // 6. Multi infection command
- if (allowed_multi())
- len += formatex(menu[len], sizeof menu - 1 - len, "\r6.\w %L^n", id, "MENU_ADMIN6")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d6. %L^n", id, "MENU_ADMIN6")
- // 7. Plague mode command
- if (allowed_plague())
- len += formatex(menu[len], sizeof menu - 1 - len, "\r7.\w %L^n", id, "MENU_ADMIN7")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d7. %L^n", id, "MENU_ADMIN7")
- // 8. Armagedon mode command
- if (allowed_armagedon())
- len += formatex(menu[len], sizeof menu - 1 - len, "\r8.\w %L^n", id, "MENU_ADMIN8")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d8. %L^n", id, "MENU_ADMIN8")
- // 0. Exit
- len += formatex(menu[len], sizeof menu - 1 - len, "^n\r0.\w %L", id, "MENU_EXIT")
- show_menu(id, KEYSMENU, menu, -1, "Admin Menu")
- }
- // Player List Menu
- show_menu_player_list(id)
- {
- static menu[400], len, player, name[32]
- len = 0
- // Title
- switch (PL_ACTION)
- {
- case 0: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN1")
- case 1: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN2")
- case 2: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN3")
- case 3: len += formatex(menu[len], sizeof menu - 1 - len, "\y%L ", id, "MENU_ADMIN4")
- }
- len += formatex(menu[len], sizeof menu - 1 - len, "\r[%d-%d]^n^n", PL_STARTID+1, min(PL_STARTID+7, g_maxplayers))
- // 1-7. player list
- for (player = PL_STARTID+1; player <= min(PL_STARTID+7, g_maxplayers); player++)
- {
- if (is_user_connected(player)) // check if it's connected
- {
- // Get player's name
- get_user_name(player, name, sizeof name - 1)
- // Format text depending on the action to take
- switch (PL_ACTION)
- {
- case 0:
- {
- if (g_zombie[player])
- {
- if (allowed_human(player))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s \r[%L]^n", player-PL_STARTID, name, id, "CLASS_ZOMBIE")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s [%L]^n", player-PL_STARTID, name, id, "CLASS_ZOMBIE")
- }
- else
- {
- if (allowed_zombie(player))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s \y[%L]^n", player-PL_STARTID, name, id, "CLASS_HUMAN")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s [%L]^n", player-PL_STARTID, name, id, "CLASS_HUMAN")
- }
- }
- case 1:
- {
- if (allowed_nemesis(player))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", player-PL_STARTID, name)
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s^n", player-PL_STARTID, name)
- }
- case 2:
- {
- if (allowed_survivor(player))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", player-PL_STARTID, name)
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s^n", player-PL_STARTID, name)
- }
- case 3:
- {
- if (allowed_respawn(player))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s^n", player-PL_STARTID, name)
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s^n", player-PL_STARTID, name)
- }
- }
- }
- else
- {
- len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. -----^n", player-PL_STARTID)
- }
- }
- // 8. Back - 9. Next - 0. Exit
- 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")
- show_menu(id, KEYSMENU, menu, -1, "Player List Menu")
- }
- public show_menu_registro(id)
- {
- static menu[999], szData[512], len; len = 0
- // Title
- 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")
- if (fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
- 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])
- else
- 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])
- // Option n°1
- if (!fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\w Register^n")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\d Register^n")
- // Option n°2
- if (fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
- len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\w Login^n")
- else
- len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\d Login^n")
- len += formatex(menu[len], sizeof menu - 1 - len, "^n\r0.\w Exit")
- show_menu(id, KEYSMENU, menu, -1, "Menu Register")
- }
- /*================================================================================
- [Menu Handlers]
- =================================================================================*/
- // Game Menu
- public menu_game(id, key)
- {
- switch (key)
- {
- case 0: // Buy Weapons
- {
- // Custom buy menus enabled?
- if (get_pcvar_num(cvar_buycustom))
- {
- // Disable the remember selection setting
- WPN_AUTO_ON = 0
- zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"BUY_ENABLED")
- // Show menu if player hasn't yet bought anything
- if (g_canbuy[id]) show_menu_eleccion(id)
- }
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- }
- case 1: // Extra Items
- {
- // Extra items enabled?
- if (get_pcvar_num(cvar_extraitems))
- {
- // Check whether the player is able to buy anything
- if (is_user_alive(id) && !g_survivor[id] && !g_nemesis[id])
- show_menu_extras(id)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT")
- }
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT_EXTRAS")
- }
- case 2: // Zombie Classes || Human Classes
- {
- // Zombie classes enabled?
- if (g_zombie[id])
- show_menu_zclass(id)
- else
- show_menu_hclass(id)
- }
- case 3: // Unstuck
- {
- // Check if player is stuck
- if (is_user_alive(id) && is_player_stuck(id))
- {
- // Spawn randomly / get back to base
- if (get_pcvar_num(cvar_randspawn))
- do_random_spawn(id)
- else
- dllfunc(DLLFunc_Spawn, id)
- }
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT_STUCK")
- }
- case 4: // Join Spectator
- {
- // If alive
- if (is_user_alive(id))
- {
- // Check that we still have both humans and zombies to keep the round going
- check_round(id)
- // Kill him before he switches team
- dllfunc(DLLFunc_ClientKill, id)
- }
- // Temporarily save player stats?
- if (get_pcvar_num(cvar_statssave)) save_stats(id)
- // Remove previous tasks
- remove_task(id+TASK_TEAM)
- remove_task(id+TASK_MODEL)
- remove_task(id+TASK_FLASH)
- remove_task(id+TASK_CHARGE)
- remove_task(id+TASK_SPAWN)
- remove_task(id+TASK_BLOOD)
- // Then move him to the spectator team
- fm_set_user_team(id, CS_TEAM_SPECTATOR)
- fm_user_team_update(id)
- }
- case 5: menu_usuario(id)
- case 6: menu_upgrade(id)
- case 7: cmdParty(id)
- case 8: // Admin Menu
- {
- // Check if player has the required access
- if (get_user_flags(id) & ACCESS_FLAG)
- show_menu_admin(id)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_ACCESS")
- }
- }
- return PLUGIN_HANDLED;
- }
- // Buy Menu 1
- public menu_buy1(id, key)
- {
- // Zombies or survivors get no guns
- if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
- return PLUGIN_HANDLED;
- // Special keys / weapon list exceeded
- if (key >= MENU_KEY_AUTOSELECT || WPN_SELECTION >= WPN_MAXIDS)
- {
- switch (key)
- {
- case MENU_KEY_AUTOSELECT: // toggle auto select
- {
- WPN_AUTO_ON = 1 - WPN_AUTO_ON
- }
- case MENU_KEY_NEXT: // next/back
- {
- if (WPN_STARTID+7 < WPN_MAXIDS)
- WPN_STARTID += 7
- else
- WPN_STARTID = 0
- }
- case MENU_KEY_EXIT: // exit
- {
- return PLUGIN_HANDLED;
- }
- }
- // Show buy menu again
- show_menu_buy1(id)
- return PLUGIN_HANDLED;
- }
- if(g_level[id] >= lvlarmas[WPN_SELECTION] && g_reset[id] >= resetarmas[WPN_SELECTION])
- {
- // Store selected weapon id
- WPN_AUTO_PRI = WPN_SELECTION
- // Buy primary weapon
- buy_primary_weapon(id, WPN_AUTO_PRI)
- // Show pistols menu
- show_menu_buy2(id)
- }
- else
- show_menu_buy1(id)
- return PLUGIN_HANDLED;
- }
- // Buy Primary Weapon
- buy_primary_weapon(id, selection)
- {
- // Drop previous weapons
- drop_weapons(id, 1)
- drop_weapons(id, 2)
- // Strip off from weapons
- fm_strip_user_weapons(id)
- fm_give_item(id, "weapon_knife")
- // Get weapon index
- static weaponid
- weaponid = get_weaponid(g_primary_items[selection])
- // Give the new weapon
- fm_give_item(id, g_primary_items[selection])
- fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
- // Weapons bought
- g_canbuy[id] = false
- }
- // Buy Menu 2
- public menu_buy2(id, key)
- {
- // Zombies or survivors get no guns
- if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
- return PLUGIN_HANDLED;
- // Special keys / weapon list exceeded
- if (key >= sizeof g_secondary_items)
- {
- // Toggle autoselect
- if (key == MENU_KEY_AUTOSELECT)
- WPN_AUTO_ON = 1 - WPN_AUTO_ON
- // Reshow menu unless user exited
- if (key != MENU_KEY_EXIT)
- show_menu_buy2(id)
- return PLUGIN_HANDLED;
- }
- // Store selected weapon
- WPN_AUTO_SEC = key
- // Drop secondary gun again, in case we picked another (bugfix)
- drop_weapons(id, 2)
- // Get weapon index
- static weaponid
- weaponid = get_weaponid(g_secondary_items[key])
- // Give the new weapon with full ammo
- fm_give_item(id, g_secondary_items[key])
- fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
- show_menu_granades(id)
- if (g_humanclassnext[id] == HCLASS_NONE && get_pcvar_num(cvar_hclasses))
- set_task(5.0, "show_menu_hclass", id)
- return PLUGIN_HANDLED;
- }
- // Extra Items Menu
- public menu_extras(id, key)
- {
- // Nemesis or Survivor shouldnt get extra items
- if (g_survivor[id] || g_nemesis[id] || !is_user_alive(id))
- {
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- return PLUGIN_HANDLED;
- }
- // Special keys / items list exceeded
- if (key >= MENU_KEY_BACK || EXTRAS_SELECTION >= g_extraitem_i)
- {
- switch (key)
- {
- case MENU_KEY_BACK: // back
- {
- if (EXTRAS_STARTID-7 >= 0) EXTRAS_STARTID -= 7
- }
- case MENU_KEY_NEXT: // next
- {
- if (EXTRAS_STARTID+7 < g_extraitem_i) EXTRAS_STARTID += 7
- }
- case MENU_KEY_EXIT: // exit
- {
- return PLUGIN_HANDLED;
- }
- }
- // Show extra items menu again
- show_menu_extras(id)
- return PLUGIN_HANDLED;
- }
- // Try to buy the item
- buy_extra_item(id, EXTRAS_SELECTION);
- return PLUGIN_HANDLED;
- }
- // Buy Extra Item
- buy_extra_item(id, itemid)
- {
- // Check for human only items
- if (g_zombie[id] && g_extraitem_team[itemid] == ZP_TEAM_HUMAN)
- {
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_HUMAN_ONLY")
- return;
- }
- // Check for zombie only items
- if (!g_zombie[id] && g_extraitem_team[itemid] == ZP_TEAM_ZOMBIE)
- {
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_ZOMBIE_ONLY")
- return;
- }
- // Check for unavailable items
- 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)))
- {
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- return;
- }
- // Check for hard coded items with special conditions
- 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)))
- {
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_CANTUSE")
- return;
- }
- // Check that we have enough ammo packs
- if (g_ammopacks[id] < g_extraitem_cost[itemid] * g_level[id])
- {
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "NOT_ENOUGH_AMMO")
- return;
- }
- // Deduce item cost
- update_ap(id, 0 - g_extraitem_cost[itemid] * g_level[id], 0)
- // Check which kind of item we're buying
- switch (itemid)
- {
- case EXTRA_NVISION: // Night Vision
- {
- if (!is_user_bot(id))
- {
- g_nvision[id] = true
- g_nvisionenabled[id] = true
- // Custom nvg?
- if (get_pcvar_num(cvar_cnvg))
- {
- remove_task(id+TASK_NVISION)
- set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
- }
- else
- set_user_gnvision(id, 1)
- }
- else
- fm_set_bot_nvg(id, 1)
- }
- case EXTRA_ANTIDOTE: // Antidote
- {
- humanme(id, 0)
- }
- case EXTRA_MADNESS: // Zombie Madness
- {
- g_nodamage[id] = true
- zombie_aura(id+TASK_BLOOD)
- engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_madness[random_num(0, sizeof zombie_madness - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- set_task(get_pcvar_float(cvar_madnessduration), "madness_over", id+TASK_BLOOD)
- }
- case EXTRA_INFBOMB: // Infection Bomb
- {
- // Increase infection bomb purchase count for this round
- g_infbombcounter++
- // Already own one
- if (user_has_weapon(id, CSW_HEGRENADE))
- {
- // Increase BP ammo on it instead
- fm_set_user_bpammo(id, CSW_HEGRENADE, fm_get_user_bpammo(id, CSW_HEGRENADE) + 1)
- // Flash ammo in hud
- message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
- write_byte(AMMOID[CSW_HEGRENADE]) // ammo id
- write_byte(1) // ammo amount
- message_end()
- // Play clip purchase sound
- engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
- return; // stop here
- }
- // Give weapon to the player
- fm_give_item(id, "weapon_hegrenade")
- }
- case EXTRA_WEAPONS_STARTID .. EXTRAS_CUSTOM_STARTID-1: // Weapons
- {
- // Get weapon index
- static weaponid
- weaponid = get_weaponid(g_extra_items[itemid-4])
- // If we are giving a primary/secondary weapon
- if (MAXBPAMMO[weaponid] > 2)
- {
- // Make user drop the previous one
- if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
- drop_weapons(id, 1)
- else
- drop_weapons(id, 2)
- // Give full BP ammo for the new one
- fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
- }
- // If we are giving a grenade which the user already owns
- else if (user_has_weapon(id, weaponid))
- {
- // Increase BP ammo on it instead
- fm_set_user_bpammo(id, weaponid, fm_get_user_bpammo(id, weaponid) + 1)
- // Flash ammo in hud
- message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
- write_byte(AMMOID[weaponid]) // ammo id
- write_byte(1) // ammo amount
- message_end()
- // Play clip purchase sound
- engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
- return; // stop here
- }
- // Give weapon to the player
- fm_give_item(id, g_extra_items[itemid-4])
- }
- default: // Custom additions
- {
- // Item selected forward
- ExecuteForward(g_fwExtraItemSelected, g_fwDummyResult, id, itemid);
- }
- }
- }
- // Zombie Class Menu
- public menu_zclass(id, key)
- {
- // Special keys / items list exceeded
- if (key >= MENU_KEY_BACK || ZCLASSES_SELECTION >= g_zclass_i)
- {
- switch (key)
- {
- case MENU_KEY_BACK: // back
- {
- if (ZCLASSES_STARTID-6 >= 0) ZCLASSES_STARTID -= 6
- }
- case MENU_KEY_NEXT: // next
- {
- if (ZCLASSES_STARTID+6 < g_zclass_i) ZCLASSES_STARTID += 6
- }
- case MENU_KEY_EXIT: // exit
- {
- return PLUGIN_HANDLED;
- }
- }
- // Show extra items menu again
- show_menu_zclass(id)
- return PLUGIN_HANDLED;
- }
- if (g_level[id] >= g_zclass_lvl[ZCLASSES_SELECTION])
- {
- // Store selection for the next infection
- g_zombieclassnext[id] = ZCLASSES_SELECTION;
- // Show selected zombie class info and stats
- zp_colored_print(id, "^x04[ZP]^x01 %L: %s", id, "ZOMBIE_SELECT", g_zclass_name[g_zombieclassnext[id]])
- 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]],
- id, "ZOMBIE_ATTRIB3", floatround(g_zclass_grav[g_zombieclassnext[id]]*800), id, "ZOMBIE_ATTRIB4", floatround(g_zclass_kb[g_zombieclassnext[id]]*100))
- }
- else
- {
- 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])
- return PLUGIN_HANDLED;
- }
- return PLUGIN_HANDLED;
- }
- // Human Class Menu
- public menu_hclass(id, key)
- {
- // Special keys / items list exceeded
- if (key >= MENU_KEY_BACK || HCLASSES_SELECTION >= g_hclass_i)
- {
- switch (key)
- {
- case MENU_KEY_BACK: // back
- {
- if (HCLASSES_STARTID-6 >= 0) HCLASSES_STARTID -= 6
- }
- case MENU_KEY_NEXT: // next
- {
- if (HCLASSES_STARTID+6 < g_hclass_i) HCLASSES_STARTID += 6
- }
- case MENU_KEY_EXIT: // exit
- {
- return PLUGIN_HANDLED;
- }
- }
- // Show extra items menu again
- show_menu_hclass(id)
- return PLUGIN_HANDLED;
- }
- if (g_level[id] >= g_hclass_lvl[HCLASSES_SELECTION])
- {
- // Store selection for the next infection
- g_humanclassnext[id] = HCLASSES_SELECTION;
- // Show selected zombie class info and stats
- zp_colored_print(id, "^x04[ZP]^x01 %L: %s", id, "HUMAN_SELECT", g_hclass_name[g_humanclassnext[id]])
- 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]],
- id, "HUMAN_ATTRIB3", floatround(g_hclass_grav[g_humanclassnext[id]]*800))
- }
- else
- {
- 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])
- return PLUGIN_HANDLED;
- }
- return PLUGIN_HANDLED;
- }
- // Info Menu
- public menu_info(id, key)
- {
- static motd[1000], len
- len = 0
- switch (key)
- {
- case 0: // General
- {
- static weather, lights[2]
- weather = 0
- // Get light style
- get_pcvar_string(cvar_lighting, lights, sizeof lights - 1)
- strtolower(lights)
- len += formatex(motd[len], sizeof motd - 1 - len, "%L ", id, "MOTD_INFO11", "Zombie Plague", PLUGIN_VERSION, "Alan<3")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO12")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_A")
- #if defined AMBIENCE_FOG
- len += formatex(motd[len], sizeof motd - 1 - len, (weather < 1) ? " %L" : ". %L", id, "MOTD_FOG")
- weather++
- #endif
- #if defined AMBIENCE_RAIN
- len += formatex(motd[len], sizeof motd - 1 - len, (weather < 1) ? " %L" : ". %L", id, "MOTD_RAIN")
- weather++
- #endif
- #if defined AMBIENCE_SNOW
- len += formatex(motd[len], sizeof motd - 1 - len, (weather < 1) ? " %L" : ". %L", id, "MOTD_SNOW")
- weather++
- #endif
- if (weather < 1) len += formatex(motd[len], sizeof motd - 1 - len, " %L", id, "MOTD_DISABLED")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_B", lights)
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_C", id, get_pcvar_num(cvar_triggered) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- 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))
- 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")
- 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")
- if (get_pcvar_num(cvar_deathmatch)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_G", get_pcvar_num(cvar_spawnprotection))
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_H", id, get_pcvar_num(cvar_randspawn) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_I", id, get_pcvar_num(cvar_extraitems) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_J", id, get_pcvar_num(cvar_zclasses) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_K", id, get_pcvar_num(cvar_cnvg) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO1_L", id, get_pcvar_num(cvar_cflash) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- show_motd(id, motd)
- }
- case 1: // Humans
- {
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_A", g_hclass_hp[0])
- 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))
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_C", g_hclass_spd[0])
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_D", floatround(g_hclass_grav[0]*800))
- 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")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_F", get_pcvar_num(cvar_ammodamage))
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_G", id, get_pcvar_num(cvar_firegrenades) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_H", id, get_pcvar_num(cvar_frostgrenades) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_I", id, get_pcvar_num(cvar_flaregrenades) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO2_J", id, get_pcvar_num(cvar_knockback) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- show_motd(id, motd)
- }
- case 2: // Zombies
- {
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_A", g_zclass_hp[0])
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_B", floatround(g_zclass_hp[0]*get_pcvar_float(cvar_zombiefirsthp)))
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_C", floatround(get_pcvar_float(cvar_zombiearmor)*100))
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_D", g_zclass_spd[0])
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_E", floatround(g_zclass_grav[0]*800))
- if (get_pcvar_num(cvar_zombiebonushp)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_F", get_pcvar_num(cvar_zombiebonushp))
- 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")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_H", id, get_pcvar_num(cvar_zombiebleeding) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO3_I", get_pcvar_num(cvar_ammoinfect))
- show_motd(id, motd)
- }
- case 3: // Gameplay Modes
- {
- static nemhp[5], survhp[5]
- // Get nemesis and survivor health
- num_to_str(get_pcvar_num(cvar_nemhp), nemhp, sizeof nemhp - 1)
- num_to_str(get_pcvar_num(cvar_survhp), survhp, sizeof survhp - 1)
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_A", id, get_pcvar_num(cvar_nem) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- if (get_pcvar_num(cvar_nem)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_B", get_pcvar_num(cvar_nemchance))
- 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]")
- if (get_pcvar_num(cvar_nem)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_D", get_pcvar_num(cvar_nemspd))
- 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))
- 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")
- 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")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_H", id, get_pcvar_num(cvar_surv) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- if (get_pcvar_num(cvar_surv)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_I", get_pcvar_num(cvar_survchance))
- 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]")
- if (get_pcvar_num(cvar_surv)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_K", get_pcvar_num(cvar_survspd))
- 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))
- 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")
- 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")
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_O", id, get_pcvar_num(cvar_swarm) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- if (get_pcvar_num(cvar_swarm)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_P", get_pcvar_num(cvar_swarmchance))
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_Q", id, get_pcvar_num(cvar_multi) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- if (get_pcvar_num(cvar_multi)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_R", get_pcvar_num(cvar_multichance))
- 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))
- len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_T", id, get_pcvar_num(cvar_plague) ? "MOTD_ENABLED" : "MOTD_DISABLED")
- if (get_pcvar_num(cvar_plague)) len += formatex(motd[len], sizeof motd - 1 - len, "%L", id, "MOTD_INFO4_U", get_pcvar_num(cvar_plaguechance))
- 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))
- show_motd(id, motd)
- }
- default: return PLUGIN_HANDLED;
- }
- // Show help menu again if user wishes to read another topic
- set_task(0.2, "show_menu_info", id);
- return PLUGIN_HANDLED;
- }
- // Admin Menu
- public menu_admin(id, key)
- {
- switch (key)
- {
- case 0: // Zombiefy/Humanize command
- {
- if (g_endround || g_swarmround || g_nemround || g_survround || g_plagueround || task_exists(TASK_WELCOMEMSG))
- {
- // Not available
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- show_menu_admin(id)
- }
- else
- {
- // Show player list for admin to pick a target
- PL_ACTION = key
- show_menu_player_list(id)
- }
- }
- case 1: // Nemesis command
- {
- if (g_endround || !g_newround || !get_pcvar_num(cvar_nem) || task_exists(TASK_WELCOMEMSG))
- {
- // Not available
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- show_menu_admin(id)
- }
- else
- {
- // Show player list for admin to pick a target
- PL_ACTION = key
- show_menu_player_list(id)
- }
- }
- case 2: // Survivor command
- {
- if (g_endround || !g_newround || !get_pcvar_num(cvar_surv) || task_exists(TASK_WELCOMEMSG))
- {
- // Not available
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- show_menu_admin(id)
- }
- else
- {
- // Show player list for admin to pick a target
- PL_ACTION = key
- show_menu_player_list(id)
- }
- }
- case 3: // Respawn command
- {
- if (g_endround || g_survround || g_swarmround || g_nemround || g_plagueround)
- {
- // Not available
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- show_menu_admin(id)
- }
- else
- {
- // Show player list for admin to pick a target
- PL_ACTION = key
- show_menu_player_list(id)
- }
- }
- case 4: // Swarm Mode command
- {
- if (allowed_swarm())
- command_swarm(id)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- show_menu_admin(id)
- }
- case 5: // Multiple Infection command
- {
- if (allowed_multi())
- command_multi(id)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- show_menu_admin(id)
- }
- case 6: // Plague Mode command
- {
- if (allowed_plague())
- command_plague(id)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- show_menu_admin(id)
- }
- case 7: // Armagedon Mode command
- {
- if (allowed_armagedon())
- command_armagedon(id)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- show_menu_admin(id)
- }
- }
- return PLUGIN_HANDLED;
- }
- // Player List Menu
- public menu_player_list(id, key)
- {
- switch (key)
- {
- case MENU_KEY_BACK: // back
- {
- if (PL_STARTID-7 >= 0) PL_STARTID -= 7
- }
- case MENU_KEY_NEXT: // next
- {
- if (PL_STARTID+7 < g_maxplayers) PL_STARTID += 7
- }
- case MENU_KEY_EXIT: // go back to admin menu
- {
- show_menu_admin(id);
- return PLUGIN_HANDLED
- }
- default: // perform action on player
- {
- // Make sure it's connected
- if (is_user_connected(PL_SELECTION))
- {
- // Perform the right action if allowed
- switch (PL_ACTION)
- {
- case 0:
- {
- if (g_zombie[PL_SELECTION])
- {
- if (allowed_human(PL_SELECTION))
- command_human(id, PL_SELECTION)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- }
- else
- {
- if (allowed_zombie(PL_SELECTION))
- command_zombie(id, PL_SELECTION)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- }
- }
- case 1:
- {
- if (allowed_nemesis(PL_SELECTION))
- command_nemesis(id, PL_SELECTION)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- }
- case 2:
- {
- if (allowed_survivor(PL_SELECTION))
- command_survivor(id, PL_SELECTION)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- }
- case 3:
- {
- if (allowed_respawn(PL_SELECTION))
- command_respawn(id, PL_SELECTION)
- else
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- }
- }
- }
- else
- {
- zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
- }
- }
- }
- show_menu_player_list(id)
- return PLUGIN_HANDLED;
- }
- public menu_registro(id, key)
- {
- static szData[512]
- switch (key)
- {
- case 0:
- {
- if (!fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
- {
- client_cmd(id, "messagemode Create_Password")
- set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
- ShowSyncHudMsg(id, g_MsgSync3, "Enter a new password^nPress ESC to exit")
- }
- else
- {
- zp_colored_print(id, "^x04[ZP]^x01 You cannot use this option.")
- show_menu_registro(id)
- }
- }
- case 1:
- {
- if (fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
- {
- client_cmd(id, "messagemode Login_Password")
- set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
- ShowSyncHudMsg(id, g_MsgSync3, "Enter your password^nPress ESC to exit.")
- }
- else
- {
- zp_colored_print(id, "^x04[ZP]^x01 You cannot use this option.")
- show_menu_registro(id)
- }
- }
- }
- return PLUGIN_HANDLED;
- }
- /*================================================================================
- [Admin Commands]
- =================================================================================*/
- // zp_toggle [1/0]
- public cmd_toggle(id, level, cid)
- {
- // Check for access flag
- if (!cmd_access(id, level, cid, 2))
- return PLUGIN_HANDLED;
- // Retrieve arguments
- new arg[2]
- read_argv(1, arg, sizeof arg - 1)
- // Mod already enabled/disabled
- if (str_to_num(arg) == g_pluginenabled)
- return PLUGIN_HANDLED;
- // Set the toggle cvar
- set_pcvar_num(cvar_toggle, str_to_num(arg))
- // Retrieve map name
- new mapname[32]
- get_mapname(mapname, sizeof mapname - 1)
- // Restart current map
- server_cmd("changelevel %s", mapname)
- return PLUGIN_HANDLED;
- }
- // zp_zombie [target]
- public cmd_zombie(id, level, cid)
- {
- // Check for access flag
- if (!cmd_access(id, level, cid, 2))
- return PLUGIN_HANDLED;
- // Retrieve arguments
- static arg[32], player
- read_argv(1, arg, sizeof arg - 1)
- player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
- // Invalid target
- if (!player) return PLUGIN_HANDLED;
- // Target not allowed to be zombie
- if (!allowed_zombie(player))
- {
- client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
- return PLUGIN_HANDLED
- }
- command_zombie(id, player)
- return PLUGIN_HANDLED;
- }
- // zp_human [target]
- public cmd_human(id, level, cid)
- {
- // Check for access flag
- if (!cmd_access(id, level, cid, 2))
- return PLUGIN_HANDLED;
- // Retrieve arguments
- static arg[32], player
- read_argv(1, arg, sizeof arg - 1)
- player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
- // Invalid target
- if (!player) return PLUGIN_HANDLED;
- // Target not allowed to be human
- if (!allowed_human(player))
- {
- client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
- return PLUGIN_HANDLED;
- }
- command_human(id, player)
- return PLUGIN_HANDLED;
- }
- // zp_survivor [target]
- public cmd_survivor(id, level, cid)
- {
- // Check for access flag
- if (!cmd_access(id, level, cid, 2))
- return PLUGIN_HANDLED;
- // Retrieve arguments
- static arg[32], player
- read_argv(1, arg, sizeof arg - 1)
- player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
- // Invalid target
- if (!player) return PLUGIN_HANDLED;
- // Target not allowed to be survivor
- if (!allowed_survivor(player))
- {
- client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
- return PLUGIN_HANDLED;
- }
- command_survivor(id, player)
- return PLUGIN_HANDLED;
- }
- // zp_nemesis [target]
- public cmd_nemesis(id, level, cid)
- {
- // Check for access flag
- if (!cmd_access(id, level, cid, 2))
- return PLUGIN_HANDLED;
- // Retrieve arguments
- static arg[32], player
- read_argv(1, arg, sizeof arg - 1)
- player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF)
- // Invalid target
- if (!player) return PLUGIN_HANDLED;
- // Target not allowed to be nemesis
- if (!allowed_nemesis(player))
- {
- client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
- return PLUGIN_HANDLED;
- }
- command_nemesis(id, player)
- return PLUGIN_HANDLED;
- }
- // zp_respawn [target]
- public cmd_respawn(id, level, cid)
- {
- // Check for access flag
- if (!cmd_access(id, level, cid, 2))
- return PLUGIN_HANDLED;
- // Retrieve arguments
- static arg[32], player
- read_argv(1, arg, sizeof arg - 1)
- player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
- // Invalid target
- if (!player) return PLUGIN_HANDLED;
- // Target not allowed to be respawned
- if (!allowed_respawn(player))
- {
- client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
- return PLUGIN_HANDLED;
- }
- command_respawn(id, player)
- return PLUGIN_HANDLED;
- }
- // zp_swarm
- public cmd_swarm(id, level, cid)
- {
- // Check for access flag
- if (!cmd_access(id, level, cid, 1))
- return PLUGIN_HANDLED;
- // Swarm mode not allowed
- if (!allowed_swarm())
- {
- client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
- return PLUGIN_HANDLED;
- }
- command_swarm(id)
- return PLUGIN_HANDLED;
- }
- // zp_armagedon
- public cmd_armagedon(id, level, cid)
- {
- // Check for access flag
- if (!cmd_access(id, level, cid, 1))
- return PLUGIN_HANDLED;
- // Swarm mode not allowed
- if (!allowed_armagedon())
- {
- client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
- return PLUGIN_HANDLED;
- }
- command_armagedon(id)
- return PLUGIN_HANDLED;
- }
- // zp_multi
- public cmd_multi(id, level, cid)
- {
- // Check for access flag
- if (!cmd_access(id, level, cid, 1))
- return PLUGIN_HANDLED;
- // Multi infection mode not allowed
- if (!allowed_multi())
- {
- client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
- return PLUGIN_HANDLED;
- }
- command_multi(id)
- return PLUGIN_HANDLED;
- }
- // zp_plague
- public cmd_plague(id, level, cid)
- {
- // Check for access flag
- if (!cmd_access(id, level, cid, 1))
- return PLUGIN_HANDLED;
- // Plague mode not allowed
- if (!allowed_plague())
- {
- client_print(id, print_console, "[ZP] %L", id, "CMD_NOT")
- return PLUGIN_HANDLED;
- }
- command_plague(id)
- return PLUGIN_HANDLED;
- }
- /*================================================================================
- [Message Hooks]
- =================================================================================*/
- // Current Weapon info
- public message_cur_weapon(msg_id, msg_dest, msg_entity)
- {
- // Player not alive or not an active weapon
- if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
- return;
- // Get weapon id
- static weapon
- weapon = get_msg_arg_int(2)
- // Store weapon id for reference
- g_currentweapon[msg_entity] = weapon
- // Replace weapon models with custom ones
- replace_models(msg_entity)
- // Unlimited Clip Ammo?
- if (MAXBPAMMO[weapon] > 2 && (g_survivor[msg_entity] || get_pcvar_num(cvar_infammo) > 1))
- {
- // Refill when it's running out
- if (get_msg_arg_int(3) < 7)
- {
- // Get weapon entity
- static wname[32], weapon_ent
- get_weaponname(weapon, wname, sizeof wname - 1)
- weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
- // Max out clip ammo
- fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
- }
- // HUD should show full clip all the time
- set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon])
- }
- }
- // BP Ammo update
- public message_ammo_x(msg_id, msg_dest, msg_entity)
- {
- // Get ammo type
- static type
- type = get_msg_arg_int(1)
- // Unknown ammo type
- if (type >= sizeof AMMOWEAPON) return;
- // Get weapon id
- static weapon
- weapon = AMMOWEAPON[type]
- // Primary and secondary only
- if (MAXBPAMMO[weapon] > 2)
- {
- // Get ammo amount
- static amount
- amount = get_msg_arg_int(2)
- // Unlimited BP Ammo?
- if (g_survivor[msg_entity] || get_pcvar_num(cvar_infammo))
- {
- if (amount < MAXBPAMMO[weapon])
- {
- fm_set_user_bpammo(msg_entity, weapon, MAXBPAMMO[weapon])
- set_msg_arg_int(2, get_msg_argtype(2), MAXBPAMMO[weapon])
- }
- }
- // Bots automatically buy ammo when needed
- else if (!g_zombie[msg_entity] && !g_survivor[msg_entity] && g_ammopacks[msg_entity] > 0 && amount <= BUYAMMO[weapon] && is_user_bot(msg_entity))
- clcmd_buyammo(msg_entity);
- }
- }
- // Take off player's money
- public message_money(msg_id, msg_dest, msg_entity)
- {
- // Remove money setting enabled?
- if (!get_pcvar_num(cvar_removemoney))
- return PLUGIN_CONTINUE;
- set_pdata_int(msg_entity, OFFSET_CSMONEY, 0, OFFSET_LINUX)
- return PLUGIN_HANDLED;
- }
- // Fix for the HL engine bug when HP is multiples of 256
- public message_health(msg_id, msg_dest, msg_entity)
- {
- // Get player's health
- static health
- health = get_msg_arg_int(1)
- // Don't bother
- if (health < 256) return;
- // Check if we need to fix it
- if (health % 256 == 0)
- fm_set_user_health(msg_entity, pev(msg_entity, pev_health)+1)
- // HUD can only show as much as 255 hp
- set_msg_arg_int(1, get_msg_argtype(1), 255)
- }
- // Block flashlight battery messages when it's not available, or if custom flashlight is enabled instead
- public message_flashbat(msg_id, msg_dest, msg_entity)
- {
- if (g_zombie[msg_entity] || g_survivor[msg_entity] || get_pcvar_num(cvar_cflash) || !is_user_alive(msg_entity))
- return PLUGIN_HANDLED;
- return PLUGIN_CONTINUE;
- }
- // Flashbangs should only affect zombies
- public message_screenfade(msg_id, msg_dest, msg_entity)
- {
- 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)
- return PLUGIN_CONTINUE;
- // Nemesis shouldn't be FBed
- if (g_zombie[msg_entity] && !g_nemesis[msg_entity])
- {
- // Set flash color to nighvision's
- set_msg_arg_int(4, get_msg_argtype(4), get_pcvar_num(cvar_nvgcolor[0]))
- set_msg_arg_int(5, get_msg_argtype(5), get_pcvar_num(cvar_nvgcolor[1]))
- set_msg_arg_int(6, get_msg_argtype(6), get_pcvar_num(cvar_nvgcolor[2]))
- return PLUGIN_CONTINUE;
- }
- return PLUGIN_HANDLED;
- }
- // Prevent spectators' nightvision from being turned off when switching targets, etc.
- public message_nvgtoggle(msg_id, msg_dest, msg_entity)
- {
- return PLUGIN_HANDLED;
- }
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- // Set correct model on player corpses
- public message_clcorpse()
- {
- set_msg_arg_string(1, g_playermodel[get_msg_arg_int(12)])
- }
- #endif
- // Prevent zombies from seeing any weapon pickup icon
- public message_weappickup(msg_id, msg_dest, msg_entity)
- {
- if (g_zombie[msg_entity])
- return PLUGIN_HANDLED;
- return PLUGIN_CONTINUE;
- }
- // Prevent zombies from seeing any ammo pickup icon
- public message_ammopickup(msg_id, msg_dest, msg_entity)
- {
- if (g_zombie[msg_entity])
- return PLUGIN_HANDLED;
- return PLUGIN_CONTINUE;
- }
- // Block hostage HUD display
- public message_scenario()
- {
- if (get_msg_args() > 1)
- {
- static sprite[8]
- get_msg_arg_string(2, sprite, sizeof sprite - 1)
- if (equal(sprite, "hostage"))
- return PLUGIN_HANDLED;
- }
- return PLUGIN_CONTINUE;
- }
- // Block hostages from appearing on radar
- public message_hostagepos()
- {
- return PLUGIN_HANDLED;
- }
- // Block some text messages
- public message_textmsg()
- {
- static textmsg[22]
- get_msg_arg_string(2, textmsg, sizeof textmsg - 1);
- // Game restarting, reset scores and call round end to balance the teams
- if (equal(textmsg, "#Game_will_restart_in"))
- {
- g_scorehumans = 0
- g_scorezombies = 0
- logevent_round_end()
- }
- // Block round end related messages
- else if (equal(textmsg, "#Hostages_Not_Rescued") || equal(textmsg, "#Round_Draw") || equal(textmsg, "#Terrorists_Win") || equal(textmsg, "#CTs_Win"))
- {
- return PLUGIN_HANDLED;
- }
- return PLUGIN_CONTINUE;
- }
- // Block CS round win audio messages, since we're playing our own instead
- public message_sendaudio()
- {
- static audio[17]
- get_msg_arg_string(2, audio, sizeof audio - 1)
- if(equal(audio[7], "terwin") || equal(audio[7], "ctwin") || equal(audio[7], "rounddraw"))
- return PLUGIN_HANDLED;
- return PLUGIN_CONTINUE;
- }
- // Send actual team scores (T = zombies // CT = humans)
- public message_teamscore()
- {
- static team[2]
- get_msg_arg_string(1, team, sizeof team - 1)
- switch (team[0])
- {
- // CT
- case 'C': set_msg_arg_int(2, get_msg_argtype(2), g_scorehumans)
- // Terrorist
- case 'T': set_msg_arg_int(2, get_msg_argtype(2), g_scorezombies)
- }
- }
- // Team Switch (or player joining a team for first time)
- public message_teaminfo(msg_id, msg_dest)
- {
- // Only hook global messages
- if (msg_dest != MSG_ALL && msg_dest != MSG_BROADCAST) return;
- // Get player id
- static id
- id = get_msg_arg_int(1)
- // Don't pick up our own TeamInfo messages for this player (bugfix)
- if (g_switchingteam[id]) return;
- // Enable spectators' nightvision if not spawning right away
- set_task(0.2, "spec_nvision", id)
- // Round didn't start yet, nothing to worry about
- if (g_newround) return;
- // Get his new team
- static team[2]
- get_msg_arg_string(2, team, sizeof team - 1)
- switch (team[0])
- {
- case 'C': // CT
- {
- if (g_survround && fnGetHumans()) // survivor alive --> switch to T and spawn as zombie
- {
- g_respawn_as_zombie[id] = true;
- remove_task(id+TASK_TEAM)
- fm_set_user_team(id, CS_TEAM_T)
- set_msg_arg_string(2, "TERRORIST")
- }
- else if (!fnGetZombies()) // no zombies alive --> switch to T and spawn as zombie
- {
- g_respawn_as_zombie[id] = true;
- remove_task(id+TASK_TEAM)
- fm_set_user_team(id, CS_TEAM_T)
- set_msg_arg_string(2, "TERRORIST")
- }
- }
- case 'T': // Terrorist
- {
- if ((g_swarmround || g_survround) && fnGetHumans()) // survivor alive or swarm round w/ humans --> spawn as zombie
- {
- g_respawn_as_zombie[id] = true;
- }
- else if (g_armagedonround && fnGetHumans()) g_respawn_as_zombie[id] = false;
- else if (fnGetZombies()) // zombies alive --> switch to CT
- {
- remove_task(id+TASK_TEAM)
- fm_set_user_team(id, CS_TEAM_CT)
- set_msg_arg_string(2, "CT")
- }
- }
- }
- }
- /*================================================================================
- [Main Functions]
- =================================================================================*/
- // Make Zombie Task
- public make_zombie_task()
- {
- // Call make a zombie with no specific mode
- make_a_zombie(MODE_NONE, 0)
- }
- // Make a Zombie Function
- make_a_zombie(mode, id)
- {
- // Get alive players count
- static iPlayersnum
- iPlayersnum = fnGetAlive()
- // Not enough players, come back later!
- if (iPlayersnum < 1)
- {
- set_task(10.0, "make_zombie_task", TASK_MAKEZOMBIE)
- return;
- }
- #if defined AMBIENCE_SOUNDS
- // Start ambience sounds after a mode begins
- remove_task(TASK_AMBIENCESOUNDS)
- set_task(2.0, "ambience_sound_effects", TASK_AMBIENCESOUNDS)
- #endif
- // Get prevent consecutive modes setting
- static preventconsecutive
- preventconsecutive = get_pcvar_num(cvar_preventconsecutive)
- // Round starting
- g_newround = false
- g_survround = false
- g_nemround = false
- g_swarmround = false
- g_plagueround = false
- g_armagedonround = false
- // Set up some common vars
- static forward_id, name[32], iZombies, iMaxZombies
- 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)
- {
- // Survivor Mode
- g_survround = true
- g_lastmode = MODE_SURVIVOR
- // Choose player randomly?
- if (mode == MODE_NONE)
- id = fnGetRandomAlive(random_num(1, iPlayersnum))
- // Remember id for calling our forward later
- forward_id = id
- // Turn player into a survivor
- humanme(id, 1)
- // Turn the remaining players into zombies
- for (id = 1; id <= g_maxplayers; id++)
- {
- // Not alive
- if (!is_user_alive(id))
- continue;
- // Survivor or already a zombie
- if (g_survivor[id] || g_zombie[id])
- continue;
- // Turn into a zombie
- zombieme(id, 0, 0, 1)
- }
- // Play survivor sound
- PlaySound(sound_survivor[random_num(0, sizeof sound_survivor -1)]);
- // Get player's name
- get_user_name(forward_id, name, sizeof name - 1)
- // Show Survivor HUD notice
- set_hudmessage(20, 20, 255, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SURVIVOR", name)
- // Round start forward
- ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_SURVIVOR, forward_id);
- }
- 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)
- {
- //Armagedon Mode
- g_plagueround = true
- g_armagedonround = true
- new Float:Time // Creamos un Float con el Nombre 'Time'
- Time = 10.0 // Le asignamos al Float 'Time' 10 Segundos
- // Creamos el Efecto (ScreenFade)
- message_begin(MSG_BROADCAST, g_msgScreenFade) // Open The Function
- write_short((1<<12)*4) // Duration
- write_short(floatround((1<<12)*(Time+2.2))) // Hold Time
- write_short(0x0001) // Fade Type
- write_byte(0) // Color Red
- write_byte(0) // Color Green
- write_byte(0) // Color Blue
- write_byte(255) // Alpha: 255 = Se oscurece toda la Pantalla
- message_end() // Close The Funcion
- set_task(2.0, "Notice_One") // Creamos un Task para dar la Noticia
- set_task(Time, "EffectModeEnd", id) // Creamos un Task para poder sacar el ScreenFade de a poco y no de golpe.
- // Aca sige todo tu modo...
- // NOTA: Acuerdense de no poner el: set_hudmessage al final del Modo.
- // Turn someone into a Survivor
- id = fnGetRandomAlive(random_num(1, iPlayersnum))
- humanme(id, 1)
- // heal Svruivor
- fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpsurvi)))
- // Turn someone into a Nemesis (not the survivor!)
- while (g_survivor[id]) id = fnGetRandomAlive(random_num(1, iPlayersnum));
- zombieme(id, 0, 1, 0)
- // heal Nem
- fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpneme)))
- // iMaxZombies is rounded up, in case there aren't enough players
- iMaxZombies = floatround((iPlayersnum-2)*get_pcvar_float(cvar_plagueratio), floatround_ceil)
- iZombies = 0
- // Randomly turn iMaxZombies players into zombies
- while (iZombies < iMaxZombies)
- {
- if (id < g_maxplayers)
- id++
- else
- id = 1
- // Dead or already a zombie or survivor
- if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
- continue;
- // Random chance
- if (random_num(0, 1))
- {
- // Turn into a nemesis
- zombieme(id, 0, 1, 0)
- iZombies++
- // Apply nemesis health multiplier
- fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpneme)))
- }
- }
- // Turn the rest of players into humans
- for (id = 1; id <= g_maxplayers; id++)
- {
- // Only those of them who arent zombies or survivor
- if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
- continue
- // Remove previous tasks and make them survivors
- remove_task(id+TASK_TEAM)
- humanme(id, 1)
- // Apply survivor health multiplier
- fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_armagedonhpsurvi)))
- /* Switch to CT
- if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
- {
- fm_set_user_team(id, CS_TEAM_CT)
- set_task(0.1+g_teams_i, "fm_set_user_team_msg", id+TASK_TEAM)
- g_teams_i += 0.1; // increase teams task counter
- }*/
- }
- // Play plague sound
- PlaySound(sound_plague[random_num(0, sizeof sound_plague -1)]);
- // Show Plague HUD notice
- set_hudmessage(0, 50, 200, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_ARMAGEDON")
- // Round start forward
- ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_ARMAGEDON, 0);
- }
- 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)
- {
- // Swarm Mode
- g_swarmround = true
- g_lastmode = MODE_SWARM
- // Turn every T into a zombie
- for (id = 1; id <= g_maxplayers; id++)
- {
- // Not alive
- if (!is_user_alive(id))
- continue;
- // Not a Terrorist
- if (fm_get_user_team(id) != CS_TEAM_T)
- continue;
- // Turn into a zombie
- zombieme(id, 0, 0, 1)
- }
- // Play swarm sound
- PlaySound(sound_swarm[random_num(0, sizeof sound_swarm -1)]);
- // Show Swarm HUD notice
- set_hudmessage(20, 255, 20, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SWARM")
- // Round start forward
- ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_SWARM, 0);
- }
- 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)
- {
- // Multi Infection Mode
- g_lastmode = MODE_MULTI
- // iMaxZombies is rounded up, in case there aren't enough players
- iMaxZombies = floatround(iPlayersnum*get_pcvar_float(cvar_multiratio), floatround_ceil)
- iZombies = 0
- // Randomly turn iMaxZombies players into zombies
- while (iZombies < iMaxZombies)
- {
- // Keep looping through all players
- if (++id > g_maxplayers) id = 1
- // Dead or already a zombie
- if (!is_user_alive(id) || g_zombie[id])
- continue;
- // Random chance
- if (random_num(0, 1))
- {
- // Turn into a zombie
- zombieme(id, 0, 0, 1)
- iZombies++
- }
- }
- // Turn the remaining players into humans
- for (id = 1; id <= g_maxplayers; id++)
- {
- // Only those of them who aren't zombies
- if (!is_user_alive(id) || g_zombie[id])
- continue
- // Remove previous tasks
- remove_task(id+TASK_TEAM)
- // Switch to CT
- if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
- {
- fm_set_user_team(id, CS_TEAM_CT)
- fm_user_team_update(id)
- }
- }
- // Play multi infection sound
- PlaySound(sound_multi[random_num(0, sizeof sound_multi -1)]);
- // Show Multi Infection HUD notice
- set_hudmessage(200, 50, 0, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_MULTI")
- // Round start forward
- ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_MULTI, 0);
- }
- 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
- && 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)
- {
- // Plague Mode
- g_plagueround = true
- g_lastmode = MODE_PLAGUE
- // Turn specified amount of players into Survivors
- static iSurvivors, iMaxSurvivors
- iMaxSurvivors = get_pcvar_num(cvar_plaguesurvnum)
- iSurvivors = 0
- while (iSurvivors < iMaxSurvivors)
- {
- // Choose random guy
- id = fnGetRandomAlive(random_num(1, iPlayersnum))
- // Already a survivor?
- if (g_survivor[id])
- continue;
- // If not, turn him into one
- humanme(id, 1)
- iSurvivors++
- // Apply survivor health multiplier
- fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_plaguesurvhpmulti)))
- }
- // Turn specified amount of players into Nemesis
- static iNemesis, iMaxNemesis
- iMaxNemesis = get_pcvar_num(cvar_plaguenemnum)
- iNemesis = 0
- while (iNemesis < iMaxNemesis)
- {
- // Choose random guy
- id = fnGetRandomAlive(random_num(1, iPlayersnum))
- // Already a survivor or nemesis?
- if (g_survivor[id] || g_nemesis[id])
- continue;
- // If not, turn him into one
- zombieme(id, 0, 1, 0)
- iNemesis++
- // Apply nemesis health multiplier
- fm_set_user_health(id, floatround(pev(id, pev_health)*get_pcvar_float(cvar_plaguenemhpmulti)))
- }
- // iMaxZombies is rounded up, in case there aren't enough players
- iMaxZombies = floatround((iPlayersnum-(get_pcvar_num(cvar_plaguenemnum)+get_pcvar_num(cvar_plaguesurvnum)))*get_pcvar_float(cvar_plagueratio), floatround_ceil)
- iZombies = 0
- // Randomly turn iMaxZombies players into zombies
- while (iZombies < iMaxZombies)
- {
- // Keep looping through all players
- if (++id > g_maxplayers) id = 1
- // Dead or already a zombie or survivor
- if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
- continue;
- // Random chance
- if (random_num(0, 1))
- {
- // Turn into a zombie
- zombieme(id, 0, 0, 1)
- iZombies++
- }
- }
- // Turn the remaining players into humans
- for (id = 1; id <= g_maxplayers; id++)
- {
- // Only those of them who arent zombies or survivor
- if (!is_user_alive(id) || g_zombie[id] || g_survivor[id])
- continue;
- // Remove previous tasks
- remove_task(id+TASK_TEAM)
- // Switch to CT
- if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
- {
- fm_set_user_team(id, CS_TEAM_CT)
- fm_user_team_update(id)
- }
- }
- // Play plague sound
- PlaySound(sound_plague[random_num(0, sizeof sound_plague -1)]);
- // Show Plague HUD notice
- set_hudmessage(0, 50, 200, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_PLAGUE")
- // Round start forward
- ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_PLAGUE, 0);
- }
- else
- {
- // Single Infection Mode or Nemesis Mode
- // Choose player randomly?
- if (mode == MODE_NONE)
- id = fnGetRandomAlive(random_num(1, iPlayersnum))
- // Remember id for calling our forward later
- forward_id = id
- 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)
- {
- // Nemesis Mode
- g_nemround = true
- g_lastmode = MODE_NEMESIS
- // Turn player into nemesis
- zombieme(id, 0, 1, 0)
- }
- else
- {
- // Single Infection Mode
- g_lastmode = MODE_INFECTION
- // Turn player into the first zombie
- zombieme(id, 0, 0, 0)
- }
- // Remaining players should be humans (CTs)
- for (id = 1; id <= g_maxplayers; id++)
- {
- // Not alive
- if (!is_user_alive(id))
- continue;
- // First zombie/nemesis
- if (g_zombie[id])
- continue;
- // Remove previous tasks
- remove_task(id+TASK_TEAM)
- // Switch to CT
- if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
- {
- fm_set_user_team(id, CS_TEAM_CT)
- fm_user_team_update(id)
- }
- }
- if (g_nemround)
- {
- // Play Nemesis sound
- PlaySound(sound_nemesis[random_num(0, sizeof sound_nemesis -1)]);
- // Get player's name
- get_user_name(forward_id, name, sizeof name - 1)
- // Show Nemesis HUD notice
- set_hudmessage(255, 20, 20, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_NEMESIS", name)
- // Round start forward
- ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_NEMESIS, forward_id);
- }
- else
- {
- // Get player's name
- get_user_name(forward_id, name, sizeof name - 1)
- // Show First Zombie HUD notice
- set_hudmessage(255, 0, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 5.0, 1.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L",LANG_PLAYER, "NOTICE_FIRST", name)
- // Round start forward
- ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_INFECTION, forward_id);
- }
- }
- // Last Zombie Check
- set_task(0.1, "fnCheckLastZombie")
- }
- // Zombie Me Function (player id, infector, turn into a nemesis, special mode)
- zombieme(id, infector, nemesis, specialmode)
- {
- // Pre user infect forward
- ExecuteForward(g_fwUserInfected_pre, g_fwDummyResult, id, infector)
- // Show zombie class menu if they haven't chosen any (e.g. just connected)
- if (g_zombieclassnext[id] == ZCLASS_NONE && get_pcvar_num(cvar_zclasses))
- set_task(2.0, "show_menu_zclass", id)
- // Set selected zombie class
- g_zombieclass[id] = g_zombieclassnext[id]
- // If no class selected yet, use the first (default) one
- if (g_zombieclass[id] == ZCLASS_NONE) g_zombieclass[id] = 0
- // Way to go...
- g_zombie[id] = true
- g_survivor[id] = false
- // Set zombie attributes based on the mode
- if (!specialmode)
- {
- if (nemesis)
- {
- // Nemesis
- g_nemesis[id] = true
- // Get nemesis health setting
- static nemhealth, nembasehealth
- nemhealth = get_pcvar_num(cvar_nemhp)
- nembasehealth = get_pcvar_num(cvar_nembasehp)
- // Set health [0 = auto]
- if (nemhealth == 0)
- {
- if (nembasehealth == 0)
- fm_set_user_health(id, g_zclass_hp[0]*fnGetAlive())
- else
- fm_set_user_health(id, nembasehealth*fnGetAlive())
- }
- else
- fm_set_user_health(id, nemhealth)
- // Set gravity
- set_pev(id, pev_gravity, get_pcvar_float(cvar_nemgravity))
- }
- else if (fnGetZombies() == 1)
- {
- // First zombie
- g_firstzombie[id] = true
- // Set health and gravity
- 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])))
- set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]] - Z_GRAVITY(g_skill_points[id][1][3]))
- // Infection sound
- engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_infect[random_num(0, sizeof zombie_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- }
- else
- {
- // Infected by someone
- // Set health and gravity
- fm_set_user_health(id, g_zclass_hp[g_zombieclass[id]] + Z_SALUD(g_skill_points[id][1][1]))
- set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]] - Z_GRAVITY(g_skill_points[id][1][3]))
- // Infection sound
- engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_infect[random_num(0, sizeof zombie_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Get player's name
- static name[32]
- get_user_name(id, name, sizeof name - 1)
- // Show Infection HUD notice
- set_hudmessage(255, 0, 0, HUD_INFECT_X, HUD_INFECT_Y, 0, 0.0, 5.0, 1.0, 1.0, -1)
- if (infector) // infected by someone?
- {
- static name2[32]
- get_user_name(infector, name2, sizeof name2 - 1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_INFECT2", name, name2)
- }
- else ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_INFECT", name)
- }
- }
- else
- {
- // Survivor/multi infection/swarm/plague/infection grenade
- // Set health and gravity
- fm_set_user_health(id, g_zclass_hp[g_zombieclass[id]] + Z_SALUD(g_skill_points[id][1][1]))
- set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]] - Z_GRAVITY(g_skill_points[id][1][3]))
- }
- // Remove previous tasks
- remove_task(id+TASK_TEAM)
- remove_task(id+TASK_MODEL)
- remove_task(id+TASK_BLOOD)
- // Switch to T
- if (fm_get_user_team(id) != CS_TEAM_T) // need to change team?
- {
- fm_set_user_team(id, CS_TEAM_T)
- fm_user_team_update(id)
- }
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- // Set the right model
- if (g_nemesis[id])
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_nemesis[random_num(0, sizeof model_nemesis -1)])
- else
- {
- if (get_pcvar_num(cvar_adminmodelszombie) && get_user_flags(id) & ACCESS_FLAG3)
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin_zombie[random_num(0, sizeof model_admin_zombie -1)])
- else
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_zclass_model[g_zombieclass[id]])
- }
- // Set model on player model entity
- fm_set_playermodel_ent(id)
- // Nemesis glow / remove glow on player model entity
- if (g_nemesis[id] && get_pcvar_num(cvar_nemglow))
- fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 25)
- else
- fm_set_rendering(g_ent_playermodel[id])
- #else
- // Set the right model, after checking that we don't already have it
- static currentmodel[32], already_has_model, i, iRand
- already_has_model = false
- // Get current model and compare it with current one
- fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
- if (g_nemesis[id])
- {
- for (i = 0; i < sizeof model_nemesis; i++)
- if (equal(model_nemesis[i], currentmodel)) already_has_model = true;
- if (!already_has_model)
- {
- iRand = random_num(0, sizeof model_nemesis -1)
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_nemesis[iRand])
- #if defined SET_MODELINDEX_OFFSET
- fm_set_user_model_index(id, g_modelindex_nemesis[iRand])
- #endif
- }
- }
- else
- {
- if (get_pcvar_num(cvar_adminmodelszombie) && get_user_flags(id) & ACCESS_FLAG3)
- {
- for (i = 0; i < sizeof model_admin_zombie; i++)
- if (equal(model_admin_zombie[i], currentmodel)) already_has_model = true;
- if (!already_has_model)
- {
- iRand = random_num(0, sizeof model_admin_zombie -1)
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin_zombie[iRand])
- #if defined SET_MODELINDEX_OFFSET
- fm_set_user_model_index(id, g_modelindex_admin_zombie[iRand])
- #endif
- }
- }
- else
- {
- if (equal(g_zclass_model[g_zombieclass[id]], currentmodel)) already_has_model = true;
- if (!already_has_model)
- {
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_zclass_model[g_zombieclass[id]])
- #if defined SET_MODELINDEX_OFFSET
- fm_set_user_model_index(id, g_zclass_modelindex[g_zombieclass[id]])
- #endif
- }
- }
- }
- // Need to change the model?
- if (!already_has_model)
- {
- // An additional delay is offset at round start
- // since SVC_BAD is more likely to be triggered there
- if (g_newround)
- set_task(5.0*MODELCHANGE_DELAY, "fm_user_model_update", id+TASK_MODEL)
- else
- fm_user_model_update(id+TASK_MODEL)
- }
- // Nemesis glow / remove glow
- if (g_nemesis[id] && get_pcvar_num(cvar_nemglow))
- fm_set_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 25)
- else
- fm_set_rendering(id)
- #endif
- // Remove any zoom (bugfix)
- fm_remove_user_zoom(id)
- // Remove armor
- set_pev(id, pev_armorvalue, 0.0)
- // Drop weapons when infected
- drop_weapons(id, 1)
- drop_weapons(id, 2)
- // Strip zombies from guns and give them a knife
- fm_strip_user_weapons(id)
- fm_give_item(id, "weapon_knife")
- // Fancy effects
- infection_effects(id)
- // Nemesis aura task
- if (g_nemesis[id] && get_pcvar_num(cvar_nemaura))
- zombie_aura(id+TASK_BLOOD)
- // Get nightvision give setting
- static nvggive
- nvggive = get_pcvar_num(cvar_nvggive)
- // Give Zombies Night Vision?
- if (nvggive)
- {
- if (!is_user_bot(id))
- {
- g_nvision[id] = true
- // Turn on Night Vision automatically?
- if (nvggive == 1)
- {
- g_nvisionenabled[id] = true
- // Custom nvg?
- if (get_pcvar_num(cvar_cnvg))
- {
- remove_task(id+TASK_NVISION)
- set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
- }
- else
- set_user_gnvision(id, 1)
- }
- // Turn off nightvision when infected (bugfix)
- else if (g_nvisionenabled[id])
- {
- if (!get_pcvar_num(cvar_cnvg)) set_user_gnvision(id, 0)
- g_nvisionenabled[id] = false
- }
- }
- else
- fm_set_bot_nvg(id, 1); // turn on NVG for bots
- }
- // Disable nightvision when infected (bugfix)
- else if (g_nvision[id])
- {
- if (g_nvisionenabled[id] && !get_pcvar_num(cvar_cnvg)) set_user_gnvision(id, 0)
- g_nvision[id] = false
- g_nvisionenabled[id] = false
- }
- // Get FOV setting
- static fov
- fov = get_pcvar_num(cvar_zombiefov)
- // Set custom FOV?
- if (fov != 90 && fov != 0)
- {
- message_begin(MSG_ONE, g_msgSetFOV, _, id)
- write_byte(fov) // angle
- message_end()
- }
- // Call the bloody task
- if (!g_nemesis[id] && get_pcvar_num(cvar_zombiebleeding))
- set_task(0.7, "make_blood", id+TASK_BLOOD, _, _, "b")
- // Idle sounds task
- if (!g_nemesis[id])
- set_task(random_float(50.0, 70.0), "zombie_play_idle", id+TASK_BLOOD, _, _, "b")
- // Turn off zombie's flashlight
- turn_off_flashlight(id)
- // Remove survivor's aura (bugfix)
- set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_BRIGHTLIGHT)
- // Remove spawn protection (bugfix)
- g_nodamage[id] = false
- set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_NODRAW)
- // Post user infect forward
- ExecuteForward(g_fwUserInfected_post, g_fwDummyResult, id, infector)
- // Last Zombie Check
- set_task(0.1, "fnCheckLastZombie")
- }
- // Function Human Me (player id, turn into a survivor)
- humanme(id, survivor)
- {
- // Pre user humanize forward
- ExecuteForward(g_fwUserHumanized_pre, g_fwDummyResult, id)
- // Set selected human class
- g_humanclass[id] = g_humanclassnext[id]
- // If no class selected yet, use the first (default) one
- if (g_humanclass[id] == HCLASS_NONE) g_humanclass[id] = 0
- // Reset some vars
- g_zombie[id] = false
- g_nemesis[id] = false
- g_firstzombie[id] = false
- g_nodamage[id] = false
- g_canbuy[id] = true
- g_nvision[id] = false
- g_nvisionenabled[id] = false
- // Set human attributes based on the mode
- if (survivor)
- {
- // Survivor
- g_survivor[id] = true
- // Get survivor health setting
- static survhealth, survbasehealth
- survhealth = get_pcvar_num(cvar_survhp)
- survbasehealth = get_pcvar_num(cvar_survbasehp)
- // Set Health [0 = auto]
- if (survhealth == 0)
- {
- if (survbasehealth == 0)
- fm_set_user_health(id, g_hclass_hp[0]*fnGetAlive())
- else
- fm_set_user_health(id, survbasehealth*fnGetAlive())
- }
- else
- fm_set_user_health(id, survhealth)
- // Set Gravity
- set_pev(id, pev_gravity, get_pcvar_float(cvar_survgravity))
- // Get survivor's weapon setting
- static survweapon[32]
- get_pcvar_string(cvar_survweapon, survweapon, sizeof survweapon - 1)
- // Strip survivor from weapons and give him his own
- fm_strip_user_weapons(id)
- fm_give_item(id, "weapon_knife")
- fm_give_item(id, survweapon)
- // Turn off his flashlight
- turn_off_flashlight(id)
- // Give the survivor a bright light
- if (get_pcvar_num(cvar_survaura)) set_pev(id, pev_effects, pev(id, pev_effects) | EF_BRIGHTLIGHT)
- // Survivor bots will also need nightvision to see in the dark
- if (is_user_bot(id)) fm_set_bot_nvg(id, 1);
- }
- else
- {
- // Set health
- fm_set_user_health(id, g_hclass_hp[g_humanclass[id]] + H_SALUD(g_skill_points[id][0][1]))
- set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]] - H_GRAVITY(g_skill_points[id][0][3]))
- set_user_armor(id, g_hclass_ar[g_humanclass[id]] + H_ARMOR(g_skill_points[id][0][4]))
- // Set gravity, unless frozen
- if (!g_frozen[id]) set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]] - H_GRAVITY(g_skill_points[id][0][3]))
- // Strip off from weapons
- fm_strip_user_weapons(id)
- fm_give_item(id, "weapon_knife")
- // Show custom buy menu?
- show_menu_eleccion(id)
- // Antidote sound
- engfunc(EngFunc_EmitSound, id, CHAN_ITEM, sound_antidote[random_num(0, sizeof sound_antidote - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Get player's name
- static name[32]
- get_user_name(id, name, sizeof name - 1)
- // Show Antidote HUD notice
- set_hudmessage(0, 0, 255, HUD_INFECT_X, HUD_INFECT_Y, 0, 0.0, 5.0, 1.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_ANTIDOTE", name)
- }
- // Remove previous tasks
- remove_task(id+TASK_TEAM)
- remove_task(id+TASK_MODEL)
- remove_task(id+TASK_BLOOD)
- // Switch to CT
- if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
- {
- fm_set_user_team(id, CS_TEAM_CT)
- fm_user_team_update(id)
- }
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- // Set the right model
- if (g_survivor[id])
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_survivor[random_num(0, sizeof model_survivor -1)])
- else
- {
- if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[random_num(0, sizeof model_admin -1)])
- else
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
- }
- // Set model on player model entity
- fm_set_playermodel_ent(id)
- // Set survivor glow / remove glow, unless frozen
- if (g_survivor[id] && get_pcvar_num(cvar_survglow))
- fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25)
- else if (!g_frozen[id])
- fm_set_rendering(g_ent_playermodel[id])
- #else
- // Set the right model, after checking that we don't already have it
- static currentmodel[32], already_has_model, i, iRand
- already_has_model = false;
- // Get current model and compare it with current one
- fm_get_user_model(id, currentmodel, sizeof currentmodel - 1);
- if (g_survivor[id])
- {
- for (i = 0; i < sizeof model_survivor; i++)
- if (equal(model_survivor[i], currentmodel)) already_has_model = true;
- if (!already_has_model)
- {
- iRand = random_num(0, sizeof model_survivor -1)
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_survivor[iRand])
- #if defined SET_MODELINDEX_OFFSET
- fm_set_user_model_index(id, g_modelindex_survivor[iRand])
- #endif
- }
- }
- else
- {
- if (get_pcvar_num(cvar_adminmodelshuman) && get_user_flags(id) & ACCESS_FLAG3)
- {
- for (i = 0; i < sizeof model_admin; i++)
- if (equal(model_admin[i], currentmodel)) already_has_model = true;
- if (!already_has_model)
- {
- iRand = random_num(0, sizeof model_admin -1)
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, model_admin[iRand])
- #if defined SET_MODELINDEX_OFFSET
- fm_set_user_model_index(id, g_modelindex_admin[iRand])
- #endif
- }
- }
- else
- {
- if (equal(g_hclass_model[g_humanclass[id]], currentmodel)) already_has_model = true;
- if (!already_has_model)
- {
- copy(g_playermodel[id], sizeof g_playermodel[] - 1, g_hclass_model[g_humanclass[id]])
- #if defined SET_MODELINDEX_OFFSET
- fm_set_user_model_index(id, g_hclass_modelindex[g_humanclass[id]])
- #endif
- }
- }
- }
- // Need to change the model?
- if (!already_has_model)
- {
- // An additional delay is offset at round start
- // since SVC_BAD is more likely to be triggered there
- if (g_newround)
- set_task(5.0*MODELCHANGE_DELAY, "fm_user_model_update", id+TASK_MODEL)
- else
- fm_user_model_update(id+TASK_MODEL)
- }
- // Set survivor glow / remove glow, unless frozen
- if (g_survivor[id] && get_pcvar_num(cvar_survglow))
- fm_set_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25)
- else if (!g_frozen[id])
- fm_set_rendering(id)
- #endif
- // Get FOV setting
- static fov
- fov = get_pcvar_num(cvar_zombiefov)
- // Restore FOV?
- if (fov != 90 && fov != 0)
- {
- message_begin(MSG_ONE, g_msgSetFOV, _, id)
- write_byte(90) // angle
- message_end()
- }
- // Disable nightvision
- if (is_user_bot(id)) fm_set_bot_nvg(id, 0)
- else if (!get_pcvar_num(cvar_cnvg)) set_user_gnvision(id, 0)
- // Post user humanize forward
- ExecuteForward(g_fwUserHumanized_post, g_fwDummyResult, id)
- // Last Zombie Check
- set_task(0.1, "fnCheckLastZombie")
- }
- public clcmd_login(id)
- {
- static Password[24], szData[512]
- read_args(Password, charsmax(Password))
- remove_quotes(Password)
- trim(Password)
- fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData))
- parse(szData, g_password[id], charsmax(g_password[]))
- if(!equali(Password, g_password[id]))
- {
- zp_colored_print(id, "^x04[ZP]^x01 Password incorrecta. Intente nuevamente.")
- client_cmd(id, "messagemode Login_Password")
- set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
- ShowSyncHudMsg(id, g_MsgSync3, "Enter your password^nPress ESC to exit")
- return PLUGIN_HANDLED;
- }
- else
- {
- g_estado[id] = ONLINE
- Load(id)
- zp_colored_print(0, "^x04[ZP]^x03 %s^x01 has entered the server.", g_playername[id])
- engclient_cmd(id, "jointeam", "5")
- engclient_cmd(id, "joinclass", "5")
- return PLUGIN_HANDLED;
- }
- return PLUGIN_CONTINUE;
- }
- public clcmd_register(id)
- {
- read_args(g_password[id], charsmax(g_password[]))
- remove_quotes(g_password[id])
- trim(g_password[id])
- if(equal(g_password[id], "") || contain(g_password[id], " ") != -1)
- {
- zp_colored_print(id, "^x04[ZP]^x01 The password must contain at least one letter and no space.")
- client_cmd(id, "messagemode Create_Password")
- set_hudmessage(0, 255, 255, 0.03, 0.05, 0, 0.1, 4.0, 0.01, 0.01, -1)
- ShowSyncHudMsg(id, g_MsgSync3, "Enter a new password^nPress ESC to exit")
- return PLUGIN_HANDLED;
- }
- else
- {
- get_user_name(id, g_playername[id], charsmax(g_playername[]))
- g_password[id] = g_password[id]
- g_estado[id] = ONLINE
- Save(id)
- Registrado[id] = 1
- zp_colored_print(0, "^x04[ZP]^x03 %s^x01 has registered in the server.", g_playername[id])
- engclient_cmd(id, "jointeam", "5")
- engclient_cmd(id, "joinclass", "5")
- return PLUGIN_HANDLED;
- }
- return PLUGIN_CONTINUE;
- }
- Load(id)
- {
- 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],
- guardahgra[10], guardahar[10], guardazvi[10], guardazda[10], guardazve[10], guardazgra[10], usahu[10], usazo[10]
- if(!fvault_get_data(SaveData, g_playername[id], szData, charsmax(szData)))
- return;
- parse(szData, g_password[id], charsmax(g_password[]), guardapacks, charsmax(guardapacks), guardalevel, charsmax(guardalevel), guardazclas, charsmax(guardazclas), reset, charsmax(reset),
- registrado, charsmax(registrado), guardahclas, charsmax(guardahclas), superreset, charsmax(superreset) , guardahpo, charsmax(guardahpo), guardazpo, charsmax(guardazpo), guardahda,
- charsmax(guardahda), guardahvi, charsmax(guardahvi), guardahve, charsmax(guardahve), guardahgra, charsmax(guardahgra), guardahar, charsmax(guardahar), guardazda, charsmax(guardazda),
- guardazvi, charsmax(guardazvi), guardazve, charsmax(guardazve), guardazgra, charsmax(guardazgra), usahu, charsmax(usahu), usazo, charsmax(usazo))
- g_ammopacks[id] = str_to_num(guardapacks)
- g_level[id] = str_to_num(guardalevel)
- g_zombieclassnext[id] = str_to_num(guardazclas)
- g_reset[id] = str_to_num(reset)
- Registrado[id] = str_to_num(registrado)
- g_humanclassnext[id] = str_to_num(guardahclas)
- g_grandreset[id] = str_to_num(superreset)
- g_points[id][0] = str_to_num(guardahpo)
- g_points[id][1] = str_to_num(guardazpo)
- g_skill_points[id][0][0] = str_to_num(guardahda)
- g_skill_points[id][0][1] = str_to_num(guardahvi)
- g_skill_points[id][0][2] = str_to_num(guardahve)
- g_skill_points[id][0][3] = str_to_num(guardahgra)
- g_skill_points[id][0][4] = str_to_num(guardahar)
- g_skill_points[id][1][0] = str_to_num(guardazda)
- g_skill_points[id][1][1] = str_to_num(guardazvi)
- g_skill_points[id][1][2] = str_to_num(guardazve)
- g_skill_points[id][1][3] = str_to_num(guardazgra)
- g_usedpoints[id][0] = str_to_num(usahu)
- g_usedpoints[id][1] = str_to_num(usazo)
- }
- Save(id)
- {
- if (!Registrado[id] || BadPassword[id])
- return PLUGIN_HANDLED;
- static szData[512]
- 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],
- 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])
- fvault_set_data(SaveData, g_playername[id], szData)
- return PLUGIN_CONTINUE;
- }
- // Player info changed?
- public FWClientUserInfoChanged(id, buffer)
- {
- if(!is_user_connected(id))
- return FMRES_IGNORED;
- static NickName[32], NickOld[32]; get_user_name(id, NickOld, 31)
- engfunc(EngFunc_InfoKeyValue, buffer, "name", NickName, 31)
- if(equal( NickName, NickOld))
- return FMRES_IGNORED;
- engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", NickOld)
- client_cmd(id, "name ^"%s^"; setinfo name ^"%s^"", NickOld, NickOld)
- return FMRES_SUPERCEDE;
- }
- /*================================================================================
- [Other Functions and Tasks]
- =================================================================================*/
- // Register Ham Forwards for CZ bots
- public register_ham_czbots(id)
- {
- // Make sure it's a CZ bot and it's still connected
- if (g_hamczbots || !get_pcvar_num(cvar_botquota) || !is_user_connected(id) || !is_user_bot(id))
- return;
- RegisterHamFromEntity(Ham_Spawn, id, "fw_PlayerSpawn_Post", 1)
- RegisterHamFromEntity(Ham_Killed, id, "fw_PlayerKilled")
- RegisterHamFromEntity(Ham_TakeDamage, id, "fw_TakeDamage")
- RegisterHamFromEntity(Ham_TraceAttack, id, "fw_TraceAttack")
- // Ham forwards for CZ bots succesfully registered
- g_hamczbots = true
- // If the bot has already spawned, call the forward manually for him
- if (is_user_alive(id)) fw_PlayerSpawn_Post(id)
- }
- // Disable minmodels task
- public disable_minmodels(id)
- {
- if (!is_user_connected(id)) return;
- client_cmd(id, "cl_minmodels 0")
- }
- // Bots automatically buy extra items
- public bot_buy_extras(taskid)
- {
- // Nemesis or Survivor shouldnt get extra items
- if (g_survivor[ID_SPAWN] || g_nemesis[ID_SPAWN] || !is_user_alive(ID_SPAWN))
- return;
- if (!g_zombie[ID_SPAWN]) // human bots
- {
- // Attempt to buy Night Vision
- buy_extra_item(ID_SPAWN, EXTRA_NVISION)
- // Attempt to buy a weapon
- buy_extra_item(ID_SPAWN, random_num(EXTRA_WEAPONS_STARTID, EXTRAS_CUSTOM_STARTID-1))
- }
- else // zombie bots
- {
- // Attempt to buy an Antidote
- buy_extra_item(ID_SPAWN, EXTRA_ANTIDOTE)
- }
- }
- // Balance Teams Task
- public balance_teams()
- {
- // Get users playing
- static iPlayersnum
- iPlayersnum = fnGetPlaying()
- // No players, don't bother
- if (iPlayersnum < 1) return;
- // Split players evenly
- static g_team[33], id, iTerrors, iMaxTerrors, team
- iMaxTerrors = iPlayersnum/2
- iTerrors = 0
- // First, mark everyone as CT
- for (id = 1; id <= g_maxplayers; id++)
- g_team[id] = CS_TEAM_CT
- // Then randomly mark half of the players as Terrorists
- while (iTerrors < iMaxTerrors)
- {
- // Keep looping through all players
- if (++id > g_maxplayers) id = 1
- // Skip if not connected
- if (!is_user_connected(id))
- continue;
- team = fm_get_user_team(id)
- // Skip if not playing
- if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
- continue;
- // Already a Terrorist
- if (g_team[id] == CS_TEAM_T)
- continue;
- // Random chance
- if (random_num(0, 1))
- {
- g_team[id] = CS_TEAM_T
- iTerrors++
- }
- }
- // Set everyone's team for real
- for (id = 1; id <= g_maxplayers; id++)
- {
- // Skip if not connected
- if (!is_user_connected(id))
- continue;
- team = fm_get_user_team(id)
- // Skip if not playing
- if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
- continue;
- // Set team
- remove_task(id+TASK_TEAM)
- fm_set_user_team(id, g_team[id])
- }
- }
- // Welcome Message Task
- public welcome_msg()
- {
- // Show mod info
- zp_colored_print(0, "^x01**** ^x04%s^x01 ****", g_modname)
- zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "NOTICE_INFO1")
- if (!get_pcvar_num(cvar_infammo)) zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "NOTICE_INFO2")
- // Show T-virus HUD notice
- set_hudmessage(0, 125, 200, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_VIRUS_FREE")
- }
- // Respawn Player Task
- public respawn_player(taskid)
- {
- // Get player's team
- static team
- team = fm_get_user_team(ID_SPAWN)
- // Respawn on infection rounds only
- if (!g_endround && !g_survround && !g_swarmround && !g_nemround && !g_plagueround && team != CS_TEAM_SPECTATOR && team != CS_TEAM_UNASSIGNED && !is_user_alive(ID_SPAWN))
- {
- // Set proper team before respawning, so that the TeamInfo message that's sent doesn't confuse PODBots
- if (g_respawn_as_zombie[ID_SPAWN])
- fm_set_user_team(ID_SPAWN, CS_TEAM_T)
- else
- fm_set_user_team(ID_SPAWN, CS_TEAM_CT)
- // Respawning a player has never been so easy
- ExecuteHamB(Ham_CS_RoundRespawn, ID_SPAWN)
- }
- }
- // Check Round Task -check that we still have both zombies & humans on a round-
- check_round(leaving_player)
- {
- // Round ended or make_a_zombie task still active
- if (g_endround || task_exists(TASK_MAKEZOMBIE))
- return;
- // Get alive players count
- static iPlayersnum
- iPlayersnum = fnGetAlive()
- // Last alive player, don't bother
- if (iPlayersnum < 2)
- return;
- // Set up some common vars
- static id, name[32]
- // Last zombie disconnecting
- if (g_zombie[leaving_player] && fnGetZombies() == 1)
- {
- // Only one CT left, don't bother
- if (fnGetHumans() == 1 && fnGetCTs() == 1)
- return;
- // Pick a random one to take his place
- while ((id = fnGetRandomAlive(random_num(1, iPlayersnum))) == leaving_player ) {}
- // Show last zombie left notice
- get_user_name(id, name, sizeof name - 1)
- zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "LAST_ZOMBIE_LEFT", name)
- // Turn into a Nemesis or just a zombie?
- if (g_nemesis[leaving_player] && !g_plagueround)
- make_a_zombie(MODE_NEMESIS, id)
- else
- zombieme(id, 0, 0, 0)
- }
- // Last human disconnecting
- else if (!g_zombie[leaving_player] && fnGetHumans() == 1)
- {
- // Only one T left, don't bother
- if (fnGetZombies() == 1 && fnGetTs() == 1)
- return;
- // Pick a random one to take his place
- while ((id = fnGetRandomAlive(random_num(1, iPlayersnum))) == leaving_player ) {}
- // Show last human left notice
- get_user_name(id, name, sizeof name - 1)
- zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "LAST_HUMAN_LEFT", name)
- // Turn into a Survivor or just a human?
- if (g_survivor[leaving_player] && !g_plagueround)
- make_a_zombie(MODE_SURVIVOR, id)
- else
- humanme(id, 0)
- }
- }
- // Lighting Effects Task
- public lighting_effects()
- {
- // Lighting style ["a"-"z"]
- static lights[2]
- get_pcvar_string(cvar_lighting, lights, sizeof lights - 1)
- strtolower(lights)
- // Lighting disabled? ["0"]
- if (lights[0] == '0')
- {
- // Task not needed anymore
- remove_task(TASK_LIGHTING)
- return;
- }
- // Darkest light settings?
- if (lights[0] >= 'a' && lights[0] <= 'd')
- {
- // Get thunderclaps setting
- static Float:thunderclap
- thunderclap = get_pcvar_float(cvar_thunder)
- // Set thunderclap tasks if neccesary
- if (thunderclap > 0.0 && !task_exists(TASK_THUNDER_PRE) && !task_exists(TASK_THUNDER))
- {
- g_lights_i = 0
- switch (random_num(0, 2))
- {
- case 0: set_task(thunderclap, "thunderclap1", TASK_THUNDER_PRE)
- case 1: set_task(thunderclap, "thunderclap2", TASK_THUNDER_PRE)
- case 2: set_task(thunderclap, "thunderclap3", TASK_THUNDER_PRE)
- }
- }
- // Set lighting only when no thunderclaps are going on
- if (!task_exists(TASK_THUNDER)) engfunc(EngFunc_LightStyle, 0, lights)
- }
- else
- {
- // Remove thunderclap tasks
- remove_task(TASK_THUNDER_PRE)
- remove_task(TASK_THUNDER)
- // Set lighting
- engfunc(EngFunc_LightStyle, 0, lights)
- }
- }
- // Thunderclap 1
- public thunderclap1()
- {
- // Play thunder sound
- if (!g_lights_i) PlaySound(sound_thunder[random_num(0, sizeof sound_thunder - 1)])
- // Set lighting
- engfunc(EngFunc_LightStyle, 0, lights_thunder1[g_lights_i])
- g_lights_i++
- // Loop the task until we reach the end of the cycle
- if (g_lights_i >= sizeof lights_thunder1)
- {
- remove_task(TASK_THUNDER)
- lighting_effects()
- }
- else if (!task_exists(TASK_THUNDER))
- set_task(0.1, "thunderclap1", TASK_THUNDER, _, _, "b")
- }
- // Thunderclap 2
- public thunderclap2()
- {
- // Play thunder sound
- if (!g_lights_i) PlaySound(sound_thunder[random_num(0, sizeof sound_thunder - 1)])
- // Set lighting
- engfunc(EngFunc_LightStyle, 0, lights_thunder2[g_lights_i])
- g_lights_i++
- // Loop the task until we reach the end of the cycle
- if (g_lights_i >= sizeof lights_thunder2)
- {
- remove_task(TASK_THUNDER)
- lighting_effects()
- }
- else if (!task_exists(TASK_THUNDER))
- set_task(0.1, "thunderclap2", TASK_THUNDER, _, _, "b")
- }
- // Thunderclap 3
- public thunderclap3()
- {
- // Play thunder sound
- if (!g_lights_i) PlaySound(sound_thunder[random_num(0, sizeof sound_thunder - 1)])
- // Set lighting
- engfunc(EngFunc_LightStyle, 0, lights_thunder3[g_lights_i])
- g_lights_i++
- // Loop the task until we reach the end of the cycle
- if (g_lights_i >= sizeof lights_thunder3)
- {
- remove_task(TASK_THUNDER)
- lighting_effects()
- }
- else if (!task_exists(TASK_THUNDER))
- set_task(0.1, "thunderclap3", TASK_THUNDER, _, _, "b")
- }
- #if defined AMBIENCE_SOUNDS
- // Ambience Sound Effects Task
- public ambience_sound_effects(taskid)
- {
- // Play a random sound depending on the round
- static amb_sound[64], isound, Float:duration
- if (g_nemround) // Nemesis Mode
- {
- isound = random_num(0, sizeof sound_ambience2 - 1)
- copy(amb_sound, sizeof amb_sound -1, sound_ambience2[isound])
- duration = sound_ambience2_duration[isound]
- }
- else if (g_survround) // Survivor Mode
- {
- isound = random_num(0, sizeof sound_ambience3 - 1)
- copy(amb_sound, sizeof amb_sound -1, sound_ambience3[isound])
- duration = sound_ambience3_duration[isound]
- }
- else if (g_swarmround) // Swarm Mode
- {
- isound = random_num(0, sizeof sound_ambience4 - 1)
- copy(amb_sound, sizeof amb_sound -1, sound_ambience4[isound])
- duration = sound_ambience4_duration[isound]
- }
- else if (g_plagueround) // Plague Mode
- {
- isound = random_num(0, sizeof sound_ambience5 - 1)
- copy(amb_sound, sizeof amb_sound -1, sound_ambience5[isound])
- duration = sound_ambience5_duration[isound]
- }
- else // Infection Mode
- {
- isound = random_num(0, sizeof sound_ambience1 - 1)
- copy(amb_sound, sizeof amb_sound -1, sound_ambience1[isound])
- duration = sound_ambience1_duration[isound]
- }
- // Check whether it's a wav or mp3 and play it on clients
- if (equal(amb_sound[strlen(amb_sound)-4], ".mp3"))
- client_cmd(0, "mp3 play ^"sound/%s^"", amb_sound)
- else
- PlaySound(amb_sound)
- // The task should be called again after the sound is done playing
- set_task(duration, "ambience_sound_effects", TASK_AMBIENCESOUNDS)
- }
- // Ambience Sounds Stop Task
- public ambience_sound_stop()
- {
- client_cmd(0, "mp3 stop; stopsound")
- }
- #endif
- // Flashlight Charge Task
- public flashlight_charge(taskid)
- {
- // Custom flashlight disabled or flashlight not available for player
- if (g_zombie[ID_CHARGE] || g_survivor[ID_CHARGE] || !get_pcvar_num(cvar_cflash) || !is_user_alive(ID_CHARGE))
- {
- // Task not needed anymore
- remove_task(taskid);
- return;
- }
- // Drain or charge?
- if (g_flashlight[ID_CHARGE])
- g_flashbattery[ID_CHARGE] -= get_pcvar_num(cvar_flashdrain)
- else
- g_flashbattery[ID_CHARGE] += get_pcvar_num(cvar_flashcharge)
- // Battery fully charged
- if (g_flashbattery[ID_CHARGE] >= 100)
- {
- // Don't exceed 100%
- g_flashbattery[ID_CHARGE] = 100;
- // Update flashlight battery on HUD
- message_begin(MSG_ONE, g_msgFlashBat, _, ID_CHARGE)
- write_byte(g_flashbattery[ID_CHARGE]) // battery
- message_end()
- // Task not needed anymore
- remove_task(taskid);
- return;
- }
- // Battery depleted
- if (g_flashbattery[ID_CHARGE] <= 0)
- {
- // Turn it off
- g_flashlight[ID_CHARGE] = false;
- g_flashbattery[ID_CHARGE] = 0;
- // Update flashlight status on HUD
- message_begin(MSG_ONE, g_msgFlashlight, _, ID_CHARGE)
- write_byte(g_flashlight[ID_CHARGE]) // toggle
- write_byte(g_flashbattery[ID_CHARGE]) // battery
- message_end()
- }
- else
- {
- // Update flashlight battery on HUD
- message_begin(MSG_ONE_UNRELIABLE, g_msgFlashBat, _, ID_CHARGE)
- write_byte(g_flashbattery[ID_CHARGE]) // battery
- message_end()
- }
- }
- // Remove Spawn Protection Task
- public remove_spawn_protection(taskid)
- {
- // Not alive
- if (!is_user_alive(ID_SPAWN))
- return;
- // Remove spawn protection
- g_nodamage[ID_SPAWN] = false;
- set_pev(ID_SPAWN, pev_effects, pev(ID_SPAWN, pev_effects) & ~EF_NODRAW)
- }
- // Task Hide Player's Money
- public task_hide_money(taskid)
- {
- // Not alive
- if (!is_user_alive(ID_SPAWN))
- return;
- // Hide money
- message_begin(MSG_ONE, g_msgHideWeapon, _, ID_SPAWN)
- write_byte(HIDE_MONEY) // what to hide bitsum
- message_end()
- // Hide the HL crosshair that's drawn
- message_begin(MSG_ONE, g_msgCrosshair, _, ID_SPAWN)
- write_byte(0) // toggle
- message_end()
- }
- // Turn Off Game Flashlight
- turn_off_flashlight(id)
- {
- // Check if flashlight is on
- if (pev(id, pev_effects) & EF_DIMLIGHT)
- {
- // Turn it off
- set_pev(id, pev_effects, pev(id, pev_effects) & ~EF_DIMLIGHT)
- // Update HUD
- message_begin(MSG_ONE, g_msgFlashlight, _, id)
- write_byte(0) // toggle
- write_byte(100) // battery
- message_end()
- }
- // Clear any stored flashlight impulse (bugfix)
- set_pev(id, pev_impulse, 0)
- }
- // Infection Grenade Explosion
- infection_explode(ent)
- {
- // Round ended (bugfix)
- if (g_endround) return;
- // Get origin
- static Float:originF[3]
- pev(ent, pev_origin, originF)
- // Make the explosion
- create_blast(originF)
- // Infection nade explode sound
- engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, grenade_infect[random_num(0, sizeof grenade_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Get attacker
- static attacker
- attacker = pev(ent, pev_owner)
- // Collisions
- static victim
- victim = -1
- while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
- {
- // Only effect alive non-spawnprotected humans
- if (!is_user_alive(victim) || g_zombie[victim] || g_nodamage[victim])
- continue;
- // Last human is killed
- if (fnGetHumans() == 1)
- {
- ExecuteHamB(Ham_Killed, victim, attacker, 0)
- continue;
- }
- // Infected victim's sound
- engfunc(EngFunc_EmitSound, victim, CHAN_VOICE, grenade_infect_player[random_num(0, sizeof grenade_infect_player - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- SendDeathMsg(attacker, victim) // send death notice
- FixDeadAttrib(victim) // fix the "dead" attrib on scoreboard
- UpdateFrags(attacker, victim, get_pcvar_num(cvar_fragsinfect), 1, 1) // add corresponding frags & deaths
- zombieme(victim, attacker, 0, 1) // turn into zombie
- update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0) // ammo packs given to zombie for infection
- fm_set_user_health(attacker, pev(attacker, pev_health)+get_pcvar_num(cvar_zombiebonushp)) // infection HP bonus
- }
- // Get rid of the grenade
- engfunc(EngFunc_RemoveEntity, ent)
- }
- // Fire Grenade Explosion
- fire_explode(ent)
- {
- // Get origin
- static Float:originF[3]
- pev(ent, pev_origin, originF)
- // Make the explosion
- create_blast2(originF)
- // Fire nade explode sound
- engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, grenade_fire[random_num(0, sizeof grenade_fire - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Collisions
- static victim
- victim = -1
- while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
- {
- // Only effect alive zombies
- if (!is_user_alive(victim) || !g_zombie[victim] || g_nodamage[victim])
- continue;
- // Heat icon?
- if (get_pcvar_num(cvar_hudicons))
- {
- message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim)
- write_byte(0) // damage save
- write_byte(0) // damage take
- write_long(DMG_BURN) // damage type
- write_coord(0) // x
- write_coord(0) // y
- write_coord(0) // z
- message_end()
- }
- // Our task params
- static params[1]
- if (g_nemesis[victim]) // fire duration (nemesis takes less)
- params[0] = get_pcvar_num(cvar_fireduration)
- else
- params[0] = get_pcvar_num(cvar_fireduration)*5
- // Set burning task on victim
- set_task(0.1, "burning_flame", victim+TASK_BLOOD, params, sizeof params)
- }
- // Get rid of the grenade
- engfunc(EngFunc_RemoveEntity, ent)
- }
- // Frost Grenade Explosion
- frost_explode(ent)
- {
- // Get origin
- static Float:originF[3]
- pev(ent, pev_origin, originF)
- // Make the explosion
- create_blast3(originF)
- // Frost nade explode sound
- engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, grenade_frost[random_num(0, sizeof grenade_frost - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Collisions
- static victim
- victim = -1
- while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
- {
- // Only effect alive unfrozen zombies
- if (!is_user_alive(victim) || !g_zombie[victim] || g_frozen[victim] || g_nodamage[victim])
- continue;
- // Nemesis shouldn't be frozen
- if (g_nemesis[victim])
- {
- // Get player's origin
- static Float:origin2F[3]
- pev(victim, pev_origin, origin2F)
- // Broken glass sound
- engfunc(EngFunc_EmitSound, victim, CHAN_BODY, grenade_frost_break[random_num(0, sizeof grenade_frost_break - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Glass shatter
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2F, 0)
- write_byte(TE_BREAKMODEL) // TE id
- engfunc(EngFunc_WriteCoord, origin2F[0]) // x
- engfunc(EngFunc_WriteCoord, origin2F[1]) // y
- engfunc(EngFunc_WriteCoord, origin2F[2]+24.0) // z
- write_coord(16) // size x
- write_coord(16) // size y
- write_coord(16) // size z
- write_coord(random_num(-50, 50)) // velocity x
- write_coord(random_num(-50, 50)) // velocity y
- write_coord(25) // velocity z
- write_byte(10) // random velocity
- write_short(g_glassSpr) // model
- write_byte(10) // count
- write_byte(25) // life
- write_byte(BREAK_GLASS) // flags
- message_end()
- continue;
- }
- // Freeze icon?
- if (get_pcvar_num(cvar_hudicons))
- {
- message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim)
- write_byte(0) // damage save
- write_byte(0) // damage take
- write_long(DMG_DROWN) // damage type - DMG_FREEZE
- write_coord(0) // x
- write_coord(0) // y
- write_coord(0) // z
- message_end()
- }
- // Light blue glow while frozen
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- fm_set_rendering(g_ent_playermodel[victim], kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
- #else
- fm_set_rendering(victim, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
- #endif
- // Freeze sound
- engfunc(EngFunc_EmitSound, victim, CHAN_BODY, grenade_frost_player[random_num(0, sizeof grenade_frost_player - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Get freeze duration setting
- static Float:freezeduration
- freezeduration = get_pcvar_float(cvar_freezeduration)
- // Add a blue tint to their screen
- message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, victim)
- write_short(UNIT_SECOND*1) // duration
- write_short(floatround(UNIT_SECOND*freezeduration)) // hold time
- write_short(FFADE_IN) // fade type
- write_byte(0) // red
- write_byte(50) // green
- write_byte(200) // blue
- write_byte(100) // alpha
- message_end()
- // Prevent from jumping
- if (pev(victim, pev_flags) & FL_ONGROUND)
- set_pev(victim, pev_gravity, 999999.9) // set really high
- else
- set_pev(victim, pev_gravity, 0.000001) // no gravity
- // Set a task to remove the freeze
- g_frozen[victim] = true;
- set_task(freezeduration, "remove_freeze", victim)
- }
- // Get rid of the grenade
- engfunc(EngFunc_RemoveEntity, ent)
- }
- // Remove freeze task
- public remove_freeze(id)
- {
- // Not alive or not frozen anymore
- if (!g_frozen[id] || !is_user_alive(id))
- return;
- // Unfreeze
- g_frozen[id] = false;
- /// Restore normal gravity
- if (g_zombie[id])
- set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]])
- else
- set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]])
- // Broken glass sound
- engfunc(EngFunc_EmitSound, id, CHAN_BODY, grenade_frost_break[random_num(0, sizeof grenade_frost_break - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Remove glow
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- fm_set_rendering(g_ent_playermodel[id])
- #else
- fm_set_rendering(id)
- #endif
- // Get player's origin
- static Float:origin2F[3]
- pev(id, pev_origin, origin2F)
- // Glass shatter
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2F, 0)
- write_byte(TE_BREAKMODEL) // TE id
- engfunc(EngFunc_WriteCoord, origin2F[0]) // x
- engfunc(EngFunc_WriteCoord, origin2F[1]) // y
- engfunc(EngFunc_WriteCoord, origin2F[2]+24.0) // z
- write_coord(16) // size x
- write_coord(16) // size y
- write_coord(16) // size z
- write_coord(random_num(-50, 50)) // velocity x
- write_coord(random_num(-50, 50)) // velocity y
- write_coord(25) // velocity z
- write_byte(10) // random velocity
- write_short(g_glassSpr) // model
- write_byte(10) // count
- write_byte(25) // life
- write_byte(BREAK_GLASS) // flags
- message_end()
- }
- // Remove Stuff Task
- public remove_stuff()
- {
- static ent, removedoors
- removedoors = get_pcvar_num(cvar_removedoors)
- // Remove rotating doors
- if (removedoors > 0)
- {
- ent = -1;
- while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_door_rotating")) != 0)
- engfunc(EngFunc_SetOrigin, ent, Float:{8192.0 ,8192.0 ,8192.0})
- }
- // Remove all doors
- if (removedoors > 1)
- {
- ent = -1;
- while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_door")) != 0)
- engfunc(EngFunc_SetOrigin, ent, Float:{8192.0 ,8192.0 ,8192.0})
- }
- // Triggered lights
- if (!get_pcvar_num(cvar_triggered))
- {
- ent = -1
- while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "light")) != 0)
- {
- dllfunc(DLLFunc_Use, ent, 0); // turn off the light
- set_pev(ent, pev_targetname, 0) // prevent it from being triggered
- }
- }
- }
- // Set Custom Weapon Models
- public replace_models(id)
- {
- // Not alive
- if (!is_user_alive(id))
- return;
- switch (g_currentweapon[id])
- {
- case CSW_KNIFE: // Custom knife models
- {
- if (g_zombie[id] && !g_newround && !g_endround)
- {
- if (g_nemesis[id]) // Nemesis
- {
- set_pev(id, pev_viewmodel2, model_vknife_nemesis)
- set_pev(id, pev_weaponmodel2, "")
- }
- else // Zombies
- {
- static mdl[100]
- formatex(mdl, sizeof mdl - 1, "models/[VG]/%s", g_zclass_clawmodel[g_zombieclass[id]])
- set_pev(id, pev_viewmodel2, mdl)
- set_pev(id, pev_weaponmodel2, "")
- }
- }
- else // Humans
- {
- static mdl[100]
- formatex(mdl, sizeof mdl - 1, "models/[VG]/%s", g_hclass_clawmodel[g_humanclass[id]])
- set_pev(id, pev_viewmodel2, mdl)
- set_pev(id, pev_weaponmodel2, "")
- }
- }
- case CSW_M249: // Survivor's M249
- {
- if (g_survivor[id])
- {
- set_pev(id, pev_viewmodel2, model_vm249_survivor)
- set_pev(id, pev_weaponmodel2, model_pm249_survivor)
- }
- else if(g_rpg17[id])
- {
- set_pev(id, pev_viewmodel2, model_rpg17_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_rpg17_human1)
- }
- }
- case CSW_HEGRENADE: // Infection bomb or fire grenade
- {
- if (g_zombie[id] && !g_newround && !g_endround)
- set_pev(id, pev_viewmodel2, model_grenade_infect)
- else
- set_pev(id, pev_viewmodel2, model_grenade_fire)
- }
- case CSW_FLASHBANG: // Frost grenade
- {
- set_pev(id, pev_viewmodel2, model_grenade_frost)
- }
- case CSW_AK47: // Arma
- {
- if (g_akdestruction[id] == true)
- {
- set_pev(id, pev_viewmodel2, model_akdestruction_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_akdestruction_human1) // Este es para que los demas vean el modelo del arma que llevas usando´
- }
- else if (g_supermide[id])
- {
- set_pev(id, pev_viewmodel2, model_supermide_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_supermide_human1)
- }
- }
- case CSW_SG552: // Arma
- {
- if (g_ultimate[id] == true) // Variable
- {
- set_pev(id, pev_viewmodel2, model_ultimate_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_ultimate_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- else if (g_ultrak[id])
- {
- set_pev(id, pev_viewmodel2, model_ultrak_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_ultrak_human1)
- }
- else if (g_coldtorment[id])
- {
- set_pev(id, pev_viewmodel2, model_coldtorment_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_coldtorment_human1)
- }
- }
- case CSW_FAMAS: // Arma
- {
- if (g_atomic[id] == true) // Variable
- {
- set_pev(id, pev_viewmodel2, model_atomic_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_atomic_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- else if (g_adge[id])
- {
- set_pev(id, pev_viewmodel2, model_adge_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_adge_human1)
- }
- else if (g_aru[id])
- {
- set_pev(id, pev_viewmodel2, model_aru_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_aru_human1)
- }
- }
- case CSW_P90: // Arma
- {
- if (g_masive[id]) // Variable
- {
- set_pev(id, pev_viewmodel2, model_masive_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_masive_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- }
- case CSW_MP5NAVY: // Arma
- {
- if (g_navi[id]) // Variable
- {
- set_pev(id, pev_viewmodel2, model_navi_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_navi_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- }
- case CSW_XM1014: // Arma
- {
- if (g_power[id] == true) // Variable
- {
- set_pev(id, pev_viewmodel2, model_overpower_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_overpower_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- else if (g_ultra[id])
- {
- set_pev(id, pev_viewmodel2, model_ultra_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_ultra_human1)
- }
- else if (g_shredder[id])
- {
- set_pev(id, pev_viewmodel2, model_shredder_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_shredder_human1)
- }
- }
- case CSW_G3SG1: // Arma
- {
- if (g_stfu[id] == true) // Variable
- {
- set_pev(id, pev_viewmodel2, model_stfu_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_stfu_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- else if (g_raampage[id])
- {
- set_pev(id, pev_viewmodel2, model_raampage_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_raampage_human1)
- }
- }
- case CSW_UMP45: // Arma
- {
- if (g_rlp[id] == true) // Variable
- {
- set_pev(id, pev_viewmodel2, model_rlp_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_rlp_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- else if (g_101000cannon[id])
- {
- set_pev(id, pev_viewmodel2, model_101000cannon_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_101000cannon_human1)
- }
- }
- case CSW_M4A1: // Arma
- {
- if (g_m4[id] == true) // Variable
- {
- set_pev(id, pev_viewmodel2, model_m4_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_m4_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- else if (g_farger[id])
- {
- set_pev(id, pev_viewmodel2, model_farger_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_farger_human1)
- }
- else if (g_tmp2xx[id])
- {
- set_pev(id, pev_viewmodel2, model_tmp2xx_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_tmp2xx_human1)
- }
- }
- case CSW_M3: // Arma
- {
- if (g_barret[id] == true) // Variable
- {
- set_pev(id, pev_viewmodel2, model_barret_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_barret_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- else if (g_super[id])
- {
- set_pev(id, pev_viewmodel2, model_super_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_super_human1)
- }
- else if (g_zpr350[id])
- {
- set_pev(id, pev_viewmodel2, model_zpr350_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_zpr350_human1)
- }
- }
- case CSW_GALI: // Arma
- {
- if (g_devil[id] == true) // Variable
- {
- set_pev(id, pev_viewmodel2, model_devil_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_devil_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- else if (g_storm[id])
- {
- set_pev(id, pev_viewmodel2, model_storm_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_storm_human1)
- }
- else if (g_xh500w[id])
- {
- set_pev(id, pev_viewmodel2, model_xh500w_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_xh500w_human1)
- }
- }
- case CSW_AUG: // Arma
- {
- if (g_rampage[id] == true) // Variable
- {
- set_pev(id, pev_viewmodel2, model_rampage_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_rampage_human1) // Este es para que los demas vean el modelo del arma que llevas usando
- }
- else if (g_nule[id])
- {
- set_pev(id, pev_viewmodel2, model_nule_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_nule_human1)
- }
- else if (g_thunderstorm[id])
- {
- set_pev(id, pev_viewmodel2, model_thunderstorm_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_thunderstorm_human1)
- }
- else if (g_101000xx[id])
- {
- set_pev(id, pev_viewmodel2, model_101000xx_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_101000xx_human1)
- }
- }
- case CSW_AWP:
- {
- if (g_dvlsxx[id] == true)
- {
- set_pev(id, pev_viewmodel2, model_dvlsxx_human) // Este es para el player que tiene el arma en la mano
- set_pev(id, pev_weaponmodel2, model_dvlsxx_human1)
- }
- }
- case CSW_SMOKEGRENADE: // Flare grenade
- {
- set_pev(id, pev_viewmodel2, model_grenade_flare)
- }
- }
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- fm_set_weaponmodel_ent(id)
- #endif
- }
- // Reset Player Vars
- reset_vars(id, resetall)
- {
- g_zombie[id] = false
- g_nemesis[id] = false
- g_armagedon[id] = false
- g_survivor[id] = false
- g_firstzombie[id] = false
- g_lastzombie[id] = false
- g_lasthuman[id] = false
- g_frozen[id] = false
- g_nodamage[id] = false
- g_respawn_as_zombie[id] = false
- g_nvision[id] = false
- g_nvisionenabled[id] = false
- g_flashlight[id] = false
- g_flashbattery[id] = 100
- g_canbuy[id] = true
- if (resetall)
- {
- g_grandreset[id] = 0
- g_level[id] = 0
- g_reset[id] = 0
- g_ammopacks[id] = 0
- g_damage[id] = 0
- g_total[id] = 0
- g_zombieclass[id] = ZCLASS_NONE
- g_zombieclassnext[id] = ZCLASS_NONE
- g_humanclass[id] = HCLASS_NONE
- g_humanclassnext[id] = HCLASS_NONE
- g_damagedealt[id] = 0
- WPN_AUTO_ON = 0
- g_points[id][0] = 0
- g_points[id][1] = 0
- g_skill_points[id][0][0] = 0
- g_skill_points[id][0][1] = 0
- g_skill_points[id][0][2] = 0
- g_skill_points[id][0][3] = 0
- g_skill_points[id][0][4] = 0
- g_skill_points[id][1][0] = 0
- g_skill_points[id][1][1] = 0
- g_skill_points[id][1][2] = 0
- g_skill_points[id][1][3] = 0
- g_usedpoints[id][0] = 0
- g_usedpoints[id][1] = 0
- }
- }
- // Set spectators nightvision
- public spec_nvision(id)
- {
- // Not connected, playing, or bot
- if (!is_user_connected(id) || is_user_alive(id) || is_user_bot(id))
- return;
- // Give Night Vision?
- if (get_pcvar_num(cvar_nvggive))
- {
- g_nvision[id] = true
- // Turn on Night Vision automatically?
- if (get_pcvar_num(cvar_nvggive) == 1)
- {
- g_nvisionenabled[id] = true
- // Custom nvg?
- if (get_pcvar_num(cvar_cnvg))
- {
- remove_task(id+TASK_NVISION)
- set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
- }
- else
- set_user_gnvision(id, 1)
- }
- }
- }
- // Show HUD Task
- public ShowHUD(taskid)
- {
- static id
- id = ID_SHOWHUD;
- // Player died?
- if (!is_user_alive(id))
- {
- // Get spectating target
- id = pev(id, PEV_SPEC_TARGET)
- // Target not alive
- if (!is_user_alive(id)) return;
- }
- // Format the classname
- static class[32], red, green, blue
- if (g_zombie[id]) // zombies
- {
- red = 200
- green = 250
- blue = 0
- if (g_nemesis[id])
- formatex(class, sizeof class - 1, "%L", ID_SHOWHUD,"CLASS_NEMESIS")
- else
- copy(class, sizeof class - 1, g_zclass_name[g_zombieclass[id]])
- }
- else // humans
- {
- red = 0
- green = 255
- blue = 0
- if (g_survivor[id])
- formatex(class, sizeof class - 1, "%L", ID_SHOWHUD,"CLASS_SURVIVOR")
- else
- copy(class, sizeof class - 1, g_hclass_name[g_humanclass[id]])
- }
- // Spectating someone else?
- if (id != ID_SHOWHUD)
- {
- static name[32]
- get_user_name(id, name, sizeof name - 1)
- // Show name, health, class, and ammo packs
- set_hudmessage(255, 255, 255, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
- 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])
- }
- else
- {
- new Float:Porcentaje = ((g_ammopacks[id] - NIVELES[g_level[id]-1]) * 100.0) / (NIVELES[g_level[id]] - NIVELES[g_level[id]-1])
- // Show health, class and ammo packs
- set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
- 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])
- }
- }
- // Play idle zombie sounds
- public zombie_play_idle(taskid)
- {
- // Round ended/new one starting
- if (g_endround || g_newround)
- return;
- // Last zombie?
- if (g_lastzombie[ID_BLOOD])
- 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)
- else
- engfunc(EngFunc_EmitSound, ID_BLOOD, CHAN_VOICE, zombie_idle[random_num(0, sizeof zombie_idle - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
- }
- // Madness Over Task
- public madness_over(taskid)
- {
- g_nodamage[ID_BLOOD] = false
- }
- // Place user at a random spawn
- do_random_spawn(id)
- {
- // No spawns?
- if (!g_spawnCount)
- return;
- // Get whether the player is crouching
- static hull
- hull = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN
- // Choose random spawn to start looping at
- static sp_index, i
- sp_index = random_num(0, g_spawnCount - 1)
- // Try to find a clear spawn
- for (i = sp_index + 1; i != 999; i++)
- {
- // Start over when we reach the end
- if (i >= g_spawnCount) i = 0
- // Free spawn space?
- if (is_hull_vacant(g_spawns[i], hull))
- {
- // Engfunc_SetOrigin is used so ent's mins and maxs get updated instantly
- engfunc(EngFunc_SetOrigin, id, g_spawns[i])
- break;
- }
- // Loop completed, no free space found
- if (i == sp_index) break;
- }
- }
- // Get Zombies -returns alive zombies number-
- fnGetZombies()
- {
- static iZombies, id
- iZombies = 0
- for (id = 1; id <= g_maxplayers; id++)
- {
- if (is_user_alive(id) && g_zombie[id])
- iZombies++
- }
- return iZombies;
- }
- // Get Humans -returns alive humans number-
- fnGetHumans()
- {
- static iHumans, id
- iHumans = 0
- for (id = 1; id <= g_maxplayers; id++)
- {
- if (is_user_alive(id) && !g_zombie[id])
- iHumans++
- }
- return iHumans;
- }
- // Get Alive -returns alive players number-
- fnGetAlive()
- {
- static iAlive, id
- iAlive = 0
- for (id = 1; id <= g_maxplayers; id++)
- {
- if (is_user_alive(id))
- iAlive++
- }
- return iAlive;
- }
- // Get Random Alive -returns index of alive player number n -
- fnGetRandomAlive(n)
- {
- static iAlive, id
- iAlive = 0
- for (id = 1; id <= g_maxplayers; id++)
- {
- if (is_user_alive(id))
- iAlive++
- if (iAlive == n)
- return id;
- }
- return -1;
- }
- // Get Playing -returns number of users playing-
- fnGetPlaying()
- {
- static iPlaying, id, team
- iPlaying = 0
- for (id = 1; id <= g_maxplayers; id++)
- {
- if (is_user_connected(id))
- {
- team = fm_get_user_team(id)
- if (team != CS_TEAM_SPECTATOR && team != CS_TEAM_UNASSIGNED)
- iPlaying++
- }
- }
- return iPlaying;
- }
- // Get CTs -returns number of CTs connected-
- fnGetCTs()
- {
- static iCTs, id
- iCTs = 0
- for (id = 1; id <= g_maxplayers; id++)
- {
- if (is_user_connected(id))
- {
- if (fm_get_user_team(id) == CS_TEAM_CT)
- iCTs++
- }
- }
- return iCTs;
- }
- // Get Ts -returns number of Ts connected-
- fnGetTs()
- {
- static iTs, id
- iTs = 0
- for (id = 1; id <= g_maxplayers; id++)
- {
- if (is_user_connected(id))
- {
- if (fm_get_user_team(id) == CS_TEAM_T)
- iTs++
- }
- }
- return iTs;
- }
- // Last Zombie Check -check for last zombie and set its flag-
- public fnCheckLastZombie()
- {
- static id
- for (id = 1; id <= g_maxplayers; id++)
- {
- // Last zombie
- if (g_zombie[id] && is_user_alive(id) && fnGetZombies() == 1)
- g_lastzombie[id] = true
- else
- g_lastzombie[id] = false
- // Last human
- if (!g_zombie[id] && !g_survivor[id] && is_user_alive(id) && fnGetHumans() == 1)
- {
- // Reward extra hp for last human?
- if (!g_lasthuman[id]) fm_set_user_health(id, g_hclass_hp[g_humanclass[id]] + H_SALUD(g_skill_points[id][0][1]))
- g_lasthuman[id] = true
- }
- else
- g_lasthuman[id] = false
- }
- }
- // Save player's stats into the database
- save_stats(id)
- {
- // Get user name
- static name[32]
- get_user_name(id, name, sizeof name - 1)
- // Check whether there is another record already in that slot
- if (db_name[id][0] && !equal(name, db_name[id]))
- {
- // If DB size is exceeded, write over old records
- if (db_slot_i >= sizeof db_name)
- db_slot_i = g_maxplayers+1
- // Move previous record onto an additional save slot
- copy(db_name[db_slot_i], sizeof db_name[] - 1, db_name[id])
- db_ammopacks[db_slot_i] = db_ammopacks[id]
- db_zombieclass[db_slot_i] = db_zombieclass[id]
- db_humanclass[db_slot_i] = db_humanclass[id]
- db_slot_i++
- }
- // Now save the current player stats
- copy(db_name[id], sizeof db_name[] - 1, name) // name
- db_ammopacks[id] = g_ammopacks[id] // ammo packs
- db_zombieclass[id] = g_zombieclassnext[id] // zombie class
- db_humanclass[id] = g_humanclassnext[id] // human class
- }
- // Load player's stats from the database (if a record is found)
- load_stats(id)
- {
- // Get user name
- static name[32], i
- get_user_name(id, name, sizeof name - 1)
- // Look for a matching record in the DB
- for (i = 0; i < sizeof db_name; i++)
- {
- if (equal(name, db_name[i]))
- {
- // Bingo!
- g_ammopacks[id] = db_ammopacks[i]
- g_zombieclass[id] = db_zombieclass[i]
- g_zombieclassnext[id] = db_zombieclass[i]
- g_humanclass[id] = db_humanclass[i]
- g_humanclassnext[id] = db_humanclass[i]
- return;
- }
- }
- }
- // Checks if a player should leap
- allowed_leap(id)
- {
- // Leap available for zombies/nemesis/survivor only
- if ((!g_zombie[id] && !g_survivor[id]) || g_frozen[id])
- return false;
- // Nemesis cvar not enabled
- if (g_nemesis[id] && !get_pcvar_num(cvar_leapnemesis))
- return false;
- // Survivor cvar not enabled
- if (g_survivor[id] && !get_pcvar_num(cvar_leapsurvivor))
- return false;
- // Get zombie cvar
- static leapzombies
- leapzombies = get_pcvar_num(cvar_leapzombies)
- // Zombie cvar not enabled
- if (leapzombies == 0 && !g_nemesis[id] && !g_survivor[id])
- return false;
- // Not the first zombie
- if (leapzombies == 2 && !g_nemesis[id] && !g_survivor[id] && !g_firstzombie[id])
- return false;
- // Not the last zombie
- if (leapzombies == 3 && !g_nemesis[id] && !g_survivor[id] && !g_lastzombie[id])
- return false;
- // Get currently pressed buttons
- static buttons
- buttons = pev(id, pev_button)
- // Not doing a longjump (added bot support)
- if ((!(buttons & IN_JUMP) || !(buttons & IN_DUCK)) && !is_user_bot(id))
- return false;
- // Get cooldown cvar
- static Float:cooldown
- cooldown = g_survivor[id] ? get_pcvar_float(cvar_leapsurvivorcooldown) : g_nemesis[id] ? get_pcvar_float(cvar_leapnemesiscooldown) : get_pcvar_float(cvar_leapzombiescooldown)
- // Cooldown not over yet
- if (get_gametime() - g_lastleaptime[id] < cooldown)
- return false;
- // Not on ground or not enough speed
- if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
- return false;
- return true;
- }
- // Checks if a player should be Pain Shock Free
- allowed_painshockfree(id)
- {
- // Pain shock free available for zombies/nemesis/survivor only
- if (!g_zombie[id] && !g_survivor[id])
- return false;
- // Nemesis cvar not enabled
- if (g_nemesis[id] && !get_pcvar_num(cvar_nempainfree))
- return false;
- // Survivor cvar not enabled
- if (g_survivor[id] && !get_pcvar_num(cvar_survpainfree))
- return false;
- // Get zombie cvar
- static zombiepainfree
- zombiepainfree = get_pcvar_num(cvar_zombiepainfree)
- // Zombie cvar not enabled
- if (zombiepainfree == 0 && !g_survivor[id] && !g_nemesis[id])
- return false;
- // Not the last zombie
- if (zombiepainfree == 2 && !g_survivor[id] && !g_nemesis[id] && !g_lastzombie[id])
- return false;
- // Not on ground
- if (!(pev(id, pev_flags) & FL_ONGROUND))
- return false;
- return true;
- }
- // Checks if a player is allowed to be zombie
- allowed_zombie(id)
- {
- 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))
- return false;
- return true;
- }
- // Checks if a player is allowed to be human
- allowed_human(id)
- {
- 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))
- return false;
- return true;
- }
- // Checks if a player is allowed to be survivor
- allowed_survivor(id)
- {
- if (g_endround || !g_newround || !is_user_alive(id) || !get_pcvar_num(cvar_surv) || task_exists(TASK_WELCOMEMSG) || fnGetAlive() < get_pcvar_num(cvar_survminplayers))
- return false;
- return true;
- }
- // Checks if a player is allowed to be nemesis
- allowed_nemesis(id)
- {
- if (g_endround || !g_newround || !is_user_alive(id) || !get_pcvar_num(cvar_nem) || task_exists(TASK_WELCOMEMSG) || fnGetAlive() < get_pcvar_num(cvar_nemminplayers))
- return false;
- return true;
- }
- // Checks if a player is allowed to respawn
- allowed_respawn(id)
- {
- static team
- team = fm_get_user_team(id)
- 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))
- return false;
- return true;
- }
- // Checks if swarm mode is allowed
- allowed_swarm()
- {
- if (!get_pcvar_num(cvar_swarm) || g_endround || !g_newround || task_exists(TASK_WELCOMEMSG))
- return false
- return true
- }
- // Checks if multi infection mode is allowed
- allowed_multi()
- {
- 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))
- return false;
- return true;
- }
- // Checks if multi infection mode is allowed
- allowed_armagedon()
- {
- if (g_endround || !g_newround || !get_pcvar_num(cvar_armagedon) || task_exists(TASK_WELCOMEMSG) || fnGetAlive() < get_pcvar_num(cvar_armagedonminplayers))
- return false;
- return true;
- }
- // Checks if plague mode is allowed
- allowed_plague()
- {
- 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
- || 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))
- return false;
- return true;
- }
- // Admin Command. zp_zombie
- command_zombie(id, player)
- {
- static name1[32], name2[32]
- get_user_name(id, name1, sizeof name1 - 1)
- get_user_name(player, name2, sizeof name2 - 1)
- // Show activity?
- switch (get_pcvar_num(cvar_showactivity))
- {
- case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_INFECT")
- case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_INFECT")
- }
- // Log to Zombie Plague log file?
- if (get_pcvar_num(cvar_logcommands))
- {
- static logdata[100], authid[32], ip[16]
- get_user_authid(id, authid, sizeof authid - 1)
- get_user_ip(id, ip, sizeof ip - 1, 1)
- 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)
- log_to_file("zombieplague.log", logdata)
- }
- // New round?
- if (g_newround)
- {
- // Set as first zombie
- remove_task(TASK_MAKEZOMBIE)
- make_a_zombie(MODE_INFECTION, player)
- }
- else
- {
- // Just infect
- zombieme(player, 0, 0, 0)
- }
- }
- // Admin Command. zp_human
- command_human(id, player)
- {
- static name1[32], name2[32]
- get_user_name(id, name1, sizeof name1 - 1)
- get_user_name(player, name2, sizeof name2 - 1)
- // Show activity?
- switch (get_pcvar_num(cvar_showactivity))
- {
- case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_DISINFECT")
- case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_DISINFECT")
- }
- // Log to Zombie Plague log file?
- if (get_pcvar_num(cvar_logcommands))
- {
- static logdata[100], authid[32], ip[16]
- get_user_authid(id, authid, sizeof authid - 1)
- get_user_ip(id, ip, sizeof ip - 1, 1)
- 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)
- log_to_file("zombieplague.log", logdata)
- }
- // Turn to human
- humanme(player, 0)
- }
- // Admin Command. zp_survivor
- command_survivor(id, player)
- {
- static name1[32], name2[32]
- get_user_name(id, name1, sizeof name1 - 1)
- get_user_name(player, name2, sizeof name2 - 1)
- // Show activity?
- switch (get_pcvar_num(cvar_showactivity))
- {
- case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_SURVIVAL")
- case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_SURVIVAL")
- }
- // Log to Zombie Plague log file?
- if (get_pcvar_num(cvar_logcommands))
- {
- static logdata[100], authid[32], ip[16]
- get_user_authid(id, authid, sizeof authid - 1)
- get_user_ip(id, ip, sizeof ip - 1, 1)
- 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)
- log_to_file("zombieplague.log", logdata)
- }
- // Turn into a Survivor
- remove_task(TASK_MAKEZOMBIE)
- make_a_zombie(MODE_SURVIVOR, player)
- }
- // Admin Command. zp_nemesis
- command_nemesis(id, player)
- {
- static name1[32], name2[32]
- get_user_name(id, name1, sizeof name1 - 1)
- get_user_name(player, name2, sizeof name2 - 1)
- // Show activity?
- switch (get_pcvar_num(cvar_showactivity))
- {
- case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_NEMESIS")
- case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_NEMESIS")
- }
- // Log to Zombie Plague log file?
- if (get_pcvar_num(cvar_logcommands))
- {
- static logdata[100], authid[32], ip[16]
- get_user_authid(id, authid, sizeof authid - 1)
- get_user_ip(id, ip, sizeof ip - 1, 1)
- 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)
- log_to_file("zombieplague.log", logdata)
- }
- // Turn into a Nemesis
- remove_task(TASK_MAKEZOMBIE)
- make_a_zombie(MODE_NEMESIS, player)
- }
- // Admin Command. zp_respawn
- command_respawn(id, player)
- {
- static name1[32], name2[32]
- get_user_name(id, name1, sizeof name1 - 1)
- get_user_name(player, name2, sizeof name2 - 1)
- // Show activity?
- switch (get_pcvar_num(cvar_showactivity))
- {
- case 1: client_print(0, print_chat, "ADMIN - %s %L", name2, LANG_PLAYER, "CMD_RESPAWN")
- case 2: client_print(0, print_chat, "ADMIN %s - %s %L", name1, name2, LANG_PLAYER, "CMD_RESPAWN")
- }
- // Log to Zombie Plague log file?
- if (get_pcvar_num(cvar_logcommands))
- {
- static logdata[100], authid[32], ip[16]
- get_user_authid(id, authid, sizeof authid - 1)
- get_user_ip(id, ip, sizeof ip - 1, 1)
- 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)
- log_to_file("zombieplague.log", logdata)
- }
- // Get deathmatch mode status
- static deathmatch
- deathmatch = get_pcvar_num(cvar_deathmatch)
- // Respawn as zombie?
- if (deathmatch == 2 || (deathmatch == 3 && random_num(0, 1)) || (deathmatch == 4 && fnGetZombies() < fnGetAlive()/2))
- g_respawn_as_zombie[player] = true
- respawn_player(player+TASK_SPAWN);
- }
- // Admin Command. zp_swarm
- command_swarm(id)
- {
- static name1[32]
- get_user_name(id, name1, sizeof name1 - 1)
- // Show activity?
- switch (get_pcvar_num(cvar_showactivity))
- {
- case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_SWARM")
- case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_SWARM")
- }
- // Log to Zombie Plague log file?
- if (get_pcvar_num(cvar_logcommands))
- {
- static logdata[100], authid[32], ip[16]
- get_user_authid(id, authid, sizeof authid - 1)
- get_user_ip(id, ip, sizeof ip - 1, 1)
- formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %L (Players: %d/%d)", name1, authid, ip, LANG_SERVER, "CMD_SWARM", fnGetPlaying(), g_maxplayers)
- log_to_file("zombieplague.log", logdata)
- }
- // Call Swarm Mode
- remove_task(TASK_MAKEZOMBIE)
- make_a_zombie(MODE_SWARM, 0)
- }
- command_armagedon(id)
- {
- static name1[32]
- get_user_name(id, name1, sizeof name1 - 1)
- // Show activity?
- switch (get_pcvar_num(cvar_showactivity))
- {
- case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_ARMAGEDON")
- case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_ARMAGEDON")
- }
- // Log to Zombie Plague log file?
- if (get_pcvar_num(cvar_logcommands))
- {
- static logdata[100], authid[32], ip[16]
- get_user_authid(id, authid, sizeof authid - 1)
- get_user_ip(id, ip, sizeof ip - 1, 1)
- formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %L (Players: %d/%d)", name1, authid, ip, LANG_SERVER, "CMD_ARMAGEDON", fnGetPlaying(), g_maxplayers)
- log_to_file("zombieplague.log", logdata)
- }
- // Call Swarm Mode
- remove_task(TASK_MAKEZOMBIE)
- make_a_zombie(MODE_ARMAGEDON, 0)
- }
- // Admin Command. zp_multi
- command_multi(id)
- {
- static name1[32]
- get_user_name(id, name1, sizeof name1 - 1)
- // Show activity?
- switch (get_pcvar_num(cvar_showactivity))
- {
- case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_MULTI")
- case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_MULTI")
- }
- // Log to Zombie Plague log file?
- if (get_pcvar_num(cvar_logcommands))
- {
- static logdata[100], authid[32], ip[16]
- get_user_authid(id, authid, sizeof authid - 1)
- get_user_ip(id, ip, sizeof ip - 1, 1)
- formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %L (Players: %d/%d)", name1, authid, ip, LANG_SERVER,"CMD_MULTI", fnGetPlaying(), g_maxplayers)
- log_to_file("zombieplague.log", logdata)
- }
- // Call Multi Infection
- remove_task(TASK_MAKEZOMBIE)
- make_a_zombie(MODE_MULTI, 0)
- }
- // Admin Command. zp_plague
- command_plague(id)
- {
- static name1[32]
- get_user_name(id, name1, sizeof name1 - 1)
- // Show activity?
- switch (get_pcvar_num(cvar_showactivity))
- {
- case 1: client_print(0, print_chat, "ADMIN - %L", LANG_PLAYER, "CMD_PLAGUE")
- case 2: client_print(0, print_chat, "ADMIN %s - %L", name1, LANG_PLAYER, "CMD_PLAGUE")
- }
- // Log to Zombie Plague log file?
- if (get_pcvar_num(cvar_logcommands))
- {
- static logdata[100], authid[32], ip[16]
- get_user_authid(id, authid, sizeof authid - 1)
- get_user_ip(id, ip, sizeof ip - 1, 1)
- formatex(logdata, sizeof logdata - 1, "ADMIN %s <%s><%s> - %L (Players: %d/%d)", name1, authid, ip, LANG_SERVER,"CMD_PLAGUE", fnGetPlaying(), g_maxplayers)
- log_to_file("zombieplague.log", logdata)
- }
- // Call Plague Mode
- remove_task(TASK_MAKEZOMBIE)
- make_a_zombie(MODE_PLAGUE, 0)
- }
- /*================================================================================
- [Custom Natives]
- =================================================================================*/
- // Native: zp_get_user_zombie
- public native_get_user_zombie(id)
- {
- return g_zombie[id];
- }
- // Native: zp_get_user_nemesis
- public native_get_user_nemesis(id)
- {
- return g_nemesis[id];
- }
- // Native: zp_get_user_survivor
- public native_get_user_survivor(id)
- {
- return g_survivor[id];
- }
- public native_get_user_first_zombie(id)
- {
- return g_firstzombie[id];
- }
- // Native: zp_get_user_armagedon
- public native_get_user_armagedon(id)
- {
- return g_armagedon[id];
- }
- // Native: zp_is_armagedon_round
- public native_is_armagedon_round()
- {
- return g_armagedonround;
- }
- // Native: zp_get_user_last_zombie
- public native_get_user_last_zombie(id)
- {
- return g_lastzombie[id];
- }
- // Native: zp_get_user_last_human
- public native_get_user_last_human(id)
- {
- return g_lasthuman[id];
- }
- // Native: zp_get_user_zombie_class
- public native_get_user_zombie_class(id)
- {
- return g_zombieclass[id];
- }
- // Native: zp_set_user_zombie_class
- public native_set_user_zombie_class(id, classid)
- {
- g_zombieclassnext[id] = classid
- }
- // Native: zp_get_user_human_class
- public native_get_user_human_class(id)
- {
- return g_humanclass[id];
- }
- // Native: zp_set_user_human_class
- public native_set_user_human_class(id, classid)
- {
- g_humanclassnext[id] = classid
- }
- // Native: zp_get_user_ammo_packs
- public native_get_user_ammo_packs(id)
- {
- return g_ammopacks[id];
- }
- // Native: zp_set_user_ammo_packs
- public native_set_user_ammo_packs(id, amount)
- {
- return update_ap(id, 0 - g_ammopacks[id] + amount, 0)
- }
- // Native: zp_get_user_level
- public native_get_user_level(id)
- {
- return g_level[id]; //donde dice variable de lvl pongan su variable
- }
- // Native: zp_set_user_level
- public native_set_user_level(id, amount)
- {
- return g_level[id] = amount; //donde dice variable de lvl pongan su variable
- }
- // Native: zp_get_zombie_maxhealth
- public native_get_zombie_maxhealth(id)
- {
- if (g_zombie[id] && !g_nemesis[id])
- {
- if (g_firstzombie[id])
- return floatround(g_zclass_hp[g_zombieclass[id]]*get_pcvar_float(cvar_zombiefirsthp));
- else
- return g_zclass_hp[g_zombieclass[id]];
- }
- return -1;
- }
- // Native: zp_get_user_batteries
- public native_get_user_batteries(id)
- {
- return g_flashbattery[id];
- }
- // Native: zp_set_user_batteries
- public native_set_user_batteries(id, value)
- {
- g_flashbattery[id] = value;
- }
- // Native: zp_infect_user
- public native_infect_user(id, infector)
- {
- // Not allowed to be zombie or round not started yet
- if (!allowed_zombie(id) || g_newround)
- return 0;
- // Infect
- zombieme(id, infector, 0, 0)
- return 1;
- }
- // Native: zp_disinfect_user
- public native_disinfect_user(id)
- {
- // Not allowed to be human
- if (!allowed_human(id))
- return 0;
- // Turn to human
- humanme(id, 0)
- return 1;
- }
- // Native: zp_respawn_user
- public native_respawn_user(id, team)
- {
- // Respawn not allowed
- if (!allowed_respawn(id))
- return 0;
- // Respawn as zombie?
- g_respawn_as_zombie[id] = (team == ZP_TEAM_ZOMBIE) ? true : false
- // Respawnish!
- respawn_player(id+TASK_SPAWN)
- return 1;
- }
- // Native: zp_has_round_started
- public native_has_round_started()
- {
- return !g_newround;
- }
- // Native: zp_is_nemesis_round
- public native_is_nemesis_round()
- {
- return g_nemround;
- }
- // Native: zp_is_survivor_round
- public native_is_survivor_round()
- {
- return g_survround;
- }
- // Native: zp_is_swarm_round
- public native_is_swarm_round()
- {
- return g_swarmround;
- }
- // Native: zp_is_plague_round
- public native_is_plague_round()
- {
- return g_plagueround;
- }
- // Native: zp_register_extra_item
- public native_register_extra_item(const name[], cost, team)
- {
- // Reached extra items limit
- if (g_extraitem_i >= sizeof g_extraitem_name)
- return -1;
- // Strings passed byref
- param_convert(1)
- // Add the item
- copy(g_extraitem_name[g_extraitem_i], sizeof g_extraitem_name[] - 1, name)
- g_extraitem_cost[g_extraitem_i] = cost
- g_extraitem_team[g_extraitem_i] = team
- // Increase registered items counter
- g_extraitem_i++
- // Return id under which we registered the item
- return g_extraitem_i-1;
- }
- // Function: zp_register_extra_item (to be used within this plugin only)
- native_register_extra_item2(const name[], cost, team)
- {
- // Reached extra items limit
- if (g_extraitem_i >= sizeof g_extraitem_name)
- return;
- // Add the item
- copy(g_extraitem_name[g_extraitem_i], sizeof g_extraitem_name[] - 1, name)
- g_extraitem_cost[g_extraitem_i] = cost
- g_extraitem_team[g_extraitem_i] = team
- // Increase registered items counter
- g_extraitem_i++
- }
- // Native: zp_register_zombie_class
- public native_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback, level)
- {
- // Reached zombie classes limit
- if (g_zclass_i >= sizeof g_zclass_name)
- return -1;
- // Strings passed byref
- param_convert(1)
- param_convert(2)
- param_convert(3)
- param_convert(4)
- // Add the class
- copy(g_zclass_name[g_zclass_i], sizeof g_zclass_name[] - 1, name)
- copy(g_zclass_info[g_zclass_i], sizeof g_zclass_info[] - 1, info)
- copy(g_zclass_model[g_zclass_i], sizeof g_zclass_model[] - 1, model)
- copy(g_zclass_clawmodel[g_zclass_i], sizeof g_zclass_clawmodel[] - 1, clawmodel)
- g_zclass_lvl[g_zclass_i] = level
- g_zclass_hp[g_zclass_i] = hp
- g_zclass_spd[g_zclass_i] = speed
- g_zclass_grav[g_zclass_i] = gravity
- g_zclass_kb[g_zclass_i] = knockback
- // Precache custom models and retrieve the modelindex
- new prec_mdl[100]
- formatex(prec_mdl, sizeof prec_mdl - 1, "models/player/%s/%s.mdl", model, model)
- g_zclass_modelindex[g_zclass_i] = engfunc(EngFunc_PrecacheModel, prec_mdl)
- formatex(prec_mdl, sizeof prec_mdl - 1, "models/[VG]/%s", clawmodel)
- engfunc(EngFunc_PrecacheModel, prec_mdl)
- // Increase registered classes counter
- g_zclass_i++
- // Return id under which we registered the class
- return g_zclass_i-1;
- }
- // Native: zp_register_human_class
- public native_register_human_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, level, armadura)
- {
- // Reached human classes limit
- if (g_hclass_i >= sizeof g_hclass_name)
- return -1;
- // Strings passed byref
- param_convert(1)
- param_convert(2)
- param_convert(3)
- param_convert(4)
- // Add the class
- copy(g_hclass_name[g_hclass_i], sizeof g_hclass_name[] - 1, name)
- copy(g_hclass_info[g_hclass_i], sizeof g_hclass_info[] - 1, info)
- copy(g_hclass_model[g_hclass_i], sizeof g_hclass_model[] - 1, model)
- copy(g_hclass_clawmodel[g_hclass_i], sizeof g_hclass_clawmodel[] - 1, clawmodel)
- g_hclass_hp[g_hclass_i] = hp
- g_hclass_spd[g_hclass_i] = speed
- g_hclass_grav[g_hclass_i] = gravity
- g_hclass_lvl[g_hclass_i] = level
- g_hclass_ar[g_hclass_i] = armadura
- // Precache custom models and retrieve the modelindex
- new prec_mdl[100]
- formatex(prec_mdl, sizeof prec_mdl - 1, "models/player/%s/%s.mdl", model, model)
- g_hclass_modelindex[g_zclass_i] = engfunc(EngFunc_PrecacheModel, prec_mdl)
- formatex(prec_mdl, sizeof prec_mdl - 1, "models/[VG]/%s", clawmodel)
- engfunc(EngFunc_PrecacheModel, prec_mdl)
- // Increase registered classes counter
- g_hclass_i++
- // Return id under which we registered the class
- return g_hclass_i-1;
- }
- /*================================================================================
- [Custom Messages]
- =================================================================================*/
- // Custom Night Vision
- public set_user_nvision(taskid)
- {
- // Not meant to have nvision or not enabled
- if (!g_nvision[ID_NVISION] || !g_nvisionenabled[ID_NVISION])
- {
- // Task not needed anymore
- remove_task(taskid);
- return;
- }
- // Get player origin and alive status
- static Float:originF[3], alive
- pev(ID_NVISION, pev_origin, originF)
- alive = is_user_alive(ID_NVISION)
- // Nightvision message
- message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, ID_NVISION)
- write_byte(TE_DLIGHT) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- write_byte(get_pcvar_num(cvar_nvgsize)) // radius
- // Nemesis / Madness / Spectator in nemesis round
- if (g_nemesis[ID_NVISION] || (g_zombie[ID_NVISION] && g_nodamage[ID_NVISION]) || (!alive && g_nemround))
- {
- write_byte(get_pcvar_num(cvar_nemnvgcolor[0])) // r
- write_byte(get_pcvar_num(cvar_nemnvgcolor[1])) // g
- write_byte(get_pcvar_num(cvar_nemnvgcolor[2])) // b
- }
- // Human / Spectator in normal round
- else if (!g_zombie[ID_NVISION] || !alive)
- {
- write_byte(get_pcvar_num(cvar_humnvgcolor[0])) // r
- write_byte(get_pcvar_num(cvar_humnvgcolor[1])) // g
- write_byte(get_pcvar_num(cvar_humnvgcolor[2])) // b
- }
- // Zombie
- else
- {
- write_byte(get_pcvar_num(cvar_nvgcolor[0])) // r
- write_byte(get_pcvar_num(cvar_nvgcolor[1])) // g
- write_byte(get_pcvar_num(cvar_nvgcolor[2])) // b
- }
- write_byte(2) // life
- write_byte(0) // decay rate
- message_end()
- }
- // Game Nightvision
- set_user_gnvision(id, toggle)
- {
- // Toggle NVG message
- message_begin(MSG_ONE, g_msgNVGToggle, _, id)
- write_byte(toggle) // toggle
- message_end()
- }
- // Custom Flashlight
- public set_user_flashlight(taskid)
- {
- // Not meant to have flashlight / not enabled / depleted
- if (!g_flashlight[ID_FLASH] || g_flashbattery[ID_FLASH] <= 0 || !get_pcvar_num(cvar_cflash))
- {
- // Task not needed anymore
- remove_task(taskid);
- return;
- }
- // Disable flashlight if it shouldn't be available
- if (g_zombie[ID_FLASH] || g_survivor[ID_FLASH] || !is_user_alive(ID_FLASH))
- {
- // Turn it off
- g_flashlight[ID_FLASH] = false;
- // Update flashlight HUD
- message_begin(MSG_ONE, g_msgFlashlight, _, ID_FLASH)
- write_byte(0) // toggle
- write_byte(100) // battery
- message_end()
- // Task not needed anymore
- remove_task(taskid);
- return;
- }
- // Get player and aiming origins
- static Float:originF[3], Float:destoriginF[3]
- pev(ID_FLASH, pev_origin, originF)
- fm_get_aim_origin(ID_FLASH, destoriginF)
- // Make sure it's within the max distance
- if (get_distance_f(originF, destoriginF) > get_pcvar_float(cvar_flashdist))
- return;
- // Send to every player?
- if (get_pcvar_num(cvar_flashshowall))
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, destoriginF, 0)
- else
- message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, ID_FLASH)
- // Flashlight
- write_byte(TE_DLIGHT) // TE id
- engfunc(EngFunc_WriteCoord, destoriginF[0]) // x
- engfunc(EngFunc_WriteCoord, destoriginF[1]) // y
- engfunc(EngFunc_WriteCoord, destoriginF[2]) // z
- write_byte(get_pcvar_num(cvar_flashsize)) // radius
- write_byte(get_pcvar_num(cvar_flashcolor[0])) // r
- write_byte(get_pcvar_num(cvar_flashcolor[1])) // g
- write_byte(get_pcvar_num(cvar_flashcolor[2])) // b
- write_byte(3) // life
- write_byte(0) // decay rate
- message_end()
- }
- // Infection special effects
- infection_effects(id)
- {
- // Screen fade?
- if (get_pcvar_num(cvar_infectionscreenfade))
- {
- message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id)
- write_short(UNIT_SECOND*1) // duration
- write_short(UNIT_SECOND*0) // hold time
- write_short(FFADE_IN) // fade type
- write_byte((g_nemesis[id]) ? get_pcvar_num(cvar_nemnvgcolor[0]) : get_pcvar_num(cvar_nvgcolor[0])) // r
- write_byte((g_nemesis[id]) ? get_pcvar_num(cvar_nemnvgcolor[1]) : get_pcvar_num(cvar_nvgcolor[1])) // g
- write_byte((g_nemesis[id]) ? get_pcvar_num(cvar_nemnvgcolor[2]) : get_pcvar_num(cvar_nvgcolor[2])) // b
- write_byte (255) // alpha
- message_end()
- }
- // Screen shake?
- if (get_pcvar_num(cvar_infectionscreenshake))
- {
- message_begin(MSG_ONE_UNRELIABLE, g_msgScreenShake, _, id)
- write_short(UNIT_SECOND*4) // amplitude
- write_short(UNIT_SECOND*2) // duration
- write_short(UNIT_SECOND*10) // frequency
- message_end()
- }
- // Infection icon?
- if (get_pcvar_num(cvar_hudicons))
- {
- message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, id)
- write_byte(0) // damage save
- write_byte(0) // damage take
- write_long(DMG_NERVEGAS) // damage type - DMG_RADIATION
- write_coord(0) // x
- write_coord(0) // y
- write_coord(0) // z
- message_end()
- }
- // Get player origin
- static Float:originF[3]
- pev(id, pev_origin, originF)
- // Tracers?
- if (get_pcvar_num(cvar_infectiontracers))
- {
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_IMPLOSION) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- write_byte(128) // radius
- write_byte(20) // count
- write_byte(3) // duration
- message_end()
- }
- // Particle burst?
- if (get_pcvar_num(cvar_infectionparticles))
- {
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_PARTICLEBURST) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- write_short(50) // radius
- write_byte(70) // color
- write_byte(3) // duration (will be randomized a bit)
- message_end()
- }
- // Light sparkle?
- if (get_pcvar_num(cvar_infectionsparkle))
- {
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_DLIGHT) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- write_byte(20) // radius
- write_byte(get_pcvar_num(cvar_nvgcolor[0])) // r
- write_byte(get_pcvar_num(cvar_nvgcolor[1])) // g
- write_byte(get_pcvar_num(cvar_nvgcolor[2])) // b
- write_byte(2) // life
- write_byte(0) // decay rate
- message_end()
- }
- }
- // Nemesis/madness aura task
- public zombie_aura(taskid)
- {
- // Not nemesis, not in zombie madness
- if (!g_nemesis[ID_BLOOD] && !g_nodamage[ID_BLOOD])
- return;
- // Get player origin
- static Float:originF[3]
- pev(ID_BLOOD, pev_origin, originF)
- // Colored Aura
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_DLIGHT) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- write_byte(20) // radius
- write_byte(get_pcvar_num(cvar_nemnvgcolor[0])) // r
- write_byte(get_pcvar_num(cvar_nemnvgcolor[1])) // g
- write_byte(get_pcvar_num(cvar_nemnvgcolor[2])) // b
- write_byte(2) // life
- write_byte(0) // decay rate
- message_end()
- // Keep sending aura messages
- set_task(0.1, "zombie_aura", taskid)
- }
- // Make zombies leave footsteps and bloodstains on the floor
- public make_blood(taskid)
- {
- // Only bleed when moving on ground
- if (fm_get_speed(ID_BLOOD) < 80 || !(pev(ID_BLOOD, pev_flags) & FL_ONGROUND))
- return;
- // Get user origin
- static Float:originF[3]
- pev(ID_BLOOD, pev_origin, originF);
- // If ducking set a little lower
- if (pev(ID_BLOOD, pev_bInDuck))
- originF[2] -= 18.0
- else
- originF[2] -= 36.0
- // Send the decal message
- engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_WORLDDECAL) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- write_byte(zombie_decals[random_num(0, sizeof zombie_decals - 1)] + (g_czero*12)) // random decal number (offsets +12 for CZ)
- message_end()
- }
- // Flare Lighting
- public flare_lighting(args[5])
- {
- // Unexistant flare entity?
- if (!pev_valid(FLARE_ENTITY))
- return;
- // Flare depleted -clean up the mess-
- if (FLARE_DURATION <= 0)
- {
- engfunc(EngFunc_RemoveEntity, FLARE_ENTITY)
- return;
- }
- // Get origin
- static Float:originF[3]
- pev(FLARE_ENTITY, pev_origin, originF)
- // Lighting
- engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_DLIGHT) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- write_byte(get_pcvar_num(cvar_flaresize)) // radius
- write_byte(FLARE_R) // r
- write_byte(FLARE_G) // g
- write_byte(FLARE_B) // b
- write_byte(51) //life
- write_byte((FLARE_DURATION < 2) ? 3 : 0) //decay rate
- message_end()
- // Sparks
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_SPARKS) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- message_end()
- // Decrease task cycle counter
- FLARE_DURATION -= 1;
- // Keep sending flare messaegs
- set_task(5.0, "flare_lighting", TASK_NADES, args, sizeof args)
- }
- // Burning Flames
- public burning_flame(args[1], taskid)
- {
- // Get player origin and flags
- static Float:originF[3], flags
- pev(ID_BLOOD, pev_origin, originF)
- flags = pev(ID_BLOOD, pev_flags)
- // Madness mode - in water - burning stopped
- if (g_nodamage[ID_BLOOD] || (flags & FL_INWATER) || FLAME_DURATION < 1)
- {
- // Smoke sprite
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_SMOKE) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]-50.0) // z
- write_short(g_smokeSpr) // sprite
- write_byte(random_num(15, 20)) // scale
- write_byte(random_num(10, 20)) // framerate
- message_end()
- return;
- }
- // Randomly play burning zombie scream sounds (not for nemesis)
- if (!random_num(0, 20) && !g_nemesis[ID_BLOOD])
- 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)
- // Get fire slow down setting
- static Float:slowdown
- slowdown = get_pcvar_float(cvar_fireslowdown)
- // Fire slow down, unless nemesis
- if (slowdown > 0.0 && !g_nemesis[ID_BLOOD] && (flags & FL_ONGROUND))
- {
- static Float:velocity[3]
- pev(ID_BLOOD, pev_velocity, velocity)
- xs_vec_mul_scalar(velocity, slowdown, velocity)
- set_pev(ID_BLOOD, pev_velocity, velocity)
- }
- // Get health and fire damage setting
- static health, firedamage
- health = pev(ID_BLOOD, pev_health)
- firedamage = get_pcvar_num(cvar_firedamage)
- // Take damage from the fire
- if (health > firedamage)
- fm_set_user_health(ID_BLOOD, health - firedamage)
- // Flame sprite
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_SPRITE) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]+random_float(-5.0, 5.0)) // x
- engfunc(EngFunc_WriteCoord, originF[1]+random_float(-5.0, 5.0)) // y
- engfunc(EngFunc_WriteCoord, originF[2]+random_float(-10.0, 10.0)) // z
- write_short(g_flameSpr) // sprite
- write_byte(random_num(5, 10)) // scale
- write_byte(200) // brightness
- message_end()
- // Decrease task cycle counter
- FLAME_DURATION -= 1;
- // Keep sending flame messaegs
- set_task(0.2, "burning_flame", taskid, args, sizeof args)
- }
- // Infection Grenade: Green Blast
- create_blast(const Float:originF[3])
- {
- // Smallest ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(200) // green
- write_byte(0) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- // Medium ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(200) // green
- write_byte(0) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- // Largest ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(200) // green
- write_byte(0) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- }
- // Fire Grenade: Fire Blast
- create_blast2(const Float:originF[3])
- {
- // Smallest ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(200) // red
- write_byte(100) // green
- write_byte(0) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- // Medium ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(200) // red
- write_byte(50) // green
- write_byte(0) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- // Largest ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(200) // red
- write_byte(0) // green
- write_byte(0) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- }
- // Frost Grenade: Freeze Blast
- create_blast3(const Float:originF[3])
- {
- // Smallest ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(100) // green
- write_byte(200) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- // Medium ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(100) // green
- write_byte(200) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- // Largest ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(100) // green
- write_byte(200) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- }
- // Fix Dead Attrib on scoreboard
- FixDeadAttrib(id)
- {
- message_begin(MSG_BROADCAST, g_msgScoreAttrib)
- write_byte(id) // id
- write_byte(0) // attrib
- message_end()
- }
- // Send Death Message for infections
- SendDeathMsg(attacker, victim)
- {
- message_begin(MSG_BROADCAST, g_msgDeathMsg)
- write_byte(attacker) // killer
- write_byte(victim) // victim
- write_byte(1) // headshot flag
- write_string("infection") // killer's weapon
- message_end()
- }
- // Update Player Frags and Deaths
- UpdateFrags(attacker, victim, frags, deaths, scoreboard)
- {
- // Set attacker frags
- set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) + frags))
- // Set victim deaths
- fm_set_user_deaths(victim, fm_get_user_deaths(victim) + deaths)
- // Update scoreboard with attacker and victim info
- if (scoreboard)
- {
- message_begin(MSG_BROADCAST, g_msgScoreInfo)
- write_byte(attacker) // id
- write_short(pev(attacker, pev_frags)) // frags
- write_short(fm_get_user_deaths(attacker)) // deaths
- write_short(0) // class?
- write_short(fm_get_user_team(attacker)) // team
- message_end()
- message_begin(MSG_BROADCAST, g_msgScoreInfo)
- write_byte(victim) // id
- write_short(pev(victim, pev_frags)) // frags
- write_short(fm_get_user_deaths(victim)) // deaths
- write_short(0) // class?
- write_short(fm_get_user_team(victim)) // team
- message_end()
- }
- }
- // Remove Player Frags (when Nemesis/Survivor ignore_frags cvar is enabled)
- RemoveFrags(attacker, victim)
- {
- // Remove attacker frags
- set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) - 1))
- // Remove victim deaths
- fm_set_user_deaths(victim, fm_get_user_deaths(victim) - 1)
- }
- // Plays a sound on clients
- PlaySound(const sound[])
- {
- client_cmd(0, "spk ^"%s^"", sound)
- }
- // Prints a colored message to target (use 0 for everyone), supports ML formatting.
- // Note: I still need to make something like gungame's LANG_PLAYER_C to avoid unintended
- // argument replacement when a function passes -1 (it will be considered a LANG_PLAYER)
- zp_colored_print(target, const message[], any:...)
- {
- static buffer[512], i, argscount
- argscount = numargs()
- // Send to everyone
- if (!target)
- {
- static player
- for (player = 1; player <= g_maxplayers; player++)
- {
- // Not connected
- if (!is_user_connected(player))
- continue;
- // Remember changed arguments
- static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
- changedcount = 0
- // Replace LANG_PLAYER with player id
- for (i = 2; i < argscount; i++)
- {
- if (getarg(i) == LANG_PLAYER)
- {
- setarg(i, 0, player)
- changed[changedcount] = i
- changedcount++
- }
- }
- // Format message for player
- vformat(buffer, sizeof buffer - 1, message, 3)
- // Send it
- message_begin(MSG_ONE, g_msgSayText, _, player)
- write_byte(player)
- write_string(buffer)
- message_end()
- // Replace back player id's with LANG_PLAYER
- for (i = 0; i < changedcount; i++)
- setarg(changed[i], 0, LANG_PLAYER)
- }
- }
- // Send to specific target
- else
- {
- /*
- // Replace LANG_PLAYER with player id
- for (i = 2; i < argscount; i++)
- {
- if (getarg(i) == LANG_PLAYER)
- setarg(i, 0, target)
- }
- */
- // Format message for player
- vformat(buffer, sizeof buffer - 1, message, 3)
- // Send it
- message_begin(MSG_ONE, g_msgSayText, _, target)
- write_byte(target)
- write_string(buffer)
- message_end()
- }
- }
- /*================================================================================
- [Stocks]
- =================================================================================*/
- // Set an entity's key value (from fakemeta_util)
- stock fm_set_kvd(entity, const key[], const value[], const classname[])
- {
- set_kvd(0, KV_ClassName, classname)
- set_kvd(0, KV_KeyName, key)
- set_kvd(0, KV_Value, value)
- set_kvd(0, KV_fHandled, 0)
- dllfunc(DLLFunc_KeyValue, entity, 0)
- }
- // Set entity's rendering type (from fakemeta_util)
- stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
- {
- static Float:color[3]
- color[0] = float(r)
- color[1] = float(g)
- color[2] = float(b)
- set_pev(entity, pev_renderfx, fx)
- set_pev(entity, pev_rendercolor, color)
- set_pev(entity, pev_rendermode, render)
- set_pev(entity, pev_renderamt, float(amount))
- }
- // Get entity's speed (from fakemeta_util)
- stock fm_get_speed(entity)
- {
- static Float:velocity[3]
- pev(entity, pev_velocity, velocity)
- return floatround(vector_length(velocity));
- }
- // Get entity's aim origins (from fakemeta_util)
- stock fm_get_aim_origin(id, Float:origin[3])
- {
- static Float:origin1F[3], Float:origin2F[3]
- pev(id, pev_origin, origin1F)
- pev(id, pev_view_ofs, origin2F)
- xs_vec_add(origin1F, origin2F, origin1F)
- pev(id, pev_v_angle, origin2F);
- engfunc(EngFunc_MakeVectors, origin2F)
- global_get(glb_v_forward, origin2F)
- xs_vec_mul_scalar(origin2F, 9999.0, origin2F)
- xs_vec_add(origin1F, origin2F, origin2F)
- engfunc(EngFunc_TraceLine, origin1F, origin2F, 0, id, 0)
- get_tr2(0, TR_vecEndPos, origin)
- }
- // Find entity by its owner (from fakemeta_util)
- stock fm_find_ent_by_owner(entity, const classname[], owner)
- {
- while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
- return entity;
- }
- // Set player's health (from fakemeta_util)
- stock fm_set_user_health(id, health)
- {
- (health > 0) ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id);
- }
- // Give an item to a player (from fakemeta_util)
- stock fm_give_item(id, const item[])
- {
- static ent
- ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
- if (!pev_valid(ent)) return;
- static Float:originF[3]
- pev(id, pev_origin, originF)
- set_pev(ent, pev_origin, originF)
- set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
- dllfunc(DLLFunc_Spawn, ent)
- static save
- save = pev(ent, pev_solid)
- dllfunc(DLLFunc_Touch, ent, id)
- if (pev(ent, pev_solid) != save)
- return;
- engfunc(EngFunc_RemoveEntity, ent)
- }
- // Strip user weapons (from fakemeta_util)
- stock fm_strip_user_weapons(id)
- {
- static ent
- ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
- if (!pev_valid(ent)) return;
- dllfunc(DLLFunc_Spawn, ent)
- dllfunc(DLLFunc_Use, ent, id)
- engfunc(EngFunc_RemoveEntity, ent)
- }
- // Collect random spawn points
- stock load_spawns()
- {
- // Check for CSDM spawns of the current map
- new cfgdir[32], mapname[32], filepath[100], linedata[64]
- get_configsdir(cfgdir, sizeof cfgdir - 1)
- get_mapname(mapname, sizeof mapname - 1)
- formatex(filepath, sizeof filepath - 1, "%s/csdm/%s.spawns.cfg", cfgdir, mapname)
- // Load CSDM spawns if present
- if (file_exists(filepath))
- {
- new csdmdata[10][6], file = fopen(filepath,"rt")
- while (file && !feof(file))
- {
- fgets(file, linedata, sizeof linedata - 1)
- // invalid spawn
- if(!linedata[0] || str_count(linedata,' ') < 2) continue;
- // get spawn point data
- 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)
- // origin
- g_spawns[g_spawnCount][0] = floatstr(csdmdata[0])
- g_spawns[g_spawnCount][1] = floatstr(csdmdata[1])
- g_spawns[g_spawnCount][2] = floatstr(csdmdata[2])
- // increase spawn count
- g_spawnCount++
- if (g_spawnCount >= sizeof g_spawns) break;
- }
- if (file) fclose(file)
- }
- else
- {
- // if not, collect regular spawns
- collect_spawns_ent("info_player_start")
- collect_spawns_ent("info_player_deathmatch")
- }
- }
- // Collect spawn points from entity origins
- stock collect_spawns_ent(const classname[])
- {
- new ent = -1
- while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", classname)) != 0)
- {
- // get origin
- new Float:originF[3]
- pev(ent, pev_origin, originF)
- g_spawns[g_spawnCount][0] = originF[0]
- g_spawns[g_spawnCount][1] = originF[1]
- g_spawns[g_spawnCount][2] = originF[2]
- // increase spawn count
- g_spawnCount++
- if (g_spawnCount >= sizeof g_spawns) break;
- }
- }
- // Drop primary/secondary weapons
- stock drop_weapons(id, dropwhat)
- {
- // Get user weapons
- static weapons[32], num, i, weaponid
- num = 0 // reset passed weapons count (bugfix)
- get_user_weapons(id, weapons, num)
- // Loop through them and drop primaries or secondaries
- for (i = 0; i < num; i++)
- {
- // Prevent re-indexing the array
- weaponid = weapons[i]
- if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
- {
- // Get the weapon entity
- static wname[32], weapon_ent
- get_weaponname(weaponid, wname, sizeof wname - 1)
- weapon_ent = fm_find_ent_by_owner(-1, wname, id);
- // Hack: store weapon bpammo on PEV_ADDITIONAL_AMMO
- set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, fm_get_user_bpammo(id, weaponid))
- // Player drops the weapon and looses his bpammo
- engclient_cmd(id, "drop", wname)
- fm_set_user_bpammo(id, weaponid, 0)
- }
- }
- }
- // Stock by (probably) Twilight Suzuka -counts number of chars in a string
- stock str_count(const str[], searchchar)
- {
- new count, i
- //count = 0
- for (i = 0; i <= strlen(str); i++)
- {
- if(str[i] == searchchar)
- count++
- }
- return count;
- }
- // Checks if a space is vacant (credits to VEN)
- stock is_hull_vacant(Float:origin[3], hull)
- {
- engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, 0)
- if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen))
- return true;
- return false;
- }
- // Check if a player is stuck (credits to VEN)
- stock is_player_stuck(id)
- {
- static Float:originF[3]
- pev(id, pev_origin, originF)
- engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0)
- if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
- return true;
- return false;
- }
- // Get User BP Ammo
- stock fm_get_user_bpammo(id, weapon)
- {
- return get_pdata_int(id, AMMOOFFSET[weapon], OFFSET_LINUX);
- }
- // Set User BP Ammo
- stock fm_set_user_bpammo(id, weapon, amount)
- {
- set_pdata_int(id, AMMOOFFSET[weapon], amount, OFFSET_LINUX)
- }
- // Set Weapon Clip Ammo
- stock fm_set_weapon_ammo(entity, amount)
- {
- set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS)
- }
- // Get Weapon Clip Ammo
- stock fm_get_weapon_ammo(entity)
- {
- return get_pdata_int(entity, OFFSET_CLIPAMMO, OFFSET_LINUX_WEAPONS);
- }
- // Set User Zoom
- stock fm_remove_user_zoom(id)
- {
- set_pdata_int(id, OFFSET_ZOOMTYPE, CS_NO_ZOOM, OFFSET_LINUX)
- }
- // Get User Deaths
- stock fm_get_user_deaths(id)
- {
- return get_pdata_int(id, OFFSET_CSDEATHS, OFFSET_LINUX);
- }
- // Set User Deaths
- stock fm_set_user_deaths(id, value)
- {
- set_pdata_int(id, OFFSET_CSDEATHS, value, OFFSET_LINUX)
- }
- // Set User NVG for Bots
- stock fm_set_bot_nvg(id, toggle)
- {
- if (toggle)
- {
- g_nvision[id] = true
- set_pdata_int(id, OFFSET_NVGOGGLES, get_pdata_int(id, OFFSET_NVGOGGLES, OFFSET_LINUX) | HAS_NVGOGGLES, OFFSET_LINUX)
- }
- else
- {
- g_nvision[id] = false
- set_pdata_int(id, OFFSET_NVGOGGLES, get_pdata_int(id, OFFSET_NVGOGGLES, OFFSET_LINUX) &~ HAS_NVGOGGLES, OFFSET_LINUX)
- }
- }
- // Get User Team
- stock fm_get_user_team(id)
- {
- return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX);
- }
- // Set a Player's Team
- stock fm_set_user_team(id, team)
- {
- set_pdata_int(id, OFFSET_CSTEAMS, team, OFFSET_LINUX)
- }
- // Update Player's Team on all clients (adding needed delays)
- stock fm_user_team_update(id)
- {
- static Float:current_time
- current_time = get_gametime()
- if (current_time - g_teams_targettime >= 0.1)
- {
- set_task(0.1, "fm_set_user_team_msg", id+TASK_TEAM)
- g_teams_targettime = current_time + 0.1
- }
- else
- {
- set_task(((g_teams_targettime + 0.1) - current_time), "fm_set_user_team_msg", id+TASK_TEAM)
- g_teams_targettime = g_teams_targettime + 0.1
- }
- }
- // Send User Team Message
- public fm_set_user_team_msg(taskid)
- {
- // Beware: this message can now be picked up by other metamod
- // plugins (yeah, that includes AMXX plugins as well)
- // Set the switching team flag
- g_switchingteam[ID_TEAM] = true
- // Tell everyone my new team
- emessage_begin(MSG_ALL, g_msgTeamInfo)
- ewrite_byte(ID_TEAM) // player
- ewrite_string(TEAMNAMES[fm_get_user_team(ID_TEAM)]) // team
- emessage_end()
- // Done switching team
- g_switchingteam[ID_TEAM] = false
- }
- #if defined SET_MODELINDEX_OFFSET
- // Set the precached model index (updates hitboxes server side)
- stock fm_set_user_model_index(id, value)
- {
- set_pdata_int(id, OFFSET_MODELINDEX, value, OFFSET_LINUX)
- }
- #endif
- #if defined HANDLE_MODELS_ON_SEPARATE_ENT
- // Set Player Model on Entity
- stock fm_set_playermodel_ent(id)
- {
- // Make original player entity invisible
- // but without hiding shadows or firing effects
- fm_set_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
- // Format model string
- static model[100]
- formatex(model, sizeof model - 1, "models/player/%s/%s.mdl", g_playermodel[id], g_playermodel[id])
- // Set model on entity or make a new one if unexistant
- if (!pev_valid(g_ent_playermodel[id]))
- {
- g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
- if (!pev_valid(g_ent_playermodel[id])) return;
- set_pev(g_ent_playermodel[id], pev_classname, MODEL_ENT_CLASSNAME)
- set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
- set_pev(g_ent_playermodel[id], pev_aiment, id)
- set_pev(g_ent_playermodel[id], pev_owner, id)
- }
- engfunc(EngFunc_SetModel, g_ent_playermodel[id], model)
- }
- // Set Weapon Model on Entity
- stock fm_set_weaponmodel_ent(id)
- {
- // Get player's p_ weapon model
- static model[100]
- pev(id, pev_weaponmodel2, model, sizeof model - 1)
- // Set model on entity or make a new one if unexistant
- if (!pev_valid(g_ent_weaponmodel[id]))
- {
- g_ent_weaponmodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
- if (!pev_valid(g_ent_weaponmodel[id])) return;
- set_pev(g_ent_weaponmodel[id], pev_classname, WEAPON_ENT_CLASSNAME)
- set_pev(g_ent_weaponmodel[id], pev_movetype, MOVETYPE_FOLLOW)
- set_pev(g_ent_weaponmodel[id], pev_aiment, id)
- set_pev(g_ent_weaponmodel[id], pev_owner, id)
- }
- engfunc(EngFunc_SetModel, g_ent_weaponmodel[id], model)
- }
- // Remove Custom Model Entities
- stock fm_remove_model_ents(id)
- {
- // Remove "playermodel" ent if present
- if (pev_valid(g_ent_playermodel[id]))
- {
- engfunc(EngFunc_RemoveEntity, g_ent_playermodel[id])
- g_ent_playermodel[id] = 0
- }
- // Remove "weaponmodel" ent if present
- if (pev_valid(g_ent_weaponmodel[id]))
- {
- engfunc(EngFunc_RemoveEntity, g_ent_weaponmodel[id])
- g_ent_weaponmodel[id] = 0
- }
- }
- #else
- // Set User Model
- public fm_set_user_model(taskid)
- {
- set_user_info(ID_MODEL, "model", g_playermodel[ID_MODEL])
- }
- // Get User Model -model passed byref-
- stock fm_get_user_model(player, model[], len)
- {
- get_user_info(player, "model", model, len)
- }
- // Update Player's Model on all clients (adding needed delays)
- public fm_user_model_update(taskid)
- {
- static Float:current_time
- current_time = get_gametime()
- if (current_time - g_models_targettime >= MODELCHANGE_DELAY)
- {
- fm_set_user_model(taskid)
- g_models_targettime = current_time
- }
- else
- {
- set_task(((g_models_targettime + MODELCHANGE_DELAY) - current_time), "fm_set_user_model", taskid)
- g_models_targettime = g_models_targettime + MODELCHANGE_DELAY
- }
- }
- #endif
- public update_ap(id, amount, check)
- {
- 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".
- // Aca detectamos que si es Nivel Maximo no suba mas.
- if (g_ammopacks[id] + amount > NIVELES[sizeof NIVELES - 1] - 1)
- return PLUGIN_HANDLED
- // Le damos los APs correspondientes.
- g_ammopacks[id] += amount
- // Ya lo dijimos antes ^^.
- check2:
- if(amount < 0)
- {
- if(g_ammopacks[id] < NIVELES[g_level[id]] )
- {
- g_level[id]--
- update_ap(id, -1, 1)
- }
- }
- else
- {
- if(g_ammopacks[id] >= NIVELES[g_level[id]] )
- {
- g_level[id]++
- update_ap(id, 0, 1)
- }
- }
- return PLUGIN_HANDLED
- }
- public menu_reset(id, key)
- {
- if (key >= 1)
- {
- if (key != MENU_KEY_EXIT)
- show_menu_reset(id)
- return PLUGIN_HANDLED;
- }
- if (is_user_bot(id))
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Para resetear tienes que estar muerto")
- return PLUGIN_HANDLED;
- }
- if (g_reset[id] >= 30)
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Llegastes al level maximo de resets")
- return PLUGIN_HANDLED;
- }
- switch (key)
- {
- case 0:
- {
- if (g_level[id] >= 1000)
- {
- g_level[id] = 1
- g_reset[id]++
- g_ammopacks[id] = 0
- g_skill_points[id][0][0] += 1 // 5 sumadas a daño humana
- g_skill_points[id][0][1] += 1 // 5 a vida humana
- g_skill_points[id][0][4] += 1 // 5 sumadas a chaleco humana
- g_skill_points[id][1][0] += 1 // 5 a speed zombie
- g_skill_points[id][1][1] += 1 // 5 a algo
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Acabas de resetear, ahora tenes^x03 %d reset!", g_reset[id])
- WPN_AUTO_ON = 0
- g_zombieclassnext[id] = -1
- g_humanclassnext[id] = -1
- }
- else
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 To do a reset you need to be level: 1000")
- }
- }
- return PLUGIN_HANDLED
- }
- public menu_usuario(id)
- {
- new menu = menu_create("\r User Configuracion\r:", "menu_usuarioo")
- menu_additem(menu, "\wReset \wMenu" , "1", 0);
- menu_additem(menu, "\wSuper Reset Menu" , "2", 0);
- menu_additem(menu, "\rAccount Stats" , "3", 0);
- menu_setprop(menu, MPROP_EXITNAME, "\yExit")
- menu_display(id, menu, 0)
- }
- public menu_usuarioo(id, menu, key)
- {
- switch(key)
- {
- case 0: show_menu_reset(id);
- case 1: show_menu_grand_reset(id);
- case 2: Datos1(id);
- }
- return PLUGIN_HANDLED;
- }
- public oldmenu_handle( msgid, dest, id )
- {
- client_print( id, print_chat, "You cannot choose your team, This is just the VGUI Menu" )
- return PLUGIN_HANDLED
- }
- public show_menu_grand_reset(id)
- {
- static menu[800], len
- len = 0
- 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")
- if (g_reset[id] >= 30 && g_points[id][0] >= 200 && g_points[id][1] >= 200)
- len += formatex(menu[len], charsmax(menu) - len, "\r1.\w Super Reset^n^n^n^n")
- else
- 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])
- len += formatex(menu[len], charsmax(menu) - len, "\r0.\w %L", id, "MENU_EXIT")
- show_menu(id, KEYSMENU, menu, -1, "Menu Super Reset")
- }
- //Grand Reseteo
- public menu_grand_reset(id, key)
- {
- if (key >= 1)
- {
- if (key != MENU_KEY_EXIT)
- show_menu_grand_reset(id)
- return PLUGIN_HANDLED;
- }
- if (is_user_bot(id))
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Para poder hacer super reset tienes que estar muerto")
- return PLUGIN_HANDLED;
- }
- if (g_grandreset[id] >= 30)
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Llegastes al level maximo de super resets")
- return PLUGIN_HANDLED;
- }
- switch (key)
- {
- case 0:
- {
- if (g_reset[id] == 30 && g_points[id][0] >= 200 && g_points[id][1] >= 200)
- {
- g_level[id] = 1
- g_reset[id] = 0
- g_grandreset[id]++
- g_ammopacks[id] = 0
- g_points[id][0] -= 200
- g_points[id][1] -= 200
- g_skill_points[id][0][0] += 1 // 5 sumadas a daño humana
- g_skill_points[id][0][1] += 1 // 5 a vida humana
- g_skill_points[id][0][4] += 1 // 5 sumadas a chaleco humana
- g_skill_points[id][1][0] += 1 // 5 a speed zombie
- g_skill_points[id][1][1] += 1 // 5 a algo
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Acabas de super resetear, ahora tenes^x03 %d super resets!", g_grandreset[id])
- WPN_AUTO_ON = 0
- g_zombieclassnext[id] = -1
- g_humanclassnext[id] = -1
- }
- else
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Para super resetear necesitas ser reset 30")
- }
- }
- return PLUGIN_HANDLED
- }
- // Happy Hour
- public happyhour(id)
- {
- new data[12]
- get_time("%H", data, 12)
- new Tiempo = str_to_num(data)
- for(new i=0;i <= sizeof horas - 1;i++)
- {
- if(Tiempo != horas[i]) continue
- g_happytime = true
- break;
- }
- if(g_happytime)
- {
- zp_colored_print(0, "^x04[sG]^x01 -^x03 Happy Hour:^x01 Has Started!! / ENJOY!!")
- }
- }
- // menu granadasds
- public show_menu_granades(id)
- {
- new menu = menu_create("\yGrenade Selections \r[1-4]", "menu_handler")
- if(g_level[id] >= 0)
- menu_additem(menu, "\y1 Fuego", "1", 0);
- else
- menu_additem(menu, "\d1 Fire \r[Blocked]", "1", 0);
- if(g_level[id] >= 30)
- menu_additem(menu, "\y1 Fire || 1 Ice", "2", 0);
- else
- menu_additem(menu, "\d1 Fire || 1 Ice \r[Level: 30]", "2", 0);
- if(g_level[id] >= 70)
- menu_additem(menu, "\y3 Ice", "3", 0);
- else
- menu_additem(menu, "\d3 Ice \r[Level: 70]", "3", 0);
- if(g_level[id] >= 145)
- menu_additem(menu, "\y2 Fire || 2 Ice", "4", 0);
- else
- menu_additem(menu, "\d2 Fire || 2 Ice \r[Level: 145]", "4", 0);
- if(g_level[id] >= 200)
- menu_additem(menu, "\y1 Fire || 1 Ice || 1 Bubble", "5", 0);
- else
- menu_additem(menu, "\d1 Fire || 1 Ice || 1 Bubble \r[Level: 200]", "5", 0);
- if(g_level[id] >= 260)
- menu_additem(menu, "\y1 Fire || 2 Ice || 1 Bubble", "6", 0);
- else
- menu_additem(menu, "\d1 Fire || 2 Ice || 1 Bubble \r[Level: 260]", "6", 0);
- if(g_level[id] >= 330)
- menu_additem(menu, "\y2 Fire || 2 Ice || 1 Bubble", "7", 0);
- else
- menu_additem(menu, "\d2 Fire || 2 Ice || 1 Bubble\r[Level: 330]", "7", 0);
- menu_display(id, menu, 0)
- }
- // Menu Grenades
- public menu_handler(id, menu, key)
- {
- if(g_zombie[id])
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- switch(key)
- {
- case 0:
- {
- if (g_level[id] >= 0)
- {
- give_item(id, "weapon_hegrenade");
- }
- else
- {
- show_menu_granades(id);
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
- return PLUGIN_HANDLED;
- }
- }
- case 1:
- {
- if (g_level[id] >= 30)
- {
- give_item(id, "weapon_hegrenade");
- give_item(id, "weapon_flashbang");
- }
- else
- {
- show_menu_granades(id);
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
- return PLUGIN_HANDLED;
- }
- }
- case 2:
- {
- if (g_level[id] >= 70)
- {
- give_item(id, "weapon_flashbang");
- give_item(id, "weapon_flashbang");
- give_item(id, "weapon_flashbang");
- cs_set_user_bpammo(id, CSW_FLASHBANG, 3);
- }
- else
- {
- show_menu_granades(id);
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
- return PLUGIN_HANDLED;
- }
- }
- case 3:
- {
- if (g_level[id] >= 145)
- {
- give_item(id, "weapon_flashbang");
- give_item(id, "weapon_flashbang");
- give_item(id, "weapon_hegrenade");
- cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
- }
- else
- {
- show_menu_granades(id);
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
- return PLUGIN_HANDLED;
- }
- }
- case 4:
- {
- if (g_level[id] >= 200)
- {
- g_bubble_bomb[id] = true
- g_bubble_bomb[id]++
- fm_give_item(id, "weapon_hegrenade")
- fm_give_item(id, "weapon_flashbang")
- fm_give_item(id, "weapon_smokegrenade")
- fm_set_user_bpammo(id, CSW_SMOKEGRENADE, 1)
- }
- else
- {
- show_menu_granades(id);
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
- return PLUGIN_HANDLED;
- }
- }
- case 5:
- {
- if (g_level[id] >= 260)
- {
- g_bubble_bomb[id] = true
- g_bubble_bomb[id] ++
- fm_give_item(id, "weapon_hegrenade");
- fm_give_item(id, "weapon_flashbang");
- fm_give_item(id, "weapon_flashbang");
- fm_give_item(id, "weapon_smokegrenade");
- fm_set_user_bpammo(id, CSW_SMOKEGRENADE, 1)
- }
- else
- {
- show_menu_granades(id);
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
- return PLUGIN_HANDLED;
- }
- }
- case 6:
- {
- if (g_level[id] >= 330)
- {
- g_bubble_bomb[id] = true
- g_bubble_bomb[id] += 2
- fm_give_item(id, "weapon_hegrenade");
- fm_give_item(id, "weapon_hegrenade");
- fm_give_item(id, "weapon_flashbang");
- fm_give_item(id, "weapon_flashbang");
- fm_give_item(id, "weapon_smokegrenade");
- fm_set_user_bpammo(id, CSW_SMOKEGRENADE, 2)
- fm_set_user_bpammo(id, CSW_HEGRENADE, 2)
- }
- else
- {
- show_menu_granades(id);
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 You do not have the sufficient Level for this grenade");
- return PLUGIN_HANDLED;
- }
- }
- }
- return PLUGIN_HANDLED
- }
- // Bubble Grenade Explosion
- public bubble_explode(id)
- {
- // Get origin
- static Float:originF[3] // originF para llamar la entidad de create_blast4
- pev(id, pev_origin, originF) // ...
- // Create Blast
- create_blast4(originF) // entidad de los anillos de explocion
- set_pcvar_num(cvar_flaregrenades,1) // tomamos las cvar de la flare, para usarla como activador y desactivador de esta bomba.
- // Create entitity
- new iEntity = create_entity("info_target") // creamo la entidad con su determinado objetivo
- if(!is_valid_ent(iEntity)) // determinamos que la entidad esta en false
- return PLUGIN_HANDLED // tramitamos nuevamente
- new Float: Origin[3] // origen
- entity_get_vector(id, EV_VEC_origin, Origin)
- entity_set_string(iEntity, EV_SZ_classname, entclas) // llamamos ala clase de entidad
- entity_set_vector(iEntity,EV_VEC_origin, Origin) // no se que es
- entity_set_model(iEntity,model) // modelo dela burbuja
- entity_set_int(iEntity, EV_INT_solid, SOLID_TRIGGER) // no se que es
- 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
- entity_set_int(iEntity, EV_INT_renderfx, kRenderFxGlowShell) // le damos el glow
- entity_set_int(iEntity, EV_INT_rendermode, kRenderTransAlpha) // hacemos que sea transparente
- entity_set_float(iEntity, EV_FL_renderamt, 50.0) // le damos la intensidad
- // Colored Aura / aura cuando explota la granada
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_DLIGHT) // aura
- engfunc(EngFunc_WriteCoord, originF[0]) // x position
- engfunc(EngFunc_WriteCoord, originF[1]) // y position
- engfunc(EngFunc_WriteCoord, originF[2]) // z position
- write_byte(15) // radius / radio
- write_byte(255) // red: rojo
- write_byte(255) // green: verde
- write_byte(255) // blue: azul
- write_byte(2) // life
- write_byte(0) // decay rate / desintegración de la tasa
- message_end() // cerramos la entidad
- #if defined RANDOM_COLOR // color por default
- if(is_valid_ent(iEntity)) // entidad valida
- {
- new Float:vColor[3] // variable vColor defaul / por defecto
- for(new i; i < 3; i++) // nose que es
- vColor[i] = random_float(0.0, 255.0) // color r, g, b
- entity_set_vector(iEntity, EV_VEC_rendercolor, vColor) // el glow de la burbuja
- }
- #endif
- #if defined ONE_COLOR
- entity_set_vector(iEntity, EV_VEC_rendercolor, colour_force_shield) // declaramos el color cuztomizable al principio
- #endif
- #if defined CAMPO_TASK
- set_task(15.0, "DeleteEntity", iEntity) // tiempo que demora en removerse el campo
- #endif
- return PLUGIN_CONTINUE;
- }
- // Bubble Grenade: Yellow Blast
- create_blast4(const Float:originF[3])
- {
- // Smallest ring / anillo de explcion 1
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
- write_short(g_exploSpr) // sprite de los anillos
- write_byte(0) // startframe / fotograma inicial
- write_byte(0) // framerate / imágenes por segundo
- write_byte(4) // life
- write_byte(60) // width / ancho
- write_byte(0) // noise / ruido
- write_byte(255) // red: rojo
- write_byte(255) // green: verde
- write_byte(255) // blue: azul
- write_byte(200) // brightness / brillo
- write_byte(0) // speed / rapidez
- message_end()
- // Medium ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe / fotograma inicial
- write_byte(0) // framerate / imágenes por segundo
- write_byte(4) // life
- write_byte(60) // width / ancho
- write_byte(0) // noise / ruido
- write_byte(255) // red: rojo
- write_byte(255) // green: verde
- write_byte(255) // blue: azul
- write_byte(200) // brightness / brillo
- write_byte(0) // speed / rapidez
- message_end()
- // Largest ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
- write_short(g_exploSpr) // sprite
- write_byte(0) // startframe / fotograma inicial
- write_byte(0) // framerate / imágenes por segundo
- write_byte(4) // life
- write_byte(60) // width / ancho
- write_byte(0) // noise / ruido
- write_byte(255) // red: rojo
- write_byte(255) // green: verde
- write_byte(255) // blue: azul
- write_byte(200) // brightness / brillo
- write_byte(0) // speed / rapidez
- message_end()
- }
- // Touch bomb bubble
- public entity_touch(touched, toucher) // entidad cuando un zombie o nemesis la toca
- {
- if(g_zombie[toucher] || g_nemesis[toucher]) // los nemesis y zombies no pueden pasar
- {
- new Float:pos_ptr[3], Float:pos_ptd[3], Float:push_power = get_pcvar_float(cvar_bubblepush) // intensidad de rechazo
- pev(touched, pev_origin, pos_ptr) // nose que es
- pev(toucher, pev_origin, pos_ptd) // nose que es
- for(new i = 0; i < 3; i++)
- {
- pos_ptd[i] -= pos_ptr[i] // nose que es
- pos_ptd[i] *= push_power // poder cuando lo tocamos y nos rechaza
- }
- set_pev(toucher, pev_velocity, pos_ptd) // velocidad del rechazo
- set_pev(toucher, pev_impulse, pos_ptd) // impulso del rechazo
- }
- }
- // Hook bubble bomb
- public hook_curwpn(id)
- {
- if(!is_user_alive(id)) // cliente muerto no recibe =D
- return PLUGIN_CONTINUE;
- if(g_bubble_bomb[id] && !g_zombie[id]) // la bomba solo la puede adquirir un humano
- {
- new wID = read_data(2)
- if(wID == CSW_SMOKEGRENADE) // toma el lugar de la smoke grenade
- set_pev(id, pev_viewmodel2, model_grenade) // modelo de la grana
- }
- return PLUGIN_CONTINUE;
- }
- // Give bubble item / hacemos que nos de el campo
- public give_item_bubble(id)
- {
- g_bubble_bomb[id] = true // seteamos la variable a true
- give_item(id,"weapon_smokegrenade") // le pedimos una smoke ya que el campo la remplaza
- }
- // Remove Entity / removemos la entidad con el task
- public DeleteEntity(entity)
- {
- if(is_valid_ent(entity )) // hacemos valida la entidad
- remove_entity(entity) // la removemos...
- }
- // luego abajo de todo el plugin agregamos esto
- public Combo_Terminado(id)
- {
- id -= TASK_COMBO
- for(new i = 0 ; i < sizeof Combo ; i++)
- {
- if (g_combo[id] >= Combo[i][Combos] && g_combo[id] < Combo[i+1][Combos])
- {
- set_hudmessage(255, 255, 255, -1.0, 0.29, 0, 0.1, 4.5, 0.01, 0.01, -1)
- 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])
- g_ammopacks[id] += g_combo[id] * Combo[i][Multiplicado]
- }
- }
- g_damage[id] = g_total[id] = g_combo[id] = 0;
- 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
- }
- // CAMBIO DE NOMBRE NO PERMITIDO
- public fwdCliUserInfoChanged(id, buffer)
- {
- static name[32]
- if(g_names[id][0])
- {
- engfunc(EngFunc_InfoKeyValue, buffer, "name", name, charsmax(name))
- if(!equal(name, g_names[id]))
- {
- client_print(id, print_center, "Para cambiar tu nombre, Desconectate del servidor PRIMERO")
- engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", g_names[id])
- return FMRES_SUPERCEDE
- }
- }
- return FMRES_IGNORED
- }
- // Menu: Habilidades
- public menu_upgrade(id)
- {
- new menu = menu_create("\yAbilities \yMenu", "menu_upgrade_handler")
- menu_additem(menu, "\wZombie Abilities", "1", 0)
- menu_additem(menu, "\wHuman Abilities", "2", 0)
- menu_setprop(menu, MPROP_EXITNAME, "\rExit")
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public menu_upgrade_handler(id, menu, item)
- {
- if (item == MENU_EXIT) return PLUGIN_HANDLED
- new data[6], iName[64], access, callback;
- menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback);
- switch (str_to_num(data))
- {
- case 1: menu_zomupgrade(id)
- case 2: menu_humupgrade(id)
- }
- return PLUGIN_HANDLED;
- }
- // Menu: Mejoras de zombie
- public menu_zomupgrade(id)
- {
- new menu[999], num[8], i
- static item[150]
- 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])
- new menu2 = menu_create(item, "menu_zomupgrade_handler")
- for (i = 0; i < 4; i++)
- {
- if (g_skill_points[id][1][i] < g_upgrade_max[1][i])
- {
- if (g_points[id][1] >= upgrade_cost(g_skill_points[id][1][i]))
- {
- 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])
- num_to_str(i, num, 7)
- menu_additem(menu2, menu, num)
- }
- else
- {
- 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])
- num_to_str(i, num, 7)
- menu_additem(menu2, menu, num)
- }
- }
- else
- {
- formatex(menu, charsmax(menu), "\d%s \d[\r Full \d]" , g_upgrades_names[1][i])
- num_to_str(i, num, 7)
- menu_additem(menu2, menu, num)
- }
- }
- menu_setprop(menu2, MPROP_EXITNAME, "\rExit")
- menu_display(id, menu2)
- return PLUGIN_HANDLED;
- }
- public menu_zomupgrade_handler(id, menu, item)
- {
- if (item == MENU_EXIT) return PLUGIN_HANDLED;
- new Key, Data[5], Name[33], access, callback
- menu_item_getinfo(menu, item, access, Data, 4, Name, 32, callback)
- Key = str_to_num(Data)
- if (g_skill_points[id][1][Key] < g_upgrade_max[1][Key])
- {
- if (g_points[id][1] >= upgrade_cost(g_skill_points[id][1][Key]))
- {
- g_points[id][1] -= upgrade_cost(g_skill_points[id][1][Key])
- g_usedpoints[id][1] += upgrade_cost(g_skill_points[id][1][Key])
- g_skill_points[id][1][Key]++
- }
- }
- menu_zomupgrade(id)
- return PLUGIN_HANDLED;
- }
- // Menu: Mejoras de humano
- public menu_humupgrade(id)
- {
- new menu[999], num[8], i
- static item[150]
- 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])
- new menu2 = menu_create(item, "menu_humupgrade_handler")
- for (i = 0; i < 5; i++)
- {
- if (g_skill_points[id][0][i] < g_upgrade_max[0][i])
- {
- if (g_points[id][0] >= upgrade_cost(g_skill_points[id][0][i]))
- {
- 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])
- num_to_str(i, num, 7)
- menu_additem(menu2, menu, num)
- }
- else
- {
- 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])
- num_to_str(i, num, 7)
- menu_additem(menu2, menu, num)
- }
- }
- else
- {
- formatex(menu, charsmax(menu), "\d%s \d[ \rFull \d]" , g_upgrades_names[0][i])
- num_to_str(i, num, 7)
- menu_additem(menu2, menu, num)
- }
- }
- menu_setprop(menu2, MPROP_EXITNAME, "\rExit")
- menu_display(id, menu2)
- return PLUGIN_HANDLED;
- }
- public menu_humupgrade_handler(id, menu, item)
- {
- if (item == MENU_EXIT) return PLUGIN_HANDLED;
- new Key, Data[5], Name[33], access, callback
- menu_item_getinfo(menu, item, access, Data, 4, Name, 32, callback)
- Key = str_to_num(Data)
- if (g_skill_points[id][0][Key] < g_upgrade_max[0][Key])
- {
- if (g_points[id][0] >= upgrade_cost(g_skill_points[id][0][Key]))
- {
- g_points[id][0] -= upgrade_cost(g_skill_points[id][0][Key])
- g_usedpoints[id][0] += upgrade_cost(g_skill_points[id][0][Key])
- g_skill_points[id][0][Key]++
- }
- }
- menu_humupgrade(id)
- return PLUGIN_HANDLED;
- }
- public bugvelocidad(id)
- {
- if (is_user_alive(id))
- {
- give_item(id, "weapon_knife")
- client_cmd(id, "cl_backspeed 10000")
- client_cmd(id, "cl_forwardspeed 10000")
- client_cmd(id, "cl_sidespeed 10000")
- }
- else
- {
- return;
- }
- }
- public cmdParty(id) {
- if(g_PartyData[id][In_Party])
- show_party_info_menu(id)
- else
- show_party_menu(id)
- return PLUGIN_HANDLED
- }
- public show_party_menu(id) {
- new iMenu = menu_create("[sG]Silent Gamerz - \rParty Menu:","party_menu"), BlockParty[50]
- menu_additem(iMenu, "\yCreate Party", "0")
- formatex(BlockParty, charsmax(BlockParty), "\yBlock Party invitations: \w%s",g_PartyData[id][Block_Party] ? "Yes" : "No")
- menu_additem(iMenu, BlockParty, "1")
- menu_setprop(iMenu, MPROP_EXITNAME, "Exit")
- menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
- menu_display(id, iMenu, 0)
- }
- public show_party_info_menu(id) {
- new iMenu = menu_create("[sG]Silent Gamerz - \rMenu Party:","party_info_menu")
- menu_additem(iMenu, "Add Members", .callback = g_MenuCallback[MASTER])
- menu_additem(iMenu, "Kick Members", .callback = g_MenuCallback[MASTER])
- menu_additem(iMenu, "Destroy Party", .callback = g_MenuCallback[MASTER])
- menu_additem(iMenu, "Leave Party", .callback = g_MenuCallback[USER])
- menu_setprop(iMenu, MPROP_EXITNAME, "Exit")
- menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
- menu_display(id, iMenu)
- }
- public show_party_add_menu(id) {
- new iMenu = menu_create(g_PartyData[id][In_Party] ? "\rAgregar Integrante:" : "\rCreate Party:", "party_create_menu"), Poss[3], Name[32]
- for(new i = 1; i <= g_maxplayers; i++) {
- if(!is_available_to_party(i) || id == i)
- continue;
- get_user_name(i, Name, charsmax(Name))
- num_to_str(i, Poss, charsmax(Poss))
- menu_additem(iMenu, Name, Poss)
- }
- menu_setprop(iMenu, MPROP_EXITNAME, "Exit")
- menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
- menu_display(id, iMenu)
- }
- public show_party_kick_menu(id) {
- new iMenu = menu_create("\rKick Party Menu:","party_kick_menu"), Players[32], Poss[3], user
- get_party_index(id, Players)
- for(new i; i < g_PartyData[id][Amount_In_Party]; i++) {
- user = Players[i]
- num_to_str(user, Poss, charsmax(Poss))
- menu_additem(iMenu, g_PartyData[user][UserName], Poss)
- }
- menu_setprop(iMenu, MPROP_EXITNAME, "Exit")
- menu_display(id, iMenu)
- }
- public show_party_invite_menu(id2, MasterId) {
- new MenuTitle[128], iMenu, Str_MasterId[3]
- set_player_party_name(MasterId)
- set_player_party_name(id2)
- client_print(MasterId, print_chat, "%s Request sent to %s", TAG, g_PartyData[id2][UserName])
- 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")
- new UserTaskArgs[3]
- UserTaskArgs[0] = iMenu = menu_create( MenuTitle , "party_invite_menu")
- UserTaskArgs[1] = MasterId
- num_to_str(MasterId, Str_MasterId, charsmax(Str_MasterId))
- menu_additem( iMenu , "Accept", Str_MasterId)
- menu_additem( iMenu , "Deny", Str_MasterId)
- if(is_user_bot(id2) && get_pcvar_num(cvar_allow_bots)) {
- party_invite_menu(id2, iMenu, 0)
- return
- }
- menu_setprop(iMenu, MPROP_EXIT, MEXIT_NEVER)
- menu_display(id2, iMenu)
- remove_task_acept(id2)
- set_task(get_pcvar_float(cvar_time_acept), "Time_Acept", id2+TASK_ACEPT, UserTaskArgs, 2)
- }
- public party_menu(id, menu, item) {
- if(item == MENU_EXIT) {
- menu_destroy(menu)
- return
- }
- if(item) {
- g_PartyData[id][Block_Party] = g_PartyData[id][Block_Party] ? false : true
- show_party_menu(id)
- }
- else
- show_party_add_menu(id)
- menu_destroy(menu)
- }
- public party_create_menu(id, menu, item) {
- if(item == MENU_EXIT) {
- menu_destroy(menu)
- return
- }
- new iKey[6], iAccess, iCallback, id2
- menu_item_getinfo(menu, item, iAccess, iKey, charsmax(iKey), _, _, iCallback)
- id2 = str_to_num(iKey)
- if(!is_available_to_party(id2))
- return
- show_party_invite_menu(id2, id)
- menu_destroy(menu)
- }
- public party_invite_menu(id, menu, item) {
- if(item == MENU_EXIT) {
- menu_destroy(menu)
- remove_task_acept(id)
- return
- }
- new iKey[6], iAccess, iCallback, id_master
- menu_item_getinfo(menu, item, iAccess, iKey, charsmax(iKey), _, _, iCallback)
- id_master = str_to_num(iKey)
- switch(item) {
- case 0: {
- if(!g_PartyData[id_master][In_Party]) {
- create_party(id_master, id)
- set_task_party_hud(id_master)
- set_task_party_hud(id)
- }
- else {
- if(g_PartyData[id_master][Amount_In_Party] == get_pcvar_num(cvar_max_players)) {
- client_print(id, print_chat, "%s Ya se alcanzo el numero maximo de integrantes en la party", TAG)
- client_print(id_master, print_chat, "%s Ya alcanzaste el numero maximo de integrantes en la party", TAG)
- remove_task_acept(id)
- menu_destroy(menu)
- return
- }
- add_party_user(id_master, id)
- set_task_party_hud(id)
- }
- client_print(id_master, print_chat, "%s %s has joined the party", TAG, g_PartyData[id][UserName])
- }
- case 1: client_print(id_master, print_chat, "%s %s Cancelled the party invitation", TAG, g_PartyData[id][UserName])
- }
- remove_task_acept(id)
- menu_destroy(menu)
- }
- public party_kick_menu(id, menu, item) {
- if(item == MENU_EXIT) {
- menu_destroy(menu)
- return
- }
- new iKey[6], iAccess, iCallback, id2
- menu_item_getinfo(menu, item, iAccess, iKey, charsmax(iKey), _, _, iCallback)
- id2 = str_to_num(iKey)
- if(is_user_connected(id2))
- g_PartyData[id][Amount_In_Party] == 2 ? destoy_party(id) : remove_party_user(id2)
- menu_destroy(menu)
- }
- public party_info_menu(id, menu,item) {
- if(item == MENU_EXIT) {
- menu_destroy(menu)
- return
- }
- switch(item) {
- case 0: {
- if(g_PartyData[id][Amount_In_Party] < get_pcvar_num(cvar_max_players))
- show_party_add_menu(id)
- else
- client_print(id, print_chat, "%s Ya alcanzaste el numero maximo de integrantes en la party", TAG)
- }
- case 1: show_party_kick_menu(id)
- case 2: destoy_party(id)
- case 3: remove_party_user(id)
- }
- menu_destroy(menu)
- }
- public PartyHud(taskid) {
- static id
- id = ID_HUD
- if(!is_user_connected(id)) {
- remove_task(taskid)
- return
- }
- static CountParty, PartyMsg[256], Players[32], id2
- CountParty = 0
- PartyMsg[0] = 0
- get_party_index(id, Players)
- for(new i; i < g_PartyData[id][Amount_In_Party]; i++)
- {
- id2 = Players[i]
- if(CountParty)
- add(PartyMsg, charsmax(PartyMsg), "^n^n")
- 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])
- CountParty++
- }
- set_hudmessage(255, 0, 0, 0.75, 0.34, 0, 6.0, 1.0);
- show_hudmessage(id, PartyMsg)
- }
- public Time_Acept(UserTaskArgs[], taskid) {
- taskid -= TASK_ACEPT;
- if(!g_PartyData[taskid][In_Party]) {
- client_print(UserTaskArgs[1], print_chat, "%s %s Cancelled the party invitation", TAG, g_PartyData[taskid][UserName])
- menu_destroy(UserTaskArgs[0])
- show_menu(taskid, 0, "^n", 1)
- }
- }
- stock create_party(master, guest) {
- set_party_member(master, master)
- set_party_member(master, guest)
- set_party_member(guest, master)
- set_party_member(guest, guest)
- set_party_vars(master, Start_Amount)
- set_party_vars(guest, ++g_PartyData[master][Amount_In_Party])
- }
- stock add_party_user(master, guest) {
- new Players[32], member, amount = g_PartyData[master][Amount_In_Party]
- get_party_index(master, Players)
- for(new i; i < amount; i++) {
- member = Players[i]
- set_party_member(guest, member)
- set_party_member(member, guest)
- g_PartyData[member][Amount_In_Party]++
- }
- set_party_member(guest, guest)
- set_party_vars(guest, amount+1)
- }
- stock set_party_member(id, id2)
- ArrayPushCell(Party_Ids[id], id2)
- stock set_party_vars(id, amount) {
- g_PartyData[id][In_Party] = true
- g_PartyData[id][Position] = amount-1
- g_PartyData[id][Amount_In_Party] = amount
- }
- stock destoy_party(id) {
- new Players[32], id2, Amount = g_PartyData[id][Amount_In_Party]
- get_party_index(id, Players)
- for(new i; i < Amount; i++) {
- id2 = Players[i]
- clear_party_user(id2)
- client_print(id2, print_chat, "%s The party is destroyed", TAG)
- }
- }
- stock remove_party_user(user) {
- new Players[32], id, Amount = g_PartyData[user][Amount_In_Party]
- get_party_index(user, Players)
- clear_party_user(user)
- for(new i; i < Amount; i++) {
- id = Players[i]
- if(id != user) {
- ArrayClear(Party_Ids[id])
- for(new z; z < Amount; z++)
- if(Players[z] != user)
- set_party_member(id, Players[z])
- g_PartyData[id][Position] = i
- g_PartyData[id][Amount_In_Party] = Amount-1
- client_print(id, print_chat, "%s %s left the party", TAG, g_PartyData[user][UserName])
- }
- }
- }
- stock clear_party_user(id) {
- ArrayClear(Party_Ids[id])
- g_PartyData[id][In_Party] = false
- g_PartyData[id][Position] = NONE
- g_PartyData[id][Amount_In_Party] = NONE
- remove_task_party_hud(id)
- }
- stock set_task_party_hud(id)
- set_task(1.0, "PartyHud", id+TASK_HUD, _, _, "b")
- stock remove_task_party_hud(id)
- remove_task(id+TASK_HUD)
- stock remove_task_acept(id)
- if(task_exists(id+TASK_ACEPT))
- remove_task(id+TASK_ACEPT)
- stock set_player_party_name(id) {
- if(g_PartyData[id][UserName][0])
- return 0
- get_user_name(id, g_PartyData[id][UserName], charsmax(g_PartyData[][UserName]))
- return 1
- }
- stock is_available_to_party(id) {
- if(!is_user_connected(id) || g_PartyData[id][In_Party] || g_PartyData[id][Block_Party])
- return false
- return true
- }
- stock get_party_index(id, players[]) {
- for(new i; i < g_PartyData[id][Amount_In_Party]; i++)
- players[i] = ArrayGetCell(Party_Ids[id], i)
- return players[0] ? 1 : 0
- }
- public check_master(id)
- return g_PartyData[id][Position] ? ITEM_DISABLED : ITEM_ENABLED
- public check_user(id)
- return g_PartyData[id][Position] ? ITEM_ENABLED : ITEM_DISABLED
- public cmdSayTeam(id) {
- static Text[192]
- read_args(Text, charsmax(Text))
- remove_quotes(Text)
- replace_all(Text, charsmax(Text), "%", "")
- if(!ValidMessage(Text) || !g_PartyData[id][In_Party]) {
- client_print(id, print_chat,"%s Tu Mensaje es invalido o no te encuentras en un Party", TAG)
- return PLUGIN_HANDLED;
- }
- static Message[192], Players[32], id2, Amount
- Amount = g_PartyData[id][Amount_In_Party]
- get_party_index(id, Players)
- formatex(Message, charsmax(Message), "^x04%s ^x03%s^x01 : %s", TAG, g_PartyData[id][UserName], Text)
- for(new i; i < Amount; i++) {
- id2 = Players[i]
- message_begin(MSG_ONE_UNRELIABLE, g_MsgSayText, _, id2)
- write_byte(id)
- write_string(Message)
- message_end()
- }
- return PLUGIN_HANDLED;
- }
- ValidMessage(text[]) {
- static len, i
- len = strlen(text)
- if(!len)
- return false
- for(i = 0; i < len; i++) {
- if( text[i] != ' ' ) {
- return true
- }
- }
- return false
- }
- show_menu_especiales(id)
- {
- if (g_survivor[id])
- return;
- new menu = menu_create("\yModified Guns:", "menu_especiala")
- if(g_level[id] >= 330 && g_reset[id] >= 0)
- menu_additem(menu, "\wAk Destruction \r[\yHabilitada Level: 330\r]", "1", 0);
- else
- menu_additem(menu, "\dAk Destruction \r[\dLevel\r: \d330 \r| \dReset\r: \d0\r]", "1", 0);
- if(g_level[id] >= 400 && g_reset[id] >= 0)
- menu_additem(menu, "\wsG Ultimate \r[\yHabilitada Level: 400\r]", "2", 0);
- else
- menu_additem(menu, "\dsG Ultimate \r[\dLevel\r: \d400 \r| \dReset\r: \d0\r]", "2", 0);
- if(g_level[id] >= 450 && g_reset[id] >= 0)
- menu_additem(menu, "\wSVT 40 Atomic \r[\yHabilitada Level: 450\r]", "3", 0);
- else
- menu_additem(menu, "\dSVT 40 Atomic \r[\dLevel\r: \d450 \r| \dReset\r: \d0\r]", "3", 0);
- if(g_level[id] >= 510 && g_reset[id] >= 0)
- menu_additem(menu, "\wDP- 31 Massive \r[\yHabilitada Level: 510\r]", "4", 0);
- else
- menu_additem(menu, "\dDP- 31 Massive \r[\dLevel\r: \d510 \r| \dReset\r: \d0\r]", "4", 0);
- if(g_level[id] >= 600 && g_reset[id] >= 0)
- menu_additem(menu, "\wNavi Strike \r[\yHabilitada Level: 600\r]", "5", 0);
- else
- menu_additem(menu, "\dNavi Strike \r[\dLevel\r: \d600 \r| \dReset\r: \d0\r]", "5", 0);
- if(g_level[id] >= 651 && g_reset[id] >= 0)
- menu_additem(menu, "\wXM1014 Overpower \r[\yHabilitada Level: 651\r]", "5", 0);
- else
- menu_additem(menu, "\dXM1014 Overpower \r[\dLevel\r: \d651 \r| \dReset\r: \d0\r]", "5", 0);
- if(g_level[id] >= 700 && g_reset[id] >= 0)
- menu_additem(menu, "\wSTFU 69 \r[\yHabilitada Level: 700\r]", "6", 0);
- else
- menu_additem(menu, "\dSTFU 69 \r[\dLevel\r: \d700 \r| \dReset\r: \d0\r]", "6", 0);
- if(g_level[id] >= 730 && g_reset[id] >= 0)
- menu_additem(menu, "\wRLP 17 \r[\yHabilitada Level: 730\r]", "7", 0);
- else
- menu_additem(menu, "\dRLP 17 \r[\dLevel\r: \d730 \r| \dReset\r: \d0\r]", "7", 0);
- if(g_level[id] >= 770 && g_reset[id] >= 0)
- menu_additem(menu, "\wM4 Extreme \r[\yHabilitada Level: 770\r]", "8", 0);
- else
- menu_additem(menu, "\dM4 Extreme \r[\dLevel\r: \d770 \r| \dReset\r: \d0\r]", "8", 0);
- if(g_level[id] >= 800 && g_reset[id] >= 0)
- menu_additem(menu, "\wBarret 5.0 \r[\yHabilitada Level: 800\r]", "9", 0);
- else
- menu_additem(menu, "\dBarret 5.0 \r[\dLevel\r: \d800 \r| \dReset\r: \d0\r]", "9", 0);
- if(g_level[id] >= 860 && g_reset[id] >= 0)
- menu_additem(menu, "\wDevil Strike \r[\yHabilitada Level: 860\r]", "10", 0);
- else
- menu_additem(menu, "\dDevil Strike \r[\dLevel\r: \d860 \r| \dReset\r: \d0\r]", "10", 0);
- if(g_level[id] >= 950 && g_reset[id] >= 0)
- menu_additem(menu, "\wM16 Rampage \r[\yHabilitada Level: 950\r]", "11", 0);
- else
- menu_additem(menu, "\dM16 Rampage \r[\dLevel\r: \d950 \r| \dReset\r: \d0\r]", "11", 0);
- if(g_level[id] >= 400 && g_reset[id] >= 1)
- menu_additem(menu, "\wSupermide \r[\wHabilitada \rLevel: \w400 \rReset: \w1\r]", "12", 0);
- else
- menu_additem(menu, "\dSupermide \r[\dLevel\r: \d400 \r| \dReset\r: \d1\r]", "12", 0);
- if(g_level[id] >= 650 && g_reset[id] >= 3)
- menu_additem(menu, "\wFarger \r[\wHabilitada \rLevel: \w650 \rReset: \w3\r]", "13", 0);
- else
- menu_additem(menu, "\dFarger \r[\dLevel\r: \d650 \r| \dReset\r: \d3\r]", "13", 0);
- if(g_level[id] >= 500 && g_reset[id] >= 6)
- menu_additem(menu, "\wStorm \r[\wHabilitada \rLevel: \w500 \rReset: \w6\r]", "14", 0);
- else
- menu_additem(menu, "\dStorm \r[\dLevel\r: \d500 \r| \dReset\r: \d6\r]", "14", 0);
- if(g_level[id] >= 450 && g_reset[id] >= 10)
- menu_additem(menu, "\wADGE-777 \r[\wHabilitada \rLevel: \w450 \rReset: \w10\r]", "15", 0);
- else
- menu_additem(menu, "\dADGE-777 \r[\dLevel\r: \d450 \r| \dReset\r: \d10\r]", "15", 0);
- if(g_level[id] >= 601 && g_reset[id] >= 15)
- menu_additem(menu, "\wXM10 Ultrapower \r[\wHabilitada \rLevel: \w601 \rReset: \w15\r]", "16", 0);
- else
- menu_additem(menu, "\dXM10 Ultrapower \r[\dLevel\r: \d601 \r| \dReset\r: \d15\r]", "16", 0);
- if(g_level[id] >= 550 && g_reset[id] >= 20)
- menu_additem(menu, "\wNule Strike \r[\wHabilitada \rLevel: \w550 \rReset: \w20\r]", "17", 0);
- else
- menu_additem(menu, "\dNule Strike \r[\dLevel\r: \d550 \r| \dReset\r: \d20\r]", "17", 0);
- if(g_level[id] >= 490 && g_reset[id] >= 24)
- menu_additem(menu, "\wSuper Strike \r[\wHabilitada \rLevel: \w490 \rReset: \w24\r]", "18", 0);
- else
- menu_additem(menu, "\dSuper Strike \r[\dLevel\r: \d490 \r| \dReset\r: \d24\r]", "18", 0);
- if(g_level[id] >= 501 && g_reset[id] >= 26)
- menu_additem(menu, "\wUltra Killer \r[\wHabilitada \rLevel: \w501 \rReset: \w26\r]", "19", 0);
- else
- menu_additem(menu, "\dUltra Killer \r[\dLevel\r: \d501 \r| \dReset\r: \d26\r]", "19", 0);
- if(g_level[id] >= 1 && g_reset[id] >= 30)
- menu_additem(menu, "\wRampage \r[\wHabilitada \rLevel: \w1 \rReset: \w30\r]", "20", 0);
- else
- menu_additem(menu, "\dRampage \r[\dLevel\r: \d1 \r| \dReset\r: \d30\r]", "20", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 1)
- menu_additem(menu, "\wZpr350 \r[\wHabilitada \rLevel: \w1 \rSReset: \w1\r]", "21", 0);
- else
- menu_additem(menu, "\dZpr350 \r[\dLevel\r: \d1 \r| \dSReset\r: \d1\r]", "21", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 3)
- menu_additem(menu, "\wRpg17 \r[\wHabilitada \rLevel: \w1 \rSReset: \w3\r]", "22", 0);
- else
- menu_additem(menu, "\dRpg17 \r[\dLevel\r: \d1 \r| \dSReset\r: \d3\r]", "22", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 5)
- menu_additem(menu, "\wAr-u \r[\wHabilitada \rLevel: \w1 \rSReset: \w5\r]", "23", 0);
- else
- menu_additem(menu, "\dAr-u \r[\dLevel\r: \d1 \r| \dSReset\r: \d30\r]", "5", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 8)
- menu_additem(menu, "\wXh500w \r[\wHabilitada \rLevel: \w1 \rSReset: \w8\r]", "24", 0);
- else
- menu_additem(menu, "\dXh500w \r[\dLevel\r: \d1 \r| \dSReset\r: \d8\r]", "24", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 11)
- menu_additem(menu, "\wDvls-xx \r[\wHabilitada \rLevel: \w1 \rSReset: \w11\r]", "25", 0);
- else
- menu_additem(menu, "\dDvls-xx \r[\dLevel\r: \d1 \r| \dSReset\r: \d11\r]", "25", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 14)
- menu_additem(menu, "\wThunderstorm \r[\wHabilitada \rLevel: \w1 \rSReset: \w14\r]", "26", 0);
- else
- menu_additem(menu, "\dThunderstorm \r[\dLevel\r: \d1 \r| \dSReset\r: \d14\r]", "26", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 19)
- menu_additem(menu, "\w101000xx \r[\wHabilitada \rLevel: \w1 \rSReset: \w19\r]", "27", 0);
- else
- menu_additem(menu, "\d101000xx \r[\dLevel\r: \d1 \r| \dSReset\r: \d19\r]", "27", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 22)
- menu_additem(menu, "\w101000Cannon \r[\wHabilitada \rLevel: \w1 \rSReset: \w22\r]", "28", 0);
- else
- menu_additem(menu, "\d101000Cannon \r[\dLevel\r: \d1 \r| \dSReset\r: \d22\r]", "28", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 25)
- menu_additem(menu, "\wTmp2-xx \r[\wHabilitada \rLevel: \w1 \rSReset: \w25\r]", "29", 0);
- else
- menu_additem(menu, "\dTmp2-xx \r[\dLevel\r: \d1 \r| \dSReset\r: \d25\r]", "29", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 27)
- menu_additem(menu, "\wColdTorment \r[\wHabilitada \rLevel: \w1 \rSReset: \w27\r]", "30", 0);
- else
- menu_additem(menu, "\dColdTorment \r[\dLevel\r: \d1 \r| \dSReset\r: \d27\r]", "30", 0);
- if(g_level[id] >= 1 && g_grandreset[id] >= 30)
- menu_additem(menu, "\wShredder \r[\wHabilitada \rLevel: \w1 \rSReset: \w30\r]", "31", 0);
- else
- menu_additem(menu, "\dShredder \r[\dLevel\r: \d1 \r| \dSReset\r: \d30\r]", "31", 0);
- menu_setprop(menu, MPROP_EXITNAME, "\yExit")
- menu_display(id, menu, 0)
- }
- public menu_especiala(id, menu, key)
- {
- switch(key)
- {
- case 0:
- {
- if(g_level[id] >= 330 && g_reset[id] >= 0)
- {
- g_akdestruction[id] = true
- give_item(id, "weapon_ak47")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AK47], AMMOTYPE[CSW_AK47], MAXBPAMMO[CSW_AK47])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 330 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 1:
- {
- if(g_level[id] >= 400 && g_reset[id] >= 0)
- {
- g_ultimate[id] = true
- give_item(id, "weapon_sg552")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_SG552], AMMOTYPE[CSW_SG552], MAXBPAMMO[CSW_SG552])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 400 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 2:
- {
- if(g_level[id] >= 450 && g_reset[id] >= 0)
- {
- g_atomic[id] = true
- give_item(id, "weapon_famas")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_FAMAS], AMMOTYPE[CSW_FAMAS], MAXBPAMMO[CSW_FAMAS])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 450 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 3:
- {
- if(g_level[id] >= 510 && g_reset[id] >= 0)
- {
- g_masive[id] = true
- give_item(id, "weapon_p90")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_P90], AMMOTYPE[CSW_P90], MAXBPAMMO[CSW_P90])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 510 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 4:
- {
- if(g_level[id] >= 600 && g_reset[id] >= 0)
- {
- g_navi[id] = true
- give_item(id, "weapon_mp5navy")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_MP5NAVY], AMMOTYPE[CSW_MP5NAVY], MAXBPAMMO[CSW_MP5NAVY])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 600 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 5:
- {
- if(g_level[id] >= 651 && g_reset[id] >= 0)
- {
- g_power[id] = true
- give_item(id, "weapon_xm1014")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_XM1014], AMMOTYPE[CSW_XM1014], MAXBPAMMO[CSW_XM1014])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 651 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 6:
- {
- if(g_level[id] >= 700 && g_reset[id] >= 0)
- {
- g_stfu[id] = true
- give_item(id, "weapon_g3sg1")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_G3SG1], AMMOTYPE[CSW_G3SG1], MAXBPAMMO[CSW_G3SG1])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 700 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 7:
- {
- if(g_level[id] >= 730 && g_reset[id] >= 0)
- {
- g_rlp[id] = true
- give_item(id, "weapon_ump45")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_UMP45], AMMOTYPE[CSW_UMP45], MAXBPAMMO[CSW_UMP45])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 730 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 8:
- {
- if(g_level[id] >= 770 && g_reset[id] >= 0)
- {
- g_m4[id] = true
- give_item(id, "weapon_m4a1")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M4A1], AMMOTYPE[CSW_M4A1], MAXBPAMMO[CSW_M4A1])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 770 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 9:
- {
- if(g_level[id] >= 800 && g_reset[id] >= 0)
- {
- g_barret[id] = true
- give_item(id, "weapon_m3")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M3], AMMOTYPE[CSW_M3], MAXBPAMMO[CSW_M3])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 800 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 10:
- {
- if(g_level[id] >= 860 && g_reset[id] >= 0)
- {
- g_devil[id] = true
- give_item(id, "weapon_galil")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_GALIL], AMMOTYPE[CSW_GALIL], MAXBPAMMO[CSW_GALIL])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 860 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 11:
- {
- if(g_level[id] >= 950 && g_reset[id] >= 0)
- {
- g_rampage[id] = true
- give_item(id, "weapon_aug")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AUG], AMMOTYPE[CSW_AUG], MAXBPAMMO[CSW_AUG])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 950 y Reset: 0");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 12:
- {
- if(g_level[id] >= 400 && g_reset[id] >= 1)
- {
- g_supermide[id] = true
- give_item(id, "weapon_ak47")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AK47], AMMOTYPE[CSW_AK47], MAXBPAMMO[CSW_AK47])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 400 y Reset: 1");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 13:
- {
- if(g_level[id] >= 650 && g_reset[id] >= 3)
- {
- g_farger[id] = true
- give_item(id, "weapon_m4a1")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M4A1], AMMOTYPE[CSW_M4A1], MAXBPAMMO[CSW_M4A1])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 650 y Reset: 3");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 14:
- {
- if(g_level[id] >= 500 && g_reset[id] >= 6)
- {
- g_storm[id] = true
- give_item(id, "weapon_galil")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_GALIL], AMMOTYPE[CSW_GALIL], MAXBPAMMO[CSW_GALIL])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 500 y Reset: 6");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 15:
- {
- if(g_level[id] >= 450 && g_reset[id] >= 10)
- {
- g_adge[id] = true
- give_item(id, "weapon_famas")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_FAMAS], AMMOTYPE[CSW_FAMAS], MAXBPAMMO[CSW_FAMAS])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 450 y Reset: 10");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 16:
- {
- if(g_level[id] >= 601 && g_reset[id] >= 15)
- {
- g_ultra[id] = true
- give_item(id, "weapon_xm1014")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_XM1014], AMMOTYPE[CSW_XM1014], MAXBPAMMO[CSW_XM1014])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 601 y Reset: 15");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 17:
- {
- if(g_level[id] >= 550 && g_reset[id] >= 20)
- {
- g_nule[id] = true
- give_item(id, "weapon_aug")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AUG], AMMOTYPE[CSW_AUG], MAXBPAMMO[CSW_AUG])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 550 y Reset: 20");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 18:
- {
- if(g_level[id] >= 490 && g_reset[id] >= 24)
- {
- g_super[id] = true
- give_item(id, "weapon_m3")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M3], AMMOTYPE[CSW_M3], MAXBPAMMO[CSW_M3])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 490 y Reset: 24");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 19:
- {
- if(g_level[id] >= 501 && g_reset[id] >= 26)
- {
- g_ultrak[id] = true
- give_item(id, "weapon_sg552")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_SG552], AMMOTYPE[CSW_SG552], MAXBPAMMO[CSW_SG552])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 501 y Reset: 26");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 20:
- {
- if(g_level[id] >= 1 && g_reset[id] >= 30)
- {
- g_raampage[id] = true
- give_item(id, "weapon_g3sg1")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_G3SG1], AMMOTYPE[CSW_G3SG1], MAXBPAMMO[CSW_G3SG1])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y Reset: 30");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 21:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 1)
- {
- g_zpr350[id] = true
- give_item(id, "weapon_m3")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M3], AMMOTYPE[CSW_M3], MAXBPAMMO[CSW_M3])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 1");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 22:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 3)
- {
- g_rpg17[id] = true
- give_item(id, "weapon_m249")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M249], AMMOTYPE[CSW_M249], MAXBPAMMO[CSW_M249])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 3");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 23:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 5)
- {
- g_aru[id] = true
- give_item(id, "weapon_famas")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_FAMAS], AMMOTYPE[CSW_FAMAS], MAXBPAMMO[CSW_FAMAS])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 5");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 24:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 8)
- {
- g_xh500w[id] = true
- give_item(id, "weapon_galil")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_GALIL], AMMOTYPE[CSW_GALIL], MAXBPAMMO[CSW_GALIL])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 8");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 25:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 11)
- {
- g_dvlsxx[id] = true
- give_item(id, "weapon_awp")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AWP], AMMOTYPE[CSW_AWP], MAXBPAMMO[CSW_AWP])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 11");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 26:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 14)
- {
- g_thunderstorm[id] = true
- give_item(id, "weapon_aug")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AUG], AMMOTYPE[CSW_AUG], MAXBPAMMO[CSW_AUG])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 14");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 27:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 19)
- {
- g_101000xx[id] = true
- give_item(id, "weapon_aug")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_AUG], AMMOTYPE[CSW_AUG], MAXBPAMMO[CSW_AUG])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 19");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 28:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 22)
- {
- g_101000cannon[id] = true
- give_item(id, "weapon_ump45")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_UMP45], AMMOTYPE[CSW_UMP45], MAXBPAMMO[CSW_UMP45])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 22");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 29:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 25)
- {
- g_tmp2xx[id] = true
- give_item(id, "weapon_m4a1")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_M4A1], AMMOTYPE[CSW_M4A1], MAXBPAMMO[CSW_M4A1])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 25");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 30:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 27)
- {
- g_coldtorment[id] = true
- give_item(id, "weapon_sg552")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_SG552], AMMOTYPE[CSW_SG552], MAXBPAMMO[CSW_SG552])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 27");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- case 31:
- {
- if(g_level[id] >= 1 && g_grandreset[id] >= 30)
- {
- g_shredder[id] = true
- give_item(id, "weapon_xm1014")
- ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[CSW_XM1014], AMMOTYPE[CSW_XM1014], MAXBPAMMO[CSW_XM1014])
- g_canbuy[id] = 0;
- show_menu_buy2(id);
- }
- else
- {
- zp_colored_print(id, "^x03[^x04ZP^x03]^x01 Necesitas ser Nivel: 1 y SReset: 30");
- show_menu_especiales(id);
- return PLUGIN_HANDLED;
- }
- }
- }
- return PLUGIN_HANDLED;
- }
- show_menu_eleccion(id)
- {
- new menu = menu_create("\yWeapon Menu:", "menu_eleccion")
- menu_additem(menu, "\wRegular Weapons", "1", 0);
- menu_additem(menu, "\rModified Weapons", "2", 0);
- menu_setprop(menu, MPROP_EXITNAME, "\yExit")
- menu_display(id, menu, 0)
- }
- public menu_eleccion(id, menu, key)
- {
- switch(key)
- {
- case 0: show_menu_buy1(id);
- case 1: show_menu_especiales(id);
- }
- return PLUGIN_HANDLED;
- }
- // En 'Notice_One' estamos haciendo un Hud Message, con colores y en un lugar, todo configurado.
- public Notice_One()
- {
- set_hudmessage(141, 63, 158, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "El Fin De Los Tiempos Se Acerca!!!")
- set_task(6.0, "Notice_Two") // Llamamos a 'Notice_Two' luego de 4.3 Segundos que aparecio 'Notice_One'
- }
- // En 'Notice_Two' estamos haciendo un Hud Message, con colores y en un lugar, todo configurado.
- public Notice_Two()
- {
- set_hudmessage(141, 63, 158, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
- ShowSyncHudMsg(0, g_MsgSync, "Modo Armagedon!!")
- }
- public EffectModeEnd()
- {
- message_begin(MSG_BROADCAST, g_msgScreenFade) // Open The Function
- write_short((1<<12)*4) // Duration
- write_short(floatround((1<<12)*1.0)) // Hold Time
- write_short(0x0000) // Fade Type
- write_byte(0) // Color Red
- write_byte(0) // Color Green
- write_byte(0) // Color Blue
- write_byte(250) // Alpha
- message_end() // Close The Function
- }
- // En este Efecto, diran que es el mismo que hizimos antes, pero no es asi.
- // Si se fijan bien, tiene otras configuraciones.
- // Lo que estamos haciendo, es que el ScreenFade desaparesca de a poquito y no de Golpe.
- // Seria como un Estilo mas realista.
- public set_sombrero(id)
- {
- if(!g_reset[id])
- return
- if(is_user_alive(id))
- {
- if(g_reset[id] >= 1) g_sombrero[id] = 0
- if(g_reset[id] >= 3) g_sombrero[id] = 1
- if(g_reset[id] >= 5) g_sombrero[id] = 2
- if(g_reset[id] >= 7) g_sombrero[id] = 3
- if(g_reset[id] >= 9) g_sombrero[id] = 4
- if(g_reset[id] >= 11) g_sombrero[id] = 5
- if(g_reset[id] >= 13) g_sombrero[id] = 6
- if(g_reset[id] >= 15) g_sombrero[id] = 7
- if(g_reset[id] >= 17) g_sombrero[id] = 8
- if(g_reset[id] >= 19) g_sombrero[id] = 9
- if(g_reset[id] >= 21) g_sombrero[id] = 10
- if(g_reset[id] >= 23) g_sombrero[id] = 11
- if(g_reset[id] >= 25) g_sombrero[id] = 12
- if(g_reset[id] >= 27) g_sombrero[id] = 13
- if(g_reset[id] >= 30) g_sombrero[id] = 14
- }
- if(!g_sombrero_ent[id] || !is_valid_ent(g_sombrero_ent[id]))
- {
- new ent = create_entity("info_target")
- entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
- entity_set_edict(ent, EV_ENT_aiment, id)
- g_sombrero_ent[id] = ent
- }
- entity_set_model(g_sombrero_ent[id], g_sombretos_modes[g_sombrero[id]])
- }
- public del_sombrero(id)
- {
- if(is_valid_ent(g_sombrero_ent[id]))
- remove_entity(g_sombrero_ent[id])
- g_sombrero_ent[id] = 0
- }
- public Datos(id)
- {
- if (get_user_flags(id) & ADMIN_LEVEL_E && ADMIN_LEVEL_H)
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Admin^x03 x12", g_playername[id])
- else if (get_user_flags(id) & ADMIN_LEVEL_E)
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Vip^x03 x12", g_playername[id])
- else if (get_user_flags(id) & ADMIN_LEVEL_H && ADMIN_LEVEL_G)
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Admin^x03 x9", g_playername[id])
- else if (get_user_flags(id) & ADMIN_LEVEL_H)
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Vip^x03 x9", g_playername[id])
- else if (get_user_flags(id) & ADMIN_LEVEL_G && ADMIN_LEVEL_F)
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Admin^x03 x6", g_playername[id])
- else if (get_user_flags(id) & ADMIN_LEVEL_G)
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Vip^x03 x6", g_playername[id])
- else if (get_user_flags(id) & ADMIN_LEVEL_F && ADMIN_KICK)
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Admin^x03 x3", g_playername[id])
- else if (get_user_flags(id) & ADMIN_LEVEL_F)
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01Has Vip^x03 x3", g_playername[id])
- else
- zp_colored_print(0, "^x04[ZP]^x01 ^x04%s ^x01No Posee Ninguna Membresia", g_playername[id])
- }
- public HookSay(id)
- {
- static message[190]
- read_args(message, charsmax(message))
- remove_quotes(message)
- if (equal(message, ""))
- return PLUGIN_HANDLED;
- if (is_user_alive(id))
- 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)
- else
- zp_colored_print(0, "^x04[Muerto]^x03 %s^x01 : %s", g_playername[id], message)
- return PLUGIN_HANDLED;
- }
- // Update say /give_ammopacks
- public update_ammopacks(id)
- {
- if (!(get_user_flags(id) & ADMIN_IMMUNITY))
- {
- zp_colored_print(0, "^x04[ZP]^x01 El acceso a este comando es para ADMINES")
- console_print(id,"[ZP] El acceso a este comando es para ADMINES")
- return PLUGIN_HANDLED
- }
- show_menu_adicionalap(id)
- return PLUGIN_HANDLED
- }
- // Adicional Ammo Packs
- public show_menu_adicionalap(id)
- {
- new menu7 = menu_create("\yGive Ammo Packs^n^n- Give 170000 Ammo Packs to", "menu_adicionalap")
- new players[32], pnum, tempid
- new szName[32], szTempid[10]
- get_players(players, pnum)
- for(new i;i < pnum;i++)
- {
- tempid = players[i]
- get_user_name(tempid, szName, charsmax(szName))
- num_to_str(tempid, szTempid, charsmax(szTempid))
- menu_additem(menu7, szName, szTempid, 0)
- }
- menu_display(id, menu7, 0)
- }
- // Adicional Ammo Packs
- public menu_adicionalap(id, menu7, item)
- {
- if(item == MENU_EXIT)
- {
- menu_destroy(menu7)
- return PLUGIN_HANDLED
- }
- new data[6], iName[64]
- new access, callback
- menu_item_getinfo(menu7, item, access, data,5, iName, 63, callback)
- new tempid = str_to_num(data)
- new szAdminName[32]
- get_user_name(id,szAdminName,31)
- g_ammopacks[tempid] += 170000
- update_ap(id, 0, 1)
- client_print(id, print_center, "Admin gave you ammo packs")
- menu_destroy(menu7)
- return PLUGIN_HANDLED
- }
- public HandMenu(id, keys, menu) //los parametros deben ir en este orden
- {
- switch(keys) //hacemos un swicheo de los posibles resultados:
- {
- case 0:
- {
- zp_colored_print(id, "Account: %s", g_playername[id])
- Datos1(id)
- }
- case 1:
- {
- zp_colored_print(id, "AmmoPacks: %d", g_ammopacks[id])
- Datos1(id)
- }
- case 2:
- {
- zp_colored_print(id, "Level: %d", g_level[id])
- Datos1(id)
- }
- case 3:
- {
- zp_colored_print(id, "Reset: %d", g_reset[id])
- Datos1(id)
- }
- case 4:
- {
- zp_colored_print(id, "SuperReset: %d", g_grandreset[id])
- Datos1(id)
- }
- case 5:
- {
- zp_colored_print(id, "Password: ***Protected***")
- Datos1(id)
- }
- case 6..7:
- {
- Datos1(id)
- }
- case 9: menu_destroy(menu)
- }
- }
- public Datos1(id)
- {
- new menu[350], len;
- len = 0;
- len += formatex(menu[len], sizeof menu - 1 - len, "\r1. \yAccount: \w%s^n", g_playername[id]);
- len += formatex(menu[len], sizeof menu - 1 - len, "\r2. \yAmmoPacks: \w%d^n", g_ammopacks[id]);
- len += formatex(menu[len], sizeof menu - 1 - len, "\r3. \yLevel: \w%d^n", g_level[id]);
- len += formatex(menu[len], sizeof menu - 1 - len, "\r4. \yReset: \w%d^n", g_reset[id]);
- len += formatex(menu[len], sizeof menu - 1 - len, "\r5. \ySuperResets: \w%d^n", g_grandreset[id]);
- len += formatex(menu[len], sizeof menu - 1 - len, "\r6. \yPassword: \w***PROTECTED***^n");
- 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]);
- 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]);
- len += formatex(menu[len], sizeof menu - 1 - len, "\r0. \wExit");
- show_menu(id, KEYSMENU, menu, -1, "Menu");
- //mostramos el menu al 'id' deseado, con las teclas ya definidas, el menu 'menu'
- //el timpo es lo que tarda el menu en cerrarse en este caso -1 que es infinito, como lo registre en el init 'Menu')
- }
- public info(id)
- {
- new motd[999] // maximo de 998 caracteres as
- static len; len = 0
- len += formatex(motd[len], charsmax(motd) - len, "<meta charset=UTF-8><body bgcolor=#000000><font color=#5CACEE>Reglas del server:")
- len += formatex(motd[len], charsmax(motd) - len, "<br><br> No Campear en modo Armageddon y Survivor")
- len += formatex(motd[len], charsmax(motd) - len, "<br> No Reparar Lasermine")
- len += formatex(motd[len], charsmax(motd) - len, "<br> No matar en city")
- len += formatex(motd[len], charsmax(motd) - len, "<br> No dejarse matar (free)")
- len += formatex(motd[len], charsmax(motd) - len, "<br> Respetar admins y players")
- show_motd(id, motd, "Reglas del servidor:")
- }
- public Spawn(iEnt)
- {
- if(pev_valid(iEnt))
- {
- static szClassName[32]
- pev(iEnt, pev_classname, szClassName, charsmax(szClassName))
- if(!TrieKeyExists(g_tClass, szClassName))
- {
- RegisterHam(Ham_TraceAttack, szClassName, "TraceAttack", 1)
- TrieSetCell(g_tClass, szClassName, 1)
- }
- }
- }
- public plugin_end()
- {
- TrieDestroy(g_tClass)
- }
- // Ham Trace Attack Forward
- public TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type)
- {
- // Non-player damage or self damage
- if (!is_user_connected(attacker))
- return HAM_IGNORED
- if(g_zombie[attacker])
- return HAM_SUPERCEDE
- if(get_user_weapon(attacker) == CSW_KNIFE)
- return HAM_IGNORED
- if(g_tmp2xx[attacker] && get_user_weapon(attacker) == CSW_M4A1)
- {
- new Float:vecEndPos[3]
- get_tr2(tracehandle, TR_vecEndPos, vecEndPos)
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecEndPos, 0)
- write_byte(TE_BEAMENTPOINT)
- write_short(attacker | 0x1000)
- engfunc(EngFunc_WriteCoord, vecEndPos[0]) // x
- engfunc(EngFunc_WriteCoord, vecEndPos[1]) // x
- engfunc(EngFunc_WriteCoord, vecEndPos[2]) // x
- write_short(gTracerSpr)
- write_byte(1) // framerate
- write_byte(5) // framerate
- write_byte(2) // framerate
- write_byte(60) // framerate
- write_byte(15) // framerate
- write_byte(193) // red
- write_byte(214) // red
- write_byte(217) // red
- write_byte(255) // brightness
- write_byte(100) // brightness
- message_end()
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecEndPos, 0)
- write_byte(TE_BEAMENTPOINT)
- write_short(attacker | 0x1000)
- engfunc(EngFunc_WriteCoord, vecEndPos[0]) // x
- engfunc(EngFunc_WriteCoord, vecEndPos[1]) // x
- engfunc(EngFunc_WriteCoord, vecEndPos[2]) // x
- write_short(gTracerSpr1)
- write_byte(1) // framerate
- write_byte(5) // framerate
- write_byte(2) // framerate
- write_byte(50) // framerate
- write_byte(12) // framerate
- write_byte(215) // red
- write_byte(203) // red
- write_byte(64) // red
- write_byte(200) // brightness
- write_byte(100) // brightness
- message_end()
- }
- return HAM_HANDLED
- }
- /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
- *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang11274\\ f0\\ fs16 \n\\ par }
- */
Add Comment
Please, Sign In to add comment