Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

D7 Kill Announcer: Dota 2


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
D i 5 7 i n c T's Kill Announcer: Dota 2



687474703a2f2f6269742e6c792f4437496d6744
Replicates the Dota 2 killing spree and multi-kill announcer.

Also works on Counter-Strike: Condition Zero.

Fully compatible with ZP 5, 4, and older.



687474703a2f2f6269742e6c792f4437496d6753
CVar: D7AnnouncerKillsD2IgnoreBots
Don't play sounds or show announcements when bots make kills.
0 - disabled
1 - enabled



687474703a2f2f6269742e6c792f4437496d674c
None.



687474703a2f2f6269742e6c792f4437496d674e
This plug-in requires the following:
- BitSum stocks include file (bitsums.inc).
- DHUD messages include file (dhudmessage.inc) ONLY IF compiling with AMXX 1.8.2 or older.
- SoundInfo include file (soundinfo.inc).
- Sound resources. Extract the zip file contents in the mod's main directory.
Everything is attached along below.

Known issues:
- SoundInfo include file fails to read sound duration for mp3 files. If you plan on using mp3 files, manually specify the sound durations in the area below their names.

Get source and compile locally.



687474703a2f2f6269742e6c792f4437496d6743
MeRcyLeZZ - For his Zombie Plague Mod.
dorin2oo7 - For his images I used to style up my post.
NiHiLaNTh, schmurgel1983, KliPPy, meTaLiCroSS - For being true friends and always helping and teaching me new stuff.



687474703a2f2f6269742e6c792f4437496d6743
Code:

T = needs testing
X = done
- = cancelled

[X] remember kills and multis on global variables
[T] make sounds not play over eachother
[X] ownage message?
[X] reset kills on map restart
[X] stop announcements on new round?
[X] stop announcements on map restart?
[X] a single chat message for both kill count and multi?
[X] a single task for all announcements
[-] fix ownage sound playing when it shouldn't
[X] fix g_iMulti not resetting
[T] force visual announcement of previous player if not announced when another player makes a kill
        [T] only do it when the new player has something to announce
[T] fix first blood triggering wrong(add first blood bit info)
[T] optimize multi text showing conditions
[T] optimize multi sound playing conditions
[T] death hook with DeathMsg instead of Ham_Killed
[T] ownage announcement for team kills difference instead of >= 5 player kills
[T] don't force print last killer's ownage unless the new killer is from a different team
[T] ignore spectator kills for both victim and attacker
[T] don't add sound folder before precaching wavs
[X] zp 4.3 and lower infection support
[T] only print ownage message once
[X] don't count team kills
        [ ] decrease kills on team kill?
v0.2.2
[X] properly detect name change
[T] announce ownage even if no player specific event happens
[T] only add delay from inside the announce task if necessary
[T] delay the other announcements even if first blood sound doesn't exist
v0.2.5
[T] task on client_putinserver for renaming plugins compatibility
v0.2.6
[T] ignore bots + cvar
v0.2.7
[-] fix ownage chat message printing multiple times
[-] cache sound type instead of checking for extension every time
[-] fix bomb kills counting (for planter?)
[-] don't allow ownage sounds to interrupt spree or multi announcements?
[-] implement rpg api team code
[X] HUD
[T] don't reset multis on death or spawn and add multi only messages
[X] reset kills and multis on round start
[X] hud hold time equal to the total sound duration
[X] precache_generic for all the sounds since we're not playing them on server side
[X] optimize plugin_precache
[X] fix hud positioning system
[T] delay the initial hud show by 0.1 to avoid spamming too many messages on instant multiple kills
[X] full zp support
[X] use natives instead of team cache
[T] server interogation cvar
v0.3.8
[ ] multilang
[ ] dynamic max simultaneous announcers
[ ] external configuration
[ ] minimize or eliminate hud flicker
[ ] improve hud spacing
[ ] fix soundinfo mp3 issues
[ ]



Code(for easy readability):
PHP Code:

// Modules - global
#include <amxmodx>
#include <fakemeta>

// Modules - mod specific
#include <cstrike>

// Stocks
#include <bitsums>
#if AMXX_VERSION_NUM <= 182//!defined set_dhudmessage
#include <dhudmessage>
#endif
#include <soundinfo>
//#include <D7Debug>



new const g_szConstVersion[] = "0.3.8";

// Custom forwards
forward zp_user_infected_post(idinfectornemesis);
//forward zp_user_humanized_post(id, survivor);
forward zp_fw_core_infect_post(idattacker);
forward zp_fw_core_cure_post(idattacker);

// Custom natives
native zp_get_user_zombie(id);
native zp_core_is_zombie(id);



const 
g_iSizeSzSound 64;

new 
g_szSoundFirstBlood[g_iSizeSzSound] = "D7/Announcers/Dota2/Kill/Announcer_1stblood_01.wav";
new 
Float:g_fSoundFirstBloodDuration 1.647891;//1.645714
new const g_szConstTextFirstBlood[] = "drew first blood by killing";
new const 
g_iConstTextFirstBloodColor[3] = { 255255255 };

new 
g_szSoundsCount[][g_iSizeSzSound] =
{
    
"D7/Announcers/Dota2/Kill/Announcer_kill_spree_01.wav",
    
"D7/Announcers/Dota2/Kill/Announcer_kill_dominate_01.wav",
    
"D7/Announcers/Dota2/Kill/Announcer_kill_mega_01.wav",
    
"D7/Announcers/Dota2/Kill/Announcer_kill_unstop_01.wav",
    
"D7/Announcers/Dota2/Kill/Announcer_kill_wicked_01.wav",
    
"D7/Announcers/Dota2/Kill/Announcer_kill_monster_01.wav",
    
"D7/Announcers/Dota2/Kill/Announcer_kill_godlike_01.wav",
    
"D7/Announcers/Dota2/Kill/Announcer_kill_holy_01.wav"
}

new 
Float:g_fSoundsCountDuration[sizeof g_szSoundsCount] =
{
    
2.378684//2.377143
    
1.803990//1.802449
    
2.613786//2.612245
    
2.039093//2.037551
    
2.613786//2.612245
    
3.345215//3.343673
    
1.830113//1.828571
    
2.326439 //2.324898
}

new const 
g_szConstTextCount[sizeof g_szSoundsCount][] =
{
    
"is on a killing spree",
    
"is dominating",
    
"is on a mega kill streak",
    
"is unstoppable",
    
"is wicked sick",
    
"is on a monster kill streak",
    
"is GODLIKE",
    
"is beyond GODLIKE, someone kill them!!"
}

new const 
g_iConstTextCountColor[sizeof g_szConstTextCount][3] =
{
    { 
025564 },
    { 
940189 },//{ 35, 0, 160 },
    
2550128 },
    { 
255128},
    { 
128128},
    { 
255128255 },
    { 
2550},
    { 
255128}
}

new 
g_szSoundsMulti[][g_iSizeSzSound] =
{
    
"D7/Announcers/Dota2/Kill/Announcer_kill_double_01.wav",
    
"D7/Announcers/Dota2/Kill/Announcer_kill_triple_01.wav",
    
"D7/Announcers/Dota2/Kill/Announcer_kill_ultra_01.wav",
    
"D7/Announcers/Dota2/Kill/Announcer_kill_rampage_01.wav"
}

new 
Float:g_fSoundsMultiDuration[sizeof g_szSoundsMulti] =
{
    
2.012970//2.011429
    
1.908480//1.906939
    
2.588299//2.586122
    
1.961360 //1.959184
}

new const 
g_szConstTextMulti[sizeof g_szSoundsMulti][] =
{
    
"got a double kill!",
    
"has a TRIPLE kill!",
    
"earned an ULTRA KILL!",
    
"IS ON A RAMPAGE!!"
}

new const 
g_iConstTextMultiColor[sizeof g_szConstTextMulti][3] =
{
    { 
255255255 },
    { 
255255255 },
    { 
255255255 },
    { 
2550}
}

new const 
g_szConstTextMultiAdd[][] =
{
    
"with a double kill!",
    
"with a TRIPLE kill!",
    
"with an ULTRA KILL!",
    
"RAMPAGE!!!"
}

new 
g_szSoundOwnage[g_iSizeSzSound] = "D7/Announcers/Dota2/Kill/Announcer_ownage_01.wav";
//new Float:g_fSoundOwnageDuration = 2.586122;

const Float:g_fConstTaskMultiDelay 5.0;
const 
Float:g_fConstTaskAnnounceTextDelay 0.25;

const 
g_iConstSizeName 31;

new 
g_iMaxPlayersg_szName[33][g_iConstSizeName], g_iIDFirstBlood,
g_iKills[33], g_iMulti[33], g_iCountKillsTeamg_iIDPCVarIgnoreBots,
g_iCountAnnouncersTextg_iIDAnnouncersText[2];

new 
g_iZPRunning 4;

enum (+= 33)
{
    
g_iIDTaskResetMulti 8000,
    
g_iIDTaskUpdateName,
    
g_iIDTaskAnnounceText,
    
g_iIDTaskAnnounceTextRemove,
    
g_iIDTaskAnnounceSound
}

enum _:g_iConstTaskAnnounceTextInfo
{
    
g_iConstInfoCount,
    
g_iConstInfoMulti,
    
g_iConstInfoVictim,
    
g_iConstInfoColorR,
    
g_iConstInfoColorG,
    
g_iConstInfoColorB
}

enum _:g_iExtResults
{
    
g_iConstExtResultShort = -2,
    
g_iConstExtResultNone = -1
}

stock iFtExtPosReturn(const szFile[])
{
    new 
iTemp;
    
    for (
iTemp strlen(szFile) - 2iTemp >= -1iTemp--)
    {
        if (
iTemp == -1)
            break;
        
        
//log_to_file(szFile, "iTemp: %d. Processing character: ^"%c^".", iTemp, szFile[iTemp])
        
if (szFile[iTemp] == '.')
        {
            
iTemp++;
            
            
//log_to_file(szFile, "iTemp: %d. Found extension: ^"%s^".", iTemp, szFile[iTemp])
            
            
break;
        }
        else if (
szFile[iTemp] == '/' || szFile[iTemp] == '\' || szFile[iTemp] == ' ')
        {
            iTemp = -1;
            
            break;
        }
    }
    
    return iTemp;
}

bFtContainsFolderStart(const szDirectory[], const szFolder[])
{
    new iPosFolderNameStart,
    iStrlLenDirectory = strlen(szDirectory);
    
    while (iPosFolderNameStart < iStrlLenDirectory && (szDirectory[iPosFolderNameStart] == '
/' || szDirectory[iPosFolderNameStart] == '\'))
        iPosFolderNameStart++;
    
    new iStrLenFolder = strlen(szFolder);
    
    if (iStrlLenDirectory - (iPosFolderNameStart + 1) < iStrLenFolder + 1
    || szDirectory[iPosFolderNameStart + iStrLenFolder + 1] != '
/'
    && szDirectory[iPosFolderNameStart + iStrLenFolder + 1] != '
\')
    {
        //ftD7Log(_, _, "[bFtContainsFolderStart] szDirectory: ^"%s^". szFolder: ^"%s^". False.", szDirectory, szFolder)
        
        return 0;
    }
    
    for (new iID; iID < iStrLenFolder; iID++)
    {
        if (szDirectory[iPosFolderNameStart + iID] != szFolder[iID])
        {
            //ftD7Log(_, _, "[bFtContainsFolderStart] szDirectory: ^"%s^". szFolder: ^"%s^". False.", szDirectory, szFolder)
            
            return 0;
        }
        else if (iID == iStrLenFolder - 1)
        {
            //ftD7Log(_, _, "[bFtContainsFolderStart] szDirectory: ^"%s^". szFolder: ^"%s^". True.", szDirectory, szFolder)
            
            return 1;
        }
    }
    
    //ftD7Log(_, _, "[bFtContainsFolderStart] szDirectory: ^"%s^". szFolder: ^"%s^". False.", szDirectory, szFolder)
    
    return 0;
}

enum (<<= 1)
{
    g_iConstBitStopWAV = 1,
    g_iConstBitStopMp3
}

ftPlaySound(const szSound[], const iID = 0, const iBsStopSounds = 0, const bSpeak = 1)
{
    new iPosExt = iFtExtPosReturn(szSound)
    
    if (equali(szSound[iPosExt], "mp3"))
        client_cmd(iID, "%s%smp3 play ^"%s^"", !(iBsStopSounds & g_iConstBitStopWAV) ? "" : "stopsound; ", !(iBsStopSounds & g_iConstBitStopMp3) ? "" : "mp3 stop; ", szSound)
    else
        client_cmd(iID, "%s%s%s ^"%s^"", !(iBsStopSounds & g_iConstBitStopWAV) ? "" : "stopsound; ", !(iBsStopSounds & g_iConstBitStopMp3) ? "" : "mp3 stop; ", !bSpeak ? "spk" : "speak", szSound)
}

public plugin_natives()
{
    set_native_filter("fwNativeFilter")
}

public fwNativeFilter(const szName[], const iID, const iTrap)
{
    // Credits to Schmurgel
    /* it'
s a trap? */
    if (
equal(szName"zp_get_user_zombie") && iTrap)
    {
        
/* yes it's a trap, zp is not running */
        
g_iZPRunning 0;
        return 
PLUGIN_HANDLED
    
}
    
    return (!
iTrap) ? PLUGIN_HANDLED PLUGIN_CONTINUE
}

public 
plugin_init()
{
    
register_plugin("D7 Announcer Kills: Dota 2"g_szConstVersion"D i 5 7 i n c T")
    
    
register_event("HLTV""fwEventHltvRoundStart""a""1=0""2=0")
    
    
register_message(get_user_msgid("SayText"), "fwMsgSayTextPre")
    
register_message(get_user_msgid("DeathMsg"), "fwMsgDeathPre")
    
    
register_cvar("D7AnnouncerKillsD2Version"g_szConstVersionFCVAR_SERVER FCVAR_SPONLY)
    
set_cvar_string("D7AnnouncerKillsD2Version"g_szConstVersion)
    
    
g_iMaxPlayers get_maxplayers();
    
    
g_iIDPCVarIgnoreBots register_cvar("D7AnnouncerKillsD2IgnoreBots""0");
    
    
/* Check if Zombie Plague is running */
    
if (LibraryExists("zp50_core"LibType_Library))
    {
        
/* zp50 is running */
        
g_iZPRunning 5;
    }
    else if (
get_cvar_pointer("zp_on")) /* Cvar is registered! */
    
{
        
/* Check if ZP is really running! */
        
zp_get_user_zombie(1/* trigger: native_filter. */
    
}
    else
        
g_iZPRunning 0;
/*    
    for (new i; i <= 256; i++)
    {
        ftD7Log("a", _, "[plugin_init] Character %d: ^"%c^".", i, i)
    }*/
}

public 
fwEventHltvRoundStart()
{
    
g_iIDFirstBlood 0;
    
g_iCountKillsTeam 0;
    
/*    remove_task(g_iIDTaskAnnounceSound)
    
    while (g_iCountAnnouncersText)
    {
        remove_task(g_iIDAnnouncersText[g_iCountAnnouncersText - 1] + g_iIDTaskAnnounceTextRemove)
        fwTaskAnnounceTextRemove(g_iIDAnnouncersText[g_iCountAnnouncersText - 1] + g_iIDTaskAnnounceTextRemove)
    }
    */
    
for (new iID 1iID <= g_iMaxPlayersiID++)
    {
        
g_iKills[iID] = 0;
        
        
remove_task(iID g_iIDTaskResetMulti)
        
fwTaskResetMulti(iID g_iIDTaskResetMulti)
    }
}

public 
fwTaskUpdateName(iID)
{
    
iID -= g_iIDTaskUpdateName;
    
    
// client_disconnect doesn't cover all the disconnect cases
    // so we need to be sure the player is still connected
    
if (!is_user_connected(iID))
        return;
    
    
get_user_name(iIDg_szName[iID], charsmax(g_szName[]))
}

// Credits to Johnny got his gun
public fwMsgSayTextPre()
{
    if (
get_msg_args() != 4)
        return;
    
    static 
szBuffer[21];
    
get_msg_arg_string(2szBuffercharsmax(szBuffer))
    
    if (!
equali(szBuffer"#Cstrike_Name_Change"))
        return;
    
    new 
iID get_msg_arg_int(1);
    
    
remove_task(iID g_iIDTaskUpdateName)
    
set_task(0.1"fwTaskUpdateName"iID g_iIDTaskUpdateName)
}

public 
client_putinserver(iID)
{
    
remove_task(iID g_iIDTaskUpdateName)
    
set_task(0.1"fwTaskUpdateName"iID g_iIDTaskUpdateName)
}

#if AMXX_VERSION_NUM <= 182
public client_disconnect(iID)
#else
public client_disconnected(iID)
#endif
{
    
remove_task(iID g_iIDTaskUpdateName)
    
    
g_iKills[iID] = 0;
    
    
remove_task(iID g_iIDTaskResetMulti)
    
fwTaskResetMulti(iID g_iIDTaskResetMulti)
    
    
remove_task(iID g_iIDTaskAnnounceTextRemove)
    
fwTaskAnnounceTextRemove(iID g_iIDTaskAnnounceTextRemove)
}

public 
fwTaskResetMulti(iID)
{
    
iID -= g_iIDTaskResetMulti;
    
    
g_iMulti[iID] = 0;
    
    
//ftD7Log(_, _, "[fwTaskResetMulti] ^"%s^".", g_szName[iID])
}

public 
fwTaskAnnounceText(const szInfo[], iID)
{
    
iID -= g_iIDTaskAnnounceText;
    
    
//ftD7Log(_, iID, "iID: %s. K: %d. M: %d. iIDVictim: %d.", g_szName[iID], szInfo[g_iConstInfoCount], szInfo[g_iConstInfoMulti], szInfo[g_iConstInfoVictim])
    
    
new szTemp[128], iTemp;
    
    if (
szInfo[g_iConstInfoCount] >= 0)
    {
        for (
iTemp 0iTemp strlen(g_szConstTextCount[szInfo[g_iConstInfoCount]]); iTemp++)
            
szTemp[iTemp] = '    ';//copy(szTemp[iTemp], charsmax(szTemp) - iTemp, "    ");
        
        //replace_all(szTemp, charsmax(szTemp), "", "")
        //replace_all(szTemp, charsmax(szTemp), "Ÿ", "")
        
        // red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65,
        // effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0,
        // Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = true
        #if defined _dhudmessage_included
        
set_dhudmessage
        
(
            
szInfo[g_iConstInfoColorR], szInfo[g_iConstInfoColorG], szInfo[g_iConstInfoColorB], -1.00.1500.0,
            
g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0false
        
)
        
#else
        
set_dhudmessage
        
(
            
szInfo[g_iConstInfoColorR], szInfo[g_iConstInfoColorG], szInfo[g_iConstInfoColorB], -1.00.1500.0,
            
g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0
        
)
        
#endif
        
show_dhudmessage(0"%s%s%s", (iID == g_iIDAnnouncersText[1]) ? "^n^n" ""g_szName[iID], szTemp)
        
//ftD7Log("a", iID, "%s%s", g_szName[iID], szTemp)
        
        
szTemp "";
        
        for (
iTemp 0iTemp strlen(g_szName[iID]); iTemp++)
            
copy(szTemp[iTemp], charsmax(szTemp) - iTemp"    ");
        
        
//replace_all(szTemp, charsmax(szTemp), "", "")
        //replace_all(szTemp, charsmax(szTemp), "Ÿ", "")
        
        #if defined _dhudmessage_included
        
set_dhudmessage
        
(
            
g_iConstTextCountColor[szInfo[g_iConstInfoCount]][0], g_iConstTextCountColor[szInfo[g_iConstInfoCount]][1], g_iConstTextCountColor[szInfo[g_iConstInfoCount]][2],
            -
1.00.1500.0g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0false
        
)
        
#else
        
set_dhudmessage
        
(
            
g_iConstTextCountColor[szInfo[g_iConstInfoCount]][0], g_iConstTextCountColor[szInfo[g_iConstInfoCount]][1], g_iConstTextCountColor[szInfo[g_iConstInfoCount]][2],
            -
1.00.1500.0g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0
        
)
        
#endif
        
show_dhudmessage(0"%s%s %s", (iID == g_iIDAnnouncersText[1]) ? "^n^n" ""szTempg_szConstTextCount[szInfo[g_iConstInfoCount]])
        
//ftD7Log("a", iID, "%s %s", szTemp, g_szConstTextCount[szInfo[g_iConstInfoCount]])
        
        
if (szInfo[g_iConstInfoMulti] >= 0)
        {
            
#if defined _dhudmessage_included
            
set_dhudmessage
            
(
                
g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][0], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][1], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][2],
                -
1.00.1500.0g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0false
            
)
            
#else
            
set_dhudmessage
            
(
                
g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][0], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][1], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][2],
                -
1.00.1500.0g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0
            
)
            
#endif
            
show_dhudmessage(0"%s%s", (iID == g_iIDAnnouncersText[1]) ? "^n^n^n" "^n"g_szConstTextMultiAdd[szInfo[g_iConstInfoMulti]])
        }
    }
    else if (
szInfo[g_iConstInfoMulti] >= 0)
    {
        for (
iTemp 0iTemp strlen(g_szConstTextMulti[szInfo[g_iConstInfoMulti]]); iTemp++)
            
copy(szTemp[iTemp], charsmax(szTemp) - iTemp"    ");
        
        
//replace_all(szTemp, charsmax(szTemp), "", "")
        //replace_all(szTemp, charsmax(szTemp), "Ÿ", "")
        
        #if defined _dhudmessage_included
        
set_dhudmessage
        
(
            
szInfo[g_iConstInfoColorR], szInfo[g_iConstInfoColorG], szInfo[g_iConstInfoColorB], -1.00.1500.0,
            
g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0false
        
)
        
#else
        
set_dhudmessage
        
(
            
szInfo[g_iConstInfoColorR], szInfo[g_iConstInfoColorG], szInfo[g_iConstInfoColorB], -1.00.1500.0,
            
g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0
        
)
        
#endif
        
show_dhudmessage(0"%s%s%s", (iID == g_iIDAnnouncersText[1]) ? "^n^n" ""g_szName[iID], szTemp)
        
//ftD7Log("a", iID, "%s%s", g_szName[iID], szTemp)
        
        
szTemp "";
        
        for (
iTemp 0iTemp strlen(g_szName[iID]); iTemp++)
            
copy(szTemp[iTemp], charsmax(szTemp) - iTemp"    ");
        
        
//replace_all(szTemp, charsmax(szTemp), "", "")
        //replace_all(szTemp, charsmax(szTemp), "Ÿ", "")
        
        #if defined _dhudmessage_included
        
set_dhudmessage
        
(
            
g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][0], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][1], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][2],
            -
1.00.1500.0g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0false
        
)
        
#else
        
set_dhudmessage
        
(
            
g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][0], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][1], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][2],
            -
1.00.1500.0g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0
        
)
        
#endif
        
show_dhudmessage(0"%s%s %s", (iID == g_iIDAnnouncersText[1]) ? "^n^n" ""szTempg_szConstTextMulti[szInfo[g_iConstInfoMulti]])
        
//ftD7Log("a", iID, "%s %s", szTemp, g_szConstTextMulti[szInfo[g_iConstInfoMulti]])
    
}
    else if (
szInfo[g_iConstInfoVictim])
    {
        for (
iTemp 0iTemp strlen(g_szConstTextFirstBlood) + strlen(g_szName[szInfo[g_iConstInfoVictim]]); iTemp++)
            
copy(szTemp[iTemp], charsmax(szTemp) - iTemp"    ");
        
        
//replace_all(szTemp, charsmax(szTemp), "", "")
        //replace_all(szTemp, charsmax(szTemp), "Ÿ", "")
        
        #if defined _dhudmessage_included
        
set_dhudmessage
        
(
            
szInfo[g_iConstInfoColorR], szInfo[g_iConstInfoColorG], szInfo[g_iConstInfoColorB], -1.00.1500.0,
            
g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0false
        
)
        
#else
        
set_dhudmessage
        
(
            
szInfo[g_iConstInfoColorR], szInfo[g_iConstInfoColorG], szInfo[g_iConstInfoColorB], -1.00.1500.0,
            
g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0
        
)
        
#endif
        
show_dhudmessage(0"%s%s%s", (iID == g_iIDAnnouncersText[1]) ? "^n^n" ""g_szName[iID], szTemp)
        
//ftD7Log("a", iID, "%s%s", g_szName[iID], szTemp)
        
        
szTemp "";
        
        for (
iTemp 0iTemp strlen(g_szName[iID]); iTemp++)
            
copy(szTemp[iTemp], charsmax(szTemp) - iTemp"    ");
        
        
//replace_all(szTemp, charsmax(szTemp), "", "")
        //replace_all(szTemp, charsmax(szTemp), "Ÿ", "")
        
        #if defined _dhudmessage_included
        
set_dhudmessage
        
(
            
g_iConstTextFirstBloodColor[0], g_iConstTextFirstBloodColor[1], g_iConstTextFirstBloodColor[2],
            -
1.00.1500.0g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0false
        
)
        
#else
        
set_dhudmessage
        
(
            
g_iConstTextFirstBloodColor[0], g_iConstTextFirstBloodColor[1], g_iConstTextFirstBloodColor[2],
            -
1.00.1500.0g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 0.05), 0.00.0
        
)
        
#endif
        
show_dhudmessage(0"%s%s %s %s", (iID == g_iIDAnnouncersText[1]) ? "^n^n" ""szTempg_szConstTextFirstBloodg_szName[szInfo[g_iConstInfoVictim]])
        
//ftD7Log("a", iID, "%s %s %s", szTemp, g_szConstTextFirstBlood, g_szName[szInfo[g_iConstInfoVictim]])
    
}
}

public 
fwTaskAnnounceSound(const szSound[], iIDTask)
{
    
ftPlaySound(szSound)
}

public 
fwTaskAnnounceTextRemove(iID)
{
    
iID -= g_iIDTaskAnnounceTextRemove;
    
    
remove_task(iID g_iIDTaskAnnounceText)
    
    if (
iID == g_iIDAnnouncersText[0])
    {
        
g_iCountAnnouncersText--;
        
        
g_iIDAnnouncersText[0] = g_iIDAnnouncersText[1];
        
g_iIDAnnouncersText[1] = 0;
    }
    else if (
iID == g_iIDAnnouncersText[1])
    {
        
g_iCountAnnouncersText--;
        
        
g_iIDAnnouncersText[1] = 0;
    }
}

// After fwHamKilledPlayerPre
// Before fwHamKilledPlayer
public fwMsgDeathPre()//const iIDMsg, const iMsgDest, const iIDEnt
{
    
fwKilledPlayer(get_msg_arg_int(2), get_msg_arg_int(1))
}

public 
zp_user_infected_post(iIDiIDAttacker)
{
    if (
g_iZPRunning != 4)
        return;
    
    
fwKilledPlayer(iIDiIDAttacker)
}

public 
zp_fw_core_infect_post(iIDiIDAttacker)
{
    if (
g_iZPRunning != 5)
        return;
    
    
fwKilledPlayer(iIDiIDAttacker)
}

public 
zp_fw_core_cure_post(iIDiIDAttacker)
{
    if (
g_iZPRunning != 5)
        return;
    
    
fwKilledPlayer(iIDiIDAttacker)
}

public 
fwKilledPlayer(const iIDVictim, const iIDAttacker)
{
    if (!
iIDAttacker || iIDVictim == iIDAttacker)
        return;
    
    
g_iKills[iIDVictim] = 0;
    
    if (!
is_user_connected(iIDAttacker))
        return;
    
    new 
CsTeams:iTeamAttacker cs_get_user_team(iIDAttacker);
    
    if (
iTeamAttacker == CS_TEAM_SPECTATOR || iTeamAttacker == CS_TEAM_UNASSIGNED)
        return;
    
    new 
CsTeams:iTeamVictim;
    
    if (!
g_iZPRunning)
    {
        
iTeamVictim cs_get_user_team(iIDVictim);
    }
    else if (
g_iZPRunning == 4)
    {
        
iTeamAttacker zp_get_user_zombie(iIDAttacker) ? CS_TEAM_T CS_TEAM_CT;
        
iTeamVictim = (iTeamAttacker == CS_TEAM_CT) ? CS_TEAM_T CS_TEAM_CT;
    }
    else if (
g_iZPRunning == 5)
    {
        
iTeamAttacker zp_core_is_zombie(iIDAttacker) ? CS_TEAM_T CS_TEAM_CT;
        
iTeamVictim = (iTeamAttacker == CS_TEAM_CT) ? CS_TEAM_T CS_TEAM_CT;
    }
    
    
//ftD7Log(_, _, "[fwKilledPlayer] iIDVictim(team): ^"%s^"(%d). iIDAttacker(team): ^"%s^"(%d).", g_szName[iIDVictim], iTeamVictim, g_szName[iIDAttacker], iTeamAttacker)
    
    
if (iTeamAttacker == CS_TEAM_T)
    {
        if (
g_iCountKillsTeam >= 0)
            
g_iCountKillsTeam = -1;
        else
            
g_iCountKillsTeam--;
    }
    else if (
iTeamAttacker == CS_TEAM_CT)
    {
        if (
g_iCountKillsTeam <= 0)
            
g_iCountKillsTeam 1;
        else
            
g_iCountKillsTeam++;
    }
    
    if (
iTeamAttacker == iTeamVictim || get_pcvar_num(g_iIDPCVarIgnoreBots) && is_user_bot(iIDAttacker))
        return;
    
    if (
g_iKills[iIDAttacker] < sizeof g_szSoundsCount 2)
        
g_iKills[iIDAttacker]++;
    
    if (
g_iMulti[iIDAttacker] < sizeof g_szSoundsMulti 1)
        
g_iMulti[iIDAttacker]++;
    
    
remove_task(iIDAttacker g_iIDTaskResetMulti)
    
set_task(g_fConstTaskMultiDelay"fwTaskResetMulti"iIDAttacker g_iIDTaskResetMulti)
    
    new 
Float:fTemp;
    
    if (
g_iKills[iIDAttacker] >= || g_iMulti[iIDAttacker] >= || !g_iIDFirstBlood)
    {
        
remove_task(g_iIDTaskAnnounceSound)
        
        if (!
g_iIDFirstBlood)
        {
            
set_task(0.1"fwTaskAnnounceSound"g_iIDTaskAnnounceSoundg_szSoundFirstBloodcharsmax(g_szSoundFirstBlood))
            
fTemp += g_fSoundFirstBloodDuration;
        }
        
        if (
g_iKills[iIDAttacker] >= 3)
        {
            if (
fTemp <= 0)
                
set_task(0.1"fwTaskAnnounceSound"g_iIDTaskAnnounceSoundg_szSoundsCount[g_iKills[iIDAttacker] - 3], charsmax(g_szSoundsCount[]))
            else
                
set_task(fTemp"fwTaskAnnounceSound"g_iIDTaskAnnounceSoundg_szSoundsCount[g_iKills[iIDAttacker] - 3], charsmax(g_szSoundsCount[]))
            
            
fTemp += g_fSoundsCountDuration[g_iKills[iIDAttacker] - 3];
        }
        
        if (
g_iMulti[iIDAttacker] >= 2)
        {
            if (
fTemp <= 0)
                
set_task(0.1"fwTaskAnnounceSound"g_iIDTaskAnnounceSoundg_szSoundsMulti[g_iMulti[iIDAttacker] - 2], charsmax(g_szSoundsMulti[]))
            else
                
set_task(fTemp"fwTaskAnnounceSound"g_iIDTaskAnnounceSoundg_szSoundsMulti[g_iMulti[iIDAttacker] - 2], charsmax(g_szSoundsMulti[]))
            
            
fTemp += g_fSoundsMultiDuration[g_iMulti[iIDAttacker] - 2];
        }
        
        
remove_task(iIDAttacker g_iIDTaskAnnounceTextRemove)
        
fwTaskAnnounceTextRemove(iIDAttacker g_iIDTaskAnnounceTextRemove)
        
set_task(fTemp"fwTaskAnnounceTextRemove"iIDAttacker g_iIDTaskAnnounceTextRemove)
        
        if (!
g_iCountAnnouncersText)
        {
            
g_iCountAnnouncersText++;
            
            
g_iIDAnnouncersText[g_iCountAnnouncersText 1] = iIDAttacker;
        }
        else if (
g_iCountAnnouncersText == 1)
        {
            if (
g_iIDAnnouncersText[g_iCountAnnouncersText 1] != iIDAttacker)
            {
                
g_iCountAnnouncersText++;
                
                
g_iIDAnnouncersText[g_iCountAnnouncersText 1] = iIDAttacker;
            }
        }
        else if (
g_iCountAnnouncersText == 2)
        {
            if (
g_iIDAnnouncersText[g_iCountAnnouncersText 1] != iIDAttacker)
            {
                
remove_task(g_iIDAnnouncersText[g_iCountAnnouncersText 2] + g_iIDTaskAnnounceText)
                
                
g_iIDAnnouncersText[g_iCountAnnouncersText 2] = g_iIDAnnouncersText[g_iCountAnnouncersText 1];
                
g_iIDAnnouncersText[g_iCountAnnouncersText 1] = iIDAttacker;
            }
        }
        
        new 
szTemp[g_iConstTaskAnnounceTextInfo];
        
szTemp[g_iConstInfoCount] = g_iKills[iIDAttacker] - 3;
        
szTemp[g_iConstInfoMulti] = g_iMulti[iIDAttacker] - 2;
        
szTemp[g_iConstInfoVictim] = g_iIDFirstBlood iIDVictim;
        
szTemp[g_iConstInfoColorR] = (iTeamAttacker == CS_TEAM_T) ? 255 0;
        
szTemp[g_iConstInfoColorG] = 0;
        
szTemp[g_iConstInfoColorB] = (iTeamAttacker == CS_TEAM_T) ? 255;
        
        
remove_task(iIDAttacker g_iIDTaskAnnounceText)
        
        if (
g_fConstTaskAnnounceTextDelay >= 0.2)
            
set_task(0.1"fwTaskAnnounceText"iIDAttacker g_iIDTaskAnnounceTextszTempg_iConstTaskAnnounceTextInfo)
        
        
set_task(g_fConstTaskAnnounceTextDelay"fwTaskAnnounceText"iIDAttacker g_iIDTaskAnnounceTextszTempg_iConstTaskAnnounceTextInfo"b")
        
//ftD7Log(_, iIDAttacker, "[fwKilledPlayer] Announcers: %d. 1: ^"%s^". 2: ^"%s^".", g_iCountAnnouncersText, g_szName[g_iIDAnnouncersText[0]], (g_iCountAnnouncersText > 1) ? g_szName[g_iIDAnnouncersText[1]] : "")
    
}
    
    if (
g_iCountKillsTeam <= -|| g_iCountKillsTeam >= 5)
    {
        if (
fTemp <= 0)
        {
            
remove_task(g_iIDTaskAnnounceSound)
            
set_task(0.1"fwTaskAnnounceSound"g_iIDTaskAnnounceSoundg_szSoundOwnagecharsmax(g_szSoundOwnage))
        }
        else
            
set_task(fTemp"fwTaskAnnounceSound"g_iIDTaskAnnounceSoundg_szSoundOwnagecharsmax(g_szSoundOwnage))
    }
    
    if (!
g_iIDFirstBlood)
    {
        
g_iIDFirstBlood iIDAttacker;
    }
}

public 
plugin_precache()
{
    new 
iTempiID;
    
    if (
g_szSoundFirstBlood[0])
    {
        if (!
bFtContainsFolderStart(g_szSoundFirstBlood"sound"))
            
format(g_szSoundFirstBloodcharsmax(g_szSoundFirstBlood), "sound/%s"g_szSoundFirstBlood)
        
        
precache_generic(g_szSoundFirstBlood)
        
        
iTemp iFtExtPosReturn(g_szSoundFirstBlood);
        
        if (
iTemp >= && equali(g_szSoundFirstBlood[iTemp], "wav"))
        {
            
g_fSoundFirstBloodDuration sfile_get_duration(g_szSoundFirstBlood);
            
            
replace(g_szSoundFirstBloodcharsmax(g_szSoundFirstBlood), g_szSoundFirstBlood[iTemp 1], "")
        }
    }
    
    if (
g_szSoundOwnage[0])
    {
        if (!
bFtContainsFolderStart(g_szSoundOwnage"sound"))
            
format(g_szSoundOwnagecharsmax(g_szSoundOwnage), "sound/%s"g_szSoundOwnage)
        
        
precache_generic(g_szSoundOwnage)
        
        
iTemp iFtExtPosReturn(g_szSoundOwnage);
        
        if (
iTemp >= && equali(g_szSoundOwnage[iTemp], "wav"))
        {
            
g_fSoundFirstBloodDuration sfile_get_duration(g_szSoundOwnage);
            
            
replace(g_szSoundOwnagecharsmax(g_szSoundOwnage), g_szSoundOwnage[iTemp 1], "")
        }
    }
    
    for (
iID 0iID sizeof g_szSoundsCountiID++)
    {
        if (!
g_szSoundsCount[iID][0])
            continue;
        
        if (!
bFtContainsFolderStart(g_szSoundsCount[iID], "sound"))
            
format(g_szSoundsCount[iID], charsmax(g_szSoundsCount[]), "sound/%s"g_szSoundsCount[iID])
        
        
precache_generic(g_szSoundsCount[iID])
        
        
iTemp iFtExtPosReturn(g_szSoundsCount[iID]);
        
        if (
iTemp >= && equali(g_szSoundsCount[iID][iTemp], "wav"))
        {
            
g_fSoundFirstBloodDuration sfile_get_duration(g_szSoundsCount[iID]);
            
            
replace(g_szSoundsCount[iID], charsmax(g_szSoundsCount[]), g_szSoundsCount[iID][iTemp 1], "")
        }
    }
    
    for (
iID 0iID sizeof g_szSoundsMultiiID++)
    {
        if (!
g_szSoundsMulti[iID][0])
            continue;
        
        if (!
bFtContainsFolderStart(g_szSoundsMulti[iID], "sound"))
            
format(g_szSoundsMulti[iID], charsmax(g_szSoundsMulti[]), "sound/%s"g_szSoundsMulti[iID])
        
        
precache_generic(g_szSoundsMulti[iID])
        
        
iTemp iFtExtPosReturn(g_szSoundsMulti[iID]);
        
        if (
iTemp >= && equali(g_szSoundsMulti[iID][iTemp], "wav"))
        {
            
g_fSoundFirstBloodDuration sfile_get_duration(g_szSoundsMulti[iID]);
            
            
replace(g_szSoundsMulti[iID], charsmax(g_szSoundsMulti[]), g_szSoundsMulti[iID][iTemp 1], "")
        }
    }




687474703a2f2f6269742e6c792f4437496d6744
bitsums.inc

Attached Files
File Type: inc dhudmessage.inc (2.9 KB)
File Type: inc soundinfo.inc (12.0 KB)
File Type: sma Get Plugin or Get Source (D7AnnouncerKillsD2.sma - 28.5 KB)
File Type: zip D7KillAnnouncerDota2Sounds.zip (463.0 KB)

Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

×
×
  • Dodaj nową pozycję...