Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
|
03-02-2020
, 20:18
DHUD empty spaces
|
#1
|
I'm trying to make multiple dhuds align with eachother by leaving empty spaces to account for the rest of the message and hopefully have an apparently continuous multi-colored hud.
Problem is DHUD seems to use non-unique character sizes, so even if i calculate the spacing right and the plain text shows correctly, in-game it's a different story and the huds either overlap or are spaced too far apart. Closest i could get was by using tab space. Also tried to use unicode spaces: http://emptycharacter.com/
How can i solve this?
Examples in plain text vs in-game:
Code:
L 03/03/2020 - 02:55:41: D i 5 7 i n c T
L 03/03/2020 - 02:55:41: drew first blood by killing Finn
Code:
L 03/03/2020 - 02:55:43: D i 5 7 i n c T
L 03/03/2020 - 02:55:43: got a double kill!
Code:
L 03/03/2020 - 02:55:44: D i 5 7 i n c T
L 03/03/2020 - 02:55:44: is on a killing spree!
Code:
L 03/03/2020 - 02:55:46: D i 5 7 i n c T
L 03/03/2020 - 02:55:46: is dominating!
Code:
L 03/03/2020 - 02:55:47: D i 5 7 i n c T
L 03/03/2020 - 02:55:47: is on a mega kill streak!
Code:
L 03/03/2020 - 02:55:49: D i 5 7 i n c T
L 03/03/2020 - 02:55:49: is unstoppable!
Code:
L 03/03/2020 - 02:55:51: D i 5 7 i n c T
L 03/03/2020 - 02:55:51: is wicked sick!
Code:
L 03/03/2020 - 02:55:53: D i 5 7 i n c T
L 03/03/2020 - 02:55:53: is on a monster kill streak!
Code:
L 03/03/2020 - 02:55:55: D i 5 7 i n c T
L 03/03/2020 - 02:55:55: is GODLIKE!
Code:
L 03/03/2020 - 02:55:57: D i 5 7 i n c T
L 03/03/2020 - 02:55:57: is beyond GODLIKE, someone kill them!!
Here's the code and everything else needed:
PHP Code:
/*
To do:
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
[T] HUD
[ ] multilang
[ ] fix bomb kills counting (for planter?)
[T] don't reset multis on death or spawn and add multi only messages
[-] fix ownage chat message printing multiple times
[ ] precache_generic for all the sounds since we're not playing them on server side
[ ] cache sound type instead of checking for extension every time
[T] reset kills and multis on round start
[ ]
*/
// Modules
#include <amxmodx>
//#include <hamsandwich>
// Plug-in APIs
//#include <cs_ham_bots_api>
//#include <zombieplague>
// Stocks
#include <bitsums>
#if AMXX_VERSION_NUM <= 182//!defined set_dhudmessage
#include <dhudmessage>
#endif
#include <soundinfo>
#include <D7Debug>
const g_iSizeSzSound = 128;
new g_szSoundFirstBlood[g_iSizeSzSound] = "D7/Announcers/Dota2/Kill/Announcer_1stblood_01.wav";
new const g_szConstTextFirstBlood[] = "drew first blood by killing";
new const g_iConstTextFirstBloodColor[3] = { 255, 255, 255 };
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 const g_szConstTextCount[][] =
{
"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] =
{
{ 0, 255, 0 },
{ 35, 0, 160 },
{ 255, 255, 255, },
{ 255, 255, 255, },
{ 255, 255, 255, },
{ 255, 255, 255, },
{ 255, 0, 0 },
{ 255, 128, 0 }
}
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 const g_szConstTextMulti[][] =
{
"got a double kill!",
"has a TRIPLE kill!",
"earned an ULTRA KILL!",
"is on a RAMPAGE!!!"
}
new const g_iConstTextMultiColor[sizeof g_szConstTextMulti][3] =
{
{ 255, 255, 255, },
{ 255, 255, 255, },
{ 255, 128, 0 },
{ 255, 0, 0 }
}
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";
const g_iConstSizeName = 31;
new Float:g_fSoundFirstBloodDuration = 1.647891, //1.645714
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
},
//Float:g_fSoundOwnageDuration = 2.586122,
Float:g_fSoundsMultiDuration[sizeof g_szSoundsMulti] =
{
2.012970, //2.011429
1.908480, //1.906939
2.588299, //2.586122
1.961360 //1.959184
},
g_iMaxPlayers, g_szName[33][g_iConstSizeName], g_iIDFirstBlood,
g_iKills[33], g_iMulti[33], g_iTeam[33], g_iCountKillsTeam,
g_iBsBot, g_iIDPCVarIgnoreBots, g_iCountAnnouncersText, g_iIDAnnouncersText[2];
const Float:g_fConstTaskMultiDelay = 3.5;//5.0
const Float:g_fConstTaskAnnounceTextDelay = 0.2;
enum (+= 33)
{
g_iIDTaskResetMulti = 8000,
g_iIDTaskUpdateName,
g_iIDTaskAnnounceText,
g_iIDTaskAnnounceTextRemove,
g_iIDTaskAnnounceSound
}
public plugin_init()
{
register_plugin("D7 Announcer Kills: Dota 2", "0.2.7", "D i 5 7 i n c T")
register_event("HLTV", "fwEventHltvRoundStart", "a", "1=0", "2=0")
register_message(get_user_msgid("TeamInfo"), "fwMsgTeamInfoPre")
register_message(get_user_msgid("SayText"), "fwMsgSayTextPre")
//register_message(g_iIDMsgDeath, "fwMsgDeathPre")
register_event("DeathMsg", "fwEvDeathMsg", "a")
//RegisterHam(Ham_Killed, "player", "fwHamKilledPlayer", 1)
//RegisterHamBots(Ham_Killed, "fwHamKilledPlayer", 1)
g_iMaxPlayers = get_maxplayers();
g_iIDPCVarIgnoreBots = register_cvar("D7AnnouncerKillsD2IgnoreBots", "0");
//register_clcmd("say", "fwClCmdSay")
//register_clcmd("say_team", "fwClCmdSay")
//ftD7Log(_, _, "[plugin_init] g_iEnumBsAnnounceInfo: %d. Bitsum: %d. g_iBitSayText: %d. g_iBitHUD: %d. g_iBitKills: %d. g_iBitSoundMultis: %d.",
//g_iEnumBsAnnounceInfo, (g_iBitSayText | g_iBitHUD | g_iBitKills | g_iBitSoundMultis), g_iBitSayText, g_iBitHUD, g_iBitKills, g_iBitSoundMultis)
}
// Credits to "Speed"
public fwMsgTeamInfoPre(const iIDMsg, const iDestMsg)
{
// Only hook global messages
if (iDestMsg != MSG_ALL && iDestMsg != MSG_BROADCAST)
return;
// Get player iID and his new team
static szTeam[2], iID;
get_msg_arg_string(2, szTeam, charsmax(szTeam))
iID = get_msg_arg_int(1);
if (szTeam[0] == 'S' || szTeam[0] == 'U')
{
g_iTeam[iID] = 0;
}
//#if !defined _zombieplaguenightmare_included && !defined _zombie_plague_advance_included && !defined _zombieplague_included
else
{
if (szTeam[0] == 'T')
g_iTeam[iID] = 1;
else if (szTeam[0] == 'C')
g_iTeam[iID] = 2;
}
//#endif
}
/*
public fwClCmdSay(const iID)
{
static szArg[192], szArg1[32], szArg2[32];
read_args(szArg, charsmax(szArg))
trim(szArg)
remove_quotes(szArg)
szArg1 = "";
szArg2 = "";
parse(szArg, szArg1, charsmax(szArg1), szArg2, charsmax(szArg2))
ftD7Log(_, _, "^"%s^", ^"%s^", ^"%s^".", szArg, szArg1, szArg2)
if (equali(szArg1, "/teststring"))
{
ftD7Log(_, iID, "[fwClCmdSay] ^"%s^". sizeof: %d. charsmax: %d. strlen: %d.", szArg1, sizeof szArg1, charsmax(szArg1), strlen(szArg1))
}
if (equali(szArg1, "/ext"))
{
new iPosExt = iFtExtPosReturn(szArg2);
if (iPosExt == -1)
ftD7Log(_, iID, "[fwClCmdSay] ^"%s^". Extension: ^"None found^".", szArg2)
else if (iPosExt == -2)
ftD7Log(_, iID, "[fwClCmdSay] ^"%s^". Extension: ^"Name too short^".", szArg2)
else
ftD7Log(_, iID, "[fwClCmdSay] ^"%s^". Extension: ^"%s^".", szArg2, szArg2[iPosExt])
}
}
ftGetBitsumBitCount(iBitsum)
{
iBitsum = iBitsum - ((iBitsum >> 1) & 0x55555555);
iBitsum = (iBitsum & 0x33333333) + ((iBitsum >> 2) & 0x33333333);
return (((iBitsum + (iBitsum >> 4) & 0xF0F0F0F) * 0x1010101) >> 24);
}*/
public fwEventHltvRoundStart()
{
g_iIDFirstBlood = 0;
remove_task(g_iIDTaskAnnounceSound)
g_iCountKillsTeam = 0;
g_iCountAnnouncersText = 0;
for (new iID = 1; iID <= g_iMaxPlayers; iID++)
{
g_iKills[iID] = 0;
g_iMulti[iID] = 0;
remove_task(iID + g_iIDTaskAnnounceText)
remove_task(iID + g_iIDTaskAnnounceTextRemove)
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(iID, g_szName[iID], charsmax(g_szName[]))
}
/*
public client_infochanged(iID)
{
if (!is_user_connected(iID))
return;
//remove_task(iID + g_iIDTaskUpdateName)
//set_task(0.1, "fwTaskUpdateName", iID + g_iIDTaskUpdateName)
}*/
// Credits to Johnny got his gun
public fwMsgSayTextPre()
{
if (get_msg_args() != 4)
return;
static szBuffer[21];
get_msg_arg_string(2, szBuffer, charsmax(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_authorized(iID)
{
}*/
public client_putinserver(iID)
{
remove_task(iID + g_iIDTaskUpdateName)
set_task(0.1, "fwTaskUpdateName", iID + g_iIDTaskUpdateName)
if (is_user_bot(iID) && get_pcvar_num(g_iIDPCVarIgnoreBots))
{
bitsum_add(g_iBsBot, iID)
}
else
{
bitsum_del(g_iBsBot, iID)
}
}
#if AMXX_VERSION_NUM < 183
public client_disconnect(iID)
#else
public client_disconnected(iID)
#endif
{
remove_task(iID + g_iIDTaskUpdateName)
g_iKills[iID] = 0;
fwTaskResetMulti(iID + g_iIDTaskResetMulti)
if (iID == g_iIDAnnouncersText[0] || iID == g_iIDAnnouncersText[1])
{
remove_task(iID + g_iIDTaskAnnounceTextRemove)
fwTaskAnnounceTextRemove(iID + g_iIDTaskAnnounceTextRemove)
}
}
enum (<<= 1)
{
g_iBitStopWAV = 1,
g_iBitStopMp3
}
ftPlaySound(const szSound[], const iID = 0, const iStopSounds = 0, const bSpeak = 1)
{
new iPosExt = iFtExtPosReturn(szSound)
if (equali(szSound[iPosExt], "mp3"))
client_cmd(iID, "%s%smp3 play ^"%s^"", !(iStopSounds & g_iBitStopWAV) ? "" : "stopsound; ", !(iStopSounds & g_iBitStopMp3) ? "" : "mp3 stop; ", szSound)
else
client_cmd(iID, "%s%s%s ^"%s^"", !(iStopSounds & g_iBitStopWAV) ? "" : "stopsound; ", !(iStopSounds & g_iBitStopMp3) ? "" : "mp3 stop; ", !bSpeak ? "spk" : "speak", szSound)
}
public fwTaskResetMulti(iID)
{
remove_task(iID)
iID -= g_iIDTaskResetMulti;
g_iMulti[iID] = 0;
//ftD7Log(_, _, "[fwTaskResetMulti] ^"%s^".", g_szName[iID])
}
enum
{
g_iConstInfoCount,
g_iConstInfoMulti,
g_iConstInfoVictim
}
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 = 0; iTemp < strlen(g_szConstTextCount[szInfo[g_iConstInfoCount]]); 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
(
(g_iTeam[iID] == 1) ? 255 : 0,
0,
(g_iTeam[iID] == 1) ? 0 : 255,
-1.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.0, false
)//g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05)
#else
set_dhudmessage
(
(g_iTeam[iID] == 1) ? 255 : 0,
0,
(g_iTeam[iID] == 1) ? 0 : 255,
-1.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.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 = 0; iTemp < 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.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.0, false
)
#else
set_dhudmessage
(
g_iConstTextCountColor[szInfo[g_iConstInfoCount]][0], g_iConstTextCountColor[szInfo[g_iConstInfoCount]][1], g_iConstTextCountColor[szInfo[g_iConstInfoCount]][2],
-1.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.0
)
#endif
show_dhudmessage(0, "%s%s %s", (iID == g_iIDAnnouncersText[1]) ? "^n^n" : "", szTemp, g_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.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.0, false
)
#else
set_dhudmessage
(
g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][0], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][1], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][2],
-1.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.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 = 0; iTemp < 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
(
(g_iTeam[iID] == 1) ? 255 : 0,
0,
(g_iTeam[iID] == 1) ? 0 : 255,
-1.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.0, false
)//g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05)
#else
set_dhudmessage
(
(g_iTeam[iID] == 1) ? 255 : 0,
0,
(g_iTeam[iID] == 1) ? 0 : 255,
-1.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.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 = 0; iTemp < 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.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.0, false
)
#else
set_dhudmessage
(
g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][0], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][1], g_iConstTextMultiColor[szInfo[g_iConstInfoMulti]][2],
-1.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.0
)
#endif
show_dhudmessage(0, "%s%s %s", (iID == g_iIDAnnouncersText[1]) ? "^n^n" : "", szTemp, g_szConstTextMulti[szInfo[g_iConstInfoMulti]])
ftD7Log("a", iID, "%s %s", szTemp, g_szConstTextMulti[szInfo[g_iConstInfoMulti]])
}
else if (szInfo[g_iConstInfoVictim])
{
for (iTemp = 0; iTemp < strlen(g_szConstTextFirstBlood) + 1 + 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
(
(g_iTeam[iID] == 1) ? 255 : 0,
0,
(g_iTeam[iID] == 1) ? 0 : 255,
-1.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.0, false
)//g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05)
#else
set_dhudmessage
(
(g_iTeam[iID] == 1) ? 255 : 0,
0,
(g_iTeam[iID] == 1) ? 0 : 255,
-1.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.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 = 0; iTemp < 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.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.0, false
)
#else
set_dhudmessage
(
g_iConstTextFirstBloodColor[0], g_iConstTextFirstBloodColor[1], g_iConstTextFirstBloodColor[2],
-1.0, 0.15, 0, 0.0, g_fConstTaskAnnounceTextDelay + ((g_fConstTaskAnnounceTextDelay >= 0.2) ? 0.1 : 0.05), 0.0, 0.0
)
#endif
show_dhudmessage(0, "%s%s %s %s", (iID == g_iIDAnnouncersText[1]) ? "^n^n" : "", szTemp, g_szConstTextFirstBlood, g_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 (g_iCountAnnouncersText > 0)
g_iCountAnnouncersText--;
if (iID == g_iIDAnnouncersText[0])
{
g_iIDAnnouncersText[0] = g_iIDAnnouncersText[1];
}
g_iIDAnnouncersText[1] = 0;
}
#if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included || defined _zombieplague_included
public zp_user_infected_post(iID, iIDInfector)
{
fwHamKilledPlayer(iID, iIDInfector)
}
#endif
public fwEvDeathMsg()
{
fwHamKilledPlayer(read_data(2), read_data(1))
}
public fwHamKilledPlayer(const iIDVictim, const iIDAttacker)
{
if (!iIDAttacker || iIDVictim == iIDAttacker)
return;
g_iKills[iIDVictim] = 0;
if (!is_user_connected(iIDAttacker)
|| !g_iTeam[iIDVictim] || !g_iTeam[iIDAttacker]
|| g_iTeam[iIDVictim] == g_iTeam[iIDAttacker])
return;
if (g_iTeam[iIDAttacker] == 1)
{
if (g_iCountKillsTeam >= 0)
g_iCountKillsTeam = -1;
else
g_iCountKillsTeam--;
}
else if (g_iTeam[iIDAttacker] == 2)
{
if (g_iCountKillsTeam <= 0)
g_iCountKillsTeam = 1;
else
g_iCountKillsTeam++;
}
if (bitsum_get(g_iBsBot, 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)
if (g_iKills[iIDAttacker] >= 3 || g_iMulti[iIDAttacker] >= 2 || !g_iIDFirstBlood)
{
if (g_iCountAnnouncersText <= 0)
{
if (g_iCountAnnouncersText >= 0)
g_iCountAnnouncersText++;
else
g_iCountAnnouncersText = 1;
g_iIDAnnouncersText[0] = iIDAttacker;
g_iIDAnnouncersText[1] = 0;
}
else if (g_iCountAnnouncersText == 1 && iIDAttacker != g_iIDAnnouncersText[0])
{
g_iCountAnnouncersText++;
g_iIDAnnouncersText[1] = iIDAttacker;
}
else if (g_iCountAnnouncersText == 2 && iIDAttacker != g_iIDAnnouncersText[0] && iIDAttacker != g_iIDAnnouncersText[1])
{
remove_task(g_iIDAnnouncersText[0] + g_iIDTaskAnnounceText)
g_iIDAnnouncersText[0] = g_iIDAnnouncersText[1];
g_iIDAnnouncersText[1] = iIDAttacker;
}
ftD7Log(_, iIDAttacker, "[fwHamKilledPlayer] g_iCountAnnouncersText: %d. g_iIDAnnouncersText[0]: %d, g_iIDAnnouncersText[1]: %d.", g_iCountAnnouncersText, g_iIDAnnouncersText[0], g_iIDAnnouncersText[1])
new szTemp[3];
szTemp[g_iConstInfoCount] = g_iKills[iIDAttacker] - 3;
szTemp[g_iConstInfoMulti] = g_iMulti[iIDAttacker] - 2;
szTemp[g_iConstInfoVictim] = g_iIDFirstBlood ? 0 : iIDVictim;
fwTaskAnnounceText(szTemp, iIDAttacker + g_iIDTaskAnnounceText)
remove_task(iIDAttacker + g_iIDTaskAnnounceText)
set_task(g_fConstTaskAnnounceTextDelay, "fwTaskAnnounceText", iIDAttacker + g_iIDTaskAnnounceText, szTemp, 3, "b")
remove_task(iIDAttacker + g_iIDTaskAnnounceTextRemove)
set_task(g_fConstTaskMultiDelay, "fwTaskAnnounceTextRemove", iIDAttacker + g_iIDTaskAnnounceTextRemove)
new Float:fTemp;
remove_task(g_iIDTaskAnnounceSound)
if (!g_iIDFirstBlood)
{
fwTaskAnnounceSound(g_szSoundFirstBlood, g_iIDTaskAnnounceSound)
fTemp += g_fSoundFirstBloodDuration;
}
if (g_iKills[iIDAttacker] >= 3)
{
if (fTemp <= 0)
fwTaskAnnounceSound(g_szSoundsCount[g_iKills[iIDAttacker] - 3], g_iIDTaskAnnounceSound)
else
set_task(fTemp, "fwTaskAnnounceSound", g_iIDTaskAnnounceSound, g_szSoundsCount[g_iKills[iIDAttacker] - 3], charsmax(g_szSoundsCount[]))
fTemp += g_fSoundsCountDuration[g_iKills[iIDAttacker] - 3];
}
if (g_iMulti[iIDAttacker] >= 2)
{
if (fTemp <= 0)
fwTaskAnnounceSound(g_szSoundsMulti[g_iMulti[iIDAttacker] - 2], g_iIDTaskAnnounceSound)
else
set_task(fTemp, "fwTaskAnnounceSound", g_iIDTaskAnnounceSound, g_szSoundsMulti[g_iMulti[iIDAttacker] - 2], charsmax(g_szSoundsMulti[]))
fTemp += g_fSoundsMultiDuration[g_iMulti[iIDAttacker] - 2];
}
if (g_iCountKillsTeam <= -5 || g_iCountKillsTeam >= 5)
{
if (fTemp <= 0)
fwTaskAnnounceSound(g_szSoundOwnage, g_iIDTaskAnnounceSound)
else
set_task(fTemp, "fwTaskAnnounceSound", g_iIDTaskAnnounceSound, g_szSoundOwnage, charsmax(g_szSoundOwnage))
}
}
/*
ftD7Log(_, _, "[fwHamKilledPlayer] ^"%s^". \
K: %d. \
M: %d. \
Fb: %s.", \
g_szName[iIDAttacker], \
g_iKills[iIDAttacker], \
g_iMulti[iIDAttacker], \
!g_iIDFirstBlood ? "Yes" : "No")*/
if (!g_iIDFirstBlood)
{
g_iIDFirstBlood = iIDAttacker;
}
}
enum _:g_iExtResults
{
g_iExtensionResultShort = -2,
g_iExtensionResultNone = -1
}
stock iFtExtPosReturn(const szFile[])
{
new iTemp;
for (iTemp = strlen(szFile) - 2; iTemp >= -1; iTemp--)
{
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;
}
public plugin_precache()
{
//new iIDPCvar = get_cvar_pointer("d7_debug_log"),
//iCvarValue = get_pcvar_num(iIDPCvar);
new iTemp, iID;
if (g_szSoundFirstBlood[0])
{
iTemp = iFtExtPosReturn(g_szSoundFirstBlood);
if (iTemp >= 0)
{
if (equali(g_szSoundFirstBlood[iTemp], "wav"))
{
precache_sound(g_szSoundFirstBlood)
g_fSoundFirstBloodDuration = sfile_get_duration(g_szSoundFirstBlood);
replace(g_szSoundFirstBlood, charsmax(g_szSoundFirstBlood), g_szSoundFirstBlood[iTemp - 1], "")
if (!bFtContainsFolderStart(g_szSoundFirstBlood, "sound"))
format(g_szSoundFirstBlood, charsmax(g_szSoundFirstBlood), "sound/%s", g_szSoundFirstBlood)
}
else if (equali(g_szSoundFirstBlood[iTemp], "mp3"))
{
if (!bFtContainsFolderStart(g_szSoundFirstBlood, "sound"))
format(g_szSoundFirstBlood, charsmax(g_szSoundFirstBlood), "sound/%s", g_szSoundFirstBlood)
precache_generic(g_szSoundFirstBlood)
//g_fSoundFirstBloodDuration = sfile_get_duration(g_szSoundFirstBlood);
}
}
else
{
precache_generic(g_szSoundFirstBlood)
}
}
if (g_szSoundOwnage[0])
{
iTemp = iFtExtPosReturn(g_szSoundOwnage);
if (iTemp >= 0)
{
if (equali(g_szSoundOwnage[iTemp], "wav"))
{
precache_sound(g_szSoundOwnage)
//g_fSoundOwnageDuration = sfile_get_duration(g_szSoundOwnage);
replace(g_szSoundOwnage, charsmax(g_szSoundOwnage), g_szSoundOwnage[iTemp - 1], "")
if (!bFtContainsFolderStart(g_szSoundOwnage, "sound"))
format(g_szSoundOwnage, charsmax(g_szSoundOwnage), "sound/%s", g_szSoundOwnage)
}
else if (equali(g_szSoundOwnage[iTemp], "mp3"))
{
if (!bFtContainsFolderStart(g_szSoundOwnage, "sound"))
format(g_szSoundOwnage, charsmax(g_szSoundOwnage), "sound/%s", g_szSoundOwnage)
precache_generic(g_szSoundOwnage)
//g_fSoundOwnageDuration = sfile_get_duration(g_szSoundOwnage);
}
}
else
{
precache_generic(g_szSoundOwnage)
}
}
//set_pcvar_num(iIDPCvar, 0)
//set_pcvar_num(iIDPCvar, iCvarValue)
//g_fSoundFirstBloodDuration += 1.0;
//precache_generic(g_szSoundOwnage)
//set_pcvar_num(iIDPCvar, 0)
//g_fSoundOwnageDuration = sfile_get_duration(g_szSoundOwnage) + 1.0;
//set_pcvar_num(iIDPCvar, iCvarValue)
//g_fSoundOwnageDuration += 1.0;
//ftD7Log(_, _, "[plugin_precache] Sound: ^"%s^". Duration: %f.", g_szSoundFirstBlood, g_fSoundFirstBloodDuration)
//ftD7Log(_, _, "[plugin_precache] Sound: ^"%s^". Duration: %f.", g_szSoundOwnage, g_fSoundOwnageDuration)
for (iID = 0; iID < sizeof g_szSoundsCount; iID++)
{
if (!g_szSoundsCount[iID][0])
continue;
iTemp = iFtExtPosReturn(g_szSoundsCount[iID]);
if (iTemp >= 0)
{
if (equali(g_szSoundsCount[iID][iTemp], "wav"))
{
precache_sound(g_szSoundsCount[iID])
g_fSoundsCountDuration[iID] = sfile_get_duration(g_szSoundsCount[iID]);
replace(g_szSoundsCount[iID], charsmax(g_szSoundsCount[]), g_szSoundsCount[iID][iTemp - 1], "")
if (!bFtContainsFolderStart(g_szSoundsCount[iID], "sound"))
format(g_szSoundsCount[iID], charsmax(g_szSoundsCount[]), "sound/%s", g_szSoundsCount[iID])
}
else if (equali(g_szSoundsCount[iID][iTemp], "mp3"))
{
if (!bFtContainsFolderStart(g_szSoundsCount[iID], "sound"))
format(g_szSoundsCount[iID], charsmax(g_szSoundsCount[]), "sound/%s", g_szSoundsCount[iID])
precache_generic(g_szSoundsCount[iID])
//g_fSoundsCountDuration[iID] = sfile_get_duration(g_szSoundsCount[iID]);
}
}
else
{
precache_generic(g_szSoundsCount[iID])
}
//ftD7Log(_, _, "[plugin_precache] Sound: ^"%s^". Duration: %f.", g_szSoundsCount[iID], g_fSoundsCountDuration[iID])
}
for (iID = 0; iID < sizeof g_szSoundsMulti; iID++)
{
if (!g_szSoundsMulti[iID][0])
continue;
iTemp = iFtExtPosReturn(g_szSoundsMulti[iID]);
if (iTemp >= 0)
{
if (equali(g_szSoundsMulti[iID][iTemp], "wav"))
{
precache_sound(g_szSoundsMulti[iID])
g_fSoundsMultiDuration[iID] = sfile_get_duration(g_szSoundsMulti[iID]);
replace(g_szSoundsMulti[iID], charsmax(g_szSoundsMulti[]), g_szSoundsMulti[iID][iTemp - 1], "")
if (!bFtContainsFolderStart(g_szSoundsMulti[iID], "sound"))
format(g_szSoundsMulti[iID], charsmax(g_szSoundsMulti[]), "sound/%s", g_szSoundsMulti[iID])
}
else if (equali(g_szSoundsMulti[iID][iTemp], "mp3"))
{
if (!bFtContainsFolderStart(g_szSoundsMulti[iID], "sound"))
format(g_szSoundsMulti[iID], charsmax(g_szSoundsMulti[]), "sound/%s", g_szSoundsMulti[iID])
precache_generic(g_szSoundsMulti[iID])
//g_fSoundsMultiDuration[iID] = sfile_get_duration(g_szSoundsMulti[iID]);
}
}
else
{
precache_generic(g_szSoundsMulti[iID])
}
//ftD7Log(_, _, "[plugin_precache] Sound: ^"%s^". Duration: %f.", g_szSoundsMulti[iID], g_fSoundsMultiDuration[iID])
}
}
bitsums.inc
D7Debug.inc
__________________
|
|