Raised This Month: $51 Target: $400
 12% 

Zombie Swarm 3.1


Post New Thread Reply   
 
Thread Tools Display Modes
wickedd
Veteran Member
Join Date: Nov 2009
Old 03-20-2012 , 10:54   Re: Zombie Swarm 3.1
Reply With Quote #1521

Quote:
Originally Posted by xmarX View Post
Thanks man !
Fantastic work

BTW, I have a personal request !

I want all the human players on the 'Survivor' team and some bots (say, maximum - 10) and then around 20 bots in the zombie team !!
Is it possible to specify it in the config ?
Or should I use POD Bot config ?


Loved your mod, the best for CS 1.6 IMO
Just set up podbot to allow bots to join only T's.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 03-20-2012 at 10:55.
wickedd is offline
xmarX
New Member
Join Date: Mar 2012
Old 03-21-2012 , 06:11   Re: Zombie Swarm 3.1
Reply With Quote #1522

Quote:
Originally Posted by wickedd View Post
Just set up podbot to allow bots to join only T's.
But, I want atleast 3 or 4 CTs with me (bots) !

What I did was adding 20 Ts and 7 CTs in the podbot.cfg and it worked for the first round
Code:
pb add [skill] [stance] [team]
BUT, even after I set mp_teamautobalance and mp_limitteams to '0', after the first round, the system transferred more Ts to CTs and levelled it !!
Code:
// Use this file to configure your DEDICATED server. 
// This config file is executed on server start.

// disable autoaim
sv_aim 0

// disable clients' ability to pause the server
pausable 0

// default server name. Change to "Bob's Server", etc.
hostname "Counter-Strike 1.6 Server"

// maximum client movement speed 
sv_maxspeed 320

// 20 minute timelimit
mp_timelimit 20

sv_cheats 1
mp_autoteambalance 0
mp_limitteams 0

// load ban files
exec listip.cfg
exec banned.cfg
Then I tried installing Team Limiter Beta addon for amx mod but when the CTs spawn, n-1 of the CTs are 'inside' the first one. So, none of them can move ! After that I installed an earlier version of it but I couldn't join the round, always ending up as the spectator !!!
http://forums.alliedmods.net/showthread.php?p=1052023

Can you help me ?
Is there any limit on number of players / map ?
How can I turn team auto balacing and limit teams to zero ?

Also, is there any way I can buy and m249 through the buy menu ?
xmarX is offline
Diva
Member
Join Date: Aug 2012
Location: Denmark
Old 11-08-2012 , 07:59   Re: Zombie Swarm 3.1
Reply With Quote #1523

This is a really awesome mod, and im running it on one of my servers now,
the only thing i want is to make the human nightvision to look like the zombies nightvision.
the question is. how do i do that?, bcus i have no experience with coding as much as the most of the people in here.


Anyways Karma from me D

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <engine>
#include <hamsandwich>
#include <xs>
#include <fun>
#include <round_terminator>

/**************************************************************************
********************************* EDIT ************************************
**************************************************************************/
//The flDamage required to make the survivor's screen to go crazy
#define SURVIVOR_PUNCHANGLE    50.0
//The percentage that the backspeed of suvivors move at from the original speed. Change to 1.0 to have it default
#define SURVIVOR_BACKSPEED 0.75
//Zombie slashing minima flDamage
#define ZOMBIE_SLASH_MIN 8.0
//Zombie slashing maxima flDamage
#define ZOMBIE_SLASH_MAX 15.0
//Zombie stabbing minima flDamage
#define ZOMBIE_STAB_MIN    30.0
//Zombie stabbing maxiima flDamage
#define ZOMBIE_STAB_MAX 45.0
//The speed at which the radio voices of the zombie are set at. 100 for default
#define ZOMBIE_RADIO_SPEED 70

//Add extra zombie models here. Follow the formatting or it won't compile!
new const g_ZombiePlayerModels[][] =
{
    
"zombie_swarm",
    
"zombie_original"
};

/**************************************************************************
************** ---DO NOT EDIT ANYTHING BELOW THIS LINE --- ****************
**************************************************************************/

#pragma semicolon 1

#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame
#define write_coord_f(%1) engfunc(EngFunc_WriteCoord,%1)

#define beacon_Percentage EV_FL_fuser1
// new const MENUITEM_NVG = 5;

new const m_iId                   43;
new const 
m_flNextPrimaryAttack   46;
new const 
m_flNextSecondaryAttack 47;
new const 
m_pActiveItem           373;

enum (+= 1000)
{
    
TASKID_MODEL 1000,
    
TASKID_STRIP,
    
TASKID_NVG,
    
TASKID_HEALTH,
    
TASKID_ROUND,
    
TASKID_BEACON,
    
TASKID_FLYBY,
    
TASKID_EFFECTS,
    
TASKID_EXPLOSION
}

enum (<<= 1)
{
    
MOD_SCOUT 1,    //a.
    
MOD_XM1014,        //b...
    
MOD_MAC10,
    
MOD_AUG,
    
MOD_UMP45,
    
MOD_SG550,
    
MOD_GALIL,
    
MOD_FAMAS,
    
MOD_AWP,
    
MOD_MP5NAVY,
    
MOD_M249,
    
MOD_M3,
    
MOD_M4A1,
    
MOD_TMP,
    
MOD_G3SG1,
    
MOD_SG552,
    
MOD_AK47,
    
MOD_P90,
    
MOD_P228,
    
MOD_ELITE,
    
MOD_FIVESEVEN,
    
MOD_USP,
    
MOD_GLOCK18,
    
MOD_DEAGLE,
    
MOD_VEST,
    
MOD_VESTHELM
};

new const 
weapon_names[26][16] =
{
    
"Scout",
    
"XM1014",
    
"Mac10",
    
"Aug",
    
"UMP",
    
"SG550",
    
"Galil",
    
"Famas",
    
"AWP",
    
"MP5Navy",
    
"M249",
    
"M3",
    
"M4A1",
    
"TMP",
    
"G3SG1",
    
"SG552",
    
"AK47",
    
"P90",
    
"P228",
    
"Elite",
    
"Fiveseven",
    
"USP",
    
"Glock18",
    
"Deagle",
    
"VEST",
    
"VESTHELM"
};

new const 
g_MaxBPAmmo[] = 
{
    
0,
    
52,    //CSW_P228
    
0,
    
90,    //CSW_SCOUT
    
1,    //CSW_HEGRENADE
    
32,    //CSW_XM1014
    
1,    //CSW_C4
    
100,//CSW_MAC10
    
90,    //CSW_AUG
    
1,    //CSW_SMOKEGRENADE
    
120,//CSW_ELITE
    
100,//CSW_FIVESEVEN
    
100,//CSW_UMP45
    
90,    //CSW_SG550
    
90,    //CSW_GALIL
    
90,    //CSW_FAMAS
    
100,//CSW_USP
    
120,//CSW_GLOCK18
    
30,    //CSW_AWP
    
120,//CSW_MP5NAVY
    
200,//CSW_M249
    
32,    //CSW_M3
    
90,    //CSW_M4A1
    
120,//CSW_TMP
    
90,    //CSW_G3SG1
    
2,    //CSW_FLASHBANG
    
35,    //CSW_DEAGLE
    
90,    //CSW_SG552
    
90,    //CSW_AK47
    
0,    //CSW_KNIFE
    
100//CSW_P90
};

new const 
g_Menu_Handler1[] = "menu_Objectives";

new 
boolg_ShowMenu[33];
new 
boolg_ShowMenuFirstTime[33];
new 
g_PickedWeapons[2][33];
new 
g_CurOffset[33];
new 
g_OptionsOnMenu[8][33];

new const 
g_Menu_WeaponID[] = "Menu_WeaponID";
new const 
g_Menu_PrimaryID[]  = "Menu_PrimaryID";
new const 
g_Menu_SecID[] = "Menu_SecondaryID";

new const 
g_szClass_weather[] = "zswarm_weather";
new const 
g_szClass_flesh[] = "flesh throw";

new const 
g_MapEntities[][] =
{
    
"info_map_parameters",
    
"func_bomb_target",
    
"info_bomb_target",
    
"hostage_entity",
    
"monster_scientist",
    
"func_hostage_rescue",
    
"info_hostage_rescue",
    
"info_vip_start",
    
"func_vip_safetyzone",
    
"func_escapezone"
};

new const 
g_TouchBlockEnts[][] =
{
    
"armoury_entity",
    
"weaponbox",
    
"weapon_shield"
};

new const 
g_szSound_thunder1[] = "ambience/thunder_clap.wav";
new const 
g_szSound_thunder2[] = "de_torn/torn_thndrstrike.wav";

new const 
g_szSound_jetFlyBy[] = "ambience/jetflyby1.wav";

new const 
g_Sound_Explosion[][] = 
{
    
"weapons/hegrenade-1.wav",
    
"weapons/hegrenade-2.wav",
    
"weapons/c4_explode1.wav",
    
"weapons/explode3.wav",
    
"weapons/explode4.wav",
    
"weapons/explode5.wav"
};

new const 
g_sound_roundstart[][] =
{
    
"zombie_swarm/GermM1a.wav",
    
"zombie_swarm/BoomerBacteria.wav",
    
"zombie_swarm/HunterBacteria.wav",
    
"zombie_swarm/HunterBacteriaS.wav"
};

new const 
g_SendAudio_RoundStart[][] =
{
    
// "%!MRAD_GO",                //Conflicts with client radio command
    
"%!MRAD_LETSGO",
    
"%!MRAD_MOVEOUT",
    
"%!MRAD_LOCKNLOAD"
};

new const 
g_SendAudio_Radio[][] =
{
    
"%!MRAD_COVERME",
    
"%!MRAD_TAKEPOINT",
    
"%!MRAD_POSITION",
    
"%!MRAD_REGROUP",
    
"%!MRAD_FOLLOWME",
    
"%!MRAD_HITASSIST",
    
"%!MRAD_GO",                //Conflicts with round start audio
    
"%!MRAD_FALLBACK",
    
"%!MRAD_STICKTOG",
    
"%!MRAD_GETINPOS",
    
"%!MRAD_STORMFRONT",
    
"%!MRAD_REPORTIN",
    
"%!MRAD_AFFIRM",
    
"%!MRAD_ROGER",
    
"%!MRAD_ENEMYSPOT",
    
"%!MRAD_BACKUP",
    
"%!MRAD_CLEAR",
    
"%!MRAD_INPOS",
    
"%!MRAD_REPRTINGIN",
    
"%!MRAD_BLOW",
    
"%!MRAD_NEGATIVE",
    
"%!MRAD_ENEMYDOWN"
};

new const 
g_sound_zombiewin[] =     "zombie_swarm/LeftForDeathHit.wav";

new const 
g_sound_humanwin[] =        "zombie_swarm/themonsterswithout.wav";

new const 
g_sound_miss[][] =
{
    
"zombie/claw_miss1.wav",
    
"zombie/claw_miss2.wav"
};

new const 
g_sound_hit[][] =
{
    
"zombie/claw_strike1.wav",
    
"zombie/claw_strike2.wav",
    
"zombie/claw_strike3.wav"
};

new const 
g_sound_pain[][] =
{
    
"aslave/slv_pain1.wav",
    
"aslave/slv_pain2.wav",
    
"headcrab/hc_pain1.wav",
    
"headcrab/hc_pain2.wav",
    
"headcrab/hc_pain3.wav",
    
"zombie/zo_pain1.wav",
    
"zombie/zo_pain2.wav"
};

new const 
g_sound_die[][] =
{
    
"aslave/slv_die1.wav",
    
"aslave/slv_die2.wav",
    
"bullchicken/bc_die1.wav",
    
"bullchicken/bc_die3.wav",
    
"headcrab/hc_die1.wav",
    
"headcrab/hc_die2.wav"
};

new const 
g_SoundBuild[][] =
{
    
"buttons/spark1.wav",
    
"buttons/spark2.wav",
    
"buttons/spark3.wav",
    
"buttons/spark4.wav",
    
"buttons/spark5.wav",
    
"buttons/spark6.wav"

};

new const 
g_SoundComplete[][] = 
{
    
"buttons/button1.wav",
    
"buttons/button3.wav",
    
"buttons/button4.wav",
    
"buttons/button5.wav",
    
"buttons/button6.wav",
    
"buttons/button9.wav"
};

new 
Float:g_flDisplayDamage[33];

new 
mdl_gib_fleshmdl_gib_headmdl_gib_legbone;
new 
mdl_gib_lungmdl_gib_meatmdl_gib_spine;
new 
spr_blood_dropspr_blood_spray;

new 
boolg_bZombie[33];

new 
boolg_bHeadshot[33][33];
new 
boolg_bModel[33];
new 
g_CurrentModel[33][32];

new 
Floatg_LastLeap[33];
new 
Floatg_LastFthrow[33];

new 
boolg_bDeadNvg[2][33];
new 
g_bCustomNvg[33];

new const 
g_EntClassName[] = "objective_beacon";
new 
g_EntIndex[256];
new 
g_EntCount;
new 
boolg_EntActive[256];

new 
Floatg_BuildTime[33];
new 
boolg_Building[33];
    
new 
g_WeaponIndex[33];
new 
g_WeaponId[33];

new const 
g_RandomModel[8][9] =
{
    
"terror",
    
"leet",
    
"arctic",
    
"guerilla",
    
"urban",
    
"gsg9",
    
"sas",
    
"gign"
};

new const 
g_ZombieClaws[] = "models/v_knife_zombie.mdl";
new const 
g_ZombieFleshThrow[] = "models/hgibs.mdl";    //11 Submodels

new const g_ObjectiveBeacon[] = "models/w_weaponbox.mdl";
new 
g_szModName[32];
new 
g_MaxPlayers;
new 
g_RoundCounter;
new 
Floatg_flCounter;
new 
boolg_bTimerStart;
new 
boolg_bFreezeTime;
new 
g_bFFire;

new 
g_ForwardSpawn;

new 
boolb_LightFlashing;
new 
g_LightStyle[3][2] = { "a""b""m" };
new 
g_LightStyleNum;
new 
g_LightCounter;
new 
g_LightNum;


new 
g_bIsAlive[33], g_bIsBot[33];

new 
g_MsgID_Healthg_MsgID_ScreenFadeg_MsgID_SetFovg_MsgID_NVGToggle;

new 
cvar_Swithcvar_Healthcvar_Armourcvar_Gravitycvar_Footstepscvar_Speed,
cvar_AutoNvgcvar_Dmg_HPcvar_Dmg_APcvar_Roundcvar_Teamscvar_Blocknvgcvar_Lights,
cvar_Leapcvar_LeapCooldowncvar_LeapForcecvar_LeapHeight,
cvar_FleshThrowcvar_FleshForcecvar_FleshDmgcvar_FleshSelfDmgcvar_FleshBreakEnts,
cvar_Skynamecvar_EndRound,
cvar_GunMenucvar_Weaponscvar_Equip,
cvar_ObjectivePercent;


#define PLUGIN "Zombie Swarm"
#define VERSION "3.1"
#define AUTHOR "Mini_Midget"

public plugin_precache()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_cvar(PLUGINVERSIONFCVAR_SPONLY|FCVAR_SERVER);
    
set_cvar_string(PLUGINVERSION);
    
register_dictionary("zombie_swarm.txt");

    
register_concmd("zombie_swarm""concmd_zombieswarm"ADMIN_BAN"<0/1> Disable/Enable Zombie Swarm");

    
cvar_Swith register_cvar("zswarm_enable""1");

    if(!
get_pcvar_num(cvar_Swith))
        return;

    for(new 
sizeof g_ZombiePlayerModels i++)
    {
        new 
sz_Model[256];
        
format(sz_Modelcharsmax(sz_Model), "models/player/%s/%s.mdl"g_ZombiePlayerModels[i], g_ZombiePlayerModels[i]);
        
precache_model(sz_Model);
    }

    
precache_model(g_ZombieClaws);

    
mdl_gib_flesh precache_model("models/Fleshgibs.mdl");
    
mdl_gib_meat precache_model("models/GIB_B_Gib.mdl");
    
mdl_gib_head precache_model("models/GIB_Skull.mdl");

    
mdl_gib_spine precache_model("models/GIB_B_Bone.mdl");
    
mdl_gib_lung precache_model("models/GIB_Lung.mdl");
    
mdl_gib_legbone precache_model("models/GIB_Legbone.mdl");

    
spr_blood_drop precache_model("sprites/blood.spr");
    
spr_blood_spray precache_model("sprites/bloodspray.spr");


    
precache_sound(g_szSound_thunder1);
    
precache_sound(g_szSound_thunder2);
    
precache_sound(g_szSound_jetFlyBy);

    new 
iNum;
    for (
iNum 0iNum sizeof g_sound_missiNum++)
        
precache_sound(g_sound_miss[iNum]);
    for (
iNum 0iNum sizeof g_sound_hitiNum++)
        
precache_sound(g_sound_hit[iNum]);
    for (
iNum 0iNum sizeof g_sound_painiNum++)
        
precache_sound(g_sound_pain[iNum]);
    for (
iNum 0iNum sizeof g_sound_dieiNum++)
        
precache_sound(g_sound_die[iNum]);
    for (
iNum 1iNum sizeof g_sound_roundstartiNum++)
        
precache_sound(g_sound_roundstart[iNum]);
    for(
iNum iNum sizeof g_Sound_Explosion iNum++)
        
precache_sound(g_Sound_Explosion[iNum]);
        
    
precache_model(g_ObjectiveBeacon);
    
    for (
iNum 0iNum sizeof g_SoundBuildiNum++)
        
precache_sound(g_SoundBuild[iNum]);
    
    for (
iNum 0iNum sizeof g_SoundCompleteiNum++)
        
precache_sound(g_SoundComplete[iNum]);
        
    new 
iEnt create_entity("info_map_parameters");
    
DispatchKeyValue(iEnt"buying""1");
    
DispatchSpawn(iEnt);

    
g_ForwardSpawn register_forward(FM_Spawn"Forward_Spawn");
}

public 
plugin_init()
{
    if(!
get_pcvar_num(cvar_Swith))
        return;

    
cvar_Health     register_cvar("zswarm_health",    "1500");
    
cvar_Armour     register_cvar("zswarm_armour",    "750");
    
cvar_Gravity register_cvar("zswarm_gravity",    "700");
    
cvar_Footsteps register_cvar("zswarm_footsteps",    "1");

    
cvar_Speed register_cvar("zswarm_speed",    "300");

    
cvar_AutoNvg register_cvar("zswarm_autonvg""1");

    
cvar_Dmg_HP register_cvar("zswarm_dmg_hp_percent""50");
    
cvar_Dmg_AP register_cvar("zswarm_dmg_ap_percent""35");

    
cvar_Round register_cvar("zswarm_rounds""5");

    
cvar_Teams register_cvar("zswarm_blockteams""1");
    
cvar_Blocknvg register_cvar("zswarm_blocknvg""0");

    
cvar_Lights register_cvar("zswarm_lights""2");

    
cvar_Leap register_cvar("zswarm_leap""1");
    
cvar_LeapCooldown register_cvar("zswarm_cooldown","5.0");
    
cvar_LeapForce register_cvar("zswarm_lforce""525");
    
cvar_LeapHeight register_cvar("zswarm_lheight""260");

    
cvar_FleshThrow register_cvar("zswarm_fleshthrow""1");
    
cvar_FleshForce register_cvar("zswarm_fforce",    "1500");
    
cvar_FleshDmg register_cvar("zswarm_fleshdmg","20");
    
cvar_FleshSelfDmg register_cvar("zswarm_fselfdmg","250");
    
cvar_FleshBreakEnts register_cvar("zswarm_fleshents""1");
    
    
cvar_Skyname register_cvar("zswarm_skyname",    "space");
    
cvar_EndRound register_cvar("zswarm_endround""1");
    
    
cvar_GunMenu register_cvar("zswarm_gunmenu""1");
    
cvar_Weapons register_cvar("zswarm_weapons""abcdefghijklmnopqrstuvwxyz");
    
cvar_Equip register_cvar("zswarm_equip""hffsn");

    
cvar_ObjectivePercent register_cvar("zswarm_obj_percent""18.0");

    
g_MsgID_Health get_user_msgid("Health");
    
g_MsgID_ScreenFade get_user_msgid("ScreenFade");
    
g_MsgID_SetFov get_user_msgid("SetFOV");
    
g_MsgID_NVGToggle get_user_msgid("NVGToggle");
    
    
RegisterHam(Ham_Spawn"player""Bacon_Spawn_Post"1);
    
RegisterHam(Ham_TraceAttack"player""Bacon_TraceAttack_Post"1);
    
RegisterHam(Ham_TakeDamage"player""Bacon_TakeDamage");
    
RegisterHam(Ham_TakeDamage"player""Bacon_TakeDamage_Post" 1);
    
RegisterHam(Ham_Killed"player""Bacon_Killed_Post"1);
    for(new 
sizeof g_TouchBlockEnts i++)
        
RegisterHam(Ham_Touch,    g_TouchBlockEnts[i], "Bacon_Touch");
    
RegisterHam(Ham_Player_ResetMaxSpeed"player",    "Bacon_ResetMaxSpeed"1);


    
register_logevent("Logevent_RoundStart"2,    "1=Round_Start");
    
register_logevent("Logevent_RoundEnd" 2"1=Round_End");

    
register_event("TextMsg""Event_TextMsg""a""2&#Game_C""2&#Game_w" );
    
register_event("HLTV""Event_NewRound""a""1=0""2=0");
    
register_event("CurWeapon""Event_CurWeapon" "be""1=1");

    
register_message(get_user_msgid("StatusIcon"), "Message_StatusIcon");
    
register_message(g_MsgID_Health"Message_Health");
    
register_message(get_user_msgid("Battery"), "Message_Battery");
    
register_message(get_user_msgid("TextMsg"),    "Message_TextMessage");
    
register_message(get_user_msgid("RoundTime"), "Message_RoundTimer");
    
register_message(g_MsgID_NVGToggle"Message_NVGToggle");
    
register_message(get_user_msgid("SendAudio"), "Message_SendAudio");

    
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET);

    
//Not working as of 3.0.... Must investigate!!
    // register_menucmd(register_menuid("BuyItem", 1), 511, "menuItem");
    // register_menucmd(-34, 511, "menuItem");

    
register_menucmd(register_menuid(g_Menu_WeaponID), MENU_KEY_1 MENU_KEY_2MENU_KEY_3,"MenuID_Weapon");
    
register_menucmd(register_menuid(g_Menu_PrimaryID), MENU_KEY_1 MENU_KEY_2 MENU_KEY_3 MENU_KEY_4MENU_KEY_5 MENU_KEY_6 MENU_KEY_7 MENU_KEY_8 MENU_KEY_9 MENU_KEY_0"MenuID_Primary");
    
register_menucmd(register_menuid(g_Menu_SecID), MENU_KEY_1MENU_KEY_2MENU_KEY_3MENU_KEY_4MENU_KEY_5MENU_KEY_6MENU_KEY_7MENU_KEY_8"MenuID_Secondary");

    
register_clcmd("chooseteam""ClCmd_teams");
    
register_clcmd("nightvision""ClCmd_nvg");
    
register_clcmd("say guns""ClCmd_guns");
    
register_clcmd("say_team guns""ClCmd_guns");
    
register_clcmd("objective_menu" "ClCmd_objective"ADMIN_BAN);
    
    
register_concmd("zswarm_menu_AddWeap""ConCmd_addweap"ADMIN_BAN"<Weapon> Un-Restricts a weapon from the weapons menu.");
    
register_concmd("zswarm_menu_DelWeap""ConCmd_delweap"ADMIN_BAN"<Weapon> Restricts a weapon from the weapons menu.");


    new 
iEnt create_entity("ambient_generic");
    if(
iEnt)
    {
        
call_think(iEnt);
        
entity_set_string(iEntEV_SZ_classnameg_szClass_weather);

        
DispatchKeyValue(iEnt"message"g_szSound_thunder1);
        
DispatchKeyValue(iEnt"targetname""boom");
        
DispatchKeyValue(iEnt"pitchstart""100");
        
DispatchKeyValue(iEnt"pitch""100") ;
        
DispatchKeyValue(iEnt"health""10");
        
DispatchKeyValue(iEnt"spawnflags""49");

        
DispatchSpawn(iEnt);
        
entity_set_float(iEntEV_FL_nextthink get_gametime() + 2.0);

        
register_think(g_szClass_weather"Forward_Think_Weather");
    }

    if(
g_ForwardSpawn 0)
        
unregister_forward(FM_Spawng_ForwardSpawn);

    
format(g_szModNamecharsmax(g_szModName), "%s %s"PLUGINVERSION);
    
register_forward(FM_GetGameDescription"Forward_GetGameDescription");
    
register_forward(FM_CmdStart"Forward_CmdStart");
    
register_forward(FM_SetClientKeyValue"Forward_SetClientKeyValue");
    
register_forward(FM_ClientUserInfoChanged"Forward_ClientUserInfoChanged");
    
register_forward(FM_EmitSound"Forward_EmitSound");
    
register_forward(FM_Touch"Forward_Touch");
    
register_forward(FM_TraceLine"Forward_TraceLine_Post"1);
    
register_forward(FM_AddToFullPack"Forward_AddToFullPack_Post"1);

    
register_think(g_EntClassName"Forward_Think_Objective");
    
register_think(g_szClass_flesh"Forward_Think_Flesh");

    new 
sz_Sky[32];
    
get_pcvar_string(cvar_Skynamesz_Skycharsmax(sz_Sky));

    
set_cvar_string("sv_skyname"sz_Sky);
    
set_cvar_num("sv_skycolor_r"0);
    
set_cvar_num("sv_skycolor_g"0);
    
set_cvar_num("sv_skycolor_b"0);
    
server_cmd("sv_maxspeed 2000");

    
g_MaxPlayers get_maxplayers();
    
g_bFFire get_cvar_pointer("mp_friendlyfire");
}

public 
plugin_cfg()
{
    if(!
get_pcvar_num(cvar_Swith))
        return;
        
    
load_objective();
}
    
public 
client_putinserver(id)
{
    
g_ShowMenu[id] = true;
    
g_ShowMenuFirstTime[id] = true;
    
    if(
is_user_bot(id))
        
g_bIsBot[id] = true;
}

public 
client_disconnect(id)
{
    
g_bIsAlive[id] = false;
    
g_bIsBot[id] = false;
}

public 
concmd_zombieswarm(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED;

    new 
sz_Args[8];
    
read_argv(idsz_Argscharsmax(sz_Args));

    if ( 
equali(sz_Args"1") || equali(sz_Args"on") || equali(sz_Args"enable") )
    {
        
set_task(5.0"Task_Restart");
        
set_pcvar_num(cvar_Swith1);

        
set_hudmessage(255255255, -1.00.2501.05.00.10.2, -1);
        
show_hudmessage(0"%L"LANG_PLAYER"PLUGIN_HON_MSG"PLUGIN);

        
console_print(0"%L"LANG_PLAYER"PLUGIN_TON_MSG"PLUGIN);
        for(new 
16i++)
            
client_print(0print_chat"%L"LANG_PLAYER"PLUGIN_TON_MSG"PLUGIN);

        return 
PLUGIN_HANDLED;
    }
    else if ( 
equali(sz_Args"0") || equali(sz_Args"off") || equali(sz_Args"disable") )
    {

        
set_task(5.0"Task_Restart");
        
set_pcvar_num(cvar_Swith0);

        
set_hudmessage(255255255, -1.00.2501.05.00.10.2, -1);
        
show_hudmessage(0"%L"LANG_PLAYER"PLUGIN_HOFF_MSG"PLUGIN);

        
console_print(0"%L"LANG_PLAYER"PLUGIN_TOFF_MSG"PLUGIN);
        for(new 
16i++)
            
client_print(0print_chat"%L"LANG_PLAYER"PLUGIN_TOFF_MSG"PLUGIN);

        return 
PLUGIN_HANDLED;
    }

    
console_print(id,  "Invalid argument!");

    return 
PLUGIN_HANDLED;
}

public 
Forward_Spawn(iEnt)
{
    if(!
pev_valid(iEnt))
        return 
FMRES_IGNORED;

    static 
className[32];
    
pev(iEntpev_classnameclassNamecharsmax(className));

    for(new 
0sizeof g_MapEntities; ++i)
    {
        if(
equal(classNameg_MapEntities[i]))
        {
            
remove_entity(iEnt);
            return 
FMRES_SUPERCEDE;
        }
    }
    return 
FMRES_IGNORED;
}

public 
Bacon_Spawn_Post(id)
{
    if(!
is_user_alive(id))
        return;

    
g_bIsAlive[id] = true;
    
    new 
CsTeamsteam cs_get_user_team(id);
    new 
sz_CurrentModel[32];

    if(
team == CS_TEAM_T)
    {
        new 
HealthArmourFloatGravityFootSteps;
        
Health get_pcvar_num(cvar_Health);
        
Armour get_pcvar_num(cvar_Armour);
        
Gravity get_pcvar_float(cvar_Gravity) / 800;
        
FootSteps get_pcvar_num(cvar_Footsteps);

        
set_pev(idpev_max_healthfloat(Health));
        
set_user_health(idHealth);
        
cs_set_user_armor(idArmourCS_ARMOR_VESTHELM);
        
set_user_gravity(idGravity);
        
set_user_footsteps(idFootSteps);

        if(!
g_bZombie[id])
        {
            
g_bZombie[id] = true;
            
fm_reset_user_model(id);
        }

        
copy(g_CurrentModel[id], charsmax(g_CurrentModel[]), g_ZombiePlayerModels[random(sizeof g_ZombiePlayerModels)]);

        
fm_get_user_model(idsz_CurrentModelcharsmax(sz_CurrentModel) );

        if(!
equal(sz_CurrentModelg_CurrentModel[id]) && !g_bModel[id])
        {
            
set_task(0.25 g_flCounter"Task_Model"id TASKID_MODEL);
            
g_flCounter += 0.25;
        }

        if(!
cs_get_user_nvg(id))
            
cs_set_user_nvg(id);

        if(!
task_exists(TASKID_STRIP id))
            
set_task(0.2"Task_Strip"TASKID_STRIP id);

        if(
get_pcvar_num(cvar_AutoNvg))
            
set_task(0.2"Task_NVG"TASKID_NVG id);

    }
    else if(
team == CS_TEAM_CT)
    {
        
set_pev(idpev_max_health100.0);
        
set_user_footsteps(idfalse);
        if(
g_bZombie[id])
        {
            
g_bZombie[id] = false;
            
fm_reset_user_model(id);
        }

        
copy(g_CurrentModel[id], charsmax(g_CurrentModel[]), g_RandomModel[random(sizeof g_RandomModel)]);

        
fm_get_user_model(idsz_CurrentModelcharsmax(sz_CurrentModel) );

        if(!
equal(sz_CurrentModelg_CurrentModel[id]) && !g_bModel[id])
        {
            
set_task(0.25 g_flCounter"Task_Model"id TASKID_MODEL);
            
g_flCounter += 0.25;
        }

        
set_task(0.1"Task_Health"TASKID_HEALTH id);
        
        if(
get_pcvar_num(cvar_GunMenu))
            
Main_Weapon_Menu(id);
    }
    
    for(new 
010i++)
        
client_cmd(id"-nvgadjust");
    
g_bDeadNvg[0][id] = false;
}

public 
Bacon_TraceAttack_Post(iVictimiAttackerFloatflDamageFloatflDirection[3], trace_handleiDamageType)
{
    if(!
g_bIsAlive[iVictim] || !is_user_connected(iAttacker))
        return 
HAM_IGNORED;
        
    
g_bHeadshot[iAttacker][iVictim] = bool:( get_tr2(trace_handleTR_iHitgroup) == HIT_HEAD );
    
    return 
HAM_IGNORED;
}        

public 
Bacon_TakeDamage(iVictimiInflictoriAttackerFloat:flDamageiDamageType)
{
    if ( 
iDamageType DMG_GENERIC || /*iVictim == iAttacker ||*/ !g_bIsAlive[iVictim] || !is_user_connectediAttacker ) || iInflictor == 0)
        return 
HAM_IGNORED;
        
    new 
CsTeams:team[2];
    
team[0] = cs_get_user_team(iVictim), team[1] = cs_get_user_team(iAttacker);

    if(!
get_pcvar_num(g_bFFire) && team[0] == team[1])
        return 
HAM_SUPERCEDE;
        
    new 
CsArmorTypeArmorTypei_Armour cs_get_user_armor(iVictim ArmorType );

    new 
iDmgHP floatroundflDamage * (get_pcvar_float(cvar_Dmg_HP) / 100.0) );
    new 
iDmgArmor floatroundflDamage * (get_pcvar_float(cvar_Dmg_AP) / 100.0) ); //or 0.35
    
new iHealth get_user_healthiVictim );
    new 
maxArmour get_pcvar_num(cvar_Armour);

    if ( ((
iHealth iDmgHP) > 0) && (g_bZombie[iVictim]) && (i_Armour) )
    {
        
ExecuteHam(Ham_TakeDamageiVictimiInflictoriAttacker0.0DMG_BULLET DMG_NEVERGIB);
        
set_user_health(iVictimiHealth iDmgHP );
        
cs_set_user_armor(iVictimclamp(i_Armour iDmgArmor0maxArmour), ArmorType);
        
g_flDisplayDamage[iVictim] = float(iDmgHP);

        
// *** for testing ***
        // client_print( iVictim , print_chat , "Adjusted flDamage = %d" , iDmgHP );

        
return HAM_SUPERCEDE;
    }

    new 
weapon get_user_weapon(iAttacker);
    if( (
weapon == CSW_KNIFE) && (!g_bZombie[iVictim]) )
    {
        new 
button get_user_button(iAttacker);

        if ( 
button IN_ATTACK)
            
flDamage random_float(ZOMBIE_SLASH_MINZOMBIE_SLASH_MAX);
        else if ( 
button IN_ATTACK2)
            
flDamage random_float(ZOMBIE_STAB_MINZOMBIE_STAB_MAX);

        if(
g_bHeadshot[iAttacker][iVictim])
        {
            
g_bHeadshot[iAttacker][iVictim] = false;
            
flDamage *= 4.0;
            
//client_print(iAttacker, print_center, "HEADSHOT!");
        
}
        
        
SetHamParamFloat(4flDamage);

        return 
HAM_HANDLED;
    }
    

    return 
HAM_IGNORED;
}

public 
Bacon_TakeDamage_Post(iVictiminflictoriAttackerFloat:flDamageiDamageType)
{
    if (
g_flDisplayDamage[iVictim])
    {
        
set_pev(iVictimpev_dmg_takeg_flDisplayDamage[iVictim]);
        
g_flDisplayDamage[iVictim] = 0.0;
    }

    else if (
g_bIsAlive[iVictim] || is_user_connected(iAttacker))
    {
        if(
g_bZombie[iAttacker] && !g_bZombie[iVictim])
        {
            if(
flDamage >= SURVIVOR_PUNCHANGLE)
            {
                new 
Floatfl_Angle[3];
                for(new 
i++)
                    
fl_Angle[i] = random_float(-75.075.0);

                
entity_set_vector(iVictimEV_VEC_punchanglefl_Angle);
            }
        }
    }
}

public 
Bacon_Killed_Post(idiKiller)
{
    
g_bIsAlive[id] = false;
    
    if(
g_bZombie[id])
    {        
        new 
Victim_Origin[3];
        
get_user_origin(idVictim_Origin);

        
entity_set_int(idEV_INT_effectsentity_get_int(idEV_INT_effects) | EF_NODRAW);

        
//Credits to JTP10181 for his amx_gore_ultimate!!!
        
new flesh[2];
        
flesh[0] = mdl_gib_flesh;
        
flesh[1] = mdl_gib_meat;
        new 
gibtime 100//10 seconds

        // Gib explosions

        // Head
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        
write_byte(TE_MODEL);
        
write_coord(Victim_Origin[0]);
        
write_coord(Victim_Origin[1]);
        
write_coord(Victim_Origin[2] + 40);
        
write_coord(random_num(080));
        
write_coord(random_num(080));
        
write_coord(random_num(80200));
        
write_angle(random_num(0360));
        
write_short(mdl_gib_head);
        
write_byte(0); // bounce
        
write_byte(gibtime); // life
        
message_end();

        
// Parts
        
for(new 04i++)
        {
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
            
write_byte(TE_MODEL);
            
write_coord(Victim_Origin[0]);
            
write_coord(Victim_Origin[1]);
            
write_coord(Victim_Origin[2]);
            
write_coord(random_num(0,80));
            
write_coord(random_num(0,80));
            
write_coord(random_num(80200));
            
write_angle(random_num(0,360));
            
write_short(flesh[random_num(0,1)]);
            
write_byte(0); // bounce
            
write_byte(gibtime); // life
            
message_end();
        }

        
// Spine
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        
write_byte(TE_MODEL);
        
write_coord(Victim_Origin[0]);
        
write_coord(Victim_Origin[1]);
        
write_coord(Victim_Origin[2]+30);
        
write_coord(random_num(0,80));
        
write_coord(random_num(0,80));
        
write_coord(random_num(80200));
        
write_angle(random_num(0,360));
        
write_short(mdl_gib_spine);
        
write_byte(0); // bounce
        
write_byte(gibtime); // life
        
message_end();

        
// Lung
        
for(new 0<= 1i++)
        {
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
            
write_byte(TE_MODEL);
            
write_coord(Victim_Origin[0]);
            
write_coord(Victim_Origin[1]);
            
write_coord(Victim_Origin[2]+10);
            
write_coord(random_num(0,80));
            
write_coord(random_num(0,80));
            
write_coord(random_num(80200));
            
write_angle(random_num(0,360));
            
write_short(mdl_gib_lung);
            
write_byte(0); // bounce
            
write_byte(gibtime); // life
            
message_end();
        }

        
//Legs
        
for(new 0<= 1i++)
        {
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
            
write_byte(TE_MODEL);
            
write_coord(Victim_Origin[0]);
            
write_coord(Victim_Origin[1]);
            
write_coord(Victim_Origin[2]-10);
            
write_coord(random_num(0,80));
            
write_coord(random_num(0,80));
            
write_coord(random_num(80200));
            
write_angle(random_num(0,360));
            
write_short(mdl_gib_legbone);
            
write_byte(0); // bounce
            
write_byte(gibtime); // life
            
message_end();
        }

        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        
write_byte(TE_BLOODSPRITE);
        
write_coord(Victim_Origin[0]);
        
write_coord(Victim_Origin[1]);
        
write_coord(Victim_Origin[2]+20);
        
write_short(spr_blood_spray);
        
write_short(spr_blood_drop);
        
write_byte(247); // color index
        
write_byte(20); // size
        
message_end();

        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        
write_byte(TE_WORLDDECAL);
        
write_coord(Victim_Origin[0] + random_num(-50,50));
        
write_coord(Victim_Origin[1] + random_num(-50,50));
        
write_coord(Victim_Origin[2] - 36);
        
write_byte(random_num(204205)); // index
        
message_end();

        for(new 
i++)
        {
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
            
write_byte(TE_WORLDDECAL);
            
write_coord(Victim_Origin[0] + random_num(-100,100));
            
write_coord(Victim_Origin[1] + random_num(-100,100));
            
write_coord(Victim_Origin[2] - 36);
            
write_byte(random_num(190197)); // index
            
message_end();
        }

    }
    
    
//20% chance to show this message. 0 - 4
    
if(random(4) == 0)
        
client_print(idprint_chat"[Zombie Swarm] Turn on nightvision while dead by pressing your ^"nightvision ^" key");
        
    
g_bDeadNvg[0][id] = true;

}

public 
Bacon_Touch(entid)
{
    if (
is_user_alive(id) && g_bZombie[id])
        return 
HAM_SUPERCEDE;

    return 
HAM_IGNORED;
}

public 
Bacon_ResetMaxSpeed(id)
{
    if(!
g_bZombie[id])
        return;

    static 
Floatmaxspeedmaxspeed get_pcvar_float(cvar_Speed);

    if(
get_user_maxspeed(id) != 1.0)
        
set_user_maxspeed(idmaxspeed);

}

public 
Logevent_RoundStart()
{
    
g_bTimerStart true;

    
g_bFreezeTime false;
}

public 
Logevent_RoundEnd()
{
    if(
get_pcvar_num(cvar_EndRound))
        
remove_task(TASKID_ROUND);

    if(
task_exists(TASKID_BEACON))
        
remove_task(TASKID_BEACON);
        
    if(
task_exists(TASKID_FLYBY))
        
remove_task(TASKID_FLYBY);
        
    if(
task_exists(TASKID_EFFECTS))
        
remove_task(TASKID_EFFECTS);
        
    if(
task_exists(TASKID_EXPLOSION))
        
remove_task(TASKID_EXPLOSION);
        
    
g_flCounter 0.0;

    
fn_Rounds();
}

public 
Event_TextMsg()
{
    if(
get_pcvar_num(cvar_EndRound))
        
remove_task(TASKID_ROUND);

    
g_flCounter 0.0;

    
g_RoundCounter 0;
}

public 
Event_NewRound()
{
    
g_bFreezeTime true;
    
// remove_entity_name(CLASS_FLESH);

    
g_RoundCounter++;

    new 
rounds get_pcvar_num(cvar_Round);

    if(
rounds 0)
        
client_print(0print_chat"%L"LANG_PLAYER"ROUND_COUNTER"g_RoundCounterrounds);
        
    
remove_task(TASKID_BEACON);
    
remove_task(TASKID_FLYBY);
    
remove_task(TASKID_EFFECTS);
    
remove_task(TASKID_EXPLOSION);
        
    for(new 
g_EntCount i++)
    {
        if(
is_valid_ent(g_EntIndex[i]))
        {
            
entity_set_float(g_EntIndex[i], beacon_Percentage0.0);
            
entity_set_int(g_EntIndex[i], EV_INT_effectsEF_DIMLIGHT);
            
g_EntActive[i] = false;
        }
        else
            
log_amx("Error: Failed to create beacon during map config. Create a new config. Index number: %d"i);
            
    }
}

public 
Event_CurWeapon(id)
{
    if(!
g_bIsAlive[id] || !g_bZombie[id])
        return;

    if(
read_data(2) != CSW_KNIFE)
    {
        
engclient_cmd(id"weapon_knife");
        
UTIL_SetModel(idg_ZombieClaws"");
    }
}

public 
Message_StatusIcon(msg_idmsg_destid)
{
    if(!
is_user_connected(id))
        return 
PLUGIN_CONTINUE;

    new 
sz_Icon[4];
    
get_msg_arg_string(2sz_Iconcharsmax(sz_Icon));


    if(
equali(sz_Icon"buy"))
    {
        if (!
get_pcvar_num(cvar_GunMenu) && !g_bZombie[id])
            return 
PLUGIN_CONTINUE;
        
        return 
PLUGIN_HANDLED;
    }

    return 
PLUGIN_CONTINUE;
}

public 
Message_Health(msg_idmsg_destid)
{
    if(!
g_bIsAlive[id] || !g_bZombie[id])
        return;

    
// static iHealth ; iHealth = get_msg_arg_int(1);

    
static CurrentHealth CurrentHealth get_user_health(id);
    static 
FloatMaxHealth MaxHealth get_pcvar_float(cvar_Health);

    
//Must use 'clamp' to fix '0' hud bug
    
set_msg_arg_int(1ARG_BYTEclamp(floatround((CurrentHealth MaxHealth) * 100.0), 1100));    
}

public 
Message_Battery(msg_idmsg_destid)
{
    if(!
g_bIsAlive[id] || !g_bZombie[id])
        return;

    static 
CurrentArmour CurrentArmour get_user_armor(id);
    static 
FloatMaxArmour MaxArmour get_pcvar_float(cvar_Armour);

    
set_msg_arg_int(1ARG_SHORTfloatround((CurrentArmour MaxArmour) * 100.0));
}

public 
Message_TextMessage(msg_idmsg_destid)
{
    if(
get_msg_arg_int(1) != 4)
        return 
PLUGIN_CONTINUE;

    new 
sz_TextMsg[25], sz_WinMsg[32];
    
get_msg_arg_string(2sz_TextMsgcharsmax(sz_TextMsg));

    if(
equal(sz_TextMsg[1], "Game_bomb_drop") || equal(sz_TextMsg[1], "Terrorist_cant_buy") || (equal(sz_TextMsg[1], "CT_cant_buy")))
        return 
PLUGIN_HANDLED;

    else if(
equal(sz_TextMsg[1], "Terrorists_Win"))
    {
        
formatex(sz_WinMsgcharsmax(sz_WinMsg), "%L"LANG_SERVER"WIN_ZOMBIE");
        
set_msg_arg_string(2sz_WinMsg);
    }
    else if(
equal(sz_TextMsg[1], "Target_Saved") || equal(sz_TextMsg[1], "CTs_Win"))
    {
        
formatex(sz_WinMsgcharsmax(sz_WinMsg) , "%L"LANG_SERVER"WIN_HUMAN");
        
set_msg_arg_string(2sz_WinMsg);
    }
    return 
PLUGIN_CONTINUE;
}

public 
Message_RoundTimer()
{
    if(
get_pcvar_num(cvar_EndRound))
    {
        if(
g_bTimerStart)
        {
            
g_bTimerStart false;

            
set_task(float(get_msg_arg_int(1)), "Task_RoundEnd"TASKID_ROUND);
        }
    }
}

public 
Message_NVGToggle(msg_idmsg_destid)
{
    static 
iNvgToggle iNvgToggle get_msg_arg_int(1);
    if(
g_bZombie[id] && g_bIsAlive[id] && !g_bIsBot[id])
    {
        
g_bCustomNvg[id] = iNvgToggle;
        
set_msg_arg_int(1ARG_BYTE0);
        
        if( 
g_bCustomNvg[id] )
        {
            
// new color[11], red[4], green[4], blue[4];
            // get_pcvar_string( g_pCVarColor, color, 10 );
            // parse( color, red, 3, green, 3, blue, 3 );
            
            
message_beginMSG_ONE_UNRELIABLEg_MsgID_ScreenFade, { 0,0,}, id); 
            
write_short1<<); 
            
write_short1<<); 
            
write_short0x0004 ); 
            
write_byte175 );
            
write_byte50 );
            
write_byte25 ); 
            
write_byte50 ); 
            
message_end( );
            
            
message_begin(MSG_ONE_UNRELIABLEg_MsgID_SetFov, {0,0,0}, id);
            
write_byte(110);
            
message_end();
        }
        else
        {
            
message_beginMSG_ONE_UNRELIABLEg_MsgID_ScreenFade, { 0,0,}, id); 
            
write_short); 
            
write_short); 
            
write_short0x0000 ); 
            
write_byte);
            
write_byte);
            
write_byte); 
            
write_byte); 
            
message_end( );
            
            
message_begin(MSG_ONE_UNRELIABLEg_MsgID_SetFov, { 0,0,}, id);
            
write_byte(90);
            
message_end();
        }
    }
    else if(!
g_bZombie[id] && get_pcvar_num(cvar_Blocknvg))
    {
        if(
iNvgToggle)
        {
            
client_print(idprint_center"%L"LANG_PLAYER"BLOCK_NVG");
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
Message_SendAudio(msg_idmsg_destid)
{
    static 
AudioCode[22];
    
get_msg_arg_string(2AudioCodecharsmax(AudioCode) );

    for(new 
sizeof g_SendAudio_Radio i++)
    {
        if(
g_bZombie[id])
        {
            if(
equal(AudioCodeg_SendAudio_Radio[i]))
                
set_msg_arg_int(3ARG_SHORTZOMBIE_RADIO_SPEED);
        }
    }
    for(new 
sizeof g_SendAudio_RoundStart i++)
    {
        if(
equal(AudioCodeg_SendAudio_RoundStart[i]))
            
set_msg_arg_string(2g_sound_roundstart[random(sizeof g_sound_roundstart)]);
    }

    if(
equal(AudioCode"%!MRAD_terwin"))
        
set_msg_arg_string(2g_sound_zombiewin);

    else if(
equal(AudioCode"%!MRAD_ctwin"))
        
set_msg_arg_string(2g_sound_humanwin);

    return 
PLUGIN_CONTINUE;
}

// public menuItem(id, key)
// {
    // client_print(0, print_chat, "[TEST] %i", key);
    
    // if(!get_pcvar_num(cvar_Blocknvg))
        // return PLUGIN_CONTINUE;

    // if(key == MENUITEM_NVG)
    // {
        // client_print(id, print_center, "%L", LANG_PLAYER, "BLOCK_NVG");
        // return PLUGIN_HANDLED;
    // }

    // return PLUGIN_CONTINUE;
// }

public Main_Weapon_Menu(id)
{
    if(
g_ShowMenuFirstTime[id])
    {
        
g_PickedWeapons[0][id] = 24;
        
g_PickedWeapons[1][id] = 25;
        
g_ShowMenuFirstTime[id] = false;
    }
    if(
g_bIsBot[id])
        
give_weapons(id);

    else
    {
        
g_CurOffset[id] = 0;
        if(
g_ShowMenu[id])
        {
            
show_menu(idMENU_KEY_1 MENU_KEY_2 MENU_KEY_3"\yWeapon Selection Method^n^n\r1. \wNew Weapons^n\r2. \wPrevious Setup^n\r3. \w2+Don't show menu again", -1g_Menu_WeaponID);
        }
        else
        {
            
give_weapons(id);
        }
    }
}

public 
MenuID_Weapon(idkey)
{
    switch(
key)
    {
        case 
0:
        {
            
g_ShowMenu[id] = true;
            
Primary_Weapon_Menu(id0);

        }
        case 
1:
        {
            
g_ShowMenu[id] = true;
            
give_weapons(id);
        }
        case 
2:
        {
            
client_print(idprint_chat"[Zombie Swarm] Type ^"guns^" to re-activate the gun menu.");
            
g_ShowMenu[id] = false;
            
give_weapons(id);
        }
    }

    return;
}

public 
Primary_Weapon_Menu(idoffset)
{
    if(
offset<0
        
offset 0;

    new 
cvar_value[32];
    
get_pcvar_string(cvar_Weaponscvar_valuecharsmax(cvar_value));

    new 
flags read_flags(cvar_value);

    new 
keyscurnummenu[2048];
    for(new 
offset 19 i++)
    {
        if(
== 18)
        {
            
g_OptionsOnMenu[curnum][id] = 24;
            
keys += (1<<curnum);
            
curnum++;
            
format(menu2047"\y%s^n^n\r%d. \wRandom^n"menucurnum);
            break;
        }
        else if(
flags power(2i))
        {
            
g_OptionsOnMenu[curnum][id] = i;
            
keys += (1<<curnum);

            
curnum++;
            
format(menu,2047"\y%s^n\r%d. \w%s"menucurnumweapon_names[i]);

            if(
curnum == 8)
                break;
        }
    }

    
format(menu2047"\ySelect Primary Weapon:\w^n%s"menu);
    if(
curnum == && offset 12)
    {
        
keys += (1<<8);
        
format(menu2047"\y%s^n^n\r9. \wNext"menu);
    }
    if(
offset)
    {
        
keys += (1<<9);
        
format(menu2047"\y%s^n\r0. \wBack"menu);
    }

    
show_menu(idkeysmenu, -1g_Menu_PrimaryID);
}

public 
MenuID_Primary(idkey)
{
    if(
key 8)
    {
        
g_PickedWeapons[0][id] = g_OptionsOnMenu[key][id];
        
g_CurOffset[id] = 0;
        
Secodary_Weapon_Menu(id,0);
    }
    else
    {
        if(
key==8)
            
g_CurOffset[id] += 8;
        if(
key==9)
            
g_CurOffset[id] -= 8;
        
Primary_Weapon_Menu(idg_CurOffset[id]);
    }

    return ;
}

public 
Secodary_Weapon_Menu(idoffset)
{
    if(
offset 0
        
offset 0;

    new 
cvar_value[32];
    
get_pcvar_string(cvar_Weaponscvar_valuecharsmax(cvar_value));

    new 
flags read_flags(cvar_value);

    new 
keyscurnummenu[2048];
    for(new 
18 24 i++)
    {
        if(
flags power(2i))
        {
            
g_OptionsOnMenu[curnum][id] = i;
            
keys += (1<<curnum);

            
curnum++;
            
format(menu2047"\y%s^n\r%d. \w%s"menucurnumweapon_names[i]);
        }
    }
    
g_OptionsOnMenu[curnum][id] = 25;
    
keys += (1<<curnum);
    
curnum++;
    
format(menu2047"\y%s^n^n\r%d. \wRandom"menucurnum);

    
format(menu2047"\ySelect Secondary Weapon:\w^n%s"menu);

    
show_menu(idkeysmenu, -1g_Menu_SecID);
}

public 
MenuID_Secondary(idkey)
{
    if(
key<8)
    {
        
g_PickedWeapons[1][id] = g_OptionsOnMenu[key][id];
    }

    
give_weapons(id);

    return;
}

public 
give_weapons(id)
{
    if(!
g_bIsAlive[id] || !is_user_connected(id))
        return;

    
strip_user_weapons(id);
    
cs_set_user_nvg(id0);

    
give_item(id"weapon_knife");

    new 
weapon[32];
    new 
csw csw_contant(g_PickedWeapons[0][id]);
    
get_weaponname(cswweaponcharsmax(weapon));
    
give_item(idweapon);
    
cs_set_user_bpammo(idcswg_MaxBPAmmo[csw]);

    
csw csw_contant(g_PickedWeapons[1][id]);
    
get_weaponname(csw,weaponcharsmax(weapon));
    
give_item(idweapon);
    
cs_set_user_bpammo(idcswg_MaxBPAmmo[csw]);

    
get_pcvar_string(cvar_Equip,weaponcharsmax(weapon));

    new 
heflashsmoke;
    for(new 
strlen(weapon) ; i++)
    {
        switch(
weapon[i])
        {
            case 
'h'he++;
            case 
'f'flash++;
            case 
's'smoke++;
            case 
'n'cs_set_user_nvg(id);
        }
    }

    if(
hegive_item(id"weapon_hegrenade"), cs_set_user_bpammo(idCSW_HEGRENADEhe);
    if(
flashgive_item(id"weapon_flashbang"), cs_set_user_bpammo(idCSW_FLASHBANGflash);
    if(
smokegive_item(id"weapon_smokegrenade"), cs_set_user_bpammo(idCSW_SMOKEGRENADEsmoke);

    
get_pcvar_string(cvar_Weaponsweaponcharsmax(weapon));

    new 
flags read_flags(weapon);
    if(
flags MOD_VESTHELMcs_set_user_armor(id100CS_ARMOR_VESTHELM);
    else if(
flags MOD_VESTcs_set_user_armor(id100CS_ARMOR_KEVLAR);
}

public 
csw_contant(weapon)
{
    new 
num 29;
    switch(
weapon)
    {
        case 
0num 3;
        case 
1num 5;
        case 
2num 7;
        case 
3num 8;
        case 
4num 12;
        case 
5num 13;
        case 
6num 14;
        case 
7num 15;
        case 
8num 18;
        case 
9num 19;
        case 
10num 20;
        case 
11num 21;
        case 
12num 22;
        case 
13num 23;
        case 
14num 24;
        case 
15num 27;
        case 
16num 28;
        case 
17num 30;
        case 
18num 1;
        case 
19num 10;
        case 
20num 11;
        case 
21num 16;
        case 
22num 17;
        case 
23num 26;
        case 
24:
        {
            new 
s_weapon[32];
            
get_pcvar_string(cvar_Weaponss_weaponcharsmax(s_weapon));

            new 
flags read_flags(s_weapon);
            do
            {
                
num random_num(017);
                if(!(
num flags))
                {
                    
num = -1;
                }
            }
            while(
num==-1);
            
num csw_contant(num);
        }
        case 
25:
        {
            new 
s_weapon[32];
            
get_pcvar_string(cvar_Weaponss_weaponcharsmax(s_weapon));

            new 
flags read_flags(s_weapon);
            do
            {
                
num random_num(1823);
                if(!(
num flags))
                {
                    
num = -1;
                }
            }
            while(
num==-1);
            
num csw_contant(num);
        }
    }
    return 
num;
}

public 
ClCmd_teams(id)
{
    if (!
get_pcvar_num(cvar_Teams))
        return 
PLUGIN_CONTINUE;

    new 
CsTeamsteam cs_get_user_team(id);
    if(
team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED)
        return 
PLUGIN_CONTINUE;

    
client_print(idprint_center"%L"LANG_PLAYER"BLOCK_TEAMS");

    return 
PLUGIN_HANDLED;
}

public 
ClCmd_nvg(id)
{
    if(!
g_bIsAlive[id] && g_bDeadNvg[0][id])
    {
        
message_begin(MSG_ONE_UNRELIABLEg_MsgID_NVGToggle_id);
        
write_byte(g_bDeadNvg[1][id] = !g_bDeadNvg[1][id]);
        
message_end();
    }
}

public 
ClCmd_guns(id)
{
    if(!
get_pcvar_num(cvar_GunMenu))
    {
        
client_print(idprint_chat"[Zombie Swarm] Gun Menu has been disabled.");
    }
    else
    {
        
g_ShowMenu[id] = true;
        
client_print(idprint_chat"[Zombie Swarm] Weapon Selection Menu will show next time you spawn");
    }
}

public 
ClCmd_objective(id)
{
    if(!
g_bIsAlive[id])
        return 
PLUGIN_CONTINUE;
        
    new 
menu menu_create("Objective Menu"g_Menu_Handler1);
    
    
menu_additem(menu"Place objective at player position""1");
    
menu_additem(menu"Remove aiming object""2");
    
menu_addblank(menu0);
    
menu_additem(menu"Remove all objectives""3");
    
menu_addblank(menu0);
    
menu_additem(menu"Save objectives""4");
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu);

    return 
PLUGIN_HANDLED;
}

public 
menu_Objectives(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], szName[64];
    new 
accesscallback;

    
menu_item_getinfo(menuitemaccessdatacharsmax(data), szNamecharsmax(szName), callback);
    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
            
create_objective(id);
        }
        case 
2:
        {
            new 
entbody, class[32];
            
get_user_aiming(identbody);
            
            if (
is_valid_ent(ent)) 
            {
                
entity_get_string(entEV_SZ_classname, class, charsmax(class));
                
                if (
equal(class, g_EntClassName)) 
                {
                    
remove_entity(ent);
                    
g_EntCount--;
                }
                
            }
                            
        }
        case 
3:
        {
            
remove_entity_name(g_EntClassName);
            
g_EntCount 0;
            
            
client_print(0print_chat"[Objective] All objectives removed!");
        }
            
        case 
4:
        {
            
save_objective(id);
        }
            
    }

    
menu_display(idmenu);
    return 
PLUGIN_HANDLED;
}

create_objective(idFloat:origin[3]= { 0.00.00.0 }, Float:angle[3]= { 0.00.00.0 } )
{
    new 
iEnt create_entity("info_target");
    
    
entity_set_stringiEntEV_SZ_classnameg_EntClassName);
    
    if( 
id )
    {
        
entity_get_vector(idEV_VEC_originorigin);
        
entity_set_origin(iEntorigin);
        
origin[2] += 64.0;
        
entity_set_origin(idorigin);

        
entity_get_vector(idEV_VEC_anglesangle);
        
angle[0] = 0.0;
        
entity_set_vector(iEntEV_VEC_anglesangle);
    }
    else 
    {
        
entity_set_origin(iEntorigin);
        
entity_set_vector(iEntEV_VEC_anglesangle);
    }

    
entity_set_modeliEntg_ObjectiveBeacon);
    
entity_set_intiEntEV_INT_movetypeMOVETYPE_PUSHSTEP);
    
entity_set_intiEntEV_INT_solidSOLID_BBOX);
    
entity_set_int(iEntEV_INT_effectsEF_DIMLIGHT);
    
    new 
Float:mins[3] = { -7.120000 , -5.5000000.0 };
    new 
Float:maxs[3] = { 7.1200005.36000032.41000 };
    
entity_set_sizeiEntminsmaxs);
    
    
entity_set_float(iEntbeacon_Percentage0.0);
        
    
drop_to_flooriEnt);    
    
// call_think(iEnt);
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1);
    
    
g_EntIndex[g_EntCount] =  iEnt;
    
g_EntActive[g_EntCount] = false;

    
// client_print(id, print_chat, "PLANT - INDEX: %d", g_EntIndex[g_EntCount]);

    
g_EntCount++;
    
}
    
save_objective(id)
{
    
//Variables
    
new sConfigsDir[256], sFile[256], SabDir[256];
    
    
//Get the configs directory.
    
get_configsdir(sConfigsDircharsmax(sConfigsDir));
    
    
//Get the current map name
    
new sMapName[32];
    
get_mapname(sMapNamecharsmax(sMapName));
    
    
//Format 'SabDir' to ../configs/Sabotage
    
formatex(SabDircharsmax(SabDir),"%s/Objective"sConfigsDir);
    
    if(!
dir_exists(SabDir))
    {
        
log_amx("Error: The directory %s does not exist! Create the directory."SabDir);
        
client_print(idprint_chat"[Objective] The directory %s does not exist! Create the directory."SabDir);
        return;
    }
    
//Format 'sFile to ../configs/Sabotage/mapname.cfg
    
formatex(sFilecharsmax(sFile), "%s/%s.cfg",SabDir,sMapName);
        
    
//If there is already a .cfg for the current map. Delete it
    
if(file_exists(sFile))
        
delete_file(sFile);
    
    
//Variables
    
new iEnt = -1Float:fEntOrigin[3], Float:fEntAngles[3];
    static 
sBuffer[256];
    
    
//Scan and find all of my custom ents
    
while( ( iEnt find_ent_by_class(iEntg_EntClassName) ) )
    {
        
//Get the entities' origin and angle
        
entity_get_vector(iEntEV_VEC_originfEntOrigin);
        
entity_get_vector(iEntEV_VEC_anglesfEntAngles);
        
        
//Format the line of one custom ent.
        
formatex(sBuffercharsmax(sBuffer), "%d %d %d | %d"floatround(fEntOrigin[0]), floatround(fEntOrigin[1]), floatround(fEntOrigin[2]), floatround(fEntAngles[1]));
        
        
//Finally write to the mapname.cfg file and move on to the next line
        
write_file(sFilesBuffer, -1);
        
        
//We are currentlying looping to find all custom ents on the map. If found another ent. Do the above till there is none.
    
}
    
    
client_print(0print_chat"[Objective] New configuration file for %s has just been created."sMapName);
}

load_objective()
{
    new 
sConfigsDir[256], sFile[256], SabDir[256];
    
    
get_configsdir(sConfigsDircharsmax(sConfigsDir));
    
    new 
sMapName[32];
    
get_mapname(sMapNamesizeof sMapName 1);
    
    
formatex(SabDircharsmax(SabDir),"%s/Objective"sConfigsDir);
    
formatex(sFilecharsmax(sFile), "%s/%s.cfg",SabDirsMapName);
        
    
    if(!
dir_exists(SabDir))
    {
        
mkdir(SabDir);
    }
    
    if(!
file_exists(sFile))
    {
        
write_file(sFile"");
    }
    
    new 
sFileOrigin[3][32];
    new 
sOrigin[128], sAngle[128];
    new 
Float:fOrigin[3], Float:fAngles[3];
    new 
iLineiLengthsBuffer[256];
    
    while(
read_file(sFileiLine++, sBuffersizeof sBuffer 1iLength))
    {
        if((
sBuffer[0]== ';') || !iLength)
            continue;
        
        
strtok(sBuffersOrigincharsmax(sOrigin), sAnglecharsmax(sAngle), '|'0);
                
        
parse(sOriginsFileOrigin[0], charsmax(sFileOrigin[]), sFileOrigin[1], charsmax(sFileOrigin[]), sFileOrigin[2], charsmax(sFileOrigin[]));
        
        
fOrigin[0] = str_to_float(sFileOrigin[0]);
        
fOrigin[1] = str_to_float(sFileOrigin[1]);
        
fOrigin[2] = str_to_float(sFileOrigin[2]);
                
        
fAngles[1] = str_to_float(sAngle[1]);
        
        
create_objective(0fOriginfAngles);
    }
}

public 
ConCmd_addweap(id,level,cid)
{
    if(!
cmd_access(id,level,cid,2))
        return 
PLUGIN_HANDLED;

    new 
arg[32];
    
read_argv(1argcharsmax(arg));

    new 
cvar_value[32];
    
get_pcvar_string(cvar_Weaponscvar_valuecharsmax(cvar_value));

    for(new 
26 i++)
    {
        if(
equali(argweapon_names[i]))
        {
            new 
flags read_flags(cvar_value);
            new 
add_flag power(2i);
            if(!(
flags add_flag))
            {
                
console_print(id"[Zombie Swarm] Adding weapon %s to the choice list.",weapon_names[i]);
                
flags += add_flag;
                
get_flags(flagscvar_valuecharsmax(cvar_value));
                
set_pcvar_string(cvar_Weaponscvar_value);
            }
            else
            {
                
console_print(id"[Zombie Swarm] Weapon %s is already on choice list.",weapon_names[i]);

            }

            break;
        }
    }

    return 
PLUGIN_HANDLED;
}

public 
ConCmd_delweap(id,level,cid)
{
    if(!
cmd_access(id,level,cid,2))
        return 
PLUGIN_HANDLED;

    new 
arg[32];
    
read_argv(1argcharsmax(arg));

    new 
cvar_value[32];
    
get_pcvar_string(cvar_Weaponscvar_valuecharsmax(cvar_value));

    new 
flags read_flags(cvar_value);
    for(new 
26 i++)
    {
        if(
equali(argweapon_names[i]))
        {
            new 
remove_flag power(2i);
            if(
flags remove_flag)
            {
                
console_print(id"[Zombie Swarm] Removing weapon %s from the choice list."weapon_names[i]);
                
flags -= remove_flag;
                
get_flags(flagscvar_valuecharsmax(cvar_value));
                
set_pcvar_string(cvar_Weaponscvar_value);
            }
            else
            {
                
console_print(id"[Zombie Swarm] Weapon %s is already off choice list."weapon_names[i]);
            }
            break;
        }
    }

    return 
PLUGIN_HANDLED;
}

public 
Forward_Think_Weather(iEnt)
{
    if(!
is_valid_ent(iEnt))
        return 
PLUGIN_CONTINUE;

    static 
Floatgametime gametime get_gametime();

    switch (
get_pcvar_num(cvar_Lights))
    {
        case 
0:
        {
            
set_lights("m");
            
entity_set_float(iEntEV_FL_nextthinkgametime 0.1);
        }
        case 
1:
        {
            static 
thinkReturnrandNum;
            if(!
b_LightFlashing)
            {
                
randNum random_num(01);
                if(
randNum)
                    
entity_set_string(iEntEV_SZ_messageg_szSound_thunder1);
                else
                    
entity_set_string(iEntEV_SZ_messageg_szSound_thunder2);
                
b_LightFlashing true;
                
g_LightNum random_num(13);
                
dllfunc(DLLFunc_UseiEnt0);

            }
            
thinkReturn lightning();

            if(
thinkReturn)
                
entity_set_float(iEntEV_FL_nextthinkgametime random_float(9.516.5));
            else
                
entity_set_float(iEntEV_FL_nextthinkgametime 0.1);
        }
        case 
2:
        {
            
set_lights("b");
            
entity_set_float(iEntEV_FL_nextthinkgametime 0.1);
        }
        default:
        {
            
set_lights("b");
            
entity_set_float(iEntEV_FL_nextthinkgametime 0.1);
        }

    }
    return 
PLUGIN_CONTINUE;
}

lightning()
{
    switch(
g_LightNum)
    {
        
// Flash 1 time
        
case 1:
        {
            
g_LightCounter += 1;
            switch(
g_LightCounter)
            {
                case 
1g_LightStyleNum 1;
                case 
2g_LightStyleNum 2;
                case 
3g_LightStyleNum 1;
                case 
4g_LightStyleNum 0;
            }
            
set_lights(g_LightStyle[g_LightStyleNum]);

            if(
g_LightCounter == 4)
            {
                
g_LightCounter 0;
                
b_LightFlashing false;
                return 
1;
            }
            else
                return 
0;
        }
        
// Flash 2 times
        
case 2:
        {
            
g_LightCounter += 1;
            switch(
g_LightCounter)
            {
                case 
1g_LightStyleNum 1;
                case 
2g_LightStyleNum 2;
                case 
3g_LightStyleNum 1;
                case 
4g_LightStyleNum 2;
                case 
5g_LightStyleNum 1;
                case 
6g_LightStyleNum 0;
            }
            
set_lights(g_LightStyle[g_LightStyleNum]);

            if(
g_LightCounter == 6)
            {
                
g_LightCounter 0;
                
b_LightFlashing false;
                return 
1;
            }
            else
                return 
0;
        }
        
// Flash 3 times
        
case 3:
        {
            
g_LightCounter += 1;
            switch(
g_LightCounter)
            {
                case 
1g_LightStyleNum 1;
                case 
2g_LightStyleNum 2;
                case 
3g_LightStyleNum 1;
                case 
4g_LightStyleNum 2;
                case 
5g_LightStyleNum 1;
                case 
6g_LightStyleNum 2;
                case 
7g_LightStyleNum 1;
                case 
8g_LightStyleNum 0;
            }
            
set_lights(g_LightStyle[g_LightStyleNum]);

            if(
g_LightCounter == 8)
            {
                
g_LightCounter 0;
                
b_LightFlashing false;
                return 
1;
            }
            else
                return 
0;
        }
    }
    return 
1;
}

public 
Forward_GetGameDescription()
{
    
forward_return(FMV_STRINGg_szModName);

    return 
FMRES_SUPERCEDE;
}

public 
Forward_CmdStart(iduc_handleseed)
{
    if(!
g_bIsAlive[id])
        return 
FMRES_IGNORED;

    static 
Floatvelocity[3];
    static 
FloatflTime flTime get_gametime();
    
    static 
iButton iButton get_uc(uc_handleUC_Buttons );
    static 
oldButton oldButton pev(idpev_oldbuttons);
    
    static 
fViewAngles[3] ; get_uc(uc_handleUC_ViewAnglesfViewAngles);
    static 
iImpulse iImpulse get_uc(uc_handleUC_Impulse);
    
    static 
iFlag iFlag entity_get_int(idEV_INT_flags);

    static 
aimbodyszAimingEnt[32];
    
get_user_aiming(idaimbody60);
    
entity_get_string(aimEV_SZ_classnameszAimingEntcharsmax(szAimingEnt));
    
    if (
g_bZombie[id])
    {
        if (!
g_bFreezeTime && (iButton IN_RELOAD) && (iFlag FL_ONGROUND))
        {
            if (
get_pcvar_num(cvar_Leap))
            {
                static 
Floatfl_CoolDown fl_CoolDown get_pcvar_float(cvar_LeapCooldown);
                {
                    if(
flTime fl_CoolDown g_LastLeap[id])
                    {
                        
clcmd_leap(id);
                        
g_LastLeap[id] = flTime;
                    }
                }
            }
        }
        else if ( (!
g_bFreezeTime) && (iButton IN_ATTACK) && (iButton IN_ATTACK2))
        {
            if (
get_pcvar_num(cvar_FleshThrow))
            {
                if(
flTime 1.1 g_LastFthrow[id])
                {
                    
clcmd_throw(id);
                    
g_LastFthrow[id] = flTime;
                }
            }
        }
        
        else if (
iImpulse == 100)
            
set_uc(uc_handleUC_Impulse0);
            
    }
    else if (!
g_bZombie[id])
    {
        if ( (
iButton IN_BACK) && (iFlag FL_ONGROUND) )
        {
            
get_user_velocity(idvelocity);
            
xs_vec_mul_scalar(velocitySURVIVOR_BACKSPEEDvelocity);
            
set_user_velocity(idvelocity);
        }
        else if ((
iButton IN_USE) && (oldButton IN_USE))
        {
            if (
flTime 1.0 g_BuildTime[id])
            {
                for(new 
0g_EntCounti++)
                {
                    if(
is_valid_ent(g_EntIndex[i]))
                    {
                        if( (
get_entity_distance(idg_EntIndex[i]) < 75) && (equal(szAimingEntg_EntClassName)) )
                        {
                            if(!
g_EntActive[i])
                            {
                                
CacheWeaponInfo (id);
                                static 
FloatEntPercent EntPercent entity_get_float(g_EntIndex[i], beacon_Percentage);
                                static 
FloatMaxPercent MaxPercent get_pcvar_float(cvar_ObjectivePercent);
                                if(
EntPercent >= MaxPercent)
                                {
                                    
client_print(idprint_center"Beacon Complete");
                                    
emit_sound(g_EntIndex[i], CHAN_VOICEg_SoundComplete[random(sizeof g_SoundComplete)], VOL_NORMATTN_NORM0PITCH_NORM);
                                    
g_EntActive[i] = true;
                                    
entity_set_int(g_EntIndex[i], EV_INT_effectsEF_BRIGHTLIGHT);

                                    
ExecuteHamBHam_Item_Deployg_WeaponIndex[id], );
                                    
g_Building[id] = false;
                                    
//Check all  ents here
                                    
if(Is_Ents_Built())
                                    {
                                        new 
FloatflTimer random_float(2.04.0);
                                        
                                        
set_task(flTimer"Task_BeaconJetFlyBy"TASKID_FLYBY);
                                        
set_task(flTimer flTimer"Task_BeaconEffects"TASKID_EFFECTS);
                                        
set_task((flTimer flTimer) + 1.0"Task_BeaconExplosion"TASKID_EXPLOSION);
                                        
set_task(flTimer flTimer 1.0"Task_BeaconComplete"TASKID_BEACON);
                                    }
                                    return 
FMRES_SUPERCEDE;
                                }

                                
client_print(idprint_center"%d%"floatround((EntPercent MaxPercent) * 100.0));                                            
                                
entity_set_float(g_EntIndex[i], beacon_PercentageEntPercent 1.0);
                                
                                static 
FloatEntMin[3], FloatEntMax[3];
                                
entity_get_vector(g_EntIndex[i], EV_VEC_absminEntMin);
                                
entity_get_vector(g_EntIndex[i], EV_VEC_absmaxEntMax);

                                for(new 
j++)
                                {
                                    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
                                    
write_byte(TE_SPARKS);
                                    
write_coord_f(random_float(EntMin[0], EntMax[0]));
                                    
write_coord_f(random_float(EntMin[1], EntMax[1]));
                                    
write_coord_f(random_float(EntMin[2], EntMax[2]));
                                    
message_end();
                                }
                                
emit_sound(g_EntIndex[i], CHAN_AUTOg_SoundBuild[random(sizeof g_SoundBuild)], VOL_NORMATTN_NORM0PITCH_NORM);
                                
                                
                                
UTIL_SetNextAttack g_WeaponIndex[id], 1.25 );
                                
UTIL_SetModel(id"""");
                                
// client_print(id, print_chat, "Build - INDEX: %d", g_EntIndex[i]);

                                
g_BuildTime[id] = flTime;    
                                
g_Building[id] = true;
                                break;
                            }
                        }
                        else
                        {
                            if(
g_Building[id])
                            {
                                
ExecuteHamBHam_Item_Deployg_WeaponIndex[id], );
                                
g_Building[id] = false;
                            }    
                        }
                    }
                    else
                        
log_amx("Error: Failed to use. Index number: %d. Create a new config file."i);
                }
            }
        }
        else if( !(
iButton IN_USE) && (oldButton IN_USE))
        {
            if(
g_Building[id])
            {
                
ExecuteHamBHam_Item_Deployg_WeaponIndex[id], );
                
g_Building[id] = false;
            }
        }
    }

    return 
FMRES_IGNORED;
}

public 
clcmd_leap(id)
{
    new 
Floatvelocity[3];
    new 
Floatlheightlforce;
    
lforce get_pcvar_num(cvar_LeapForce);
    
lheight get_pcvar_float(cvar_LeapHeight);

    
velocity_by_aim(idlforcevelocity);
    
velocity[2] = lheight;
    
entity_set_vector(idEV_VEC_velocityvelocity);
    
emit_sound(idCHAN_VOICEg_sound_pain[random(sizeof g_sound_pain)], VOL_NORMATTN_NORM0PITCH_NORM);
}

public 
clcmd_throw(id)
{
    new 
iOrigin[3], FloatflOrigin[3], FloatflVelocity[3];
    
// pev(id, pev_origin, Origin);
    
get_user_origin(idiOrigin1);
    
entity_get_vector(idEV_VEC_velocity,  flVelocity);

    new 
HealthflDamage;
    
Health get_user_health(id);
    
flDamage get_pcvar_num(cvar_FleshSelfDmg);

    if (
Health flDamage)
    {
        new 
iEnt create_entity("info_target");

        
entity_set_string(iEntEV_SZ_classnameg_szClass_flesh);
        
        
entity_set_model(iEntg_ZombieFleshThrow);
        
entity_set_int(iEntEV_INT_bodyrandom_num(110)); //Submodel 0 is skull/head
        
        
new FloatMinBox[3] = { -2.5, -2.50.0 };
        new 
FloatMaxBox[3] = { 2.52.52.0 };
        
entity_set_size(iEntMinBoxMaxBox);

        
IVecFVec(iOriginflOrigin);
        
entity_set_vector(iEntEV_VEC_originflOrigin);
        
        
entity_set_int(iEntEV_INT_movetypeMOVETYPE_TOSS);
        
entity_set_int(iEntEV_INT_solidSOLID_TRIGGER);
        
        
entity_set_edict(iEntEV_ENT_ownerid); 

        
velocity_by_aim(idget_pcvar_num(cvar_FleshForce), flVelocity);
        
entity_set_vector(iEntEV_VEC_velocityflVelocity);

        
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1);
         
        
emit_sound(idCHAN_VOICEg_sound_pain[random(sizeof g_sound_pain)], VOL_NORMATTN_NORM0PITCH_NORM);
        
set_user_health(idHealth flDamage);
    }
    else
    {
        
client_print(idprint_center"%L"LANG_PLAYER"FLESH_HEALTH");
    }

}

public 
Forward_SetClientKeyValue(idinfobufferkey[], value[])
{
    if (
g_bModel[id] && equal(key"model"))
        return 
FMRES_SUPERCEDE;

    return 
FMRES_IGNORED;
}

public 
Forward_ClientUserInfoChanged(idinfobuffer)
{
    if (!
g_bModel[id])
        return 
FMRES_IGNORED;

    new 
sz_CurrentModel[32];
    
fm_get_user_model(idsz_CurrentModelcharsmax(sz_CurrentModel));

    if(!
equal(sz_CurrentModelg_CurrentModel[id]))
        
fm_set_user_model(idg_CurrentModel[id]);


    return 
FMRES_IGNORED;
}

public 
Forward_EmitSound(idchannelsample[], Float:volumeFloat:attnflagpitch)
{
    if(!
is_user_connected(id))
        return 
FMRES_IGNORED;

    if(
g_bZombie[id])
    {
        
//KNIFE
        
if (sample[0] == 'w' && sample[1] == 'e' && sample[8] == 'k' && sample[9] == 'n')
        {
            switch(
sample[17])
            {
                case 
'l':
                    return 
FMRES_SUPERCEDE;

                case 
's''w':
                {
                    
emit_sound(idCHAN_WEAPONg_sound_miss[random(sizeof g_sound_miss)], volumeattnflagpitch);
                    return 
FMRES_SUPERCEDE;
                }

                case 
'b''1''2''3''4':
                {
                    
emit_sound(idCHAN_WEAPONg_sound_hit[random(sizeof g_sound_hit)], volumeattnflagpitch);
                    return 
FMRES_SUPERCEDE;
                }
            }
        }
        
//PAIN
        
else if (sample[1] == 'l' && sample[2] == 'a' && sample[3] == 'y' && ( (containi(sample"bhit") != -1) || (containi(sample"pain") != -1) || (containi(sample"shot") != -1)))
        {
            
emit_sound(idCHAN_VOICEg_sound_pain[random(sizeof g_sound_pain)], volumeattnflagpitch);
            return 
FMRES_SUPERCEDE;
        }
        
//DEATH
        
else if (sample[7] == 'd' && (sample[8] == 'i' && sample[9] == 'e' || sample[12] == '6'))
        {
            
emit_sound(idCHAN_VOICEg_sound_die[random(sizeof g_sound_die)], volumeattnflagpitch);
            return 
FMRES_SUPERCEDE;
        }
        else if (
sample[6] == 'n' && sample[7] == 'v' && sample[8] == 'g')
            return 
FMRES_SUPERCEDE;
    }
    else
    {
        
//NVG
        
if(get_pcvar_num(cvar_Blocknvg))
            if (
sample[6] == 'n' && sample[7] == 'v' && sample[8] == 'g')
                return 
FMRES_SUPERCEDE;
    }

    return 
FMRES_IGNORED;
}

public 
Forward_Touch(pToucherpTouched)
{
    if ( 
pev_valid(pToucher))
    {
        static 
sz_ClassName_Toucher[32], sz_ClassName_Touched[32];
        
pev(pToucherpev_classnamesz_ClassName_Touchercharsmax(sz_ClassName_Toucher));

        if ( 
pev_valid(pTouched))
            
pev(pTouchedpev_classnamesz_ClassName_Touchedcharsmax(sz_ClassName_Touched));

        if ( 
equal(sz_ClassName_Toucherg_szClass_flesh))
        {
            static 
iAttacker iAttacker pev(pToucherpev_owner);

            if ( 
pev_valid(pTouched))
            {
                if ( 
equal(sz_ClassName_Touched"player") && is_user_connected(pTouched))
                {
                    static 
vOrigin[3], FloatflDamage;
                    
get_user_origin(pTouchedvOrigin);
                    
flDamage get_pcvar_float(cvar_FleshDmg);
                    static 
CsTeams:team[2];
                    
team[0] = cs_get_user_team(pTouched), team[1] = cs_get_user_team(iAttacker);

                    if (
iAttacker == pTouched)
                        return 
FMRES_SUPERCEDE;

                    if (!
get_pcvar_num(g_bFFire) && team[0] == team[1])
                        return 
FMRES_SUPERCEDE;

                    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
                    
write_byte(TE_BLOOD);
                    
write_coord(vOrigin[0]);
                    
write_coord(vOrigin[1]);
                    
write_coord(vOrigin[2] + 10);
                    
write_coord(random_num(-360360));
                    
write_coord(random_num(-360360));
                    
write_coord(-10);
                    
write_byte(70);
                    
write_byte(random_num(1535));
                    
message_end();
                    
ExecuteHamB(Ham_TakeDamagepTouchedpToucheriAttackerrandom_float(flDamage 5.0flDamage 10.0), DMG_BULLET DMG_NEVERGIB);
                }
                else if ( 
equal(sz_ClassName_Touched"func_breakable") && (get_pcvar_num(cvar_FleshBreakEnts)) )
                    
dllfunc(DLLFunc_UsepTouchediAttacker);

                else if ( 
equal(sz_ClassName_Touchedg_szClass_flesh))
                    return 
FMRES_SUPERCEDE;
            }
            
remove_entity(pToucher);
        }
    }

    return 
FMRES_IGNORED;
}

public 
Forward_TraceLine_Post(Float:start[3], Float:end[3], nomonstersidtrace)
{
    if(!
is_user_alive(id) || !is_user_bot(id) || !g_bZombie[id] )
        return 
FMRES_IGNORED;
        
    static 
FloatgameTime gameTime get_gametime();
    static 
FloatleapCooldown leapCooldown get_pcvar_float(cvar_LeapCooldown);
    static 
FloatleapMax leapMax get_pcvar_float(cvar_LeapForce);
    static 
FloatleapMin leapMin get_pcvar_float(cvar_LeapHeight);
    
    static 
FloatflshThrowForce flshThrowForce get_pcvar_float(cvar_FleshForce);
    
    static 
distance;
    static 
targettarget get_tr2(traceTR_pHit);
    
    
leapMax *= 2.0;
    
leapMin *= 1.5;
    
    
flshThrowForce /= 2.5;
    
    if(
is_user_alive(target) && !g_bZombie[target])
    {
        
distance get_entity_distance(idtarget);
        
        if (
gameTime leapCooldown g_LastLeap[id])
        {
            static 
chance chance random_num(1100);
            
            if (
leapMin distance leapMax && chance <= 15)
            {
                
clcmd_leap(id);
                
g_LastLeap[id] = gameTime;
            }
        }
        
        if (
gameTime 1.1 g_LastFthrow[id])
        {
            static 
chance chance random_num(1100);
            
            if(
distance flshThrowForce && chance <= 10)
            {
                
clcmd_throw(id);
                
g_LastFthrow[id] = gameTime;
            }
        }
        
    }

    return 
FMRES_IGNORED;
}
public 
Forward_AddToFullPack_Postes_handleeenthosthostflagsplayerpset )
{
    if( 
player && host == ent && g_bCustomNvg[host] && g_bIsAlive[host] && !g_bIsBot[host])
        
set_eses_handleES_Effectsget_eses_handleES_Effects ) | EF_BRIGHTLIGHT ); 
        
    if( 
player  && g_bCustomNvg[host] && g_bIsAlive[host] && !g_bIsBot[host])
    {
        static 
RenderColor[3];
        
RenderColor[0] = 200;
        
RenderColor[1] = 25;
        
RenderColor[2] = 25;
        static 
CsTeams:team[2];
        
team[0] = cs_get_user_team(ent), team[1] = cs_get_user_team(host);
        
        
set_es(es_handleES_RenderModekRenderNormal);    
        
set_es(es_handleES_RenderAmt16);    
        
        if(
team[0] == team[1])
            
RenderColor = {5015050};
            
        
set_es(es_handleES_RenderColorRenderColor);
        
set_es(es_handleES_RenderFxkRenderFxGlowShell);
    }
}

public 
Forward_Think_Objective(iEnt)
{
    if(!
is_valid_ent(iEnt))
        return;
        
    
// for(new i = 0; i < g_EntCount; i++)
    // {    
        // if(g_EntActive[i])
        // {
            // static Float: angles[3];
            // entity_get_vector(g_EntIndex[i], EV_VEC_angles, angles);
            
            // angles[1] += 5.0;
        
            // entity_set_vector(g_EntIndex[i], EV_VEC_angles, angles);
        // }
    // }
    
    
static FloatflCoords[3];
    
    for (new 
id id <= g_MaxPlayers id++)
    {
        if (!
g_bIsAlive[id] || g_bZombie[id]) 
            continue;
        
        for (new 
g_EntCount i++)
        {            
            if(
g_EntActive[i])
                continue;
                
            
entity_get_vector(g_EntIndex[i], EV_VEC_originflCoords);
        
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("HostagePos"), {0,0,0}, id);
            
write_byte(id);
            
write_byte(i);
            
write_coord_f(flCoords[0]);
            
write_coord_f(flCoords[1]);
            
write_coord_f(flCoords[2]);
            
message_end();
        
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("HostageK"), {0,0,0}, id);
            
write_byte(i);
            
message_end();
            
        }
    }
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 2.0);
}

public 
Forward_Think_Flesh(iEnt)
{
    if(!
is_valid_ent(iEnt))
        return;
        
    static 
FloatflAngles[3];
    
    
entity_get_vector(iEntEV_VEC_anglesflAngles);
    
    for(new 
i++)
        
flAngles[i] += 10.0;

    
entity_set_vector(iEntEV_VEC_anglesflAngles);
        
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1);
}

public 
Task_Restart()
{
    new 
sz_MapName[32];
    
get_mapname(sz_MapNamecharsmax(sz_MapName));
    
server_cmd("changelevel %s"sz_MapName);
}

public 
Task_Model(id)
{
    
id -= TASKID_MODEL;

    if(!
g_bIsAlive[id])
        return;
    
    
fm_set_user_model(idg_CurrentModel[id]);
}

public 
Task_Strip(id)
{
    
id -= TASKID_STRIP;

    if(!
g_bIsAlive[id])
        return;
        
    if (
cs_get_user_submodel(id))
        
cs_set_user_submodel(id0);

    
strip_user_weapons(id);
    
give_item(id"weapon_knife");
    
UTIL_SetModel(idg_ZombieClaws"");

}

public 
Task_NVG(id)
{
    
id -= TASKID_NVG;

    if(!
g_bIsAlive[id])
        return;
        
    
engclient_cmd(id"nightvision");

}

public 
Task_Health(id)
{
    
id -= TASKID_HEALTH;

    if(!
g_bIsAlive[id])
        return;
        
    
message_begin(MSG_ONE_UNRELIABLEg_MsgID_Healthid);
    
write_byte(100);
    
message_end();
}

public 
Task_BeaconJetFlyBy()
{
        
engfunc(EngFunc_EmitAmbientSound0Float: { 0.00.00.0 }, g_szSound_jetFlyByVOL_NORMATTN_NONE0PITCH_NORM);
}

public 
Task_BeaconEffects()
{
    for(new 
id id <= g_MaxPlayersid++)
    {            
        if(
g_bIsAlive[id])
        {
            
message_begin(MSG_ONE_UNRELIABLEg_MsgID_ScreenFade, { 0,0,}, id); 
            
write_short1<<12 ); 
            
write_short1<<12 ); 
            
write_short0x0001 ); 
            
write_byte255 );
            
write_byte255 );
            
write_byte255 ); 
            
write_byte225 ); 
            
message_end( );
            
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("ScreenShake"), {0,0,0}, id);
            
write_short(random_num(1020) * 1<<12);
            
write_short(1<<12);
            
write_short(random_num(510)  * 1<<12);
            
message_end();
        }
    }
}

public 
Task_BeaconExplosion()
{
    new 
FloatflOrigin[3];
    for(new 
i++)
        
flOrigin[i] = random_float(-8192.08192.0);
        
    for(new 
sizeof g_Sound_Explosion i++)
    {
        
engfunc(EngFunc_EmitAmbientSound0flOriging_Sound_Explosion[i], VOL_NORMATTN_NONE0PITCH_NORM); 
    }
}

public 
Task_BeaconComplete()
{
    for(new 
id id <= g_MaxPlayersid++)
    {            
        if(
g_bIsAlive[id] && g_bZombie[id])
        {
            
user_silentkill(id);
        }
    }
    
    
TerminateRound(RoundEndType_TeamExterminationTeamWinning_Ct);
}
    
public 
Task_RoundEnd()
{
    
remove_task(TASKID_ROUND);
    
TerminateRound(RoundEndType_Draw);
    
fn_Rounds();
}

public 
fn_Rounds()
{
    new 
rounds get_pcvar_num(cvar_Round);

    if(
rounds 0)
    {
        if ( 
g_RoundCounter >= rounds )
        {
            
g_RoundCounter 0;

            
client_print(0print_chat"%L"LANG_PLAYER"ROUND_CHANGE");
            
            for(new 
<= g_MaxPlayersi++)
            {
                if (!
is_user_connected(i) || is_user_bot(i))
                    continue;

                switch(
cs_get_user_team(i))
                {
                    case 
CS_TEAM_UNASSIGNEDCS_TEAM_SPECTATOR:
                        continue;

                    case 
CS_TEAM_T:
                    {
                            
cs_set_user_team(iCS_TEAM_CT);
                            if(
g_bIsAlive[i])
                                
cs_set_user_armor(i0CS_ARMOR_NONE);
                            
                    }

                    case 
CS_TEAM_CT:
                    {
                            
cs_set_user_team(iCS_TEAM_T);
                    }

                }
            }
        }
    }
}

stock fm_set_user_model(playermodelname[])
{
    
engfunc(EngFunc_SetClientKeyValueplayerengfunc(EngFunc_GetInfoKeyBufferplayer), "model"modelname);

    
g_bModel[player] = true;
}

stock fm_get_user_model(playermodel[], len)
{
    
engfunc(EngFunc_InfoKeyValueengfunc(EngFunc_GetInfoKeyBufferplayer), "model"modellen);
}

stock fm_reset_user_model(player)
{
    
g_bModel[player] = false;

    
dllfunc(DLLFunc_ClientUserInfoChangedplayerengfunc(EngFunc_GetInfoKeyBufferplayer));
}


//Arkshine
stock UTIL_SetNextAttack ( const WeapIndex, const Float:Delay )
{
    
set_pdata_floatWeapIndexm_flNextPrimaryAttackDelay );
    
set_pdata_floatWeapIndexm_flNextSecondaryAttackDelay );
}

stock UTIL_SetModel ( const PlayerId, const viewModel[], weaponModel[] )
{
    
entity_set_stringPlayerIdEV_SZ_viewmodelviewModel);
    
entity_set_stringPlayerIdEV_SZ_weaponmodelweaponModel);
}
//Arkshine
stock CacheWeaponInfo ( const PlayerId )
{
    
g_WeaponIndexPlayerId ] = get_pdata_cbasePlayerIdm_pActiveItem );
    
g_WeaponId   PlayerId ] = get_pdata_intg_WeaponIndexPlayerId ], m_iId);
}

stock Is_Ents_Built()
{
    for(new 
g_EntCount i++)
    {
        if(!
g_EntActive[i])
            return 
false;
    }
    return 
true;


Last edited by Diva; 11-09-2012 at 04:00.
Diva is offline
12114
Senior Member
Join Date: Jan 2006
Old 12-19-2012 , 23:47   Re: Zombie Swarm 3.1
Reply With Quote #1524

why does it take 3 stabs to kill a ct? how to fix?
nvm fixed it

another one: how do i remove bots flesh throwing ability?
nvm fixed

third one, how do i make it so it messes up zombie screens too? not just humans?

Last edited by 12114; 12-20-2012 at 00:12.
12114 is offline
bb3214
New Member
Join Date: Dec 2012
Old 12-31-2012 , 05:25   Re: Zombie Swarm 3.1
Reply With Quote #1525

can you upload again zombie_swarm.sma?? thanks i can't download this and i don't know why i can't to make zombie_swarm.sma to amxx

i am very like play this mod T.T thanks
bb3214 is offline
bb3214
New Member
Join Date: Dec 2012
Old 12-31-2012 , 05:33   Re: Zombie Swarm 3.1
Reply With Quote #1526

okok i fix that sorry XD
bb3214 is offline
Glow
Junior Member
Join Date: Feb 2013
Old 02-03-2013 , 14:52   Re: Zombie Swarm 3.1
Reply With Quote #1527

looks nice, i might try it out
__________________
Glow is offline
12114
Senior Member
Join Date: Jan 2006
Old 02-19-2013 , 20:34   Re: Zombie Swarm 3.1
Reply With Quote #1528

Hey guys, I'm trying to put mp5 navy on the first page in place of Scout in the gun menu, how can I do this?
Thanks, tried everything...

EDIT!: Nevermind, figured it out!, for those who are wondering, go to amxconst and look up weapon names that correspond to a number, then edit .sma accordingly, switch 3 with 19

Last edited by 12114; 02-19-2013 at 20:56.
12114 is offline
Alphadios
Junior Member
Join Date: Jan 2010
Old 10-05-2013 , 10:23   Re: Zombie Swarm 3.1
Reply With Quote #1529

i want the original nvg back... ho to do ? also i want to stop the bots from throwing flesh gibs at me... and... why the zombies can't bleed ?
Alphadios is offline
NewKidz
Member
Join Date: Oct 2010
Old 04-22-2014 , 13:02   Re: Zombie Swarm 3.1
Reply With Quote #1530

Could i activated the default objectives? like bomb defuse or hostage using this mod?
If can, please tell me how. I need it, thankyou before.
NewKidz is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode