From 9e4fe0d51438cd96653f4a6e6a51d95b6f941162 Mon Sep 17 00:00:00 2001 From: connorr Date: Sat, 10 Aug 2013 11:46:02 +0200 Subject: [PATCH] Add missing stats sounds, sounds precaching and fix few bugs in miscstats plugin (bug 5810, r=arkshine) Former-commit-id: beca0030e4636dffce77d34e18c981adef34b065 --- configs/miscstats.ini | 26 ++ plugins/cstrike/miscstats.sma | 679 +++++++++++++++++++++++++--------- plugins/lang/statscfg.txt | 154 ++++++++ 3 files changed, 686 insertions(+), 173 deletions(-) create mode 100644 configs/miscstats.ini diff --git a/configs/miscstats.ini b/configs/miscstats.ini new file mode 100644 index 00000000..5d5e4d29 --- /dev/null +++ b/configs/miscstats.ini @@ -0,0 +1,26 @@ +; To disable a sound, disable it from amxmodmenu (stats settings) or from command amx_statscfgmenu +; Sound name length mustn't exceed 54 characters (without sound/ and without .wav extension) +; Otherwise plugin won't take it in account because fast download wouldn't be supported + +FirstBloodSound misc/firstblood +LastManVsOthersSound misc/oneandonly +LastManDuelSound misc/maytheforce +HeadShotKillSoundKiller misc/headshot +HeadShotKillSoundVictim fvox/flatline +KnifeKillSound misc/humiliation +DoubleKillSound misc/doublekill +RoundCounterSound misc/prepare +GrenadeKillSound djeyl/grenade +GrenadeSuicideSound djeyl/witch +BombPlantedSound djeyl/c4powa +BombDefusedSound djeyl/laugh +BombFailedSound djeyl/witch + +; KillingStreak and MultiKill Sounds +MultiKillSound misc/multikill +UltraKillSound misc/ultrakill +KillingSpreeSound misc/killingspree +RampageSound misc/rampage +UnstopableSound misc/unstoppable +MonsterKillSound misc/monsterkill +GodLike misc/godlike diff --git a/plugins/cstrike/miscstats.sma b/plugins/cstrike/miscstats.sma index 31f1aed1..cab080a7 100755 --- a/plugins/cstrike/miscstats.sma +++ b/plugins/cstrike/miscstats.sma @@ -33,8 +33,12 @@ */ #include +#include #include -#include + +#define AMXMODX_NOAUTOLOAD +#include +#include public MultiKill public MultiKillSound @@ -66,6 +70,17 @@ public DoubleKillSound public PlayerName public FirstBloodSound +public BombPlantedSound +public BombDefusedSound +public BombFailedSound +public BombCountHUD +public LastManSound +public GrenadeKillSound +public GrenadeSuicideSound + +const SOUNDFILE_PATH_MAXLEN = 64 +const SOUND_SHORTPATH_MAXLEN = SOUNDFILE_PATH_MAXLEN - 10 // 64 (sound/ [ 54 ] .wav) critical value for fast dl + new g_streakKills[33][2] new g_multiKills[33][2] new g_C4Timer @@ -85,6 +100,18 @@ new g_left_sync new g_bottom_sync new g_he_sync +new g_pcvar_mp_c4timer, g_c4timer_value + +const TASK_BOMB_TIMER = 8038 +const TASK_DELAYED_NEW_ROUND = 98038 + +const TEAM_T = 1 +const TEAM_CT = 2 + +new g_connected[33] + +new g_bIsBombMap = false + new g_MultiKillMsg[7][] = { "Multi-Kill! %s^n%L %d %L (%d %L)", @@ -96,16 +123,31 @@ new g_MultiKillMsg[7][] = "%s IS GODLIKE!!!!^n%L %d %L (%d %L)" } -new g_Sounds[7][] = +new g_Sounds[7][SOUND_SHORTPATH_MAXLEN] = { - "multikill", - "ultrakill", - "killingspree", - "rampage", - "unstoppable", - "monsterkill", - "godlike" + "misc/multikill", + "misc/ultrakill", + "misc/killingspree", + "misc/rampage", + "misc/unstoppable", + "misc/monsterkill", + "misc/godlike" } + +new g_firstbloodsound[SOUND_SHORTPATH_MAXLEN] = "misc/firstblood" +new g_lastmansound_1vsothers[SOUND_SHORTPATH_MAXLEN] = "misc/oneandonly" +new g_lastmansound_duel[SOUND_SHORTPATH_MAXLEN] = "misc/maytheforce" +new g_hssound_killer[SOUND_SHORTPATH_MAXLEN] = "misc/headshot" +new g_hssound_victim[SOUND_SHORTPATH_MAXLEN] = "misc/headshot" +new g_knifekillsound[SOUND_SHORTPATH_MAXLEN] = "misc/humiliation" +new g_doublekillsound[SOUND_SHORTPATH_MAXLEN] = "misc/doublekill" +new g_roundcountersound[SOUND_SHORTPATH_MAXLEN] = "misc/prepare" +new g_grenadekillsound[SOUND_SHORTPATH_MAXLEN] = "djeyl/grenade" +new g_grenadesuicidesound[SOUND_SHORTPATH_MAXLEN] = "djeyl/witch" +new g_bombplantedsound[SOUND_SHORTPATH_MAXLEN] = "djeyl/c4powa" +new g_bombdefusedsound[SOUND_SHORTPATH_MAXLEN] = "djeyl/laugh" +new g_bombfailedsound[SOUND_SHORTPATH_MAXLEN] = "djeyl/witch" + new g_KillingMsg[7][] = { "%s: Multi-Kill!", @@ -174,24 +216,30 @@ public plugin_init() register_dictionary("miscstats.txt") register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w") register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw") - register_event("RoundTime", "eNewRound", "bc") - register_event("StatusValue", "setTeam", "be", "1=1") - register_event("StatusValue", "showStatus", "be", "1=2", "2!0") - register_event("StatusValue", "hideStatus", "be", "1=1", "2=0") + + register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0") // cache c4 timer value + register_logevent("LogEvent_Round_Start", 2, "1=Round_Start") // replaces ugly register_event("RoundTime", "eNewRound", "bc") + register_event("StatusValue", "setTeam", "bef", "1=1") + register_event("StatusValue", "showStatus", "bef", "1=2", "2!0") + register_event("StatusValue", "hideStatus", "bef", "1=1", "2=0") - new mapname[32] - get_mapname(mapname, 31) - - if (equali(mapname, "de_", 3) || equali(mapname, "csde_", 5)) + new mapname[32], n = get_mapname(mapname, charsmax(mapname)) + new CLASSNAME[] = "classname", INFO_BOMB_TARGET[] = "info_bomb_target", FUNC_BOMB_TARGET[] = "func_bomb_target" + if( ( LibraryExists("engine", LibType_Library) && ( find_ent_by_class(0, INFO_BOMB_TARGET) > 0 || find_ent_by_class(0, FUNC_BOMB_TARGET) > 0 ) ) + || ( LibraryExists("fakemeta", LibType_Library) && ( engfunc(EngFunc_FindEntityByString, 0, CLASSNAME, INFO_BOMB_TARGET) > 0 || engfunc(EngFunc_FindEntityByString, 0, CLASSNAME, FUNC_BOMB_TARGET) > 0 ) ) + || (equali(mapname, "de_", 3) || equali(mapname, "csde_", 5)) ) { + g_bIsBombMap = true register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4") register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb") register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d") + register_event("BarTime", "eStopDefuse", "b", "1=0") } - else if (equali(mapname, "cs_italy")) + else if (equali(mapname, "cs_italy") || equali(mapname, "cs_italy_cz")) { - register_event("23", "chickenKill", "a", "1=108", /*"12=106", */ "15=4") - register_event("23", "radioKill", "a", "1=108", /*"12=294", */ "15=2") + register_event("23", "chickenKill", "a", "1=108", "15=4") + register_event("23", "radioKill", "a", "1=108", n == 8 ? "15=2" : "15=8") // cz radio is wood + } g_center1_sync = CreateHudSyncObj() @@ -200,6 +248,207 @@ public plugin_init() g_left_sync = CreateHudSyncObj() g_bottom_sync = CreateHudSyncObj() g_he_sync = CreateHudSyncObj() + + g_pcvar_mp_c4timer = get_cvar_pointer("mp_c4timer") + g_c4timer_value = get_pcvar_num( g_pcvar_mp_c4timer ) +} + +public plugin_precache() +{ + // parse sounds and precache them + new szConfigsDir[64], szCfgFile[64] + get_configsdir(szConfigsDir, charsmax(szConfigsDir)) + formatex(szCfgFile, charsmax(szCfgFile), "%s/stats.ini", szConfigsDir) + + new buffer[256] + + // initialize xvars so we can know later if sounds have to be precached or not. + // xvars gonna be initialized again in statscfg.amxx plugin_init, this is ok. + new fp = fopen(szCfgFile, "rt") + if( fp ) + { + new xvarname[32], xvarid + while( !feof(fp) ) + { + fgets(fp, buffer, charsmax(buffer)) + trim(buffer) + if( buffer[0] != ';' ) + { + parse(buffer, xvarname, charsmax(xvarname)) + if ((xvarid = get_xvar_id(xvarname)) != -1) + { + set_xvar_num(xvarid, 1) + } + } + } + fclose(fp) + } + + formatex(szCfgFile, charsmax(szCfgFile), "%s/miscstats.ini", szConfigsDir) + fp = fopen(szCfgFile, "rt") + if( fp ) + { + new szSoundKey[32], szSoundFile[SOUNDFILE_PATH_MAXLEN] + while( !feof(fp) ) + { + fgets(fp, buffer, charsmax(buffer)) + trim(buffer) + if( buffer[0] != ';' && parse(buffer, szSoundKey, charsmax(szSoundKey), szSoundFile, charsmax(szSoundFile)) == 2 ) + { + if( equal(szSoundKey, "FirstBloodSound") ) + { + copy_sound(g_firstbloodsound, charsmax(g_firstbloodsound), szSoundFile) + if( FirstBloodSound ) precache_sound_custom(g_firstbloodsound) + } + else if( equal(szSoundKey, "LastManVsOthersSound") ) + { + copy_sound(g_lastmansound_1vsothers, charsmax(g_lastmansound_1vsothers), szSoundFile) + if( LastManSound ) precache_sound_custom(g_lastmansound_1vsothers) + } + else if( equal(szSoundKey, "LastManDuelSound") ) + { + copy_sound(g_lastmansound_duel, charsmax(g_lastmansound_duel), szSoundFile) + if( LastManSound ) precache_sound_custom(g_lastmansound_duel) + } + else if( equal(szSoundKey, "HeadShotKillSoundKiller") ) + { + copy_sound(g_hssound_killer, charsmax(g_hssound_killer), szSoundFile) + if( HeadShotKillSound ) precache_sound_custom(g_hssound_killer) + } + else if( equal(szSoundKey, "HeadShotKillSoundVictim") ) + { + copy_sound(g_hssound_victim, charsmax(g_hssound_victim), szSoundFile) + if( HeadShotKillSound ) precache_sound_custom(g_hssound_victim) + } + else if( equal(szSoundKey, "KnifeKillSound") ) + { + copy_sound(g_knifekillsound, charsmax(g_knifekillsound), szSoundFile) + if( KnifeKillSound ) precache_sound_custom(g_knifekillsound) + } + else if( equal(szSoundKey, "DoubleKillSound") ) + { + copy_sound(g_doublekillsound, charsmax(g_doublekillsound), szSoundFile) + if( DoubleKillSound ) precache_sound_custom(g_doublekillsound) + } + else if( equal(szSoundKey, "RoundCounterSound") ) + { + copy_sound(g_roundcountersound, charsmax(g_roundcountersound), szSoundFile) + if( RoundCounterSound ) precache_sound_custom(g_roundcountersound) + } + else if( equal(szSoundKey, "GrenadeKillSound") ) + { + copy_sound(g_grenadekillsound, charsmax(g_grenadekillsound), szSoundFile) + if( GrenadeKillSound ) precache_sound_custom(g_grenadekillsound) + } + else if( equal(szSoundKey, "GrenadeSuicideSound") ) + { + copy_sound(g_grenadesuicidesound, charsmax(g_grenadesuicidesound), szSoundFile) + if( GrenadeSuicideSound ) precache_sound_custom(g_grenadesuicidesound) + } + else if( equal(szSoundKey, "BombPlantedSound") ) + { + copy_sound(g_bombplantedsound, charsmax(g_bombplantedsound), szSoundFile) + if( BombPlantedSound ) precache_sound_custom(g_bombplantedsound) + } + else if( equal(szSoundKey, "BombDefusedSound") ) + { + copy_sound(g_bombdefusedsound, charsmax(g_bombdefusedsound), szSoundFile) + if( BombDefusedSound ) precache_sound_custom(g_bombdefusedsound) + } + else if( equal(szSoundKey, "BombFailedSound") ) + { + copy_sound(g_bombfailedsound, charsmax(g_bombfailedsound), szSoundFile) + if( BombFailedSound ) precache_sound_custom(g_bombfailedsound) + } + else + { + // KillingStreakSound and MultiKillSound + if( equal(szSoundKey, "MultiKillSound") ) + { + copy_sound(g_Sounds[0], charsmax(g_Sounds[]), szSoundFile) + if( KillingStreakSound || MultiKillSound ) precache_sound_custom(g_Sounds[0]) + } + else if( equal(szSoundKey, "UltraKillSound") ) + { + copy_sound(g_Sounds[1], charsmax(g_Sounds[]), szSoundFile) + if( KillingStreakSound || MultiKillSound ) precache_sound_custom(g_Sounds[1]) + } + else if( equal(szSoundKey, "KillingSpreeSound") ) + { + copy_sound(g_Sounds[2], charsmax(g_Sounds[]), szSoundFile) + if( KillingStreakSound || MultiKillSound ) precache_sound_custom(g_Sounds[2]) + } + else if( equal(szSoundKey, "RampageSound") ) + { + copy_sound(g_Sounds[3], charsmax(g_Sounds[]), szSoundFile) + if( KillingStreakSound || MultiKillSound ) precache_sound_custom(g_Sounds[3]) + } + else if( equal(szSoundKey, "UnstopableSound") ) + { + copy_sound(g_Sounds[4], charsmax(g_Sounds[]), szSoundFile) + if( KillingStreakSound || MultiKillSound ) precache_sound_custom(g_Sounds[4]) + } + else if( equal(szSoundKey, "MonsterKillSound") ) + { + copy_sound(g_Sounds[5], charsmax(g_Sounds[]), szSoundFile) + if( KillingStreakSound || MultiKillSound ) precache_sound_custom(g_Sounds[5]) + } + else if( equal(szSoundKey, "GodLike") ) + { + copy_sound(g_Sounds[6], charsmax(g_Sounds[]), szSoundFile) + if( KillingStreakSound || MultiKillSound ) precache_sound_custom(g_Sounds[6]) + } + } + } + } + fclose(fp) + } +} + +precache_sound_custom( const sound[] ) +{ + new fullpathsound[SOUNDFILE_PATH_MAXLEN] + formatex(fullpathsound, charsmax(fullpathsound), "sound/%s.wav", sound) + if( file_exists(fullpathsound) ) + { + precache_sound(fullpathsound[6]) + } + else + { + log_amx("Could not locate <%s> file", fullpathsound) + } +} + +copy_sound(dest[], len, src[]) +{ + new n = copy(dest, len, src[ 6 * equali(src, "sound/", 6) ]) + if( n > 4 && equal(dest[n-4], ".wav") ) + { + dest[n-4] = EOS + } +} + +public plugin_natives() +{ + set_module_filter("module_filter") + set_native_filter("native_filter") +} + +public module_filter(const module[]) +{ + if (equali(module, "engine") + || equali(module, "fakemeta")) + return PLUGIN_HANDLED + + return PLUGIN_CONTINUE +} + +public native_filter(const name[], index, trap) +{ + if (!trap) + return PLUGIN_HANDLED + + return PLUGIN_CONTINUE } public plugin_cfg() @@ -211,19 +460,26 @@ public plugin_cfg() server_cmd(g_addStast, "ST_BOMB_PLANTING", "BombPlanting") server_cmd(g_addStast, "ST_BOMB_DEFUSING", "BombDefusing") server_cmd(g_addStast, "ST_BOMB_PLANTED", "BombPlanted") + server_cmd(g_addStast, "ST_BOMB_PLANTED_SOUND", "BombPlantedSound") server_cmd(g_addStast, "ST_BOMB_DEF_SUCC", "BombDefused") + server_cmd(g_addStast, "ST_BOMB_DEF_SUCC_SOUND", "BombDefusedSound") server_cmd(g_addStast, "ST_BOMB_DEF_FAIL", "BombFailed") + server_cmd(g_addStast, "ST_BOMB_DEF_FAIL_SOUND", "BombFailedSound") server_cmd(g_addStast, "ST_BOMB_PICKUP", "BombPickUp") server_cmd(g_addStast, "ST_BOMB_DROP", "BombDrop") + server_cmd(g_addStast, "ST_BOMB_CD_HUD", "BombCountHUD") server_cmd(g_addStast, "ST_BOMB_CD_VOICE", "BombCountVoice") server_cmd(g_addStast, "ST_BOMB_CD_DEF", "BombCountDef") server_cmd(g_addStast, "ST_BOMB_SITE", "BombReached") server_cmd(g_addStast, "ST_ITALY_BONUS", "ItalyBonusKill") server_cmd(g_addStast, "ST_LAST_MAN", "LastMan") + server_cmd(g_addStast, "ST_LAST_MAN_SOUND", "LastManSound") server_cmd(g_addStast, "ST_KNIFE_KILL", "KnifeKill") server_cmd(g_addStast, "ST_KNIFE_KILL_SOUND", "KnifeKillSound") server_cmd(g_addStast, "ST_HE_KILL", "GrenadeKill") + server_cmd(g_addStast, "ST_HE_KILL_SOUND", "GrenadeKillSound") server_cmd(g_addStast, "ST_HE_SUICIDE", "GrenadeSuicide") + server_cmd(g_addStast, "ST_HE_SUICIDE_SOUND", "GrenadeSuicideSound") server_cmd(g_addStast, "ST_HS_KILL", "HeadShotKill") server_cmd(g_addStast, "ST_HS_KILL_SOUND", "HeadShotKillSound") server_cmd(g_addStast, "ST_ROUND_CNT", "RoundCounter") @@ -241,6 +497,12 @@ public client_putinserver(id) { g_multiKills[id] = {0, 0} g_streakKills[id] = {0, 0} + g_connected[id] = true +} + +public client_disconnect(id) +{ + g_connected[id] = false } public client_death(killer, victim, wpnindex, hitplace, TK) @@ -251,11 +513,13 @@ public client_death(killer, victim, wpnindex, hitplace, TK) new headshot = (hitplace == HIT_HEAD) ? 1 : 0 new selfkill = (killer == victim) ? 1 : 0 + new victim_alive = is_user_alive(victim) // happens on ClientKill + if (g_firstBlood) { g_firstBlood = 0 if (FirstBloodSound) - play_sound("misc/firstblood") + play_sound(g_firstbloodsound) } if ((KillingStreak || KillingStreakSound) && !TK) @@ -273,7 +537,7 @@ public client_death(killer, victim, wpnindex, hitplace, TK) if ((a > -1) && !(a % 2)) { new name[32] - get_user_name(killer, name, 31) + get_user_name(killer, name, charsmax(name)) if ((a >>= 1) > 6) a = 6 @@ -286,10 +550,7 @@ public client_death(killer, victim, wpnindex, hitplace, TK) if (KillingStreakSound) { - new file[32] - - format(file, 31, "misc/%s", g_Sounds[a]) - play_sound(file) + play_sound(g_Sounds[a]) } } } @@ -306,36 +567,27 @@ public client_death(killer, victim, wpnindex, hitplace, TK) param[0] = killer param[1] = g_multiKills[killer][0] - set_task(4.0 + float(param[1]), "checkKills", 0, param, 2) + set_task(4.0 + float(param[1]), "checkKills", killer, param, 2) } } + new team = get_user_team(victim) if (EnemyRemaining && is_user_connected(victim)) { - new ppl[32], pplnum = 0, maxplayers = get_maxplayers() - new epplnum = 0 - new CsTeams:team = cs_get_user_team(victim) - new CsTeams:other_team - new CsTeams:enemy_team = (team == CS_TEAM_T) ? CS_TEAM_CT : CS_TEAM_T - - if (team == CS_TEAM_T || team == CS_TEAM_CT) + if( TEAM_T <= team <= TEAM_CT ) { - for (new i=1; i<=maxplayers; i++) + new ppl[32], pplnum, epplnum, a + get_players(ppl, epplnum, "ae", team == TEAM_T ? "CT" : "TERRORIST") + get_players(ppl, pplnum, "ae", team == TEAM_T ? "TERRORIST" : "CT") + if( victim_alive ) { - if (!is_user_connected(i)) + for(a=0; a= 2) - client_print(i, print_chat, "* %L", i, "KILLED_ROW", g_streakKills[i][0]) - else if (g_streakKills[i][1] >= 2) - client_print(i, print_chat, "* %L", i, "DIED_ROUNDS", g_streakKills[i][1]) - } + if (g_streakKills[i][0] >= 2) + client_print(i, print_chat, "* %L", i, "KILLED_ROW", g_streakKills[i][0]) + else if (g_streakKills[i][1] >= 2) + client_print(i, print_chat, "* %L", i, "DIED_ROUNDS", g_streakKills[i][1]) } } } @@ -610,7 +901,7 @@ public eEndRound() { g_C4Timer = -2 g_LastOmg = 0.0 - remove_task(8038) + remove_task(TASK_BOMB_TIMER) g_LastAnnounce = 0 } @@ -634,7 +925,7 @@ public checkKills(param[]) { new name[32] - get_user_name(id, name, 31) + get_user_name(id, name, charsmax(name)) set_hudmessage(255, 0, 100, 0.05, 0.50, 2, 0.02, 6.0, 0.01, 0.1, -1) ShowSyncHudMsg(0, g_left_sync, g_MultiKillMsg[a], name, LANG_PLAYER, "WITH", g_multiKills[id][0], LANG_PLAYER, "KILLS", g_multiKills[id][1], LANG_PLAYER, "HS") @@ -642,9 +933,7 @@ public checkKills(param[]) if (MultiKillSound) { - new sound[24] - format(sound, 23, "misc/%s", g_Sounds[a]) - play_sound(sound) + play_sound(g_Sounds[a]) } } g_multiKills[id] = {0, 0} @@ -667,7 +956,7 @@ announceEvent(id, message[]) { new name[32] - get_user_name(id, name, 31) + get_user_name(id, name, charsmax(name)) set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, -1) ShowSyncHudMsg(0, g_announce_sync, "%L", LANG_PLAYER, message, name) } @@ -699,30 +988,54 @@ public bombTimer() { if (--g_C4Timer > 0) { + if( BombCountHUD ) + { + new r, g + if( g_C4Timer < 10 ) + { + r = 255, g = 0 + } + else + { + r = (((max(g_c4timer_value - g_C4Timer - 10,0)) * 255000) / (g_c4timer_value - 10)) / 1000 + g = 255 - r + } + + set_hudmessage(r, g, 0, -1.0, 0.75, g_C4Timer <= 10 ? 1 : 0, 0.01, 1.1, 0.001, 0.001, .channel = -1) + show_hudmessage(0, "C4: %ds", g_C4Timer) + } if (BombCountVoice) { if (g_C4Timer == 30 || g_C4Timer == 20) { new temp[64] - num_to_word(g_C4Timer, temp, 63) - format(temp, 63, "^"vox/%s seconds until explosion^"", temp) + num_to_word(g_C4Timer, temp, charsmax(temp)) + format(temp, charsmax(temp), "^"vox/%s seconds until explosion^"", temp) play_sound(temp) } else if (g_C4Timer < 11) { new temp[64] - num_to_word(g_C4Timer, temp, 63) - format(temp, 63, "^"vox/%s^"", temp) + num_to_word(g_C4Timer, temp, charsmax(temp)) + format(temp, charsmax(temp), "^"vox/%s^"", temp) play_sound(temp) } } - if (BombCountDef && g_Defusing) + if (BombCountDef && g_Defusing && is_user_alive(g_Defusing)) client_print(g_Defusing, print_center, "%d", g_C4Timer) } else - remove_task(8038) + remove_task(TASK_BOMB_TIMER) +} + +public eStopDefuse(id) +{ + if( id == g_Defusing ) + { + g_Defusing = 0 + } } public bomb_planted(planter) @@ -731,13 +1044,28 @@ public bomb_planted(planter) if (BombPlanted) announceEvent(planter, "SET_UP_BOMB") + + if (BombPlantedSound) + play_sound(g_bombplantedsound) - g_C4Timer = get_cvar_num("mp_c4timer") - set_task(1.0, "bombTimer", 8038, "", 0, "b") + g_C4Timer = g_c4timer_value + 1 + bombTimer() + set_task(1.0, "bombTimer", TASK_BOMB_TIMER, "", 0, "b") } public bomb_planting(planter) { + // obviously we are on a bomb map and detection (engine and fakemeta are not loaded) failed + // register now missing event, better than nothing + if( !g_bIsBombMap ) + { + g_bIsBombMap = true + register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4") + register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb") + register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d") + register_event("BarTime", "eStopDefuse", "b", "1=0") + } + if (BombPlanting) announceEvent(planter, "PLANT_BOMB") } @@ -754,25 +1082,30 @@ public bomb_defused(defuser) { if (BombDefused) announceEvent(defuser, "DEFUSED_BOMB") + if (BombDefusedSound) + play_sound(g_bombdefusedsound) } public bomb_explode(planter, defuser) { - if (BombFailed && defuser) - announceEvent(defuser, "FAILED_DEFU") -} - -public play_sound(sound[]) -{ - new players[32], pnum - get_players(players, pnum, "c") - new i - - for (i = 0; i < pnum; i++) + if( defuser ) { - if (is_user_connecting(players[i])) - continue - - client_cmd(players[i], "spk %s", sound) + if (BombFailed) + announceEvent(defuser, "FAILED_DEFU") + if (BombFailedSound) + play_sound(g_bombfailedsound) + } +} + +play_sound(sound[]) +{ + new players[32], pnum, id + get_players(players, pnum, "ch") + + for(--pnum; pnum>=0; pnum--) + { + id = players[pnum] + if ( g_connected[id] ) + client_cmd(id, "spk %s", sound) } } diff --git a/plugins/lang/statscfg.txt b/plugins/lang/statscfg.txt index 75ee0b90..883e603c 100755 --- a/plugins/lang/statscfg.txt +++ b/plugins/lang/statscfg.txt @@ -72,6 +72,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [de] NO_OPTION = Finde keine Optionen mit dieser Variable (Name "%s") @@ -147,6 +154,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rang Info +ST_BOMB_PLANTED_SOUND = Bombe platziert Sound +ST_BOMB_DEF_SUCC_SOUND = Bombe entschaerfen erf. Sound +ST_BOMB_DEF_FAIL_SOUND = Bombe entschaerfen fehl. Sound +ST_BOMB_CD_HUD = Bomben Countdown Hud +ST_LAST_MAN_SOUND = Letzter Mann Sound +ST_HE_KILL_SOUND = Granaten Kill Sound +ST_HE_SUICIDE_SOUND = Granaten Selbstmord Sound [sr] NO_OPTION = Nepostoji optcija(e) sa tom promenljivom (ime "%s") @@ -222,6 +236,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [tr] NO_OPTION = O isimde aranan secenek(ler) bulunamadi (isim "%s") @@ -297,6 +318,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [fr] NO_OPTION = Option(s) introuvable(s) avec cette variable (nom ^"%s^") @@ -372,6 +400,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Info Rang Spectateur +ST_BOMB_PLANTED_SOUND = Son Bombe Amorcee +ST_BOMB_DEF_SUCC_SOUND = Son Bombe Desamorcee +ST_BOMB_DEF_FAIL_SOUND = Son Bombe Non Desamorcee +ST_BOMB_CD_HUD = Compte a Rebours Bombe Visuel +ST_LAST_MAN_SOUND = Son Dernier en Vie +ST_HE_KILL_SOUND = Son Frag a la Grenade +ST_HE_SUICIDE_SOUND = Son Suicide a la Grenade [sv] NO_OPTION = Kunde inte hitta val(en) med en dylik variabel (namn "%s") @@ -448,6 +483,13 @@ ST_SAY_TOP15 = Say /top15 ST_SAY_FLOP15 = Say /flop15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [da] NO_OPTION = Kunne ikke finde mulighed(er)med en saadan variabel (name "%s") @@ -523,6 +565,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [pl] NO_OPTION = Nie mozna znalesc opcji z podana zmienna (nazwa "%s") @@ -598,6 +647,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Rankingi w obserwatorze +ST_BOMB_PLANTED_SOUND = Bomba podlozona - dzwiek +ST_BOMB_DEF_SUCC_SOUND = Bomba rozbrojona - dzwiek +ST_BOMB_DEF_FAIL_SOUND = Bomba - nieudane rozbrajanie - dzwiek +ST_BOMB_CD_HUD = Bomba - odliczanie - Hud +ST_LAST_MAN_SOUND = Ostatni gracz - dzwiek +ST_HE_KILL_SOUND = Zabicie granatem - dzwiek +ST_HE_SUICIDE_SOUND = Samobojstwo granatem - dzwiek [nl] NO_OPTION = Kon opties met zo'n variabele niet vinden (naam "%s") @@ -673,6 +729,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [es] NO_OPTION = No se encontraron opcion(es) con dicha variable (nombre "%s") @@ -748,6 +811,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [bp] NO_OPTION = Nao pode achar opcao(oes) com tal(is) variavel(is) (nome "%s") @@ -823,6 +893,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Info de Rank para Espectador +ST_BOMB_PLANTED_SOUND = Som de Bomba Plantada +ST_BOMB_DEF_SUCC_SOUND = Som de Bomba Defusada +ST_BOMB_DEF_FAIL_SOUND = Som de Falha ao Defusar a Bomba +ST_BOMB_CD_HUD = Contagem da Bomba (Hud) +ST_LAST_MAN_SOUND = Som de Ultimo Homem +ST_HE_KILL_SOUND = Som de Frag de Granada +ST_HE_SUICIDE_SOUND = Som de Suicidio de Granada [cz] NO_OPTION = Nemuzu najit volbu s takovou promennou (jmeno "%s") @@ -898,6 +975,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [fi] NO_OPTION = Ei loydetty asetuksia tuolla muuttujan nimella (nimi "%s") @@ -972,6 +1056,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [ls] NO_OPTION = C0|_|ld|\|'t f!|\|d 0pt!0|\|(s) w!th s|_|(h v4r!4bl3 (|\|4m3 "%s") @@ -1047,6 +1138,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [bg] NO_OPTION = Neuspe6no namerena opcia(i) s takav variable (ime "%s") @@ -1122,6 +1220,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [ro] NO_OPTION = Couldn't find option(s) with such variable (name "%s") @@ -1197,6 +1302,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [hu] NO_OPTION = Nem talalhato Funkcio a megadott nevvel (nev "%s") @@ -1272,6 +1384,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [lt] NO_OPTION = Negali surasti tokios optijos su tokiu kintamuoju (vardas "%s") @@ -1347,6 +1466,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [sk] NO_OPTION = Nemozem najst volbu s takouto premennou (meno "%s") @@ -1422,6 +1548,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [mk] NO_OPTION = Ne postoi opcija so takva vrednost (ime "%s") @@ -1497,6 +1630,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [hr] NO_OPTION = Nepostoji opcija(e) sa tom promjenljivom (ime "%s") @@ -1572,6 +1712,13 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Info +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound [bs] NO_OPTION = Nepostoji opcija(e) sa tom promijenjivom (ime "%s") @@ -1647,4 +1794,11 @@ ST_SAY_SCORE = Say /score ST_SAY_TOP15 = Say /top15 ST_SAY_STATS = Say /stats ST_SPEC_RANK = Spec. Rank Inf +ST_BOMB_PLANTED_SOUND = Bomb Planted Sound +ST_BOMB_DEF_SUCC_SOUND = Bomb Defuse Succ. Sound +ST_BOMB_DEF_FAIL_SOUND = Bomb Def. Failure Sound +ST_BOMB_CD_HUD = Bomb Countdown Hud +ST_LAST_MAN_SOUND = Last Man Sound +ST_HE_KILL_SOUND = Grenade Kill Sound +ST_HE_SUICIDE_SOUND = Grenade Suicide Sound