/*-------------------------------------------------------------------------------------------------* [ Zombie Plague Plugin Addon: Counter-Strike Online In-Game Theme ] [ By jc980 ] Description: - Adds Countdown And Warning Sounds And Round Start Sounds And Ambience Sounds Kill Effects. Changelog: - 0.1 - Countdown Added - 0.2 - Sounds Added - 0.3 - Warning Added - 0.4 - Infection Warning Added - 0.5 - Round Start Music Added - 0.6 - Ambience Sound Added - 0.7 - ZP Round Start Warning Added - 0.8 - Fixed Problem At zp_user_infected_post - 0.9 - Optimization - 1.0 - Tested Plugin - 1.1 - Countdown Fix - 1.2 - Sound Fix - 1.3 - Re-Optimization - 1.4 - Emit Sound Fix - 1.5 - Optimization - 1.6 - Added NVault - 1.7 - Points And Kills - 1.8 - Countdown Sound Re-Fix - 1.9 - Kill Streaks - 2.0 - Fixed Kill Streak On Infect - 2.1 - Changed Nick To IP Save Method - 2.2 - Fixed Double Kill Sound - 2.3 - Added Limited Time Before Kill Streak Disappears - 2.4 - HUD Problem Fixed - 2.5 - Kill Type Problem Fixed - 2.6 - Changed Fix Emit_Sound With Speak - 2.7 - Re-Optimization Coming Updates: - Supply Box Drop - Speed Run Extra Item - x1.5 Ammo Extra Item - Damage Recoil Level - Zombie Evolution Level - Hammer Extra Item - x30% Damage Recoil Level Extra Item - x5 Damage To Zombies Extra Item - Zombie Regeneration - Something Else Thats Cool *-------------------------------------------------------------------------------------------------*/ #include #include #include #include #include new const ZP_CSO_PLUGIN_NAME[] = "[ZP] CSO In-Game Theme" new const ZP_CSO_PLUGIN_VERSION[] = "2.7" new const ZP_CSO_PLUGIN_AUTHOR[] = "jc980" new zp_cso_sec, zp_center_textmsg new zp_cso_hud_sync1, zp_cso_hud_sync2 new zp_cso_authid[33][35], zp_cso_vault new zp_cso_points[33], zp_cso_point_multiplier[33] new zp_cso_kill_lvl[33], zp_cso_kill_total[33], zp_cso_kill_time[33], zp_cso_kill_time_end, zp_cso_maxkills new const zp_cso_roundstart[][] = { "sound/zombie_plague/cso/zombi_start.mp3" } new const zp_cso_roundambience[][] = { "sound/zombie_plague/cso/zombi_ambience.mp3" } new const zp_cso_infectchant[][] = { "zombie_plague/cso/zombi_coming_1.wav" } new const zp_cso_warning[][] = { "zombie_plague/cso/20secs.wav" } new zp_cso_countchant[10][] = { "zombie_plague/cso/1.wav", "zombie_plague/cso/2.wav", "zombie_plague/cso/3.wav", "zombie_plague/cso/4.wav", "zombie_plague/cso/5.wav", "zombie_plague/cso/6.wav", "zombie_plague/cso/7.wav", "zombie_plague/cso/8.wav", "zombie_plague/cso/9.wav", "zombie_plague/cso/10.wav" } new zp_cso_kill_sounds1[14][] = { "zombie_plague/cso/kill1.wav", "zombie_plague/cso/kill2.wav", "zombie_plague/cso/kill3.wav", "zombie_plague/cso/kill4.wav", "zombie_plague/cso/kill5.wav", "zombie_plague/cso/kill6.wav", "zombie_plague/cso/kill7.wav", "zombie_plague/cso/kill8.wav", "zombie_plague/cso/kill9.wav", "zombie_plague/cso/kill10.wav", "zombie_plague/cso/kill11.wav", "zombie_plague/cso/kill12.wav", "zombie_plague/cso/kill13.wav", "zombie_plague/cso/kill14.wav" } new zp_cso_kill_sounds2[3][] = { "zombie_plague/cso/kill_knife.wav", "zombie_plague/cso/kill_grenade.wav", "zombie_plague/cso/kill_headshot.wav" } new const zp_cso_kill_r[14] = { 250, 50, 250, 250, 250, 250, 250, 50, 250, 250, 250, 250, 250, 250 } new const zp_cso_kill_g[14] = { 250, 150, 250, 150, 0, 250, 50, 150, 150, 0, 150, 250, 150, 0 } new const zp_cso_kill_b[14] = { 250, 250, 50, 50, 0, 50, 250, 250, 50, 0, 250, 50, 50, 0 } public plugin_init() { register_plugin(ZP_CSO_PLUGIN_NAME, ZP_CSO_PLUGIN_VERSION, ZP_CSO_PLUGIN_AUTHOR) register_event("HLTV", "zp_cso_round_start", "a", "1=0", "2=0") register_event("DeathMsg", "zp_cso_death", "a"); zp_center_textmsg = get_user_msgid("TextMsg") zp_cso_vault = nvault_open("zp_cso_theme20") zp_cso_hud_sync1 = CreateHudSyncObj() zp_cso_hud_sync2 = CreateHudSyncObj() } public plugin_end() { nvault_close(zp_cso_vault) } public plugin_precache() { register_dictionary("zp_cso_theme.txt") new i for(i = 0; i < sizeof zp_cso_roundstart; i++) engfunc(EngFunc_PrecacheGeneric, zp_cso_roundstart[i]) for(i = 0; i < sizeof zp_cso_roundambience; i++) engfunc(EngFunc_PrecacheGeneric, zp_cso_roundambience[i]) for(i = 0; i < sizeof zp_cso_infectchant; i++) engfunc(EngFunc_PrecacheSound, zp_cso_infectchant[i]) for(i = 0; i < sizeof zp_cso_warning; i++) engfunc(EngFunc_PrecacheSound, zp_cso_warning[i]) for(i = 0; i < sizeof zp_cso_countchant; i++) engfunc(EngFunc_PrecacheSound, zp_cso_countchant[i]) for(i = 0; i < sizeof zp_cso_kill_sounds1; i++) engfunc(EngFunc_PrecacheSound, zp_cso_kill_sounds1[i]) for(i = 0; i < sizeof zp_cso_kill_sounds2; i++) engfunc(EngFunc_PrecacheSound, zp_cso_kill_sounds2[i]) } public zp_cso_round_start() { new iSound, iMP3, MP3[64] iSound = random_num(0,charsmax(zp_cso_warning)) iMP3 = random_num(0,charsmax(zp_cso_roundstart)) copy(MP3, charsmax(MP3), zp_cso_roundstart[iMP3]) emit_sound( 0, CHAN_VOICE, zp_cso_warning[iSound], 1.0, ATTN_NORM, 0, PITCH_NORM ) client_cmd(0,"mp3 play ^"%s^"", MP3) zp_cso_maxkills = 14 zp_cso_kill_time_end = 10 zp_cso_sec = 20 set_task(20.0,"zp_cso_ambience") zp_cso_countdown() } public zp_cso_death() { new iKiller = read_data(1) new iVictim = read_data(2) new iHeadshot = read_data(3) new iClip, iAmmo, iWeapon = get_user_weapon(iKiller, iClip, iAmmo) new iReward = 100 new iKills[32], iType[32] zp_cso_kill_lvl[iVictim] = 0 zp_cso_kill_time[iVictim] = 0 zp_cso_kill_time[iKiller] = 0 zp_cso_kill_total[iKiller] += 1 if(zp_get_user_zombie(iVictim)) { zp_cso_kill_lvl[iVictim] = 0 zp_cso_kill_time[iVictim] = 0 } if(zp_cso_kill_lvl[iKiller] <= zp_cso_maxkills) { zp_cso_kill_lvl[iKiller] += 1 iKills[iKiller] = zp_cso_kill_lvl[iKiller] zp_cso_point_multiplier[iKiller] = iKills[iKiller] if(zp_get_user_zombie(iKiller)) { iType[iKiller] = 0 } else if(iWeapon == CSW_KNIFE) { iType[iKiller] = 1 } else if(iWeapon == CSW_HEGRENADE) { iType[iKiller] = 2 } else if(iHeadshot) { iType[iKiller] = 3 } else { iType[iKiller] = 0 } zp_cso_announce_kill(iKiller, iKills[iKiller], iType[iKiller]) } zp_cso_points[iKiller] += iReward * zp_cso_point_multiplier[iKiller] if(zp_cso_kill_lvl[iKiller] == zp_cso_maxkills) { zp_cso_kill_lvl[iKiller] = 0 } return PLUGIN_CONTINUE } public zp_cso_announce_kill(id, zp_kill_lvl, zp_kill_type) { new iSpeak[64], iSound, iMsg[600], zp_r, zp_g, zp_b if(zp_kill_type == 0) { iSound = zp_kill_lvl - 1 copy(iSpeak, charsmax(iSpeak), zp_cso_kill_sounds1[iSound]) format(iMsg, 63,"%i %L", zp_kill_lvl, LANG_PLAYER, "ZP_CSO_KILL") } else if(zp_kill_type == 1) { iSound = zp_kill_type - 1 copy(iSpeak, charsmax(iSpeak), zp_cso_kill_sounds2[iSound]) format(iMsg, 63,"%i %L %L", zp_kill_lvl, LANG_PLAYER, "ZP_CSO_KILL", LANG_PLAYER, "ZP_CSO_KNIFE") } else if(zp_kill_type == 2) { iSound = zp_kill_type - 1 copy(iSpeak, charsmax(iSpeak), zp_cso_kill_sounds2[iSound]) format(iMsg, 63,"%i %L %L", zp_kill_lvl, LANG_PLAYER, "ZP_CSO_KILL", LANG_PLAYER, "ZP_CSO_GRENADE") } else if(zp_kill_type == 3) { iSound = zp_kill_type - 1 copy(iSpeak, charsmax(iSpeak), zp_cso_kill_sounds2[iSound]) format(iMsg, 63,"%i %L %L", zp_kill_lvl, LANG_PLAYER, "ZP_CSO_KILL", LANG_PLAYER, "ZP_CSO_HEADSHOT") } zp_r = zp_cso_kill_r[zp_kill_lvl] zp_g = zp_cso_kill_g[zp_kill_lvl] zp_b = zp_cso_kill_b[zp_kill_lvl] set_hudmessage(zp_r, zp_g, zp_b, -1.0, 0.30, 0, 6.0, 6.0, 0.1, 0.2, -1) ShowSyncHudMsg(id, zp_cso_hud_sync1, iMsg) client_cmd(id,"speak ^"%s^"", iSpeak) if(zp_cso_kill_lvl[id] == zp_cso_maxkills) { zp_cso_kill_lvl[id] = 0 } return PLUGIN_CONTINUE } public zp_cso_ambience() { new iMP3, MP3[64] iMP3 = random_num(0,charsmax(zp_cso_roundambience)) copy(MP3, charsmax(MP3), zp_cso_roundambience[iMP3]) client_cmd(0,"mp3 play ^"%s^"", MP3) } public zp_cso_countdown() { new iText[64] format(iText, charsmax(iText), "%L", LANG_PLAYER, "ZP_CSO_COUNTDOWN_NOTICE", zp_cso_sec) zp_clientcenter_text(0, iText) zp_cso_sec -= 1 if(zp_cso_sec <= 10) { set_task(0.9, "zp_cso_chantdown") } if(zp_cso_sec >= 1) { set_task(1.0, "zp_cso_countdown") } } public zp_cso_chantdown() { new iChant[64], iSound iSound = zp_cso_sec - 1 copy(iChant, charsmax(iChant), zp_cso_countchant[iSound]) client_cmd(0,"speak ^"%s^"", iChant) } public zp_round_started() { new iSound, iText[64] iSound = random_num(0,charsmax(zp_cso_infectchant)) emit_sound(0, CHAN_VOICE, zp_cso_infectchant[iSound], 1.0, ATTN_NORM, 0, PITCH_NORM) format(iText, charsmax(iText), "%L", LANG_PLAYER, "ZP_CSO_INFECTED_NOTICE") zp_clientcenter_text(0, iText) } public zp_user_infected_post(id, infector, nemesis) { if ( !infector || nemesis) return PLUGIN_CONTINUE new iSound, iText[64], iKills[32], iType[32] new iReward = 100 zp_cso_kill_time[infector] = 0 zp_cso_kill_total[infector] += 1 if(zp_cso_kill_lvl[infector] <= zp_cso_maxkills) { zp_cso_kill_lvl[infector] += 1 iKills[infector] = zp_cso_kill_lvl[infector] zp_cso_point_multiplier[infector] = iKills[infector] zp_cso_announce_kill(infector, iKills[infector], iType[infector]) } zp_cso_points[infector] += iReward * zp_cso_point_multiplier[infector] iSound = random_num(0, charsmax(zp_cso_infectchant)) emit_sound(0, CHAN_VOICE, zp_cso_infectchant[iSound], 1.0, ATTN_NORM, 0, PITCH_NORM) format(iText, charsmax(iText), "%L", LANG_PLAYER, "ZP_CSO_INFECTED_NOTICE") zp_clientcenter_text(0, iText) if(zp_cso_kill_lvl[infector] == zp_cso_maxkills) { zp_cso_kill_lvl[infector] = 0 } return PLUGIN_CONTINUE } public client_authorized(id) { get_user_ip( id, zp_cso_authid[id], charsmax( zp_cso_authid[])) } public client_putinserver(id) { zp_cso_auto_on(id) } public zp_cso_auto_on(id) { set_task(1.0,"zp_cso_hud_info", id, _, _, "b") set_task(1.0,"zp_check_kill_time", id, _, _, "b") } public zp_check_kill_time(id) { if(zp_cso_kill_time[id] == zp_cso_kill_time_end) { zp_cso_kill_lvl[id] = 0 return PLUGIN_CONTINUE } zp_cso_kill_time[id] += 1 return PLUGIN_CONTINUE } public zp_cso_hud_info(id) { new iMsg[600] set_hudmessage( 0, 250, 0, -0.02, -0.28, 0, 6.0, 1.1, 0.0, 0.0, -1) format(iMsg, charsmax(iMsg), "[%L] - [%L: ]^n[%L: %i ]^n[%L: %i ]", LANG_PLAYER, "ZP_CSO_TITLE", LANG_PLAYER, "ZP_CSO_STATS", LANG_PLAYER, "ZP_CSO_KILLTOTAL", zp_cso_kill_total[id], LANG_PLAYER, "ZP_CSO_POINTTOTAL", zp_cso_points[id]) ShowSyncHudMsg(id, zp_cso_hud_sync2, iMsg) } public client_connect(id) { zp_cso_points[id] = 0 zp_cso_kill_total[id] = 0 zp_cso_load_stats(id) } public client_disconnect(id) { zp_cso_save_stats(id) zp_cso_points[id] = 0 zp_cso_kill_total[id] = 0 } zp_cso_load_stats(id) { new iKey[64], iData[256], iPlayerTotalPoints[32], iPlayerTotalKills[32] format(iKey, 63, "[%s][zp_cso_theme20]", zp_cso_authid[id]) nvault_get(zp_cso_vault, iKey, iData, 255) replace_all(iData, 255, "#", " ") parse(iData, iPlayerTotalPoints, 31, iPlayerTotalKills, 31) zp_cso_points[id] = str_to_num(iPlayerTotalPoints) zp_cso_kill_total[id] = str_to_num(iPlayerTotalKills) return PLUGIN_CONTINUE } zp_cso_save_stats(id) { new iKey[64], iData[256] format(iKey, 63, "[%s][zp_cso_theme20]", zp_cso_authid[id]) format(iData,255,"%i#%i#",zp_cso_points[id], zp_cso_kill_total[id]) nvault_set(zp_cso_vault, iKey, iData) return PLUGIN_CONTINUE } stock zp_clientcenter_text(id, zp_message[]) { new dest if (id) dest = MSG_ONE else dest = MSG_ALL message_begin(dest, zp_center_textmsg, {0,0,0}, id) write_byte(4) write_string(zp_message) message_end() }