廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 9050 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
ad2255819
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x2 鮮花 x8
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[插件] 煩請大家幫小弟我解釋下SMA裡的語法
這是NST_Zombie_Scenario.sma的內容複製程式
#include <amxmodx>#include <amxmisc>#include <cstrike>#include <fakemeta>#include <hamsandwich>#include <xs>#include <engine>

#include <nst_player>#include <nst_wpn>



#define PLUGIN "NST Zombie Scenario"#define VERSION "1.0"#define AUTHOR "NST"



// Setting File Namenew const SETTING_FILE[] = "nst_zombie_scenario.ini"new const CVAR_FILE[] = "nst_zombie_scenario.cfg"new const LANG_FILE[] = "nst_zombie.txt"new const ZOMBIE_MOD = 3

// Limiters for stuff not worth making dynamic arrays out of (increase if needed)const MAX_SPAWNS = 128const MAX_STATS_SAVED = 64const MAX_SUPPLYBOX = 50new SUPPLYBOX_CLASSNAME[] = "nst_zbs_supplybox"new const SPAWNS_URL[] = "%s/nstzb/%s.zbs_spawns.cfg"

// Cvarnew cvar_lighting, cvar_thunder, cvar_zombie_attack_damage, cvar_boss_attack_damage, cvar_weapons_uclip, cvar_time_show_tutortext,cvar_nvg_zombie_color[3], cvar_nvg_zombie_alpha, cvar_nvg_zombie_size, cvar_damage_nade, cvar_damage_grenade, cvar_time_show_spr

// available spawn points counternew g_spawnCount, g_spawnCount2new Float:g_spawns[MAX_SPAWNS][3], Float:g_spawns2[MAX_SPAWNS][3] // spawn points data

// Knock backnew cvar_knockback, cvar_knockbackdamage, cvar_knockbackpower, cvar_knockbackzvel,Float:kb_weapon_power[31] = {-1.0, ... }

// Playernew g_zombie[33], g_zombieclass[33], g_respawning[33], g_protection[33], g_nvg[33], g_kill[33], g_level[33], g_set_money[33], g_zbtype[33],g_startcount, g_freezetime, g_newround, g_endround, g_rount_count, g_zombie_die, g_zombie_die_a_round, g_score_human, g_score_zombie, g_maxplayers, g_fwSpawn,g_zombie_wake_count, g_supplybox_count, g_supplybox_ent[MAX_SUPPLYBOX], g_supplybox_appear // Msgnew g_msgBarTime, g_msgStatusIcon, g_msgTutorText, g_msgTutorClose, g_msgScoreInfo, g_msgNVGToggle, g_msgHealth, g_msgAmmoPickup, g_msgTextMsg, g_msgScreenFade,g_msgClCorpse, g_msgDamage,g_HudMsg_ScoreMatch, g_HudMsg_Health

// Customization varsnew Float:g_round_time, Float:g_free_time, g_zombie_wake_time, g_money_start, g_money_kill_zombie, Float:g_respawn_wait, Float:g_pro_time, Array:g_pro_color,human_kills_levelup, human_levelup_healthup, human_max_level, human_health, human_armor, Float:zombie_health_start, Float:zombie_health_up,Float:zombie_health_max, Float:zombie_speed_start, Float:zombie_speed_up, Float:zombie_speed_max, g_zombies_boss, g_zombies_zombiebomb,

supplybox_max, Array:supplybox_item, Array:supplybox_models, supplybox_sound_drop[64], supplybox_sound_pickup[64], Array:supplybox_item_nade,

zombiebom_model[64], Float:zombiebom_radius, Float:zombiebom_power, zombiebom_sprites_exp[64], zombiebom_sound_exp[64],zombiebom_idsprites_exp, zombiebom_model_p[64], zombiebom_model_w[64],

Array:sound_zombie_attack, Array:sound_zombie_hitwall, Array:sound_zombie_swing, Array:sound_thunder,sound_round_clear[64], sound_round_fail[64], sound_levelup[64], sound_match_ready[64], sound_match_start[64],

Array:lights_thunder, g_lights_i, g_lights_cycle[64], g_lights_cycle_len, g_ambience_rain, g_ambience_snow, g_ambience_fog,g_fog_color[12], g_fog_density[10], g_sky_enable, Array:g_sky_names, Array:g_objective_ents

// class zombie varnew class_count, Array:zombie_name, Array:zombie_health, Array:zombie_gravity, Array:zombie_speed, Array:zombie_knockback, Array:zombie_modelindex,Array:zombie_sound_death1, Array:zombie_sound_death2, Array:zombie_sound_hurt1, Array:zombie_sound_hurt2, Array:zombie_wpnmodel,Array:zombie_modelindex_host, Array:zombie_modelindex_origin, Array:zombie_viewmodel_host, Array:zombie_viewmodel_origin, Array:zombiebom_viewmodel,Array:zombie_sound_heal, Array:zombie_sex, Array:zombie_boss, Array:idclass_boss, Array:idclass_zombie

// hud spr namenew const hud_kill[] = "zbs_kill"new const hud_kill_levelup[] = "zbs_kill_levelup"new const hud_kill_boss[] = "zbs_kill_boss"new const hud_round_clear[] = "zbs_round_clear"new const hud_round_fail[] = "zbs_round_fail"



// Customization file sectionsenum{ SECTION_NONE = 0, SECTION_CONFIG_VALUE, SECTION_SUPPLYBOX, SECTION_ZOMBIEBOM, SECTION_SOUNDS, SECTION_SPRITES, SECTION_WEATHER_EFFECTS, SECTION_SKY, SECTION_LIGHTNING, SECTION_KNOCKBACK, SECTION_OBJECTIVE_ENTS, SECTION_MODELS}// Task offsetsenum (+= 100){ TASK_WELLCOME = 2000, TASK_FREETIME, TASK_ZOMBIEWAKE, TASK_RESPAWN, TASK_MAKEPLAYER, TASK_PROTECTION, TASK_NVISION, TASK_THUNDER_PRE, TASK_THUNDER, TASK_STATUSICON, TASK_TUTORTEXT, TASK_HUMANCHANGETEAM}// IDs inside tasks#define ID_RESPAWN (taskid - TASK_RESPAWN)#define ID_MAKEPLAYER (taskid - TASK_MAKEPLAYER)#define ID_PROTECTION (taskid - TASK_PROTECTION)#define ID_NVISION (taskid - TASK_NVISION)#define ID_STATUSICON (taskid - TASK_STATUSICON)#define ID_TUTORTEXT (taskid - TASK_TUTORTEXT)#define ID_HUMANCHANGETEAM (taskid - TASK_HUMANCHANGETEAM)

// CS Teamsenum{ FM_CS_TEAM_UNASSIGNED = 0, FM_CS_TEAM_T, FM_CS_TEAM_CT, FM_CS_TEAM_SPECTATOR}// Zombie Typeenum{ ZBTYPE_BOSS = 1, ZBTYPE_ZOMBIEBOM}// type itemenum{ NSTZB_ITEM_WPNDEFAULT = 1, NSTZB_ITEM_NSTWPN, NSTZB_ITEM_AMMONADE}// CS Player PData Offsets (win32)const OFFSET_PAINSHOCK = 108 // ConnorMcLeodconst OFFSET_CSTEAMS = 114const OFFSET_LINUX = 5 // offsets 5 higher in Linux buildsconst IMPULSE_FLASHLIGHT = 100const OFFSET_FLASHLIGHT_BATTERY = 244const DMG_HEGRENADE = (1<<24)

// Weapon bitsumsconst PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)const NADE_WEAPONS_BIT_SUM = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG))const NOCLIP_WPN_BS = ((1<<2)|(1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))



// Max Clip for weaponsnew const MAXCLIP[] = { -1, 13, -1, 10, -1, 7, -1, 30, 30, -1, 30, 20, 25, 30, 35, 25, 12, 20, 10, 30, 100, 8, 30, 30, 20, -1, 7, 30, 30, -1, 50 }// Weapon entity namesnew const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90" }// Ammo IDs for weaponsnew const AMMOID[] = { -1, 9, -1, 2, 12, 5, 14, 6, 4, 13, 10, 7, 6, 4, 4, 4, 6, 10, 1, 10, 3, 5, 4, 10, 2, 11, 8, 4, 2, -1, 7 }



// HACK: pev_ field used to store additional ammo on weaponsconst PEV_ADDITIONAL_AMMO = pev_iuser1

// pev_ field used to store custom nade types and their valuesconst PEV_NADE_TYPE = pev_flTimeStepSoundconst NADE_TYPE_ZOMBIEBOM = 1111

// HUD messagesconst Float:HUD_SCORE_X = -1.0const Float:HUD_SCORE_Y = 0.01const Float:HUD_HEALTH_X = 0.015const Float:HUD_HEALTH_Y = 0.92

// CS Soundnew const sound_nvg[2][] = {"items/nvg_off.wav", "items/nvg_on.wav"}new const sound_buyammo[] = "items/9mmclip1.wav"

// Some constantsconst FFADE_IN = 0x0000const FFADE_STAYOUT = 0x0004const UNIT_SECOND = (1<<12)

// Weapons Offsets (win32)const OFFSET_flNextPrimaryAttack = 46const OFFSET_flNextSecondaryAttack = 47const OFFSET_flTimeWeaponIdle = 48const OFFSET_flNextAttack = 83

// Linux diff'sconst OFFSET_LINUX_WEAPONS = 4 // weapon offsets are only 4 steps higher on Linux

new g_hamczbots, cvar_botquota, cvar_freetime

// block cmd buy#define MAXMENUPOS 34new g_Aliases[MAXMENUPOS][] = {"usp","glock","deagle","p228","elites","fn57","m3","xm1014","mp5","tmp","p90","mac10","ump45","ak47","galil","famas","sg552","m4a1","aug","scout","awp","g3sg1","sg550","m249","vest","vesthelm","flash","hegren","sgren","defuser","nvgs","shield","primammo","secammo"} new g_Aliases2[MAXMENUPOS][] = {"km45","9x19mm","nighthawk","228compact","elites","fiveseven","12gauge","autoshotgun","smg","mp","c90","mac10","ump45","cv47","defender","clarion","krieg552","m4a1","bullpup","scout","magnum","d3au1","krieg550","m249","vest","vesthelm","flash","hegren","sgren","defuser","nvgs","shield","primammo","secammo"}





/*================================================================================ [Natives, Precache and Init]=================================================================================*/public plugin_natives(){ // Player natives register_native("nst_zb_get_mod", "native_get_mod", 1) register_native("nst_zb_get_user_sex", "native_get_user_sex", 1) register_native("nst_zb_get_user_zombie", "native_get_user_zombie", 1) register_native("nst_zb_get_user_zombie_class", "native_get_user_zombie_class", 1) register_native("nst_zb_color_saytext", "natives_color_saytext", 1) register_native("nst_zb_get_user_start_health", "native_get_user_start_health", 1) register_native("nst_zb_get_user_level", "native_get_user_level", 1) register_native("nst_zb_get_take_damage", "native_get_take_damage", 1) register_native("nst_zb_get_damage_nade", "native_get_damage_nade", 1) register_native("nst_zb_get_weapons_ammo", "natives_get_weapons_ammo", 1)  // External additions natives register_native("nst_zbs_register_zombie_class", "native_register_zombie_class", 1)  // Fix Bug register_native("nst_zb_get_user_hero", "native_novalue", 1) register_native("nst_zb_zombie_respawn", "native_novalue", 1) register_native("nst_zb_remove_weapons_newround", "native_novalue", 1) register_native("nst_zb_human_kill_zombie", "native_novalue", 1) register_native("nst_zb_get_user_damage_attack", "native_novalue", 1) register_native("nst_zb_set_user_damage_attack", "native_novalue", 1) register_native("nst_zb_get_maxlevel_human", "native_novalue", 1)  register_native("nst_zb3_register_zombie_class", "native_novalue", 1) register_native("nst_zbu_register_zombie_class", "native_novalue", 1)}public plugin_init(){ register_plugin(PLUGIN, VERSION, AUTHOR)  // Language files register_dictionary(LANG_FILE)  // Events register_event("HLTV", "event_round_start", "a", "1=0", "2=0") register_logevent("logevent_round_start",2, "1=Round_Start") register_logevent("logevent_round_end", 2, "1=Round_End") register_event("CurWeapon","CurrentWeapon","be","1=1") register_event("DeathMsg", "Death", "a")

 // HAM Forwards RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1) RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage") //RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage_Post", 1) RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack") RegisterHam(Ham_Touch, "weaponbox", "fw_TouchWeapon") RegisterHam(Ham_Touch, "armoury_entity", "fw_TouchWeapon") RegisterHam(Ham_Touch, "weapon_shield", "fw_TouchWeapon") RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")

 // FM Forwards register_forward(FM_CmdStart, "fw_CmdStart") register_forward(FM_PlayerPreThink, "fw_PlayerPreThink") register_forward(FM_EmitSound, "fw_EmitSound") register_forward(FM_SetModel, "fw_SetModel") register_forward(FM_Touch, "fw_Touch") unregister_forward(FM_Spawn, g_fwSpawn)  // Admin commands register_concmd("nst_zbs_respawn", "cmd_respawn_player", _, "<target> - Respawn someone", 0)  // clien commands register_clcmd("nightvision", "cmd_nightvision")

 // Message IDs g_msgBarTime = get_user_msgid("BarTime") g_msgStatusIcon = get_user_msgid("StatusIcon") g_msgNVGToggle = get_user_msgid("NVGToggle") g_msgHealth = get_user_msgid("Health") g_msgAmmoPickup = get_user_msgid("AmmoPickup") g_msgTextMsg = get_user_msgid("TextMsg") g_msgScreenFade = get_user_msgid("ScreenFade") g_msgClCorpse = get_user_msgid("ClCorpse") g_msgTutorText = get_user_msgid("TutorText") g_msgTutorClose = get_user_msgid("TutorClose") g_msgScoreInfo = get_user_msgid("ScoreInfo") g_msgDamage = get_user_msgid("Damage")  // Message hooks register_message(g_msgHealth, "message_health") register_message(g_msgNVGToggle, "message_nvgtoggle") register_message(g_msgAmmoPickup, "message_ammopickup") register_message(g_msgTextMsg, "message_textmsg") register_message(get_user_msgid("FlashBat"), "message_flashbat") register_message(get_user_msgid("WeapPickup"), "message_weappickup") register_message(get_user_msgid("Scenario"), "message_scenario") register_message(get_user_msgid("HostagePos"), "message_hostagepos") register_message(get_user_msgid("SendAudio"), "message_sendaudio") register_message(get_user_msgid("TeamScore"), "message_teamscore") register_message(get_user_msgid("HudTextArgs"), "message_hudtextargs") register_message(get_user_msgid("DeathMsg"), "message_deathmsg")  // Block msg set_msg_block(g_msgClCorpse, BLOCK_SET)  // CVARS Game cvar_lighting = register_cvar("nst_zbs_light", "") cvar_thunder = register_cvar("nst_zbs_thunderclap", "90") cvar_zombie_attack_damage = register_cvar("nst_zbs_zombie_attack_damage", "0.1") cvar_boss_attack_damage = register_cvar("nst_zbs_boss_attack_damage", "0.3") cvar_weapons_uclip = register_cvar("nst_zbs_weapons_uclip", "0") cvar_damage_nade = register_cvar("nst_zbs_damage_nade", "80") cvar_damage_grenade = register_cvar("nst_zbs_damage_grenade", "120") cvar_time_show_spr = register_cvar("nst_zbs_time_show_spr", "2.0") cvar_time_show_tutortext = register_cvar("nst_zbs_time_show_tutortext", "5.0")  // CVARS - Flashlight and Nightvision cvar_nvg_zombie_alpha = register_cvar("nst_nvg_zombie_alpha", "70") cvar_nvg_zombie_size = register_cvar("nst_zbs_nvg_zombie_size", "150") cvar_nvg_zombie_color[0] = register_cvar("nst_zbs_nvg_zombie_color_r", "253") cvar_nvg_zombie_color[1] = register_cvar("nst_zbs_nvg_zombie_color_g", "110") cvar_nvg_zombie_color[2] = register_cvar("nst_zbs_nvg_zombie_color_b", "110")

 // CVARS - Knockback cvar_knockback = register_cvar("nst_zbs_knockback", "1") cvar_knockbackdamage = register_cvar("nst_zbs_knockback_damage", "0") cvar_knockbackpower = register_cvar("nst_zbs_knockback_power", "1") cvar_knockbackzvel = register_cvar("nst_zbs_knockback_zvel", "0")  // CVARS - Other cvar_botquota = get_cvar_pointer("bot_quota") cvar_freetime = get_cvar_pointer("mp_freezetime") server_cmd("mp_forcecamera 1")  // Collect random spawn points load_spawns()  // Set a random skybox? if (g_sky_enable) { new sky[32] ArrayGetString(g_sky_names, random_num(0, ArraySize(g_sky_names) - 1), sky, charsmax(sky)) set_cvar_string("sv_skyname", sky) }  // Disable sky lighting so it doesn't mess with our custom lighting set_cvar_num("sv_skycolor_r", 0) set_cvar_num("sv_skycolor_g", 0) set_cvar_num("sv_skycolor_b", 0)  // Create the HUD Sync Objects g_HudMsg_Health = CreateHudSyncObj() g_HudMsg_ScoreMatch = CreateHudSyncObj()  // Get Max Players g_maxplayers = get_maxplayers()

 // score match set_task(1.0, "show_hud_client", _, _, _, "b")  //register_concmd("qq", "qq")}public qq(id){ for (new i = 0; i < 33; i++) { if (!is_user_alive(i)) continue; fm_give_item(i, WEAPONENTNAMES[CSW_HEGRENADE]) }}

public plugin_precache(){ // Initialize a few dynamically sized arrays (alright, maybe more than just a few...) g_pro_color = ArrayCreate(32, 1) sound_zombie_attack = ArrayCreate(64, 1) sound_zombie_hitwall = ArrayCreate(64, 1) sound_zombie_swing = ArrayCreate(64, 1) sound_thunder = ArrayCreate(64, 1) lights_thunder = ArrayCreate(32, 1) g_sky_names = ArrayCreate(32, 1) g_objective_ents = ArrayCreate(32, 1)

 // class zombie zombie_name = ArrayCreate(64, 1) zombie_health = ArrayCreate(1, 1) zombie_gravity = ArrayCreate(1, 1) zombie_speed = ArrayCreate(1, 1) zombie_knockback = ArrayCreate(1, 1) zombie_sex = ArrayCreate(1, 1) zombie_boss = ArrayCreate(1, 1) idclass_boss = ArrayCreate(1, 1) idclass_zombie = ArrayCreate(1, 1) zombie_sound_death1 = ArrayCreate(64, 1) zombie_sound_death2 = ArrayCreate(64, 1) zombie_sound_hurt1 = ArrayCreate(64, 1) zombie_sound_hurt2 = ArrayCreate(64, 1) zombie_viewmodel_host = ArrayCreate(64, 1) zombie_viewmodel_origin = ArrayCreate(64, 1) zombie_modelindex = ArrayCreate(1, 1) zombie_modelindex_host = ArrayCreate(1, 1) zombie_modelindex_origin = ArrayCreate(1, 1) zombie_wpnmodel = ArrayCreate(64, 1) zombie_sound_heal = ArrayCreate(64, 1) zombiebom_viewmodel = ArrayCreate(64, 1) supplybox_models = ArrayCreate(64, 1) supplybox_item = ArrayCreate(64, 1) supplybox_item_nade = ArrayCreate(64, 1)  // Load customization data load_customization_from_files()  // set main cvar server_cmd("mp_roundtime %s", FloatToStr(g_round_time)) server_cmd("mp_freezetime %s", FloatToStr(g_free_time)) server_cmd("mp_buytime %s", FloatToStr(g_free_time+g_round_time))  // CS sounds (just in case) engfunc(EngFunc_PrecacheSound, sound_nvg[0]) engfunc(EngFunc_PrecacheSound, sound_nvg[1]) engfunc(EngFunc_PrecacheSound, sound_buyammo)

 new i, buffer[100]  // Custom model for (i = 0; i < ArraySize(supplybox_models); i++) { ArrayGetString(supplybox_models, i, buffer, charsmax(buffer)) engfunc(EngFunc_PrecacheModel, buffer) }  // Custom sounds //engfunc(EngFunc_PrecacheSound, sound_round_clear) //engfunc(EngFunc_PrecacheSound, sound_round_fail) //engfunc(EngFunc_PrecacheSound, sound_match_ready) //engfunc(EngFunc_PrecacheSound, sound_match_start) engfunc(EngFunc_PrecacheSound, sound_levelup) engfunc(EngFunc_PrecacheSound, supplybox_sound_drop) engfunc(EngFunc_PrecacheSound, supplybox_sound_pickup)  for (i = 0; i < ArraySize(sound_thunder); i++) { ArrayGetString(sound_thunder, i, buffer, charsmax(buffer)) engfunc(EngFunc_PrecacheSound, buffer) } for (i = 0; i < ArraySize(sound_zombie_attack); i++) { ArrayGetString(sound_zombie_attack, i, buffer, charsmax(buffer)) engfunc(EngFunc_PrecacheSound, buffer) } for (i = 0; i < ArraySize(sound_zombie_hitwall); i++) { ArrayGetString(sound_zombie_hitwall, i, buffer, charsmax(buffer)) engfunc(EngFunc_PrecacheSound, buffer) } for (i = 0; i < ArraySize(sound_zombie_swing); i++) { ArrayGetString(sound_zombie_swing, i, buffer, charsmax(buffer)) engfunc(EngFunc_PrecacheSound, buffer) }

 // Custom sprites  // zombie bomb engfunc(EngFunc_PrecacheModel, zombiebom_model_p) engfunc(EngFunc_PrecacheModel, zombiebom_model_w) zombiebom_idsprites_exp = engfunc(EngFunc_PrecacheModel, zombiebom_sprites_exp) engfunc(EngFunc_PrecacheSound, zombiebom_sound_exp)  new ent // Fake Hostage (to force round ending) ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "hostage_entity")) if (pev_valid(ent)) { engfunc(EngFunc_SetOrigin, ent, Float:{8192.0,8192.0,8192.0}) dllfunc(DLLFunc_Spawn, ent) }

 // Weather/ambience effects if (g_ambience_fog) { ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_fog")) if (pev_valid(ent)) { fm_set_kvd(ent, "density", g_fog_density, "env_fog") fm_set_kvd(ent, "rendercolor", g_fog_color, "env_fog") } } if (g_ambience_rain) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_rain")) if (g_ambience_snow) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_snow"))

 // Prevent some entities from spawning g_fwSpawn = register_forward(FM_Spawn, "fw_Spawn") }public plugin_cfg(){ // Get configs dir new cfgdir[32] get_configsdir(cfgdir, charsmax(cfgdir))  // Execute config file (zombieplague.cfg) server_cmd("exec %s/%s", cfgdir, CVAR_FILE)

 // Lighting task set_task(5.0, "lighting_effects", _, _, _, "b")  // Cache CVARs after configs are loaded / call roundstart manually set_task(0.5, "event_round_start") set_task(0.5, "logevent_round_start")}



/*================================================================================ [Main Events]=================================================================================*/// Event Round Startpublic event_round_start(){ // remove supplybox in new round supplybox_remove()  // set value g_freezetime = 1 g_newround = 1 g_endround = 0 g_supplybox_count = 0 g_zombie_die_a_round = 0 g_supplybox_appear = get_random_supplybox_appear()  if (g_startcount) g_rount_count += 1

 for (new id = 1; id <= g_maxplayers; id++) { if (!is_user_connected(id)) continue; reset_value_death(id) }  if (g_rount_count) { // well come if (task_exists(TASK_WELLCOME)) remove_task(TASK_WELLCOME) set_task(2.0, "wellcome", TASK_WELLCOME)

 // freetime new Float:freetime = get_pcvar_float(cvar_freetime) if (freetime>0.0) PlaySound(0, sound_match_ready) }}// Log Event Round Startpublic logevent_round_start(){ g_freezetime = 0 PlaySound(0, sound_match_start)  g_zombie_wake_count = g_zombie_wake_time task_zombie_wake() if (task_exists(TASK_ZOMBIEWAKE)) remove_task(TASK_ZOMBIEWAKE) set_task(1.0, "task_zombie_wake", TASK_ZOMBIEWAKE, _, _, "b")}public task_zombie_wake(){ new message[64] if (!g_zombie_wake_count) { g_newround = 0 format(message, charsmax(message), "%L", LANG_PLAYER, "ZBS_NOTICE_WAKE") remove_task(TASK_ZOMBIEWAKE) } else { format(message, charsmax(message), "%L", LANG_PLAYER, "ZBS_NOTICE_COUNT", g_zombie_wake_count) } SendCenterText(0, message)  g_zombie_wake_count -= 1}// Log Event Round Endpublic logevent_round_end(){ // off mp3 file PlaySound(0, "mute.mp3")  // set score team if (g_rount_count) { new humans = GetTotalPlayer(4, 1) new message[64] if (humans) { g_score_human += 1 ShowStatusIcon(0, hud_round_clear) PlaySound(0, sound_round_clear) format(message, charsmax(message), "%L", LANG_PLAYER, "ZBS_ROUND_CLEAR") kill_all_zombie() } else { g_score_zombie += 1 ShowStatusIcon(0, hud_round_fail) PlaySound(0, sound_round_fail) format(message, charsmax(message), "%L", LANG_PLAYER, "ZBS_ROUND_FAIL") g_rount_count -= 1 }

 // show hud msg //SendCenterText(0, message) }  // reset g_endround = 1}// StatusIconShowStatusIcon(player, const sprname[]){  HideStatusIcon(player) StatusIcon(player, sprname, 1)}HideStatusIcon(player){  StatusIcon(player, hud_kill, 0) StatusIcon(player, hud_kill_levelup, 0) StatusIcon(player, hud_kill_boss, 0) StatusIcon(player, hud_round_clear, 0) StatusIcon(player, hud_round_fail, 0)}StatusIcon(player, const sprname[], run){  new dest if (player) dest = MSG_ONE else dest = MSG_ALL  message_begin(dest, g_msgStatusIcon, {0,0,0}, player); write_byte(run); // status (0=hide, 1=show, 2=flash) write_string(sprname); // sprite name message_end();}kill_all_zombie(){ for (new id = 1; id <= g_maxplayers; id++) { if (is_user_alive(id) && g_zombie[id]) user_kill(id) }}

GetTotalPlayer(team, alive){ // team: 1 is TE, 2 is CT, 3 is Zombie, 4 is Human, 0 is all // alive: 0 is death and alive, 1 is alive static total, id total = 0  for (id = 1; id <= g_maxplayers; id++) { if ( (alive && is_user_alive(id)) || (!alive && is_user_connected(id)) ) { if ( team == 1 && fm_cs_get_user_team(id) == FM_CS_TEAM_T || team == 2 && fm_cs_get_user_team(id) == FM_CS_TEAM_CT || team == 3 && g_zombie[id] || team == 4 && !g_zombie[id] || team == 0 ) total++ } }  return total;}public wellcome(){ color_saytext(0, "^x03-=[^x04NST Zombie Scenario^x03]=-") if (task_exists(TASK_WELLCOME)) remove_task(TASK_WELLCOME) set_task(60.0, "wellcome", TASK_WELLCOME)}/*================================================================================ [Clien Public]=================================================================================*/// Client joins the gamepublic client_putinserver(id){ // reset value reset_value(id)  // Reg Ham Zbot if (is_user_bot(id) && !g_hamczbots && cvar_botquota) { set_task(0.1, "register_ham_czbots", id) }

 // make player if match start if (is_user_bot(id) && !g_newround && !g_endround) { if (task_exists(id+TASK_RESPAWN)) remove_task(id+TASK_RESPAWN) set_task(g_respawn_wait, "player_respawn", id+TASK_RESPAWN) }}// Client leavingpublic fw_ClientDisconnect(id){ reset_value(id)}public client_command(id){ new arg[13] if (read_argv(0, arg, 12) > 11) { return PLUGIN_CONTINUE  }  // block cmd buy if (g_zombie[id]) { new a = 0  do { if (equali(g_Aliases[a], arg) || equali(g_Aliases2[a], arg)) {  return PLUGIN_HANDLED  } } while(++a < MAXMENUPOS) }

  return PLUGIN_CONTINUE }public Death(){ new killer = read_data(1)  new victim = read_data(2)   //new headshot = read_data(3)   // reset value reset_value_death(victim)  // off nvg and icon turn_off_nvg(victim)  // victim is zombie if (g_zombie[victim]) {  if (is_user_connected(killer) && !g_zombie[killer]) { new isboss = ArrayGetCell(zombie_boss, g_zombieclass[victim]) new killer_level = g_level[killer]  // update kill of human g_kill[killer] ++ g_zombie_die ++ g_zombie_die_a_round ++ UpdateLevelHuman(killer, isboss) fm_cs_set_user_money(killer, cs_get_user_money(killer)-300+g_money_kill_zombie)  // give zombie type for victim if (g_zombie_die_a_round) { if (!(g_zombie_die_a_round % g_zombies_boss)) g_zbtype[victim] = ZBTYPE_BOSS else if (!(g_zombie_die_a_round % g_zombies_zombiebomb)) g_zbtype[victim] = ZBTYPE_ZOMBIEBOM }  // show hud kill if (isboss) ShowStatusIcon(killer, hud_kill_boss) else if (g_level[killer]>killer_level) ShowStatusIcon(killer, hud_kill_levelup) else ShowStatusIcon(killer, hud_kill) if (task_exists(killer+TASK_STATUSICON)) remove_task(killer+TASK_STATUSICON) set_task(get_pcvar_float(cvar_time_show_spr), "task_hide_statusicon", killer+TASK_STATUSICON)  // make supplybox if (g_zombie_die==g_supplybox_appear || isboss) { static Float:origin[3] pev(victim, pev_origin, origin) supplybox_create(origin) g_supplybox_appear += get_random_supplybox_appear() }  //client_print(0, print_chat, "[%i]", g_zombie_die) }  // respawn zombie g_respawning[victim] = 1 if (task_exists(victim+TASK_RESPAWN)) remove_task(victim+TASK_RESPAWN) set_task(g_respawn_wait, "player_respawn", victim+TASK_RESPAWN) run_bartime(victim, floatround(g_respawn_wait)) } // human is victim else { // check human change team if (task_exists(victim+TASK_HUMANCHANGETEAM)) remove_task(victim+TASK_HUMANCHANGETEAM) set_task(0.1, "task_human_change_team", victim+TASK_HUMANCHANGETEAM) }}public task_human_change_team(taskid){ new id = ID_HUMANCHANGETEAM if (fm_cs_get_user_team(id)==FM_CS_TEAM_T) fm_cs_set_user_team(id, FM_CS_TEAM_CT)}get_random_supplybox_appear(){ new num1, num2 num1 = human_kills_levelup/2 num2 = human_kills_levelup+(human_kills_levelup/2) return random_num(num1, num2)}public task_hide_statusicon(taskid){ new id = ID_STATUSICON HideStatusIcon(id)}UpdateLevelHuman(id, isboss){ if (!g_kill[id] || g_level[id]>=human_max_level) return;  new levelup = g_kill[id] % human_kills_levelup if (!levelup || isboss) { g_level[id] += 1 fm_set_user_health(id, get_user_health(id)+human_levelup_healthup) PlaySound(id, sound_levelup)

 new message[100] format(message, charsmax(message), "%L", LANG_PLAYER, "ZBS_NOTICE_HUMAN_LEVELUP", g_level[id]) //SendCenterText(id, message)  // tutor text ShowTutorText(id, message) if (task_exists(id+TASK_TUTORTEXT)) remove_task(id+TASK_TUTORTEXT) set_task(get_pcvar_float(cvar_time_show_tutortext), "task_hide_tutortext", id+TASK_TUTORTEXT) }  //client_print(id, print_chat, "L[%i]", g_level[id])}public task_hide_tutortext(taskid){ new id = ID_TUTORTEXT HideTutorText(id)}ShowTutorText(id, message[]){ message_begin(MSG_ONE, g_msgTutorText, _, id) write_string(message) write_byte(1) message_end()}HideTutorText(id){ message_begin(MSG_ONE, g_msgTutorClose, _, id) message_end()}

/*================================================================================ [Main Forwards]=================================================================================*/// Entity Spawn Forwardpublic fw_Spawn(entity){ // Invalid entity if (!pev_valid(entity)) return FMRES_IGNORED;  // Get classname new classname[32], objective[32], size = ArraySize(g_objective_ents) pev(entity, pev_classname, classname, charsmax(classname))  // Check whether it needs to be removed for (new i = 0; i < size; i++) { ArrayGetString(g_objective_ents, i, objective, charsmax(objective))  if (equal(classname, objective)) { engfunc(EngFunc_RemoveEntity, entity) return FMRES_SUPERCEDE; } }  return FMRES_IGNORED;}// Ham Player Spawn Post Forwardpublic fw_PlayerSpawn_Post(id){ // Not alive or didn't join a team yet if (!is_user_alive(id) || !fm_cs_get_user_team(id)) return;

 // Spawn at a random location? if (is_user_bot(id) && g_spawnCount) do_random_spawn(id)  // set money if (g_rount_count && !g_set_money[id]) { fm_cs_set_user_money(id, g_money_start) g_set_money[id] = 1 }  // protectio player set_protection(id)  // make player if (task_exists(id+TASK_MAKEPLAYER)) remove_task(id+TASK_MAKEPLAYER) set_task(0.5, "make_player", id+TASK_MAKEPLAYER) }// Ham Take Damage Forwardpublic fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type){ // Fix bug player not connect if (!is_user_connected(victim) || !is_user_connected(attacker)) return HAM_IGNORED;

 // Remove Damage when Freetime if (g_newround || g_endround) return HAM_SUPERCEDE;  // remove take damage when victim is protection if (g_protection[victim]) return HAM_SUPERCEDE;  // Non-player damage or self damage if (victim == attacker) return HAM_IGNORED;

 // attacker is zombie if (g_zombie[attacker] && !g_zombie[victim]) { // Fix Bug zombie has weapons # knife if (get_user_weapon(attacker) != CSW_KNIFE) return HAM_SUPERCEDE;  // take damage new isboss = ArrayGetCell(zombie_boss, g_zombieclass[attacker]) if (isboss) damage *= get_pcvar_float(cvar_boss_attack_damage) else damage *= get_pcvar_float(cvar_zombie_attack_damage)  new health_set = get_user_health(victim)-floatround(damage) fm_set_user_health(victim, health_set) nst_create_user_sound_bhit(victim) take_damage_effect(victim, floatround(damage)) if (health_set<=0) UpdateFrags(victim, 1)  return HAM_SUPERCEDE  //SetHamParamFloat(4, damage) //return HAM_IGNORED } // attacker is human else if (!g_zombie[attacker] && g_zombie[victim]) { // he xdamage if (damage_type & DMG_HEGRENADE) { new Float: hedmg = get_pcvar_float(cvar_damage_nade)+get_pcvar_float(cvar_damage_grenade) if (damage < hedmg) damage += hedmg } // X Damage else if (g_level[attacker]) { damage *= 1 + float(g_level[attacker])*0.1 }  SetHamParamFloat(4, damage) return HAM_IGNORED } // fix bug else return HAM_SUPERCEDE;   return HAM_IGNORED}take_damage_effect(id, damage){ new Float:origin[3] pev(id, pev_origin, origin)  message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, id) write_byte(0) // damage save write_byte(damage) // damage take write_long(DMG_GENERIC) // damage type - DMG_RADIATION write_coord(floatround(origin[0])) // x write_coord(floatround(origin[1])) // y write_coord(floatround(origin[2])) // z message_end()}UpdateFrags(player, num){ if (!is_user_connected(player)) return;  set_pev(player, pev_frags, float(pev(player, pev_frags) + num)) message_begin(MSG_BROADCAST, g_msgScoreInfo) write_byte(player) // id write_short(pev(player, pev_frags)) // frags write_short(get_user_deaths(player)) // deaths write_short(0) // class? write_short(get_user_team(player)) // team message_end()}// Ham Take Damage Post Forwardpublic fw_TakeDamage_Post(victim){ // Set pain shock free offset //set_pdata_float(victim, OFFSET_PAINSHOCK, 1.0, OFFSET_LINUX)}// Ham Weapon Touch Forwardpublic fw_TouchWeapon(weapon, id){ // Not a player if (!is_user_connected(id)) return HAM_IGNORED;  // Dont pickup weapons if zombie or survivor (+PODBot MM fix) if (g_zombie[id]) return HAM_SUPERCEDE;  return HAM_IGNORED;}public fw_CmdStart(id, uc_handle, seed){  if (!is_user_alive(id) || g_newround || g_endround) return;

 //client_print(id, print_chat, "L[%i]", g_newround)}public fw_PlayerPreThink(id){ if (!is_user_alive(id) || g_freezetime) return;  // Set Player MaxSpeed if (g_zombie[id]) { new Float:maxspeed if (g_newround) { maxspeed = 0.01 set_player_nextattack(id, 0.5) } else { maxspeed = float(get_zombie_speed(id)) } set_pev(id, pev_maxspeed, maxspeed) }}  get_zombie_speed(id){ if (!g_zombie[id]) return 0;  new Float:speed, Float:speed_up, Float:speed_max, speed_set, round, boss round = max(0, g_rount_count-1) speed = ArrayGetCell(zombie_speed, g_zombieclass[id])  boss = ArrayGetCell(zombie_boss, g_zombieclass[id]) if (boss) return floatround(speed)  speed_up = speed*(zombie_speed_start + zombie_speed_up*round) speed_max = speed*zombie_speed_max speed_set = min(floatround(speed_max), floatround(speed_up))  return speed_set;}// Ham Trace Attack Forwardpublic fw_TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type){ // Fix bug player not connect if (!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker) return HAM_IGNORED;  // New round starting or round end if (g_newround || g_endround) return HAM_SUPERCEDE;  if (g_zombie[attacker] && !g_zombie[victim]) return HAM_IGNORED;  // remove knock back when victim is protection and invincibility or team if (g_protection[victim] || (fm_cs_get_user_team(attacker) == fm_cs_get_user_team(victim))) return HAM_SUPERCEDE;  // Knockback disabled, nothing else to do here if (!get_pcvar_num(cvar_knockback)) return HAM_IGNORED;

 // Get distance between players static origin1[3], origin2[3] get_user_origin(victim, origin1) get_user_origin(attacker, origin2)  // Get victim's velocity static Float:velocity[3] pev(victim, pev_velocity, velocity)

 // Use damage on knockback calculation if (get_pcvar_num(cvar_knockbackdamage)) xs_vec_mul_scalar(direction, damage, direction)

 // Use weapon power on knockback calculation if (get_pcvar_num(cvar_knockbackpower)) { new Float:weapon_knockback weapon_knockback = kb_weapon_power[get_user_weapon(attacker)] xs_vec_mul_scalar(direction, weapon_knockback, direction) }  // Apply zombie class knockback multiplier if (g_zombie[victim]) { new Float:classzb_knockback classzb_knockback = ArrayGetCell(zombie_knockback, g_zombieclass[victim]) xs_vec_mul_scalar(direction, classzb_knockback, direction) }  // Add up the new vector xs_vec_add(velocity, direction, direction)  // Should knockback also affect vertical velocity? if (!get_pcvar_num(cvar_knockbackzvel)) direction[2] = velocity[2]  // Set the knockback'd victim's velocity set_pev(victim, pev_velocity, direction)  //client_print(attacker, print_chat, "[%i][%i]", victim_kb, class_kb) return HAM_IGNORED;}// Emit Sound Forwardpublic fw_EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch){ //client_print(id, print_chat, "[%s]", sample)  // Block all those unneeeded hostage sounds if (sample[0] == 'h' && sample[1] == 'o' && sample[2] == 's' && sample[3] == 't' && sample[4] == 'a' && sample[5] == 'g' && sample[6] == 'e') return FMRES_SUPERCEDE;  // Replace these next sounds for zombies only if (!is_user_connected(id) || !g_zombie[id]) return FMRES_IGNORED;  static sound[64]  // Zombie being hit if (sample[7] == 'b' && sample[8] == 'h' && sample[9] == 'i' && sample[10] == 't' || sample[7] == 'h' && sample[8] == 'e' && sample[9] == 'a' && sample[10] == 'd') { if (g_level[id]==1) ArrayGetString(zombie_sound_hurt1, g_zombieclass[id], sound, charsmax(sound)) else ArrayGetString(zombie_sound_hurt2, g_zombieclass[id], sound, charsmax(sound)) emit_sound(id, channel, sound, volume, attn, flags, pitch) return FMRES_SUPERCEDE; }  // Zombie dies if (sample[7] == 'd' && ((sample[8] == 'i' && sample[9] == 'e') || (sample[8] == 'e' && sample[9] == 'a'))) { if (g_level[id]==1) ArrayGetString(zombie_sound_death1, g_zombieclass[id], sound, charsmax(sound)) else ArrayGetString(zombie_sound_death2, g_zombieclass[id], sound, charsmax(sound)) emit_sound(id, channel, sound, volume, attn, flags, pitch) return FMRES_SUPERCEDE; }

 // Zombie Attack new attack_type if (equal(sample,"weapons/knife_hitwall1.wav")) attack_type = 1 else if (equal(sample,"weapons/knife_hit1.wav") || equal(sample,"weapons/knife_hit3.wav") || equal(sample,"weapons/knife_hit2.wav") || equal(sample,"weapons/knife_hit4.wav") || equal(sample,"weapons/knife_stab.wav")) attack_type = 2 else if(equal(sample,"weapons/knife_slash1.wav") || equal(sample,"weapons/knife_slash2.wav")) attack_type = 3 if (attack_type) { new sound[64] if (attack_type == 1) ArrayGetString(sound_zombie_hitwall, random(ArraySize(sound_zombie_hitwall)), sound, charsmax(sound)) else if (attack_type == 2) ArrayGetString(sound_zombie_attack, random(ArraySize(sound_zombie_attack)), sound, charsmax(sound)) else if (attack_type == 3) ArrayGetString(sound_zombie_swing, random(ArraySize(sound_zombie_swing)), sound, charsmax(sound)) emit_sound(id, channel, sound, volume, attn, flags, pitch) return FMRES_SUPERCEDE; }

  return FMRES_IGNORED;}// Forward Set Modelpublic fw_SetModel(entity, const model[]){ // check valid ent if (!is_valid_ent(entity)) return FMRES_IGNORED

 // We don't care if (strlen(model) < 8) return FMRES_IGNORED;

// ######## Zombie Bomb // Get damage time of grenade static Float:dmgtime pev(entity, pev_dmgtime, dmgtime)  // Grenade not yet thrown if (dmgtime == 0.0) return FMRES_IGNORED;  // Get attacker static attacker attacker = pev(entity, pev_owner)  // Get whether grenade's owner is a zombie if (g_zombie[attacker]) { if (model[9] == 'h' && model[10] == 'e') // Zombie Bomb { // Set grenade type on the thrown grenade entity set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_ZOMBIEBOM) engfunc(EngFunc_SetModel, entity, zombiebom_model_w)  return FMRES_SUPERCEDE } }

 return FMRES_IGNORED}// Ham Grenade Think Forwardpublic fw_ThinkGrenade(entity){ // Invalid entity if (!pev_valid(entity)) return FMRES_IGNORED;  // Get damage time of grenade static Float:dmgtime pev(entity, pev_dmgtime, dmgtime)  // Check if it's time to go off if (dmgtime > get_gametime()) return HAM_IGNORED;  // Check if it's one of our custom nades switch (pev(entity, PEV_NADE_TYPE)) { case NADE_TYPE_ZOMBIEBOM: { zombiebom_explode(entity) } default: return HAM_IGNORED; }  return HAM_SUPERCEDE;}



/*================================================================================ [Main Public]=================================================================================*/// ##################### SupplyBox #####################// SupplyBox Pickuppublic fw_Touch(ent, id){ if (!pev_valid(ent) || !is_user_alive(id) || g_zombie[id]) return FMRES_IGNORED  new classname[32] entity_get_string(ent,EV_SZ_classname,classname,31) //client_print(id, print_chat, "[%s][%i]", classname, ent)  if (equal(classname, SUPPLYBOX_CLASSNAME)) { // get item from supply pickup new item[64] ArrayGetString(supplybox_item, random(ArraySize(supplybox_item)), item, charsmax(item))

 // give item for player supplybox_give_item(id, item)  // play sound PlayEmitSound(id, CHAN_VOICE, supplybox_sound_pickup)

 // remove ent in supplybox_ent new num_box = entity_get_int(ent, EV_INT_iuser1) g_supplybox_ent[num_box] = 0 remove_entity(ent) }  return FMRES_IGNORED}supplybox_give_item(id, item[]){ new item_type = supplybox_get_type_item(item)  // give cs weapons default if (item_type == NSTZB_ITEM_WPNDEFAULT) { new idweapon = csw_name_to_id(item) new wpn_type = get_weapon_type(idweapon) if (wpn_type==1 || wpn_type==2) drop_weapons(id, wpn_type) give_weapon(id, idweapon) } // give weapon mod nst wpn else if (item_type == NSTZB_ITEM_NSTWPN) { replace(item, 32, "nst_", "") nst_wpn_give_weapon(id, item) } // give nade else if (item_type == NSTZB_ITEM_AMMONADE) { give_ammo(id) give_nade(id) }  //client_print(0, print_chat, "[%i]", item_type)}supplybox_get_type_item(item[]){ new left[64], right[64], type strbreak(item, left, 4, right, 63) if (equali(left, "csw_")) type = NSTZB_ITEM_WPNDEFAULT else if (equali(left, "nst_")) type = NSTZB_ITEM_NSTWPN else if (equali(item, "item_ammonade")) type = NSTZB_ITEM_AMMONADE  return type}// Create SupplyBoxpublic supplybox_create(Float:origin[3]){ // check max supplybox if (g_supplybox_count>=supplybox_max || g_newround || g_endround) return;

 // supply box count g_supplybox_count += 1  // get random model supplybox static model_w[64] ArrayGetString(supplybox_models, random(ArraySize(supplybox_models)), model_w, charsmax(model_w))

 // create supply box new ent = create_entity("info_target") entity_set_string(ent, EV_SZ_classname, SUPPLYBOX_CLASSNAME) entity_set_model(ent, model_w)  entity_set_size(ent, Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0}) entity_set_int(ent,EV_INT_solid,1) entity_set_int(ent,EV_INT_movetype,6) entity_set_int(ent, EV_INT_iuser1, g_supplybox_count) entity_set_vector(ent,EV_VEC_origin,origin)  // give ent SupplyBox g_supplybox_ent[g_supplybox_count] = ent  // play sound PlayEmitSound(ent, CHAN_VOICE, supplybox_sound_drop)}// Remove SupplyBoxsupplybox_remove(){ remove_ent_by_class(SUPPLYBOX_CLASSNAME) new supplybox_ent_reset[MAX_SUPPLYBOX] g_supplybox_ent = supplybox_ent_reset}

// Give Weaponsgive_ammo(id){ new weapons[32], num, i, idwpn, ammo num = 0 get_user_weapons(id, weapons, num)

 for (i = 0; i < num; i++) { idwpn = weapons[i] ammo = get_ammo_buywpn(idwpn) if (ammo>2) { show_hud_ammo(id, idwpn, ammo) cs_set_user_bpammo(id, idwpn, ammo) } }  // set full ammo for nst wpn nst_wpn_set_fullammo(id)}give_nade(id){ // Get user weapons new weapons[32], num, i, weaponid num = 0 // reset passed weapons count (bugfix) get_user_weapons(id, weapons, num)  // Loop through them and drop primaries or secondaries for (i = 0; i < num; i++) { // Prevent re-indexing the array weaponid = weapons[i]  new idnade_str[32], idnade_num for (new i = 0; i < ArraySize(supplybox_item_nade); i++) { ArrayGetString(supplybox_item_nade, i, idnade_str, charsmax(idnade_str)) idnade_num = csw_name_to_id(idnade_str) if (weaponid != idnade_num) give_weapon(id, idnade_num) } }}csw_name_to_id(wpn[]){ new weapons[32] format(weapons, charsmax(weapons), "weapon_%s", wpn) replace(weapons, charsmax(weapons), "csw_", "")  return cs_weapon_name_to_id(weapons)}give_weapon(id, idwpn){ if (g_zombie[id]) return;  fm_give_item(id, WEAPONENTNAMES[idwpn]) new ammo = get_ammo_buywpn(idwpn) if (ammo > 2) { cs_set_user_bpammo(id, idwpn, ammo) show_hud_ammo(id, idwpn, ammo) }}show_hud_ammo(id, weapon, ammo){ message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id) write_byte(AMMOID[weapon]) // ammo id write_byte(ammo) // ammo amount message_end()  PlayEmitSound(id, CHAN_ITEM, sound_buyammo)}get_ammo_buywpn(wpn){ new ammo = 1 if (wpn == CSW_P228 || wpn == CSW_ELITE || wpn == CSW_FIVESEVEN || wpn == CSW_USP || wpn == CSW_GLOCK18) { ammo = 200 } else if (wpn == CSW_DEAGLE) { ammo = 200 } else if (wpn == CSW_M3 || wpn == CSW_XM1014) { ammo = 200 } else if (wpn == CSW_MAC10 || wpn == CSW_UMP45 || wpn == CSW_MP5NAVY || wpn == CSW_TMP || wpn == CSW_P90) { ammo = 200 } else if (wpn == CSW_AUG || wpn == CSW_FAMAS || wpn == CSW_M4A1 || wpn == CSW_SG552 || wpn == CSW_AK47 || wpn == CSW_SCOUT || wpn == CSW_G3SG1 || wpn == CSW_SG550) { ammo = 200 } else if (wpn == CSW_M249) { ammo = 200 } else if (wpn == CSW_AWP) { ammo = 200 } else if (wpn == CSW_HEGRENADE || wpn == CSW_SMOKEGRENADE || wpn == CSW_FLASHBANG) { ammo = 1 } return ammo;}



// Current Weaponpublic CurrentWeapon(id){ if (!is_user_alive(id)) return;  // check weapons CheckWeapon(id)  // Uclip if (get_pcvar_num(cvar_weapons_uclip) && !g_zombie[id]) { new WpnName[64] new idwpn = get_user_weapon(id) if ( idwpn && !(NOCLIP_WPN_BS & (1<<idwpn)) && get_weaponname(idwpn, WpnName, charsmax(WpnName)) ) { new ent = get_weapon_ent(id, idwpn) new uclip = max(1, MAXCLIP[idwpn]) if (ent) cs_set_weapon_ammo(ent, uclip) //client_print(0, print_chat, "[%i]", ent) } }  return;}//get weapon entget_weapon_ent(id, weaponid){ static wname[32], weapon_ent get_weaponname(weaponid, wname, charsmax(wname)) weapon_ent = fm_find_ent_by_owner(-1, wname, id) return weapon_ent}CheckWeapon(id){ if (!is_user_alive(id)) return;  // zombie weapons new current_weapon = get_user_weapon(id) if (g_zombie[id] && current_weapon) { new boss = ArrayGetCell(zombie_boss, g_zombieclass[id])  // remove weapon # knife & he if (current_weapon != CSW_KNIFE) { if (boss) { fm_strip_user_weapons(id) fm_give_item(id, "weapon_knife") } else if (current_weapon!=CSW_HEGRENADE) drop_weapons(id, get_weapon_type(current_weapon), 1) } else if (!boss) { // set model zonbie bom if (current_weapon == CSW_HEGRENADE) { new idclass, v_model[64] idclass = g_zombieclass[id] ArrayGetString(zombiebom_viewmodel, idclass, v_model, charsmax(v_model)) set_pev(id, pev_viewmodel2, v_model) set_pev(id, pev_weaponmodel2, zombiebom_model_p) } // set model knife zombie else { new model_wpn[64], idclass idclass = g_zombieclass[id] ArrayGetString(zombie_wpnmodel, idclass, model_wpn, charsmax(model_wpn))  set_pev(id, pev_viewmodel2, model_wpn) set_pev(id, pev_weaponmodel2, "") } } }}public reset_wpnmodel(id){ if (get_user_weapon(id) == CSW_KNIFE) { set_pev(id, pev_viewmodel2, "models/v_knife.mdl") set_pev(id, pev_weaponmodel2, "models/p_knife.mdl") }}// Spawn a player [admin cmd]public cmd_respawn_player(id, level, cid){ if (!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED

 // Retrieve arguments static arg[32], player read_argv(1, arg, charsmax(arg)) player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)  // Remove Respawn when Freetime if (g_newround || g_endround || !is_user_connected(player)) return PLUGIN_HANDLED

 reset_value_death(player) player_respawn(player+TASK_RESPAWN)

 return PLUGIN_HANDLED}// Player Respawnpublic player_respawn(taskid){ new id = ID_RESPAWN  // Remove Respawn when Freetime if (g_newround || g_endround || !is_user_connected(id)) return;  // remove respawn g_respawning[id] = 0

 // respawn player respawn_player_manually(id)

 // remove task if (task_exists(taskid)) remove_task(taskid)}// Set Protectionset_protection(id){ g_protection[id] = 1 new color[3] color[0] = ArrayGetCell(g_pro_color, 0) color[1] = ArrayGetCell(g_pro_color, 1) color[2] = ArrayGetCell(g_pro_color, 2) fm_set_rendering(id, kRenderFxGlowShell, color[0], color[1], color[2], kRenderNormal, 10) if (task_exists(id+TASK_PROTECTION)) remove_task(id+TASK_PROTECTION) set_task(g_pro_time, "remove_protection", id+TASK_PROTECTION)}// Remove Protectionpublic remove_protection(taskid){ new id = ID_PROTECTION  // Remove when not connection if (!is_user_connected(id)) return;  // respawn g_protection[id] = 0 fm_set_rendering(id)  // Fix bug CurrentWeapon(id)}// Show Hudpublic show_hud_client(){ new message[128]  for (new id = 1; id <= g_maxplayers; id++) { if (!is_user_alive(id)) continue;  // score match new kill_team[32], kill_player[32], round[32] format(kill_team, charsmax(kill_team), "%s", FixNumber(g_zombie_die)) format(kill_player, charsmax(kill_player), "%s", FixNumber(g_kill[id])) format(round, charsmax(round), "%s", FixNumber(g_rount_count)) format(message, charsmax(message), "%L", LANG_PLAYER, "ZBS_HUD_SCORE_MATCH", kill_team, round, kill_player) set_hudmessage(255, 255, 255, HUD_SCORE_X, HUD_SCORE_Y, 0, 6.0, 1.1, 0.0, 0.0, -1) ShowSyncHudMsg(id, g_HudMsg_ScoreMatch, "%s", message)  // health layer if (g_zombie[id]) format(message, charsmax(message), "%L", LANG_PLAYER, "ZBS_HUD_ZOMBIE_HEALTH", get_user_health(id)) else format(message, charsmax(message), "%L", LANG_PLAYER, "ZBS_HUD_HUMAN_HEALTH", get_user_health(id), g_level[id]) set_hudmessage(0, 125, 0, HUD_HEALTH_X, HUD_HEALTH_Y, 0, 6.0, 2.0, 0.0, 0.0, -1) ShowSyncHudMsg(id, g_HudMsg_Health, "%s", message) }}

// Nightvision togglepublic cmd_nightvision(id){ if (!is_user_alive(id)) return PLUGIN_HANDLED;

 if (!g_nvg[id]) { g_nvg[id] = 1 if (g_zombie[id]) { remove_task(id+TASK_NVISION) set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b") } else  set_user_gnvision(id, g_nvg[id]) PlaySound(id, sound_nvg[1]) } else { g_nvg[id] = 0 if (g_zombie[id]) { remove_task(id+TASK_NVISION) set_user_screen_fade(id) } else  set_user_gnvision(id, g_nvg[id]) PlaySound(id, sound_nvg[0]) }  return PLUGIN_HANDLED;}turn_off_nvg(id){ if (!is_user_connected(id)) return;  g_nvg[id] = 0 remove_task(id+TASK_NVISION) set_user_screen_fade(id) set_user_gnvision(id, 0)}



// Custom Night Visionpublic set_user_nvision(taskid){ new id = ID_NVISION  if (!is_user_alive(id)) return;

 // Get player's origin static origin[3] get_user_origin(id, origin)  // Nightvision message message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id) write_byte(TE_DLIGHT) // TE id write_coord(origin[0]) // x write_coord(origin[1]) // y write_coord(origin[2]) // z write_byte(get_pcvar_num(cvar_nvg_zombie_size)) // radius write_byte(get_pcvar_num(cvar_nvg_zombie_color[0])) // r write_byte(get_pcvar_num(cvar_nvg_zombie_color[1])) // g write_byte(get_pcvar_num(cvar_nvg_zombie_color[2])) // b write_byte(2) // life write_byte(0) // decay rate message_end()

 // screen_fade set_user_screen_fade(id)}set_user_gnvision(id, toggle){ // Toggle NVG message message_begin(MSG_ONE, g_msgNVGToggle, _, id) write_byte(toggle) // toggle message_end()}set_user_screen_fade(id){ if (!is_user_connected(id)) return;  new alpha if (g_nvg[id]) alpha = get_pcvar_num(cvar_nvg_zombie_alpha) else alpha = 0  message_begin(MSG_ONE, g_msgScreenFade, _, id) write_short(0) // duration write_short(0) // hold time write_short(FFADE_STAYOUT) // fade type write_byte(get_pcvar_num(cvar_nvg_zombie_color[0])) // r write_byte(get_pcvar_num(cvar_nvg_zombie_color[1])) // g write_byte(get_pcvar_num(cvar_nvg_zombie_color[2])) // b write_byte(alpha) // alpha message_end()}

// Register Ham Forwards for CZ botspublic register_ham_czbots(id){ // Make sure it's a CZ bot and it's still connected if (g_hamczbots || !is_user_connected(id) || !get_pcvar_num(cvar_botquota)) return;  RegisterHamFromEntity(Ham_Spawn, id, "fw_PlayerSpawn_Post", 1) RegisterHamFromEntity(Ham_TakeDamage, id, "fw_TakeDamage") //RegisterHamFromEntity(Ham_TakeDamage, id, "fw_TakeDamage_Post", 1) RegisterHamFromEntity(Ham_TraceAttack, id, "fw_TraceAttack")  // Ham forwards for CZ bots succesfully registered g_hamczbots = true  // If the bot has already spawned, call the forward manually for him if (is_user_alive(id)) fw_PlayerSpawn_Post(id)}



/*================================================================================ [Main Function]=================================================================================*/// Make Playerpublic make_player(taskid){ new id = ID_MAKEPLAYER if (is_user_bot(id)) make_zombie(id) else make_human(id)}// Make Human Functionmake_human(id){ if (!is_user_alive(id)) return;  // set value g_zombie[id] = 0 fm_cs_set_user_team(id, FM_CS_TEAM_CT) fm_set_user_health(id, (human_health+(human_levelup_healthup*g_level[id]))) fm_set_user_armor(id, human_armor)  // set model set_model_for_player(id)  // turn off flashlight and nvg turn_off_flashlight(id) turn_off_nvg(id)}// Make Zombie Functionmake_zombie(id){ if (!is_user_alive(id)) return;

 // set value, random level of zombie g_zombie[id] = 1 g_level[id] = random_num(1, 2)  // random class new isboss if (g_zbtype[id]==ZBTYPE_BOSS) { isboss = 1 g_zbtype[id] = 0 //client_print(0, print_chat, "ZBTYPE_BOSS") } g_zombieclass[id] = get_random_classzombie(isboss)  // Remove survivor's aura (bugfix) set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_BRIGHTLIGHT)  // Remove spawn protection (bugfix) set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_NODRAW)

 // Remove any zoom (bugfix) cs_set_user_zoom(id, CS_RESET_ZOOM, 1)  // Remove armor set_pev(id, pev_armorvalue, 0.0)  // Strip off from weapons fm_strip_user_weapons(id) fm_give_item(id, "weapon_knife")  // set team fm_cs_set_user_team(id, FM_CS_TEAM_T)

 // give info zombie new Float:gravity gravity = ArrayGetCell(zombie_gravity, g_zombieclass[id]) set_pev(id, pev_gravity, gravity) fm_set_user_health(id, get_zombie_health(id))  // set model set_model_for_player(id)  // give zombie bom if (g_zbtype[id]==ZBTYPE_ZOMBIEBOM) { give_zombiebom(id) g_zbtype[id] = 0 //client_print(0, print_chat, "ZBTYPE_ZOMBIEBOM") }

 // check model CurrentWeapon(id)  // nvg flashlight turn_off_flashlight(id) turn_off_nvg(id) cmd_nightvision(id)}set_model_for_player(id){  if (!is_user_connected(id)) return;  if (g_zombie[id]) { // set model player new model_view[64], model_index, idclass idclass = g_zombieclass[id] if (g_level[id]==1) { ArrayGetString(zombie_viewmodel_host, idclass, model_view, charsmax(model_view)) model_index = ArrayGetCell(zombie_modelindex_host, idclass) } else { ArrayGetString(zombie_viewmodel_origin, idclass, model_view, charsmax(model_view)) model_index = ArrayGetCell(zombie_modelindex_origin, idclass) } nst_set_user_model(id, model_view) if (get_zombie_set_modelindex(id)) nst_set_user_model_index(id, model_index) else nst_reset_user_model_index(id)

 //client_print(id, print_chat, "[%s][%s]", model_view, model_wpn) } else { nst_reset_user_model(id) }}get_zombie_set_modelindex(id){ if (!g_zombie[id]) return 0;  new modelindex = ArrayGetCell(zombie_modelindex, g_zombieclass[id]) if ( (modelindex==3) || (modelindex==2 && g_level[id]>1) || (modelindex==1 && g_level[id]==1) ) return 1; else return 0;  return 0;}get_random_classzombie(boss){ // firt check total boss and zombie new total_boss, total_zombie total_boss = ArraySize(idclass_boss) total_zombie = ArraySize(idclass_zombie)

 // random idclass zombie if not total_boss or total_zombie if ((boss && !total_boss) || (!boss && !total_zombie)) return random(class_count)  // random idclass new idclass if (boss) idclass = ArrayGetCell(idclass_boss, random(total_boss)) else idclass = ArrayGetCell(idclass_zombie, random(total_zombie))  return idclass}get_zombie_health(id){ if (!g_zombie[id]) return 0;  new Float:health, Float:health_up, Float:health_max, health_set, round, boss round = max(0, g_rount_count-1) health = float(ArrayGetCell(zombie_health, g_zombieclass[id])) boss = ArrayGetCell(zombie_boss, g_zombieclass[id])  if (boss) { health_up = health*(1.0 + zombie_health_up*round) health_max = health*(1.0 + zombie_health_max) } else { health_up = health*(zombie_health_start + zombie_health_up*round) health_max = health*zombie_health_max } health_set = min(floatround(health_max), floatround(health_up))  return health_set;}// reset value of playerreset_value(id){ g_zombie[id] = 0 g_zombieclass[id] = 0 g_kill[id] = 0 g_level[id] = 0 g_set_money[id] = 0 reset_value_death(id)

}reset_value_death(id){ if (task_exists(id+TASK_RESPAWN)) remove_task(id+TASK_RESPAWN) if (task_exists(id+TASK_PROTECTION)) remove_task(id+TASK_PROTECTION) if (task_exists(id+TASK_NVISION)) remove_task(id+TASK_NVISION)

 g_respawning[id] = 0 g_protection[id] = 0 g_nvg[id] = 0 g_zbtype[id] = 0  if (is_user_connected(id)) fm_set_rendering(id)}// ZombieBom Grenade Explosionzombiebom_explode(ent){ // Round ended (bugfix) if (g_newround || g_endround) return;  // Get origin static Float:originF[3] pev(ent, pev_origin, originF)  // Make the explosion EffectZombieBomExp(ent)  // explode sound engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, zombiebom_sound_exp, 1.0, ATTN_NORM, 0, PITCH_NORM)  // Get attacker static attacker attacker = pev(ent, pev_owner)  // Collisions static victim victim = -1  new Float:fOrigin[3],Float:fDistance,Float:fDamage while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, zombiebom_radius)) != 0) { // Only effect alive non-spawnprotected humans if (!is_user_alive(victim)) continue;  // get value pev(victim, pev_origin, fOrigin) fDistance = get_distance_f(fOrigin, originF) fDamage = zombiebom_power - floatmul(zombiebom_power, floatdiv(fDistance, zombiebom_radius))//get the damage value fDamage *= estimate_take_hurt(originF, victim, 0)//adjust if ( fDamage < 0 ) continue

 // create effect manage_effect_action(victim, fOrigin, originF, fDistance, fDamage * 35.0) nst_wpn_take_damage(attacker, victim, fDamage, NST_WPN_TYPEDAMAGE_NONE) }  // Get rid of the grenade engfunc(EngFunc_RemoveEntity, ent)  //client_print(0, print_chat, "AT[%i]", attacker)}EffectZombieBomExp(id){ static Float:origin[3]; pev(id,pev_origin,origin);  message_begin(MSG_BROADCAST,SVC_TEMPENTITY);  write_byte(TE_EXPLOSION); // TE_EXPLOSION write_coord(floatround(origin[0])); // origin x write_coord(floatround(origin[1])); // origin y write_coord(floatround(origin[2])); // origin z write_short(zombiebom_idsprites_exp); // sprites write_byte(40); // scale in 0.1's write_byte(30); // framerate write_byte(14); // flags  message_end(); // message end}manage_effect_action(iEnt, Float:fEntOrigin[3], Float:fPoint[3], Float:fDistance, Float:fDamage){ //return 1 new Float:Velocity[3] pev(iEnt, pev_velocity, Velocity)  new Float:fTime = floatdiv(fDistance, fDamage) new Float:fVelocity[3] fVelocity[0] = floatdiv((fEntOrigin[0] - fPoint[0]), fTime) fVelocity[1] = floatdiv((fEntOrigin[1] - fPoint[1]), fTime) fVelocity[2] = floatdiv((fEntOrigin[2] - fPoint[2]), fTime) set_pev(iEnt, pev_velocity, fVelocity) return 1}give_zombiebom(id){ if (!g_zombie[id]) return; if (ArrayGetCell(zombie_boss, g_zombieclass[id])) return;  // Get user weapons new weapons[32], num, i, weaponid num = 0 // reset passed weapons count (bugfix) get_user_weapons(id, weapons, num)  // Loop through them and drop primaries or secondaries for (i = 0; i < num; i++) { weaponid = weapons[i] if (weaponid != CSW_HEGRENADE) fm_give_item(id, WEAPONENTNAMES[CSW_HEGRENADE]) }}

// Respawn Player Manually (called after respawn checks are done)respawn_player_manually(id){ if (is_user_connected(id)) { ExecuteHamB(Ham_CS_RoundRespawn, id) } }// bartimerun_bartime(id, wait_time){ message_begin(MSG_ONE, g_msgBarTime, _, id) write_short(wait_time) message_end()}// Plays a sound on clientsPlaySound(id, const sound[]){ if (equal(sound[strlen(sound)-4], ".mp3")) client_cmd(id, "mp3 play ^"sound/%s^"", sound) else client_cmd(id, "spk ^"%s^"", sound)}

// Place user at a random spawndo_random_spawn(id, regularspawns = 0){ static hull, sp_index, i  // Get whether the player is crouching hull = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN  // Use regular spawns? if (!regularspawns) { // No spawns? if (!g_spawnCount) return;  // Choose random spawn to start looping at sp_index = random_num(0, g_spawnCount - 1)  // Try to find a clear spawn for (i = sp_index + 1; /*no condition*/; i++) { // Start over when we reach the end if (i >= g_spawnCount) i = 0  // Free spawn space? if (is_hull_vacant(g_spawns[i], hull)) { // Engfunc_SetOrigin is used so ent's mins and maxs get updated instantly engfunc(EngFunc_SetOrigin, id, g_spawns[i]) break; }  // Loop completed, no free space found if (i == sp_index) break; } } else { // No spawns? if (!g_spawnCount2) return;  // Choose random spawn to start looping at sp_index = random_num(0, g_spawnCount2 - 1)  // Try to find a clear spawn for (i = sp_index + 1; /*no condition*/; i++) { // Start over when we reach the end if (i >= g_spawnCount2) i = 0  // Free spawn space? if (is_hull_vacant(g_spawns2[i], hull)) { // Engfunc_SetOrigin is used so ent's mins and maxs get updated instantly engfunc(EngFunc_SetOrigin, id, g_spawns2[i]) break; }  // Loop completed, no free space found if (i == sp_index) break; } }}

// Get Type of Weaponget_weapon_type(weaponid){ new type_wpn = 0 if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM) type_wpn = 1 else if ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM) type_wpn = 2 else if ((1<<weaponid) & NADE_WEAPONS_BIT_SUM) type_wpn = 4 return type_wpn}FixNumber(number){ new numstr[32] if (number<0) format(numstr, 31, "0") else if (number<10) format(numstr, 31, "0%i", number) else format(numstr, 31, "%i", number)  return numstr}// Turn Off Flashlight and Restore Batteriesturn_off_flashlight(id){ // Restore batteries for the next use fm_cs_set_user_batteries(id, 100)  // Check if flashlight is on if (pev(id, pev_effects) & EF_DIMLIGHT) { // Turn it off set_pev(id, pev_impulse, IMPULSE_FLASHLIGHT) } else { // Clear any stored flashlight impulse (bugfix) set_pev(id, pev_impulse, 0) }  // Update flashlight HUD message_begin(MSG_ONE, get_user_msgid("Flashlight"), _, id) write_byte(0) // toggle write_byte(100) // battery message_end()}color_saytext(player, const message[], any:...){ new text[301] format(text, 300, "%s", message)

 new dest if (player) dest = MSG_ONE else dest = MSG_ALL  message_begin(dest, get_user_msgid("SayText"), {0,0,0}, player) write_byte(1) write_string(check_text(text)) return message_end()}check_text(text1[]){ new text[301] format(text, 300, "%s", text1) replace(text, 300, ">x04", "^x04") replace(text, 300, ">x03", "^x03") replace(text, 300, ">x01", "^x01") return text}SendCenterText(id, message[]){ new dest if (id) dest = MSG_ONE else dest = MSG_ALL  message_begin(dest, g_msgTextMsg, {0,0,0}, id) write_byte(4) write_string(message) message_end()}FloatToStr(Float:num){ new str[64] float_to_str(num, str, charsmax(str)) return str;}set_player_nextattack(id, Float:nexttime){ set_pdata_float(id, OFFSET_flNextAttack, nexttime, 4)}PlayEmitSound(id, type, const sound[]){ emit_sound(id, type, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)}remove_ent_by_class(classname[]){ new nextitem  = find_ent_by_class(-1, classname) while(nextitem) { remove_entity(nextitem) nextitem = find_ent_by_class(-1, classname) }}



// ##################### Lighting Effects #####################// Lighting Effects Taskpublic lighting_effects(){ // Get lighting style static lighting[2] get_pcvar_string(cvar_lighting, lighting, charsmax(lighting)) strtolower(lighting)  // Lighting disabled? ["0"] if (lighting[0] == '0') return;  // Darkest light settings? if (lighting[0] >= 'a' && lighting[0] <= 'd') { static thunderclap_in_progress, Float:thunder thunderclap_in_progress = task_exists(TASK_THUNDER) thunder = get_pcvar_float(cvar_thunder)  // Set thunderclap tasks if not existant if (thunder > 0.0 && !task_exists(TASK_THUNDER_PRE) && !thunderclap_in_progress) { g_lights_i = 0 ArrayGetString(lights_thunder, random_num(0, ArraySize(lights_thunder) - 1), g_lights_cycle, charsmax(g_lights_cycle)) g_lights_cycle_len = strlen(g_lights_cycle) //set_task(thunder, "thunderclap", TASK_THUNDER_PRE) }  // Set lighting only when no thunderclaps are going on if (!thunderclap_in_progress) engfunc(EngFunc_LightStyle, 0, lighting) } else { // Remove thunderclap tasks if (task_exists(TASK_THUNDER_PRE)) remove_task(TASK_THUNDER_PRE) if (task_exists(TASK_THUNDER)) remove_task(TASK_THUNDER)  // Set lighting engfunc(EngFunc_LightStyle, 0, lighting) }}// Thunderclap taskpublic thunderclap(){ // Play thunder sound if (g_lights_i == 0) { static sound[64] ArrayGetString(sound_thunder, random_num(0, ArraySize(sound_thunder) - 1), sound, charsmax(sound)) PlaySound(0, sound) }  // Set lighting static light[2] light[0] = g_lights_cycle[g_lights_i] engfunc(EngFunc_LightStyle, 0, light)  g_lights_i++  // Lighting cycle end? if (g_lights_i >= g_lights_cycle_len) { if (task_exists(TASK_THUNDER)) remove_task(TASK_THUNDER) lighting_effects() } // Lighting cycle start? else if (!task_exists(TASK_THUNDER)) set_task(0.1, "thunderclap", TASK_THUNDER, _, _, "b")}



/*================================================================================ [Message Hooks]=================================================================================*/// Fix for the HL engine bug when HP is multiples of 256public message_health(msg_id, msg_dest, msg_entity){ // Get player's health static health health = get_msg_arg_int(1)  // Don't bother if (health < 256) return;  // Check if we need to fix it if (health % 256 == 0) fm_set_user_health(msg_entity, pev(msg_entity, pev_health) + 1)  // HUD can only show as much as 255 hp set_msg_arg_int(1, get_msg_argtype(1), 255)}// Block flashlight battery messages if custom flashlight is enabled insteadpublic message_flashbat(){ return PLUGIN_HANDLED;}// Prevent spectators' nightvision from being turned off when switching targets, etc.public message_nvgtoggle(){ return PLUGIN_HANDLED;}// Prevent zombies from seeing any weapon pickup iconpublic message_weappickup(msg_id, msg_dest, msg_entity){ if (g_zombie[msg_entity]) return PLUGIN_HANDLED;  return PLUGIN_CONTINUE;}// Prevent zombies from seeing any ammo pickup iconpublic message_ammopickup(msg_id, msg_dest, msg_entity){ if (g_zombie[msg_entity]) return PLUGIN_HANDLED;  return PLUGIN_CONTINUE;}// Block hostage HUD displaypublic message_scenario(){ if (get_msg_args() > 1) { static sprite[8] get_msg_arg_string(2, sprite, charsmax(sprite))  if (equal(sprite, "hostage")) return PLUGIN_HANDLED; }  return PLUGIN_CONTINUE;}// Block hostages from appearing on radarpublic message_hostagepos(){ return PLUGIN_HANDLED;}// Block some text messagespublic message_textmsg(){ static textmsg[22] get_msg_arg_string(2, textmsg, charsmax(textmsg))  // Game restarting, reset scores and call round end to balance the teams if (equal(textmsg, "#Game_will_restart_in")) { logevent_round_end() g_score_human = 0 g_score_zombie = 0 g_zombie_die = 0 new g_kill_reset[33] g_kill = g_kill_reset } else if (equal(textmsg, "#Game_Commencing")) { g_startcount = 1 } // Block round end related messages else if (equal(textmsg, "#Hostages_Not_Rescued") || equal(textmsg, "#Round_Draw") || equal(textmsg, "#Terrorists_Win") || equal(textmsg, "#CTs_Win")) { return PLUGIN_HANDLED; }

 return PLUGIN_CONTINUE;}// Block CS round win audio messages, since we're playing our own insteadpublic message_sendaudio(){ static audio[17] get_msg_arg_string(2, audio, charsmax(audio))  if(equal(audio[7], "terwin") || equal(audio[7], "ctwin") || equal(audio[7], "rounddraw")) return PLUGIN_HANDLED;  return PLUGIN_CONTINUE;}// Send actual team scores (T = zombies // CT = humans)public message_teamscore(){ static team[2] get_msg_arg_string(1, team, charsmax(team))  switch (team[0]) { // CT case 'C': set_msg_arg_int(2, get_msg_argtype(2), g_score_human) // Terrorist case 'T': set_msg_arg_int(2, get_msg_argtype(2), g_score_zombie) }}public message_hudtextargs(){ return PLUGIN_HANDLED;}public message_deathmsg(){ // get value data static victim victim = get_msg_arg_int(2) if (g_zombie[victim]) { return PLUGIN_HANDLED }

 return PLUGIN_CONTINUE}



/*================================================================================ [Main Stock]=================================================================================*/

// Set a Player's Teamstock fm_cs_set_user_team(id, team){ cs_set_user_team(id, team, 0)}// Set user moneystock fm_cs_set_user_money(id, money){ cs_set_user_money(id, money, 1)}// Set player's health (from fakemeta_util)stock fm_set_user_health(id, health){ (health > 0) ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id);}// Drop primary/secondary weaponsstock drop_weapons(id, dropwhat, type=0){ // Get user weapons static weapons[32], num, i, weaponid num = 0 // reset passed weapons count (bugfix) get_user_weapons(id, weapons, num)  // Loop through them and drop primaries or secondaries for (i = 0; i < num; i++) { // Prevent re-indexing the array weaponid = weapons[i]  if (get_weapon_type(weaponid) == dropwhat) { if (type==1) { fm_strip_user_gun(id, weaponid) } else { // Get weapon entity static wname[32], weapon_ent get_weaponname(weaponid, wname, charsmax(wname)) weapon_ent = fm_find_ent_by_owner(-1, wname, id)  // Hack: store weapon bpammo on PEV_ADDITIONAL_AMMO set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, cs_get_user_bpammo(id, weaponid))  // Player drops the weapon and looses his bpammo engclient_cmd(id, "drop", wname) } } }}// Find entity by its owner (from fakemeta_util)stock fm_find_ent_by_owner(entity, const classname[], owner){ while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) { /* keep looping */ } return entity;}// Get User Teamstock fm_set_user_armor(id, armor){ set_pev(id, pev_armorvalue, float(min(armor, 999)))}// Get User Teamstock fm_cs_get_user_team(id){ return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX);}// Set entity's rendering type (from fakemeta_util)stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16){ static Float:color[3] color[0] = float(r) color[1] = float(g) color[2] = float(b)  set_pev(entity, pev_renderfx, fx) set_pev(entity, pev_rendercolor, color) set_pev(entity, pev_rendermode, render) set_pev(entity, pev_renderamt, float(amount))}// only weapon index or its name can be passed, if neither is passed then the current gun will be strippedstock fm_strip_user_gun(index, wid = 0, const wname[] = "") { new ent_class[32]; if (!wid && wname[0]) copy(ent_class, sizeof ent_class - 1, wname); else { new weapon = wid, clip, ammo; if (!weapon && !(weapon = get_user_weapon(index, clip, ammo))) return false;  get_weaponname(weapon, ent_class, sizeof ent_class - 1); }

 new ent_weap = fm_find_ent_by_owner(-1, ent_class, index); if (!ent_weap) return false;

 engclient_cmd(index, "drop", ent_class);

 new ent_box = pev(ent_weap, pev_owner); if (!ent_box || ent_box == index) return false;

 dllfunc(DLLFunc_Think, ent_box);

 return true;}

// Simplified get_weaponid (CS only)stock cs_weapon_name_to_id(const weapon[]){ static i for (i = 0; i < sizeof WEAPONENTNAMES; i++) { if (equal(weapon, WEAPONENTNAMES[i])) return i; }  return 0;}

// Give an item to a player (from fakemeta_util)stock fm_give_item(id, const item[]){ static ent ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item)) if (!pev_valid(ent)) return;  static Float:originF[3] pev(id, pev_origin, originF) set_pev(ent, pev_origin, originF) set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN) dllfunc(DLLFunc_Spawn, ent)  static save save = pev(ent, pev_solid) dllfunc(DLLFunc_Touch, ent, id) if (pev(ent, pev_solid) != save) return;  engfunc(EngFunc_RemoveEntity, ent)}// Set an entity's key value (from fakemeta_util)stock fm_set_kvd(entity, const key[], const value[], const classname[]){ set_kvd(0, KV_ClassName, classname) set_kvd(0, KV_KeyName, key) set_kvd(0, KV_Value, value) set_kvd(0, KV_fHandled, 0)

 dllfunc(DLLFunc_KeyValue, entity, 0)}// Checks if a space is vacant (credits to VEN)stock is_hull_vacant(Float:origin[3], hull){ engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, 0)  if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen)) return true;  return false;}// Collect random spawn pointsstock load_spawns(){ // Check for ZB spawns of the current map new cfgdir[32], mapname[32], filepath[100], linedata[64] get_configsdir(cfgdir, charsmax(cfgdir)) get_mapname(mapname, charsmax(mapname)) formatex(filepath, charsmax(filepath), SPAWNS_URL, cfgdir, mapname)  // Load ZB spawns if present if (file_exists(filepath)) { new zbspawns_data[10][6], file = fopen(filepath,"rt")  while (file && !feof(file)) { fgets(file, linedata, charsmax(linedata))  // invalid spawn if(!linedata[0] || str_count(linedata,' ') < 2) continue;  // get spawn point data parse(linedata,zbspawns_data[0],5,zbspawns_data[1],5,zbspawns_data[2],5,zbspawns_data[3],5,zbspawns_data[4],5,zbspawns_data[5],5,zbspawns_data[6],5,zbspawns_data[7],5,zbspawns_data[8],5,zbspawns_data[9],5)  // origin g_spawns[g_spawnCount][0] = floatstr(zbspawns_data[0]) g_spawns[g_spawnCount][1] = floatstr(zbspawns_data[1]) g_spawns[g_spawnCount][2] = floatstr(zbspawns_data[2])  // increase spawn count g_spawnCount++ if (g_spawnCount >= sizeof g_spawns) break; } if (file) fclose(file) } else { // Collect regular spawns collect_spawns_ent("info_player_start") collect_spawns_ent("info_player_deathmatch") }  // Collect regular spawns for non-random spawning unstuck collect_spawns_ent2("info_player_start") collect_spawns_ent2("info_player_deathmatch")}

// Collect spawn points from entity originsstock collect_spawns_ent(const classname[]){ new ent = -1 while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", classname)) != 0) { // get origin new Float:originF[3] pev(ent, pev_origin, originF) g_spawns[g_spawnCount][0] = originF[0] g_spawns[g_spawnCount][1] = originF[1] g_spawns[g_spawnCount][2] = originF[2]  // increase spawn count g_spawnCount++ if (g_spawnCount >= sizeof g_spawns) break; }}

// Collect spawn points from entity originsstock collect_spawns_ent2(const classname[]){ new ent = -1 while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", classname)) != 0) { // get origin new Float:originF[3] pev(ent, pev_origin, originF) g_spawns2[g_spawnCount2][0] = originF[0] g_spawns2[g_spawnCount2][1] = originF[1] g_spawns2[g_spawnCount2][2] = originF[2]  // increase spawn count g_spawnCount2++ if (g_spawnCount2 >= sizeof g_spawns2) break; }}// Stock by (probably) Twilight Suzuka -counts number of chars in a stringstock str_count(const str[], searchchar){ new count, i, len = strlen(str)  for (i = 0; i <= len; i++) { if(str[i] == searchchar) count++ }  return count;}// Strip user weapons (from fakemeta_util)stock fm_strip_user_weapons(id){ static ent ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip")) if (!pev_valid(ent)) return;  dllfunc(DLLFunc_Spawn, ent) dllfunc(DLLFunc_Use, ent, id) if (pev_valid(ent)) engfunc(EngFunc_RemoveEntity, ent)}// Set User Flashlight Batteriesstock fm_cs_set_user_batteries(id, value){ set_pdata_int(id, OFFSET_FLASHLIGHT_BATTERY, value, OFFSET_LINUX)}stock Float:estimate_take_hurt(Float:fPoint[3], ent, ignored) { new Float:fOrigin[3] new tr new Float:fFraction pev(ent, pev_origin, fOrigin) //UTIL_TraceLine ( vecSpot, vecSpot + Vector ( 0, 0, -40 ),  ignore_monsters, ENT(pev), & tr) engfunc(EngFunc_TraceLine, fPoint, fOrigin, DONT_IGNORE_MONSTERS, ignored, tr) get_tr2(tr, TR_flFraction, fFraction) if ( fFraction == 1.0 || get_tr2( tr, TR_pHit ) == ent )//no valid enity between the explode point & player return 1.0 return 0.6//if has fraise, lessen blast hurt}

/*================================================================================ [Get Config]=================================================================================*/load_customization_from_files(){ // Build customization file path new path[64] get_configsdir(path, charsmax(path)) format(path, charsmax(path), "%s/%s", path, SETTING_FILE)  // File not present if (!file_exists(path)) { new error[100] formatex(error, charsmax(error), "Cannot load customization file %s!", path) set_fail_state(error) return; }  // Set up some vars to hold parsing info new linedata[1024], key[64], value[960], section  // Open customization file for reading new file = fopen(path, "rt")  while (file && !feof(file)) { // Read one line at a time fgets(file, linedata, charsmax(linedata))  // Replace newlines with a null character to prevent headaches replace(linedata, charsmax(linedata), "^n", "")  // Blank line or comment if (!linedata[0] || linedata[0] == ';') continue;  // New section starting if (linedata[0] == '[') { section++ continue; }  // Get key and value(s) strtok(linedata, key, charsmax(key), value, charsmax(value), '=')  // Trim spaces trim(key) trim(value)  switch (section) { case SECTION_CONFIG_VALUE: { if (equal(key, "ROUND_TIME")) g_round_time = str_to_float(value) else if (equal(key, "FREE_TIME")) g_free_time = str_to_float(value) else if (equal(key, "ZOMBIE_WAKE_TIME")) g_zombie_wake_time = str_to_num(value) else if (equal(key, "ZOMBIES_BOSS")) g_zombies_boss = str_to_num(value) else if (equal(key, "ZOMBIES_ZOMBIEBOMB")) g_zombies_zombiebomb = str_to_num(value) else if (equal(key, "MONEY_START")) g_money_start = str_to_num(value) else if (equal(key, "MONEY_KILL_ZOMBIE")) g_money_kill_zombie = str_to_num(value) else if (equal(key, "RESPAWN_WAIT")) g_respawn_wait = str_to_float(value) else if (equal(key, "PROTECTION_TIME")) g_pro_time = str_to_float(value) else if (equal(key, "PROTECTION_COLOR")) { while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { trim(key) trim(value) ArrayPushCell(g_pro_color, str_to_num(key)) } } else if (equal(key, "HUMAN_LEVELUP_HEALTHUP")) human_levelup_healthup = str_to_num(value) else if (equal(key, "HUMAN_KILLS_LEVELUP")) human_kills_levelup = str_to_num(value) else if (equal(key, "HUMAN_MAX_LEVEL")) human_max_level = str_to_num(value) else if (equal(key, "HUMAN_HEALTH")) human_health = str_to_num(value) else if (equal(key, "HUMAN_ARMOR")) human_armor = str_to_num(value) else if (equal(key, "ZOMBIE_HEALTH_START")) zombie_health_start = str_to_float(value) else if (equal(key, "ZOMBIE_HEALTH_UP")) zombie_health_up = str_to_float(value) else if (equal(key, "ZOMBIE_HEALTH_MAX")) zombie_health_max = str_to_float(value) else if (equal(key, "ZOMBIE_SPEED_START")) zombie_speed_start = str_to_float(value) else if (equal(key, "ZOMBIE_SPEED_UP")) zombie_speed_up = str_to_float(value) else if (equal(key, "ZOMBIE_SPEED_MAX")) zombie_speed_max = str_to_float(value) } case SECTION_SUPPLYBOX: { if (equal(key, "SUPPLYBOX_MAX")) supplybox_max = min(MAX_SUPPLYBOX, str_to_num(value)) else if (equal(key, "SUPPLYBOX_MODEL")) { while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { trim(key) trim(value) ArrayPushString(supplybox_models, key) } } if (equal(key, "SUPPLYBOX_ITEM")) { strtolower(value) while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { trim(key) trim(value) ArrayPushString(supplybox_item, key) } } if (equal(key, "SUPPLYBOX_ITEM_NADE")) { strtolower(value) while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { trim(key) trim(value) ArrayPushString(supplybox_item_nade, key) } } else if (equal(key, "SUPPLYBOX_SOUND_PICKUP")) format(supplybox_sound_pickup, charsmax(supplybox_sound_pickup), "%s", value) else if (equal(key, "SUPPLYBOX_SOUND_DROP")) format(supplybox_sound_drop, charsmax(supplybox_sound_drop), "%s", value)

 } case SECTION_ZOMBIEBOM: { if (equal(key, "MODEL")) { format(zombiebom_model, charsmax(zombiebom_model), "%s", value) format(zombiebom_model_p, charsmax(zombiebom_model_p), "models/nst_zombie/p_%s.mdl", value) format(zombiebom_model_w, charsmax(zombiebom_model_w), "models/nst_zombie/w_%s.mdl", value) } else if (equal(key, "RADIUS")) zombiebom_radius = str_to_float(value) else if (equal(key, "POWER")) zombiebom_power = str_to_float(value) else if (equal(key, "SPRITES_EXP")) format(zombiebom_sprites_exp, charsmax(zombiebom_sprites_exp), "%s", value) else if (equal(key, "SOUND_EXP")) format(zombiebom_sound_exp, charsmax(zombiebom_sound_exp), "%s", value)

 } case SECTION_SOUNDS: { if (equal(key, "THUNDER")) { // Parse sounds while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { // Trim spaces trim(key) trim(value)  // Add to sounds array ArrayPushString(sound_thunder, key) } } else if (equal(key, "ZOMBIE_ATTACK")) { while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { trim(key) trim(value) ArrayPushString(sound_zombie_attack, key) } } else if (equal(key, "ZOMBIE_HITWALL")) { while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { trim(key) trim(value) ArrayPushString(sound_zombie_hitwall, key) } } else if (equal(key, "ZOMBIE_SWING")) { while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { trim(key) trim(value) ArrayPushString(sound_zombie_swing, key) } } else if (equal(key, "ROUND_CLEAR")) format(sound_round_clear, charsmax(sound_round_clear), "%s", value) else if (equal(key, "ROUND_FAIL")) format(sound_round_fail, charsmax(sound_round_fail), "%s", value) else if (equal(key, "LEVELUP")) format(sound_levelup, charsmax(sound_levelup), "%s", value) else if (equal(key, "MATCH_READY")) format(sound_match_ready, charsmax(sound_match_ready), "%s", value) else if (equal(key, "MATCH_START")) format(sound_match_start, charsmax(sound_match_start), "%s", value) } case SECTION_SPRITES: { } case SECTION_WEATHER_EFFECTS: { if (equal(key, "RAIN")) g_ambience_rain = str_to_num(value) else if (equal(key, "SNOW")) g_ambience_snow = str_to_num(value) else if (equal(key, "FOG")) g_ambience_fog = str_to_num(value) else if (equal(key, "FOG DENSITY")) copy(g_fog_density, charsmax(g_fog_density), value) else if (equal(key, "FOG COLOR")) copy(g_fog_color, charsmax(g_fog_color), value) } case SECTION_SKY: { if (equal(key, "ENABLE")) g_sky_enable = str_to_num(value) else if (equal(key, "SKY NAMES")) { // Parse sky names while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { // Trim spaces trim(key) trim(value)  // Add to skies array ArrayPushString(g_sky_names, key)  // Preache custom sky files formatex(linedata, charsmax(linedata), "gfx/env/%sbk.tga", key) engfunc(EngFunc_PrecacheGeneric, linedata) formatex(linedata, charsmax(linedata), "gfx/env/%sdn.tga", key) engfunc(EngFunc_PrecacheGeneric, linedata) formatex(linedata, charsmax(linedata), "gfx/env/%sft.tga", key) engfunc(EngFunc_PrecacheGeneric, linedata) formatex(linedata, charsmax(linedata), "gfx/env/%slf.tga", key) engfunc(EngFunc_PrecacheGeneric, linedata) formatex(linedata, charsmax(linedata), "gfx/env/%srt.tga", key) engfunc(EngFunc_PrecacheGeneric, linedata) formatex(linedata, charsmax(linedata), "gfx/env/%sup.tga", key) engfunc(EngFunc_PrecacheGeneric, linedata) } } } case SECTION_LIGHTNING: { if (equal(key, "LIGHTS")) { // Parse lights while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { // Trim spaces trim(key) trim(value)  // Add to lightning array ArrayPushString(lights_thunder, key) } } } case SECTION_KNOCKBACK: { // Format weapon entity name strtolower(key) format(key, charsmax(key), "weapon_%s", key)  // Add value to knockback power array kb_weapon_power[cs_weapon_name_to_id(key)] = str_to_float(value) } case SECTION_OBJECTIVE_ENTS: { if (equal(key, "CLASSNAMES")) { // Parse classnames while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { // Trim spaces trim(key) trim(value)  // Add to objective ents array ArrayPushString(g_objective_ents, key) } } } } } if (file) fclose(file)}



/*================================================================================ [Custom Natives]=================================================================================*/public native_register_zombie_class(const name[], const model[], health, Float:gravity, Float:speed, Float:knockback, const sound_death1[], const sound_death2[], const sound_hurt1[], const sound_hurt2[], const sound_heal[], sex, modelindex, boss){ // Strings passed byref param_convert(1) param_convert(2) param_convert(6) param_convert(7) param_convert(8) param_convert(9) param_convert(10) param_convert(11)  // Add the class ArrayPushString(zombie_name, name) ArrayPushCell(zombie_health, health) ArrayPushCell(zombie_gravity, gravity) ArrayPushCell(zombie_speed, speed) ArrayPushCell(zombie_knockback, knockback) ArrayPushCell(zombie_sex, sex) ArrayPushCell(zombie_boss, boss) ArrayPushCell(zombie_modelindex, modelindex) ArrayPushString(zombie_sound_death1, sound_death1) ArrayPushString(zombie_sound_death2, sound_death2) ArrayPushString(zombie_sound_hurt1, sound_hurt1) ArrayPushString(zombie_sound_hurt2, sound_hurt2) ArrayPushString(zombie_sound_heal, sound_heal)  new viewmodel_host[64], viewmodel_origin[64], viewmodel_host_url[64], viewmodel_origin_url[64], wpnmodel[64], v_zombiebom[64] if (boss) { formatex(viewmodel_host, charsmax(viewmodel_host), "%s", model) formatex(viewmodel_origin, charsmax(viewmodel_origin), "%s", model) } else { formatex(viewmodel_host, charsmax(viewmodel_host), "%s_host", model) formatex(viewmodel_origin, charsmax(viewmodel_origin), "%s_origin", model) } formatex(viewmodel_host_url, charsmax(viewmodel_host_url), "models/player/%s/%s.mdl", viewmodel_host, viewmodel_host) formatex(viewmodel_origin_url, charsmax(viewmodel_origin_url), "models/player/%s/%s.mdl", viewmodel_origin, viewmodel_origin) formatex(wpnmodel, charsmax(wpnmodel), "models/nst_zombie/v_knife_%s.mdl", model) formatex(v_zombiebom, charsmax(v_zombiebom), "models/nst_zombie/v_zombibomb_%s.mdl", model)  ArrayPushString(zombie_viewmodel_host, viewmodel_host) ArrayPushString(zombie_viewmodel_origin, viewmodel_origin) ArrayPushString(zombie_wpnmodel, wpnmodel) ArrayPushString(zombiebom_viewmodel, v_zombiebom)  ArrayPushCell(zombie_modelindex_host, engfunc(EngFunc_PrecacheModel, viewmodel_host_url)) ArrayPushCell(zombie_modelindex_origin, engfunc(EngFunc_PrecacheModel, viewmodel_origin_url)) engfunc(EngFunc_PrecacheSound, sound_death1) engfunc(EngFunc_PrecacheSound, sound_death2) engfunc(EngFunc_PrecacheSound, sound_hurt1) engfunc(EngFunc_PrecacheSound, sound_hurt2) engfunc(EngFunc_PrecacheSound, sound_heal) if (!boss) { engfunc(EngFunc_PrecacheModel, wpnmodel) engfunc(EngFunc_PrecacheModel, v_zombiebom) }  // give idclass boss zombie if (boss) ArrayPushCell(idclass_boss, class_count) else ArrayPushCell(idclass_zombie, class_count)  // Increase registered classes counter class_count++  // Return id under which we registered the class return class_count-1;}public native_get_user_sex(id){ new sex if (g_zombie[id]) sex = ArrayGetCell(zombie_sex, g_zombieclass[id]) else sex = nst_get_user_sex(id)  return sex}public native_get_user_zombie(id){ return g_zombie[id];}public native_get_user_zombie_class(id){ return g_zombieclass[id];}public natives_color_saytext(player, const message[], any:...){ param_convert(2) color_saytext(player, message) return 1}public native_get_user_level(id){ return g_level[id];}public native_get_user_start_health(id){ return get_zombie_health(id)}public native_get_mod(){ return ZOMBIE_MOD;}public native_get_take_damage(){ new take_dmg if (!g_newround && !g_endround && !g_freezetime) take_dmg = 1  return take_dmg}public native_get_damage_nade(){ return get_pcvar_num(cvar_damage_nade)}public natives_get_weapons_ammo(idwpn){ return get_ammo_buywpn(idwpn)}

// native bug fixpublic native_novalue(id){ return 0}/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }*/


如果我想要讓他再多一隻BOSS  假如說是雷比亞好了  那我應該在哪裡修改??



三傻 Aal lzz Well   好聽~~
獻花 x0 回到頂端 [樓 主] From:臺灣中華電信股份有限公司 | Posted:2011-06-12 10:27 |
ad2255819
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x2 鮮花 x8
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

....都沒有插件大神來逛逛的嗎= =?


三傻 Aal lzz Well   好聽~~
獻花 x0 回到頂端 [1 樓] From:臺灣中華電信股份有限公司 | Posted:2011-06-13 18:21 |
zsx123665 手機 會員卡
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x16 鮮花 x95
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

挖,好麻煩 = =
我也不會 -/-
我只知道:
#include <amxmodx> <-代表載入or 參考 amxmodx.inc


獻花 x0 回到頂端 [2 樓] From:臺灣亞太線上服務股份有限公司 | Posted:2011-11-14 08:32 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.070232 second(s),query:16 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言