Member
Join Date: Aug 2012
Location: Denmark
|
11-08-2012
, 07:59
Re: Zombie Swarm 3.1
|
#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 bool: g_ShowMenu[33]; new bool: g_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_flesh, mdl_gib_head, mdl_gib_legbone; new mdl_gib_lung, mdl_gib_meat, mdl_gib_spine; new spr_blood_drop, spr_blood_spray;
new bool: g_bZombie[33];
new bool: g_bHeadshot[33][33]; new bool: g_bModel[33]; new g_CurrentModel[33][32];
new Float: g_LastLeap[33]; new Float: g_LastFthrow[33];
new bool: g_bDeadNvg[2][33]; new g_bCustomNvg[33];
new const g_EntClassName[] = "objective_beacon"; new g_EntIndex[256]; new g_EntCount; new bool: g_EntActive[256];
new Float: g_BuildTime[33]; new bool: g_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 Float: g_flCounter; new bool: g_bTimerStart; new bool: g_bFreezeTime; new g_bFFire;
new g_ForwardSpawn;
new bool: b_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_Health, g_MsgID_ScreenFade, g_MsgID_SetFov, g_MsgID_NVGToggle;
new cvar_Swith, cvar_Health, cvar_Armour, cvar_Gravity, cvar_Footsteps, cvar_Speed, cvar_AutoNvg, cvar_Dmg_HP, cvar_Dmg_AP, cvar_Round, cvar_Teams, cvar_Blocknvg, cvar_Lights, cvar_Leap, cvar_LeapCooldown, cvar_LeapForce, cvar_LeapHeight, cvar_FleshThrow, cvar_FleshForce, cvar_FleshDmg, cvar_FleshSelfDmg, cvar_FleshBreakEnts, cvar_Skyname, cvar_EndRound, cvar_GunMenu, cvar_Weapons, cvar_Equip, cvar_ObjectivePercent;
#define PLUGIN "Zombie Swarm" #define VERSION "3.1" #define AUTHOR "Mini_Midget"
public plugin_precache() { register_plugin(PLUGIN, VERSION, AUTHOR); register_cvar(PLUGIN, VERSION, FCVAR_SPONLY|FCVAR_SERVER); set_cvar_string(PLUGIN, VERSION); 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 i = 0 ; i < sizeof g_ZombiePlayerModels ; i++) { new sz_Model[256]; format(sz_Model, charsmax(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 = 0; iNum < sizeof g_sound_miss; iNum++) precache_sound(g_sound_miss[iNum]); for (iNum = 0; iNum < sizeof g_sound_hit; iNum++) precache_sound(g_sound_hit[iNum]); for (iNum = 0; iNum < sizeof g_sound_pain; iNum++) precache_sound(g_sound_pain[iNum]); for (iNum = 0; iNum < sizeof g_sound_die; iNum++) precache_sound(g_sound_die[iNum]); for (iNum = 1; iNum < sizeof g_sound_roundstart; iNum++) precache_sound(g_sound_roundstart[iNum]); for(iNum = 0 ; iNum < sizeof g_Sound_Explosion ; iNum++) precache_sound(g_Sound_Explosion[iNum]); precache_model(g_ObjectiveBeacon); for (iNum = 0; iNum < sizeof g_SoundBuild; iNum++) precache_sound(g_SoundBuild[iNum]); for (iNum = 0; iNum < sizeof g_SoundComplete; iNum++) 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 i = 0 ; i < 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_2| MENU_KEY_3,"MenuID_Weapon"); register_menucmd(register_menuid(g_Menu_PrimaryID), MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4| MENU_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_1| MENU_KEY_2| MENU_KEY_3| MENU_KEY_4| MENU_KEY_5| MENU_KEY_6| MENU_KEY_7| MENU_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(iEnt, EV_SZ_classname, g_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(iEnt, EV_FL_nextthink , get_gametime() + 2.0);
register_think(g_szClass_weather, "Forward_Think_Weather"); }
if(g_ForwardSpawn > 0) unregister_forward(FM_Spawn, g_ForwardSpawn);
format(g_szModName, charsmax(g_szModName), "%s %s", PLUGIN, VERSION); 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_Skyname, sz_Sky, charsmax(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(id, level, cid) { if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED;
new sz_Args[8]; read_argv(id, sz_Args, charsmax(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_Swith, 1);
set_hudmessage(255, 255, 255, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, -1); show_hudmessage(0, "%L", LANG_PLAYER, "PLUGIN_HON_MSG", PLUGIN);
console_print(0, "%L", LANG_PLAYER, "PLUGIN_TON_MSG", PLUGIN); for(new i = 1; i < 6; i++) client_print(0, print_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_Swith, 0);
set_hudmessage(255, 255, 255, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, -1); show_hudmessage(0, "%L", LANG_PLAYER, "PLUGIN_HOFF_MSG", PLUGIN);
console_print(0, "%L", LANG_PLAYER, "PLUGIN_TOFF_MSG", PLUGIN); for(new i = 1; i < 6; i++) client_print(0, print_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(iEnt, pev_classname, className, charsmax(className));
for(new i = 0; i < sizeof g_MapEntities; ++i) { if(equal(className, g_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 CsTeams: team = cs_get_user_team(id); new sz_CurrentModel[32];
if(team == CS_TEAM_T) { new Health, Armour, Float: Gravity, FootSteps; 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(id, pev_max_health, float(Health)); set_user_health(id, Health); cs_set_user_armor(id, Armour, CS_ARMOR_VESTHELM); set_user_gravity(id, Gravity); set_user_footsteps(id, FootSteps);
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(id, sz_CurrentModel, charsmax(sz_CurrentModel) );
if(!equal(sz_CurrentModel, g_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(id, pev_max_health, 100.0); set_user_footsteps(id, false); 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(id, sz_CurrentModel, charsmax(sz_CurrentModel) );
if(!equal(sz_CurrentModel, g_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 i = 0; i < 10; i++) client_cmd(id, "-nvgadjust"); g_bDeadNvg[0][id] = false; }
public Bacon_TraceAttack_Post(iVictim, iAttacker, Float: flDamage, Float: flDirection[3], trace_handle, iDamageType) { if(!g_bIsAlive[iVictim] || !is_user_connected(iAttacker)) return HAM_IGNORED; g_bHeadshot[iAttacker][iVictim] = bool:( get_tr2(trace_handle, TR_iHitgroup) == HIT_HEAD ); return HAM_IGNORED; }
public Bacon_TakeDamage(iVictim, iInflictor, iAttacker, Float:flDamage, iDamageType) { if ( iDamageType & DMG_GENERIC || /*iVictim == iAttacker ||*/ !g_bIsAlive[iVictim] || !is_user_connected( iAttacker ) || 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 CsArmorType: ArmorType, i_Armour = cs_get_user_armor(iVictim , ArmorType );
new iDmgHP = floatround( flDamage * (get_pcvar_float(cvar_Dmg_HP) / 100.0) ); new iDmgArmor = floatround( flDamage * (get_pcvar_float(cvar_Dmg_AP) / 100.0) ); //or 0.35 new iHealth = get_user_health( iVictim ); new maxArmour = get_pcvar_num(cvar_Armour);
if ( ((iHealth - iDmgHP) > 0) && (g_bZombie[iVictim]) && (i_Armour) ) { ExecuteHam(Ham_TakeDamage, iVictim, iInflictor, iAttacker, 0.0, DMG_BULLET | DMG_NEVERGIB); set_user_health(iVictim, iHealth - iDmgHP ); cs_set_user_armor(iVictim, clamp(i_Armour - iDmgArmor, 0, maxArmour), 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_MIN, ZOMBIE_SLASH_MAX); else if ( button & IN_ATTACK2) flDamage = random_float(ZOMBIE_STAB_MIN, ZOMBIE_STAB_MAX);
if(g_bHeadshot[iAttacker][iVictim]) { g_bHeadshot[iAttacker][iVictim] = false; flDamage *= 4.0; //client_print(iAttacker, print_center, "HEADSHOT!"); } SetHamParamFloat(4, flDamage);
return HAM_HANDLED; }
return HAM_IGNORED; }
public Bacon_TakeDamage_Post(iVictim, inflictor, iAttacker, Float:flDamage, iDamageType) { if (g_flDisplayDamage[iVictim]) { set_pev(iVictim, pev_dmg_take, g_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 Float: fl_Angle[3]; for(new i = 0 ; i < 3 ; i++) fl_Angle[i] = random_float(-75.0, 75.0);
entity_set_vector(iVictim, EV_VEC_punchangle, fl_Angle); } } } }
public Bacon_Killed_Post(id, iKiller) { g_bIsAlive[id] = false; if(g_bZombie[id]) { new Victim_Origin[3]; get_user_origin(id, Victim_Origin);
entity_set_int(id, EV_INT_effects, entity_get_int(id, EV_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(0, 80)); write_coord(random_num(0, 80)); write_coord(random_num(80, 200)); write_angle(random_num(0, 360)); write_short(mdl_gib_head); write_byte(0); // bounce write_byte(gibtime); // life message_end();
// Parts for(new i = 0; i < 4; i++) { 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(80, 200)); 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(80, 200)); write_angle(random_num(0,360)); write_short(mdl_gib_spine); write_byte(0); // bounce write_byte(gibtime); // life message_end();
// Lung for(new i = 0; i <= 1; i++) { 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(80, 200)); write_angle(random_num(0,360)); write_short(mdl_gib_lung); write_byte(0); // bounce write_byte(gibtime); // life message_end(); }
//Legs for(new i = 0; i <= 1; i++) { 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(80, 200)); 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(204, 205)); // index message_end();
for(new i = 0 ; i < 8 ; 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(190, 197)); // index message_end(); }
} //20% chance to show this message. 0 - 4 if(random(4) == 0) client_print(id, print_chat, "[Zombie Swarm] Turn on nightvision while dead by pressing your ^"nightvision ^" key"); g_bDeadNvg[0][id] = true;
}
public Bacon_Touch(ent, id) { if (is_user_alive(id) && g_bZombie[id]) return HAM_SUPERCEDE;
return HAM_IGNORED; }
public Bacon_ResetMaxSpeed(id) { if(!g_bZombie[id]) return;
static Float: maxspeed; maxspeed = get_pcvar_float(cvar_Speed);
if(get_user_maxspeed(id) != 1.0) set_user_maxspeed(id, maxspeed);
}
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(0, print_chat, "%L", LANG_PLAYER, "ROUND_COUNTER", g_RoundCounter, rounds); remove_task(TASKID_BEACON); remove_task(TASKID_FLYBY); remove_task(TASKID_EFFECTS); remove_task(TASKID_EXPLOSION); for(new i = 0 ; i < g_EntCount ; i++) { if(is_valid_ent(g_EntIndex[i])) { entity_set_float(g_EntIndex[i], beacon_Percentage, 0.0); entity_set_int(g_EntIndex[i], EV_INT_effects, EF_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(id, g_ZombieClaws, ""); } }
public Message_StatusIcon(msg_id, msg_dest, id) { if(!is_user_connected(id)) return PLUGIN_CONTINUE;
new sz_Icon[4]; get_msg_arg_string(2, sz_Icon, charsmax(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_id, msg_dest, id) { if(!g_bIsAlive[id] || !g_bZombie[id]) return;
// static iHealth ; iHealth = get_msg_arg_int(1);
static CurrentHealth ; CurrentHealth = get_user_health(id); static Float: MaxHealth ; MaxHealth = get_pcvar_float(cvar_Health);
//Must use 'clamp' to fix '0' hud bug set_msg_arg_int(1, ARG_BYTE, clamp(floatround((CurrentHealth / MaxHealth) * 100.0), 1, 100)); }
public Message_Battery(msg_id, msg_dest, id) { if(!g_bIsAlive[id] || !g_bZombie[id]) return;
static CurrentArmour ; CurrentArmour = get_user_armor(id); static Float: MaxArmour ; MaxArmour = get_pcvar_float(cvar_Armour);
set_msg_arg_int(1, ARG_SHORT, floatround((CurrentArmour / MaxArmour) * 100.0)); }
public Message_TextMessage(msg_id, msg_dest, id) { if(get_msg_arg_int(1) != 4) return PLUGIN_CONTINUE;
new sz_TextMsg[25], sz_WinMsg[32]; get_msg_arg_string(2, sz_TextMsg, charsmax(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_WinMsg, charsmax(sz_WinMsg), "%L", LANG_SERVER, "WIN_ZOMBIE"); set_msg_arg_string(2, sz_WinMsg); } else if(equal(sz_TextMsg[1], "Target_Saved") || equal(sz_TextMsg[1], "CTs_Win")) { formatex(sz_WinMsg, charsmax(sz_WinMsg) , "%L", LANG_SERVER, "WIN_HUMAN"); set_msg_arg_string(2, sz_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_id, msg_dest, id) { 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(1, ARG_BYTE, 0); 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_begin( MSG_ONE_UNRELIABLE, g_MsgID_ScreenFade, { 0,0,0 }, id); write_short( 1<<0 ); write_short( 1<<0 ); write_short( 0x0004 ); write_byte( 175 ); write_byte( 50 ); write_byte( 25 ); write_byte( 50 ); message_end( ); message_begin(MSG_ONE_UNRELIABLE, g_MsgID_SetFov, {0,0,0}, id); write_byte(110); message_end(); } else { message_begin( MSG_ONE_UNRELIABLE, g_MsgID_ScreenFade, { 0,0,0 }, id); write_short( 0 ); write_short( 0 ); write_short( 0x0000 ); write_byte( 0 ); write_byte( 0 ); write_byte( 0 ); write_byte( 0 ); message_end( ); message_begin(MSG_ONE_UNRELIABLE, g_MsgID_SetFov, { 0,0,0 }, id); write_byte(90); message_end(); } } else if(!g_bZombie[id] && get_pcvar_num(cvar_Blocknvg)) { if(iNvgToggle) { client_print(id, print_center, "%L", LANG_PLAYER, "BLOCK_NVG"); return PLUGIN_HANDLED; } } return PLUGIN_CONTINUE; }
public Message_SendAudio(msg_id, msg_dest, id) { static AudioCode[22]; get_msg_arg_string(2, AudioCode, charsmax(AudioCode) );
for(new i = 0 ; i < sizeof g_SendAudio_Radio ; i++) { if(g_bZombie[id]) { if(equal(AudioCode, g_SendAudio_Radio[i])) set_msg_arg_int(3, ARG_SHORT, ZOMBIE_RADIO_SPEED); } } for(new i = 0 ; i < sizeof g_SendAudio_RoundStart ; i++) { if(equal(AudioCode, g_SendAudio_RoundStart[i])) set_msg_arg_string(2, g_sound_roundstart[random(sizeof g_sound_roundstart)]); }
if(equal(AudioCode, "%!MRAD_terwin")) set_msg_arg_string(2, g_sound_zombiewin);
else if(equal(AudioCode, "%!MRAD_ctwin")) set_msg_arg_string(2, g_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(id, MENU_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", -1, g_Menu_WeaponID); } else { give_weapons(id); } } }
public MenuID_Weapon(id, key) { switch(key) { case 0: { g_ShowMenu[id] = true; Primary_Weapon_Menu(id, 0);
} case 1: { g_ShowMenu[id] = true; give_weapons(id); } case 2: { client_print(id, print_chat, "[Zombie Swarm] Type ^"guns^" to re-activate the gun menu."); g_ShowMenu[id] = false; give_weapons(id); } }
return; }
public Primary_Weapon_Menu(id, offset) { if(offset<0) offset = 0;
new cvar_value[32]; get_pcvar_string(cvar_Weapons, cvar_value, charsmax(cvar_value));
new flags = read_flags(cvar_value);
new keys, curnum, menu[2048]; for(new i = offset ; i < 19 ; i++) { if(i == 18) { g_OptionsOnMenu[curnum][id] = 24; keys += (1<<curnum); curnum++; format(menu, 2047, "\y%s^n^n\r%d. \wRandom^n", menu, curnum); break; } else if(flags & power(2, i)) { g_OptionsOnMenu[curnum][id] = i; keys += (1<<curnum);
curnum++; format(menu,2047, "\y%s^n\r%d. \w%s", menu, curnum, weapon_names[i]);
if(curnum == 8) break; } }
format(menu, 2047, "\ySelect Primary Weapon:\w^n%s", menu); if(curnum == 8 && offset < 12) { keys += (1<<8); format(menu, 2047, "\y%s^n^n\r9. \wNext", menu); } if(offset) { keys += (1<<9); format(menu, 2047, "\y%s^n\r0. \wBack", menu); }
show_menu(id, keys, menu, -1, g_Menu_PrimaryID); }
public MenuID_Primary(id, key) { 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(id, g_CurOffset[id]); }
return ; }
public Secodary_Weapon_Menu(id, offset) { if(offset < 0) offset = 0;
new cvar_value[32]; get_pcvar_string(cvar_Weapons, cvar_value, charsmax(cvar_value));
new flags = read_flags(cvar_value);
new keys, curnum, menu[2048]; for(new i = 18 ; i < 24 ; i++) { if(flags & power(2, i)) { g_OptionsOnMenu[curnum][id] = i; keys += (1<<curnum);
curnum++; format(menu, 2047, "\y%s^n\r%d. \w%s", menu, curnum, weapon_names[i]); } } g_OptionsOnMenu[curnum][id] = 25; keys += (1<<curnum); curnum++; format(menu, 2047, "\y%s^n^n\r%d. \wRandom", menu, curnum);
format(menu, 2047, "\ySelect Secondary Weapon:\w^n%s", menu);
show_menu(id, keys, menu, -1, g_Menu_SecID); }
public MenuID_Secondary(id, key) { 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(id, 0);
give_item(id, "weapon_knife");
new weapon[32]; new csw = csw_contant(g_PickedWeapons[0][id]); get_weaponname(csw, weapon, charsmax(weapon)); give_item(id, weapon); cs_set_user_bpammo(id, csw, g_MaxBPAmmo[csw]);
csw = csw_contant(g_PickedWeapons[1][id]); get_weaponname(csw,weapon, charsmax(weapon)); give_item(id, weapon); cs_set_user_bpammo(id, csw, g_MaxBPAmmo[csw]);
get_pcvar_string(cvar_Equip,weapon, charsmax(weapon));
new he, flash, smoke; for(new i = 0 ; i < strlen(weapon) ; i++) { switch(weapon[i]) { case 'h': he++; case 'f': flash++; case 's': smoke++; case 'n': cs_set_user_nvg(id); } }
if(he) give_item(id, "weapon_hegrenade"), cs_set_user_bpammo(id, CSW_HEGRENADE, he); if(flash) give_item(id, "weapon_flashbang"), cs_set_user_bpammo(id, CSW_FLASHBANG, flash); if(smoke) give_item(id, "weapon_smokegrenade"), cs_set_user_bpammo(id, CSW_SMOKEGRENADE, smoke);
get_pcvar_string(cvar_Weapons, weapon, charsmax(weapon));
new flags = read_flags(weapon); if(flags & MOD_VESTHELM) cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM); else if(flags & MOD_VEST) cs_set_user_armor(id, 100, CS_ARMOR_KEVLAR); }
public csw_contant(weapon) { new num = 29; switch(weapon) { case 0: num = 3; case 1: num = 5; case 2: num = 7; case 3: num = 8; case 4: num = 12; case 5: num = 13; case 6: num = 14; case 7: num = 15; case 8: num = 18; case 9: num = 19; case 10: num = 20; case 11: num = 21; case 12: num = 22; case 13: num = 23; case 14: num = 24; case 15: num = 27; case 16: num = 28; case 17: num = 30; case 18: num = 1; case 19: num = 10; case 20: num = 11; case 21: num = 16; case 22: num = 17; case 23: num = 26; case 24: { new s_weapon[32]; get_pcvar_string(cvar_Weapons, s_weapon, charsmax(s_weapon));
new flags = read_flags(s_weapon); do { num = random_num(0, 17); if(!(num & flags)) { num = -1; } } while(num==-1); num = csw_contant(num); } case 25: { new s_weapon[32]; get_pcvar_string(cvar_Weapons, s_weapon, charsmax(s_weapon));
new flags = read_flags(s_weapon); do { num = random_num(18, 23); 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 CsTeams: team = cs_get_user_team(id); if(team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED) return PLUGIN_CONTINUE;
client_print(id, print_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_UNRELIABLE, g_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(id, print_chat, "[Zombie Swarm] Gun Menu has been disabled."); } else { g_ShowMenu[id] = true; client_print(id, print_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(menu, 0); menu_additem(menu, "Remove all objectives", "3"); menu_addblank(menu, 0); menu_additem(menu, "Save objectives", "4"); menu_setprop(menu, MPROP_EXIT, MEXIT_ALL); menu_display(id, menu);
return PLUGIN_HANDLED; }
public menu_Objectives(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu); return PLUGIN_HANDLED; } new data[6], szName[64]; new access, callback;
menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback); new key = str_to_num(data);
switch(key) { case 1: { create_objective(id); } case 2: { new ent, body, class[32]; get_user_aiming(id, ent, body); if (is_valid_ent(ent)) { entity_get_string(ent, EV_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(0, print_chat, "[Objective] All objectives removed!"); } case 4: { save_objective(id); } }
menu_display(id, menu); return PLUGIN_HANDLED; }
create_objective(id, Float:origin[3]= { 0.0, 0.0, 0.0 }, Float:angle[3]= { 0.0, 0.0, 0.0 } ) { new iEnt = create_entity("info_target"); entity_set_string( iEnt, EV_SZ_classname, g_EntClassName); if( id ) { entity_get_vector(id, EV_VEC_origin, origin); entity_set_origin(iEnt, origin); origin[2] += 64.0; entity_set_origin(id, origin);
entity_get_vector(id, EV_VEC_angles, angle); angle[0] = 0.0; entity_set_vector(iEnt, EV_VEC_angles, angle); } else { entity_set_origin(iEnt, origin); entity_set_vector(iEnt, EV_VEC_angles, angle); }
entity_set_model( iEnt, g_ObjectiveBeacon); entity_set_int( iEnt, EV_INT_movetype, MOVETYPE_PUSHSTEP); entity_set_int( iEnt, EV_INT_solid, SOLID_BBOX); entity_set_int(iEnt, EV_INT_effects, EF_DIMLIGHT); new Float:mins[3] = { -7.120000 , -5.500000, 0.0 }; new Float:maxs[3] = { 7.120000, 5.360000, 32.41000 }; entity_set_size( iEnt, mins, maxs); entity_set_float(iEnt, beacon_Percentage, 0.0); drop_to_floor( iEnt); // call_think(iEnt); entity_set_float(iEnt, EV_FL_nextthink, get_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(sConfigsDir, charsmax(sConfigsDir)); //Get the current map name new sMapName[32]; get_mapname(sMapName, charsmax(sMapName)); //Format 'SabDir' to ../configs/Sabotage formatex(SabDir, charsmax(SabDir),"%s/Objective", sConfigsDir); if(!dir_exists(SabDir)) { log_amx("Error: The directory %s does not exist! Create the directory.", SabDir); client_print(id, print_chat, "[Objective] The directory %s does not exist! Create the directory.", SabDir); return; } //Format 'sFile to ../configs/Sabotage/mapname.cfg formatex(sFile, charsmax(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 = -1, Float:fEntOrigin[3], Float:fEntAngles[3]; static sBuffer[256]; //Scan and find all of my custom ents while( ( iEnt = find_ent_by_class(iEnt, g_EntClassName) ) ) { //Get the entities' origin and angle entity_get_vector(iEnt, EV_VEC_origin, fEntOrigin); entity_get_vector(iEnt, EV_VEC_angles, fEntAngles); //Format the line of one custom ent. formatex(sBuffer, charsmax(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(sFile, sBuffer, -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(0, print_chat, "[Objective] New configuration file for %s has just been created.", sMapName); }
load_objective() { new sConfigsDir[256], sFile[256], SabDir[256]; get_configsdir(sConfigsDir, charsmax(sConfigsDir)); new sMapName[32]; get_mapname(sMapName, sizeof sMapName - 1); formatex(SabDir, charsmax(SabDir),"%s/Objective", sConfigsDir); formatex(sFile, charsmax(sFile), "%s/%s.cfg",SabDir, sMapName); 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 iLine, iLength, sBuffer[256]; while(read_file(sFile, iLine++, sBuffer, sizeof sBuffer - 1, iLength)) { if((sBuffer[0]== ';') || !iLength) continue; strtok(sBuffer, sOrigin, charsmax(sOrigin), sAngle, charsmax(sAngle), '|', 0); parse(sOrigin, sFileOrigin[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(0, fOrigin, fAngles); } }
public ConCmd_addweap(id,level,cid) { if(!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED;
new arg[32]; read_argv(1, arg, charsmax(arg));
new cvar_value[32]; get_pcvar_string(cvar_Weapons, cvar_value, charsmax(cvar_value));
for(new i = 0 ; i < 26 ; i++) { if(equali(arg, weapon_names[i])) { new flags = read_flags(cvar_value); new add_flag = power(2, i); if(!(flags & add_flag)) { console_print(id, "[Zombie Swarm] Adding weapon %s to the choice list.",weapon_names[i]); flags += add_flag; get_flags(flags, cvar_value, charsmax(cvar_value)); set_pcvar_string(cvar_Weapons, cvar_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(1, arg, charsmax(arg));
new cvar_value[32]; get_pcvar_string(cvar_Weapons, cvar_value, charsmax(cvar_value));
new flags = read_flags(cvar_value); for(new i = 0 ; i < 26 ; i++) { if(equali(arg, weapon_names[i])) { new remove_flag = power(2, i); if(flags & remove_flag) { console_print(id, "[Zombie Swarm] Removing weapon %s from the choice list.", weapon_names[i]); flags -= remove_flag; get_flags(flags, cvar_value, charsmax(cvar_value)); set_pcvar_string(cvar_Weapons, cvar_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 Float: gametime ; gametime = get_gametime();
switch (get_pcvar_num(cvar_Lights)) { case 0: { set_lights("m"); entity_set_float(iEnt, EV_FL_nextthink, gametime + 0.1); } case 1: { static thinkReturn, randNum; if(!b_LightFlashing) { randNum = random_num(0, 1); if(randNum) entity_set_string(iEnt, EV_SZ_message, g_szSound_thunder1); else entity_set_string(iEnt, EV_SZ_message, g_szSound_thunder2); b_LightFlashing = true; g_LightNum = random_num(1, 3); dllfunc(DLLFunc_Use, iEnt, 0);
} thinkReturn = lightning();
if(thinkReturn) entity_set_float(iEnt, EV_FL_nextthink, gametime + random_float(9.5, 16.5)); else entity_set_float(iEnt, EV_FL_nextthink, gametime + 0.1); } case 2: { set_lights("b"); entity_set_float(iEnt, EV_FL_nextthink, gametime + 0.1); } default: { set_lights("b"); entity_set_float(iEnt, EV_FL_nextthink, gametime + 0.1); }
} return PLUGIN_CONTINUE; }
lightning() { switch(g_LightNum) { // Flash 1 time case 1: { g_LightCounter += 1; switch(g_LightCounter) { case 1: g_LightStyleNum = 1; case 2: g_LightStyleNum = 2; case 3: g_LightStyleNum = 1; case 4: g_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 1: g_LightStyleNum = 1; case 2: g_LightStyleNum = 2; case 3: g_LightStyleNum = 1; case 4: g_LightStyleNum = 2; case 5: g_LightStyleNum = 1; case 6: g_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 1: g_LightStyleNum = 1; case 2: g_LightStyleNum = 2; case 3: g_LightStyleNum = 1; case 4: g_LightStyleNum = 2; case 5: g_LightStyleNum = 1; case 6: g_LightStyleNum = 2; case 7: g_LightStyleNum = 1; case 8: g_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_STRING, g_szModName);
return FMRES_SUPERCEDE; }
public Forward_CmdStart(id, uc_handle, seed) { if(!g_bIsAlive[id]) return FMRES_IGNORED;
static Float: velocity[3]; static Float: flTime ; flTime = get_gametime(); static iButton ; iButton = get_uc(uc_handle, UC_Buttons ); static oldButton ; oldButton = pev(id, pev_oldbuttons); static fViewAngles[3] ; get_uc(uc_handle, UC_ViewAngles, fViewAngles); static iImpulse ; iImpulse = get_uc(uc_handle, UC_Impulse); static iFlag ; iFlag = entity_get_int(id, EV_INT_flags);
static aim, body, szAimingEnt[32]; get_user_aiming(id, aim, body, 60); entity_get_string(aim, EV_SZ_classname, szAimingEnt, charsmax(szAimingEnt)); if (g_bZombie[id]) { if (!g_bFreezeTime && (iButton & IN_RELOAD) && (iFlag & FL_ONGROUND)) { if (get_pcvar_num(cvar_Leap)) { static Float: fl_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_handle, UC_Impulse, 0); } else if (!g_bZombie[id]) { if ( (iButton & IN_BACK) && (iFlag & FL_ONGROUND) ) { get_user_velocity(id, velocity); xs_vec_mul_scalar(velocity, SURVIVOR_BACKSPEED, velocity); set_user_velocity(id, velocity); } else if ((iButton & IN_USE) && (oldButton & IN_USE)) { if (flTime - 1.0 > g_BuildTime[id]) { for(new i = 0; i < g_EntCount; i++) { if(is_valid_ent(g_EntIndex[i])) { if( (get_entity_distance(id, g_EntIndex[i]) < 75) && (equal(szAimingEnt, g_EntClassName)) ) { if(!g_EntActive[i]) { CacheWeaponInfo (id); static Float: EntPercent ; EntPercent = entity_get_float(g_EntIndex[i], beacon_Percentage); static Float: MaxPercent ; MaxPercent = get_pcvar_float(cvar_ObjectivePercent); if(EntPercent >= MaxPercent) { client_print(id, print_center, "Beacon Complete"); emit_sound(g_EntIndex[i], CHAN_VOICE, g_SoundComplete[random(sizeof g_SoundComplete)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM); g_EntActive[i] = true; entity_set_int(g_EntIndex[i], EV_INT_effects, EF_BRIGHTLIGHT);
ExecuteHamB( Ham_Item_Deploy, g_WeaponIndex[id], 1 ); g_Building[id] = false; //Check all ents here if(Is_Ents_Built()) { new Float: flTimer = random_float(2.0, 4.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(id, print_center, "%d%", floatround((EntPercent / MaxPercent) * 100.0)); entity_set_float(g_EntIndex[i], beacon_Percentage, EntPercent + 1.0); static Float: EntMin[3], Float: EntMax[3]; entity_get_vector(g_EntIndex[i], EV_VEC_absmin, EntMin); entity_get_vector(g_EntIndex[i], EV_VEC_absmax, EntMax);
for(new j = 0 ; j < 5 ; j++) { message_begin(MSG_BROADCAST, SVC_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_AUTO, g_SoundBuild[random(sizeof g_SoundBuild)], VOL_NORM, ATTN_NORM, 0, PITCH_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]) { ExecuteHamB( Ham_Item_Deploy, g_WeaponIndex[id], 1 ); 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]) { ExecuteHamB( Ham_Item_Deploy, g_WeaponIndex[id], 1 ); g_Building[id] = false; } } }
return FMRES_IGNORED; }
public clcmd_leap(id) { new Float: velocity[3]; new Float: lheight, lforce; lforce = get_pcvar_num(cvar_LeapForce); lheight = get_pcvar_float(cvar_LeapHeight);
velocity_by_aim(id, lforce, velocity); velocity[2] = lheight; entity_set_vector(id, EV_VEC_velocity, velocity); emit_sound(id, CHAN_VOICE, g_sound_pain[random(sizeof g_sound_pain)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM); }
public clcmd_throw(id) { new iOrigin[3], Float: flOrigin[3], Float: flVelocity[3]; // pev(id, pev_origin, Origin); get_user_origin(id, iOrigin, 1); entity_get_vector(id, EV_VEC_velocity, flVelocity);
new Health, flDamage; Health = get_user_health(id); flDamage = get_pcvar_num(cvar_FleshSelfDmg);
if (Health > flDamage) { new iEnt = create_entity("info_target");
entity_set_string(iEnt, EV_SZ_classname, g_szClass_flesh); entity_set_model(iEnt, g_ZombieFleshThrow); entity_set_int(iEnt, EV_INT_body, random_num(1, 10)); //Submodel 0 is skull/head new Float: MinBox[3] = { -2.5, -2.5, 0.0 }; new Float: MaxBox[3] = { 2.5, 2.5, 2.0 }; entity_set_size(iEnt, MinBox, MaxBox);
IVecFVec(iOrigin, flOrigin); entity_set_vector(iEnt, EV_VEC_origin, flOrigin); entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_TOSS); entity_set_int(iEnt, EV_INT_solid, SOLID_TRIGGER); entity_set_edict(iEnt, EV_ENT_owner, id);
velocity_by_aim(id, get_pcvar_num(cvar_FleshForce), flVelocity); entity_set_vector(iEnt, EV_VEC_velocity, flVelocity);
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1); emit_sound(id, CHAN_VOICE, g_sound_pain[random(sizeof g_sound_pain)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM); set_user_health(id, Health - flDamage); } else { client_print(id, print_center, "%L", LANG_PLAYER, "FLESH_HEALTH"); }
}
public Forward_SetClientKeyValue(id, infobuffer, key[], value[]) { if (g_bModel[id] && equal(key, "model")) return FMRES_SUPERCEDE;
return FMRES_IGNORED; }
public Forward_ClientUserInfoChanged(id, infobuffer) { if (!g_bModel[id]) return FMRES_IGNORED;
new sz_CurrentModel[32]; fm_get_user_model(id, sz_CurrentModel, charsmax(sz_CurrentModel));
if(!equal(sz_CurrentModel, g_CurrentModel[id])) fm_set_user_model(id, g_CurrentModel[id]);
return FMRES_IGNORED; }
public Forward_EmitSound(id, channel, sample[], Float:volume, Float:attn, flag, pitch) { 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(id, CHAN_WEAPON, g_sound_miss[random(sizeof g_sound_miss)], volume, attn, flag, pitch); return FMRES_SUPERCEDE; }
case 'b', '1', '2', '3', '4': { emit_sound(id, CHAN_WEAPON, g_sound_hit[random(sizeof g_sound_hit)], volume, attn, flag, pitch); 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(id, CHAN_VOICE, g_sound_pain[random(sizeof g_sound_pain)], volume, attn, flag, pitch); return FMRES_SUPERCEDE; } //DEATH else if (sample[7] == 'd' && (sample[8] == 'i' && sample[9] == 'e' || sample[12] == '6')) { emit_sound(id, CHAN_VOICE, g_sound_die[random(sizeof g_sound_die)], volume, attn, flag, pitch); 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(pToucher, pTouched) { if ( pev_valid(pToucher)) { static sz_ClassName_Toucher[32], sz_ClassName_Touched[32]; pev(pToucher, pev_classname, sz_ClassName_Toucher, charsmax(sz_ClassName_Toucher));
if ( pev_valid(pTouched)) pev(pTouched, pev_classname, sz_ClassName_Touched, charsmax(sz_ClassName_Touched));
if ( equal(sz_ClassName_Toucher, g_szClass_flesh)) { static iAttacker ; iAttacker = pev(pToucher, pev_owner);
if ( pev_valid(pTouched)) { if ( equal(sz_ClassName_Touched, "player") && is_user_connected(pTouched)) { static vOrigin[3], Float: flDamage; get_user_origin(pTouched, vOrigin); 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_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BLOOD); write_coord(vOrigin[0]); write_coord(vOrigin[1]); write_coord(vOrigin[2] + 10); write_coord(random_num(-360, 360)); write_coord(random_num(-360, 360)); write_coord(-10); write_byte(70); write_byte(random_num(15, 35)); message_end(); ExecuteHamB(Ham_TakeDamage, pTouched, pToucher, iAttacker, random_float(flDamage - 5.0, flDamage + 10.0), DMG_BULLET | DMG_NEVERGIB); } else if ( equal(sz_ClassName_Touched, "func_breakable") && (get_pcvar_num(cvar_FleshBreakEnts)) ) dllfunc(DLLFunc_Use, pTouched, iAttacker);
else if ( equal(sz_ClassName_Touched, g_szClass_flesh)) return FMRES_SUPERCEDE; } remove_entity(pToucher); } }
return FMRES_IGNORED; }
public Forward_TraceLine_Post(Float:start[3], Float:end[3], nomonsters, id, trace) { if(!is_user_alive(id) || !is_user_bot(id) || !g_bZombie[id] ) return FMRES_IGNORED; static Float: gameTime ; gameTime = get_gametime(); static Float: leapCooldown ; leapCooldown = get_pcvar_float(cvar_LeapCooldown); static Float: leapMax ; leapMax = get_pcvar_float(cvar_LeapForce); static Float: leapMin ; leapMin = get_pcvar_float(cvar_LeapHeight); static Float: flshThrowForce ; flshThrowForce = get_pcvar_float(cvar_FleshForce); static distance; static target; target = get_tr2(trace, TR_pHit); leapMax *= 2.0; leapMin *= 1.5; flshThrowForce /= 2.5; if(is_user_alive(target) && !g_bZombie[target]) { distance = get_entity_distance(id, target); if (gameTime - leapCooldown > g_LastLeap[id]) { static chance ; chance = random_num(1, 100); 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(1, 100); if(distance < flshThrowForce && chance <= 10) { clcmd_throw(id); g_LastFthrow[id] = gameTime; } } }
return FMRES_IGNORED; } public Forward_AddToFullPack_Post( es_handle, e, ent, host, hostflags, player, pset ) { if( player && host == ent && g_bCustomNvg[host] && g_bIsAlive[host] && !g_bIsBot[host]) set_es( es_handle, ES_Effects, get_es( es_handle, ES_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_handle, ES_RenderMode, kRenderNormal); set_es(es_handle, ES_RenderAmt, 16); if(team[0] == team[1]) RenderColor = {50, 150, 50}; set_es(es_handle, ES_RenderColor, RenderColor); set_es(es_handle, ES_RenderFx, kRenderFxGlowShell); } }
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 Float: flCoords[3]; for (new id = 1 ; id <= g_MaxPlayers ; id++) { if (!g_bIsAlive[id] || g_bZombie[id]) continue; for (new i = 0 ; i < g_EntCount ; i++) { if(g_EntActive[i]) continue; entity_get_vector(g_EntIndex[i], EV_VEC_origin, flCoords); message_begin(MSG_ONE_UNRELIABLE, get_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_UNRELIABLE, get_user_msgid("HostageK"), {0,0,0}, id); write_byte(i); message_end(); } } entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0); }
public Forward_Think_Flesh(iEnt) { if(!is_valid_ent(iEnt)) return; static Float: flAngles[3]; entity_get_vector(iEnt, EV_VEC_angles, flAngles); for(new i = 0 ; i < 3 ; i++) flAngles[i] += 10.0;
entity_set_vector(iEnt, EV_VEC_angles, flAngles); entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1); }
public Task_Restart() { new sz_MapName[32]; get_mapname(sz_MapName, charsmax(sz_MapName)); server_cmd("changelevel %s", sz_MapName); }
public Task_Model(id) { id -= TASKID_MODEL;
if(!g_bIsAlive[id]) return; fm_set_user_model(id, g_CurrentModel[id]); }
public Task_Strip(id) { id -= TASKID_STRIP;
if(!g_bIsAlive[id]) return; if (cs_get_user_submodel(id)) cs_set_user_submodel(id, 0);
strip_user_weapons(id); give_item(id, "weapon_knife"); UTIL_SetModel(id, g_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_UNRELIABLE, g_MsgID_Health, _ , id); write_byte(100); message_end(); }
public Task_BeaconJetFlyBy() { engfunc(EngFunc_EmitAmbientSound, 0, Float: { 0.0, 0.0, 0.0 }, g_szSound_jetFlyBy, VOL_NORM, ATTN_NONE, 0, PITCH_NORM); }
public Task_BeaconEffects() { for(new id = 1 ; id <= g_MaxPlayers; id++) { if(g_bIsAlive[id]) { message_begin(MSG_ONE_UNRELIABLE, g_MsgID_ScreenFade, { 0,0,0 }, id); write_short( 5 * 1<<12 ); write_short( 5 * 1<<12 ); write_short( 0x0001 ); write_byte( 255 ); write_byte( 255 ); write_byte( 255 ); write_byte( 225 ); message_end( ); message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"), {0,0,0}, id); write_short(random_num(10, 20) * 1<<12); write_short(8 * 1<<12); write_short(random_num(5, 10) * 1<<12); message_end(); } } }
public Task_BeaconExplosion() { new Float: flOrigin[3]; for(new i = 0 ; i < 3 ; i++) flOrigin[i] = random_float(-8192.0, 8192.0); for(new i = 0 ; i < sizeof g_Sound_Explosion ; i++) { engfunc(EngFunc_EmitAmbientSound, 0, flOrigin, g_Sound_Explosion[i], VOL_NORM, ATTN_NONE, 0, PITCH_NORM); } }
public Task_BeaconComplete() { for(new id = 1 ; id <= g_MaxPlayers; id++) { if(g_bIsAlive[id] && g_bZombie[id]) { user_silentkill(id); } } TerminateRound(RoundEndType_TeamExtermination, TeamWinning_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(0, print_chat, "%L", LANG_PLAYER, "ROUND_CHANGE"); for(new i = 1 ; i <= g_MaxPlayers; i++) { if (!is_user_connected(i) || is_user_bot(i)) continue;
switch(cs_get_user_team(i)) { case CS_TEAM_UNASSIGNED, CS_TEAM_SPECTATOR: continue;
case CS_TEAM_T: { cs_set_user_team(i, CS_TEAM_CT); if(g_bIsAlive[i]) cs_set_user_armor(i, 0, CS_ARMOR_NONE); }
case CS_TEAM_CT: { cs_set_user_team(i, CS_TEAM_T); }
} } } } }
stock fm_set_user_model(player, modelname[]) { engfunc(EngFunc_SetClientKeyValue, player, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", modelname);
g_bModel[player] = true; }
stock fm_get_user_model(player, model[], len) { engfunc(EngFunc_InfoKeyValue, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", model, len); }
stock fm_reset_user_model(player) { g_bModel[player] = false;
dllfunc(DLLFunc_ClientUserInfoChanged, player, engfunc(EngFunc_GetInfoKeyBuffer, player)); }
//Arkshine stock UTIL_SetNextAttack ( const WeapIndex, const Float:Delay ) { set_pdata_float( WeapIndex, m_flNextPrimaryAttack, Delay ); set_pdata_float( WeapIndex, m_flNextSecondaryAttack, Delay ); }
stock UTIL_SetModel ( const PlayerId, const viewModel[], weaponModel[] ) { entity_set_string( PlayerId, EV_SZ_viewmodel, viewModel); entity_set_string( PlayerId, EV_SZ_weaponmodel, weaponModel); } //Arkshine stock CacheWeaponInfo ( const PlayerId ) { g_WeaponIndex[ PlayerId ] = get_pdata_cbase( PlayerId, m_pActiveItem ); g_WeaponId [ PlayerId ] = get_pdata_int( g_WeaponIndex[ PlayerId ], m_iId, 4 ); }
stock Is_Ents_Built() { for(new i = 0 ; i < g_EntCount ; i++) { if(!g_EntActive[i]) return false; } return true; }
Last edited by Diva; 11-09-2012 at 04:00.
|
|