Skip to content

Commit cf5e81a

Browse files
committed
Some fixes (translations focused)
General: - Fixed players sometimes receiving strings in the wrong language. - Converted `Format` to `strcopy` for literal strings and `FormatEx` (where safe) for optimization sake. Boss Percent: - Replaced FakeClientCommand's `say` command on the client with a direct `sm_current`. - I'm leaving the Footer info in the language of the server, as the readyup menu doesn't build the menu content per client, may revisit in the future when modifying readyup. Match Vote: - The pop-ups will still render in the language of the server, initially I tried intercepting them through UserMessage but then I realized it's set on the netvars of g_Votecontroller, would require a lot of work for something minimal. Skill Detect: - Use translations inside the phrases file directly rather than use helper functions to hardcode them based on the current global translation target. - Not sure why we'd end up with 1 bhop streaks printing, but I'll leave it.
1 parent 016d5f5 commit cf5e81a

14 files changed

Lines changed: 153 additions & 226 deletions
33 Bytes
Binary file not shown.
14 Bytes
Binary file not shown.
-255 Bytes
Binary file not shown.
-416 Bytes
Binary file not shown.
72 Bytes
Binary file not shown.

addons/sourcemod/scripting/1v1.sp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public Plugin myinfo =
3535
name = "1v1 EQ",
3636
author = "Blade + Confogl Team, Tabun, Visor",
3737
description = "A plugin designed to support 1v1.",
38-
version = "0.2.2",
38+
version = "0.2.3",
3939
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
4040
};
4141

@@ -76,15 +76,15 @@ void Event_PlayerHurt(Event hEvent, const char[] sEventName, bool bDontBroadcast
7676
// [1v1] Player (Hunter) had 250 health remaining!
7777
// [1v1] AI (Hunter) had 250 health remaining!
7878

79-
char sName[MAX_NAME_LENGTH];
80-
if (IsFakeClient(iAttacker)) {
81-
Format(sName, sizeof(sName), "%t", "AI");
82-
} else {
79+
if (IsFakeClient(iAttacker))
80+
CPrintToChatAll("%t %t%t", "Tag", "AI", "HealthRemaining", "", L4D2_InfectedNames[iZclass], iRemainingHealth);
81+
else
82+
{
83+
char sName[MAX_NAME_LENGTH];
8384
GetClientName(iAttacker, sName, sizeof(sName));
85+
CPrintToChatAll("%t %t", "Tag", "HealthRemaining", sName, L4D2_InfectedNames[iZclass], iRemainingHealth);
8486
}
8587

86-
CPrintToChatAll("%t %t", "Tag", "HealthRemaining", sName, L4D2_InfectedNames[iZclass], iRemainingHealth);
87-
8888
RequestFrame(NextFrame_PlayerHurt, iAttackerId);
8989

9090
if (iRemainingHealth == 1) {

addons/sourcemod/scripting/1v1_skeetstats.sp

Lines changed: 40 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
Changelog
8282
---------
8383
84+
0.1g
85+
- fixed translations issues
8486
0.1f
8587
- fixed more error spam in error logs
8688
0.1e
@@ -94,7 +96,7 @@ public Plugin myinfo =
9496
name = "1v1 SkeetStats",
9597
author = "Tabun",
9698
description = "Shows 1v1-relevant info at end of round.",
97-
version = "0.1f",
99+
version = "0.1g",
98100
url = "nope"
99101
};
100102

@@ -864,131 +866,84 @@ void WeaponFire_Event(Handle event, const char[] name, bool dontBroadcast)
864866

865867
void PrintSkeetStats(int toClient)
866868
{
867-
char printBuffer[512];
868-
char tmpBuffer[256];
869-
870-
printBuffer = "";
871-
872869
if (iClientPlaying <= 0)
873870
{
874871
return;
875872
}
876873

877-
/*
878-
//decl String:tmpName[64];
879-
if (!IsClientConnected(iClientPlaying)) {
880-
tmpName = sClientName[iClientPlaying];
881-
} else {
882-
Format(tmpName, sizeof(tmpName),"%N", iClientPlaying);
883-
} */
884-
885-
// no need to calculate, show stats
886-
// 1. SI damage & SI kills
887-
// 2. skeets
888-
// 3. accuracy
889-
// 4. common kills
890-
891-
/*
892-
TODO: make it so:
893-
1v1Stat - Kills: (934 Dmg, 4 Kills) (23 Common)
894-
1v1Stat - Skeet: (1 Normal, 3 Injured) (5 Deadstops)
895-
1v1Stat - Acc. : (Total [72%], Per Pellet [25%]) (3 Headshots)
896-
*/
874+
if (toClient)
875+
{
876+
if (IsClientAndInGame(toClient))
877+
PrintSkeetStatsTo(toClient);
878+
}
879+
else
880+
{
881+
for (int i = 1; i <= MaxClients; i++)
882+
{
883+
if (IsClientInGame(i) && !IsFakeClient(i))
884+
PrintSkeetStatsTo(i);
885+
}
886+
}
887+
}
897888

898-
// report
899-
// 1
889+
static void PrintSkeetStatsTo(int target)
890+
{
891+
// 1. SI damage & SI kills
900892
if (!(iBrevityFlags & BREV_SI))
901893
{
902894
if (!(iBrevityFlags & BREV_DMG))
903895
{
904896
if (!(iBrevityFlags & BREV_CI))
905-
{
906-
Format(tmpBuffer, sizeof(tmpBuffer), "%t %t", "TagKills", "SI_DMG_CI", iDidDamageAll[iClientPlaying], iGotKills[iClientPlaying], iGotCommon[iClientPlaying]);
907-
}
897+
CPrintToChat(target, "%t %t", "TagKills", "SI_DMG_CI", iDidDamageAll[iClientPlaying], iGotKills[iClientPlaying], iGotCommon[iClientPlaying]);
908898
else
909-
{
910-
Format(tmpBuffer, sizeof(tmpBuffer), "%t %t", "TagKills", "SI_DMG", iDidDamageAll[iClientPlaying], iGotKills[iClientPlaying]);
911-
}
899+
CPrintToChat(target, "%t %t", "TagKills", "SI_DMG", iDidDamageAll[iClientPlaying], iGotKills[iClientPlaying]);
912900
}
913901
else
914902
{
915903
if (!(iBrevityFlags & BREV_CI))
916-
{
917-
Format(tmpBuffer, sizeof(tmpBuffer), "%t %t", "TagKills", "SI_CI", iGotKills[iClientPlaying], iGotCommon[iClientPlaying]);
918-
}
904+
CPrintToChat(target, "%t %t", "TagKills", "SI_CI", iGotKills[iClientPlaying], iGotCommon[iClientPlaying]);
919905
else
920-
{
921-
Format(tmpBuffer, sizeof(tmpBuffer), "%t %t", "TagKills", "SI", iGotKills[iClientPlaying]);
922-
}
923-
}
924-
StrCat(printBuffer, sizeof(printBuffer), tmpBuffer);
925-
926-
if (!toClient)
927-
{
928-
CPrintToChatAll("%s", printBuffer);
929-
}
930-
else if (IsClientAndInGame(toClient))
931-
{
932-
CPrintToChat(toClient, "%s", printBuffer);
906+
CPrintToChat(target, "%t %t", "TagKills", "SI", iGotKills[iClientPlaying]);
933907
}
934-
printBuffer = "";
935908
}
936909

910+
// 2. skeets
937911
if (!(iBrevityFlags & BREV_SKEET))
938-
{
939-
Format(tmpBuffer, sizeof(tmpBuffer), "%t %t", "TagSkeet", "SKEET", iHuntSkeets[iClientPlaying], iHuntSkeetsInj[iClientPlaying], iDeadStops[iClientPlaying]);
940-
StrCat(printBuffer, sizeof(printBuffer), tmpBuffer);
941-
942-
if (!toClient)
943-
{
944-
CPrintToChatAll("%s", printBuffer);
945-
}
946-
else if (IsClientAndInGame(toClient))
947-
{
948-
CPrintToChat(toClient, "%s", printBuffer);
949-
}
950-
printBuffer = "";
951-
}
912+
CPrintToChat(target, "%t %t", "TagSkeet", "SKEET", iHuntSkeets[iClientPlaying], iHuntSkeetsInj[iClientPlaying], iDeadStops[iClientPlaying]);
952913

914+
// 3. accuracy
953915
if (!(iBrevityFlags & BREV_ACC))
954916
{
917+
char printBuffer[512];
918+
char tmpBuffer[256];
919+
printBuffer = "";
920+
955921
if (iShotsFired[iClientPlaying] || (iMeleesFired[iClientPlaying] && !(iBrevityFlags & BREV_MELEE)))
956922
{
957923
if (iShotsFired[iClientPlaying])
958-
{
959-
Format(tmpBuffer, sizeof(tmpBuffer), "%t %t", "TagAcc", "ACC_AllShots", float(iShotsHit[iClientPlaying]) / float(iShotsFired[iClientPlaying]) * 100);
960-
}
961-
else {
962-
Format(tmpBuffer, sizeof(tmpBuffer), "%t %t", "TagAcc", "ACC_AllShots", 0.0);
963-
}
924+
FormatEx(tmpBuffer, sizeof(tmpBuffer), "%T %T", "TagAcc", target, "ACC_AllShots", target, float(iShotsHit[iClientPlaying]) / float(iShotsFired[iClientPlaying]) * 100);
925+
else
926+
FormatEx(tmpBuffer, sizeof(tmpBuffer), "%T %T", "TagAcc", target, "ACC_AllShots", target, 0.0);
927+
964928
if (iPelletsFired[iClientPlaying])
965929
{
966930
StrCat(printBuffer, sizeof(printBuffer), tmpBuffer);
967-
Format(tmpBuffer, sizeof(tmpBuffer), "%t", "ACC_BuckShot", float(iPelletsHit[iClientPlaying]) / float(iPelletsFired[iClientPlaying]) * 100);
931+
FormatEx(tmpBuffer, sizeof(tmpBuffer), "%T", "ACC_BuckShot", target, float(iPelletsHit[iClientPlaying]) / float(iPelletsFired[iClientPlaying]) * 100);
968932
}
969933
if (iMeleesFired[iClientPlaying] && !(iBrevityFlags & BREV_MELEE))
970934
{
971935
StrCat(printBuffer, sizeof(printBuffer), tmpBuffer);
972-
Format(tmpBuffer, sizeof(tmpBuffer), "%t", "ACC_Melee", float(iMeleesHit[iClientPlaying]) / float(iMeleesFired[iClientPlaying]) * 100);
936+
FormatEx(tmpBuffer, sizeof(tmpBuffer), "%T", "ACC_Melee", target, float(iMeleesHit[iClientPlaying]) / float(iMeleesFired[iClientPlaying]) * 100);
973937
}
974938
StrCat(printBuffer, sizeof(printBuffer), tmpBuffer);
975-
Format(tmpBuffer, sizeof(tmpBuffer), "\n");
939+
strcopy(tmpBuffer, sizeof(tmpBuffer), "\n");
976940
}
977941
else
978942
{
979-
Format(tmpBuffer, sizeof(tmpBuffer), "%t %t", "TagAcc", "ACC_NoShotsFired");
943+
FormatEx(tmpBuffer, sizeof(tmpBuffer), "%T %T", "TagAcc", target, "ACC_NoShotsFired", target);
980944
}
981945
StrCat(printBuffer, sizeof(printBuffer), tmpBuffer);
982-
983-
if (!toClient)
984-
{
985-
CPrintToChatAll("%s", printBuffer);
986-
}
987-
else if (IsClientAndInGame(toClient))
988-
{
989-
CPrintToChat(toClient, "%s", printBuffer);
990-
}
991-
printBuffer = "";
946+
CPrintToChat(target, "%s", printBuffer);
992947
}
993948
}
994949

addons/sourcemod/scripting/l4d2_skill_detect.sp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
#include <sdktools>
6262
#include <sourcemod>
6363

64-
#define PLUGIN_VERSION "1.1.1"
64+
#define PLUGIN_VERSION "1.1.2"
6565

6666
#define SHOTGUN_BLAST_TIME 0.1
6767
#define POUNCE_CHECK_TIME 0.1

addons/sourcemod/scripting/l4d2_skill_detect/report.sp

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ stock void HandleSkeet(int attacker, int victim, bool bMelee = false, bool bSnip
112112
CPrintToChatAll("%t %t", "Tag+", "TeamSkeetedBot");
113113
}
114114
else if (IsValidClientInGame(attacker) && IsValidClientInGame(victim) && !IsFakeClient(victim))
115-
CPrintToChatAll("%t %t", "Tag++", "Skeeted", attacker, (bMelee) ? Melee() : ((bSniper) ? Headshot() : ((bGL) ? Grenade() : "")), victim);
115+
CPrintToChatAll("%t %t", "Tag++", "Skeeted", attacker, (bMelee) ? "Melee" : ((bSniper) ? "HeadShot" : ((bGL) ? "Grenade" : "Empty")), victim);
116116
else if (IsValidClientInGame(attacker))
117-
CPrintToChatAll("%t %t", "Tag+", "SkeetedBot", attacker, (bMelee) ? Melee() : ((bSniper) ? Headshot() : ((bGL) ? Grenade() : "")));
117+
CPrintToChatAll("%t %t", "Tag+", "SkeetedBot", attacker, (bMelee) ? "Melee" : ((bSniper) ? "HeadShot" : ((bGL) ? "Grenade" : "Empty")));
118118
}
119119

120120
// call forward
@@ -155,12 +155,10 @@ stock void HandleNonSkeet(int attacker, int victim, int damage, bool bOverKill =
155155
// report?
156156
if (g_cvarReport.BoolValue && g_cvarRepHurtSkeet.BoolValue)
157157
{
158-
char buffer[64];
159-
Format(buffer, sizeof(buffer), "%t", "Unchipped");
160158
if (IsValidClientInGame(victim))
161-
CPrintToChatAll("%t %t", "Tag+", "HurtSkeet", victim, damage, (bOverKill) ? buffer : "");
159+
CPrintToChatAll("%t %t", "Tag+", "HurtSkeet", victim, damage, (bOverKill) ? "Unchipped" : "Empty");
162160
else
163-
CPrintToChatAll("%t %t", "Tag+", "HurtSkeetBot", damage, (bOverKill) ? buffer : "");
161+
CPrintToChatAll("%t %t", "Tag+", "HurtSkeetBot", damage, (bOverKill) ? "Unchipped" : "Empty");
164162
}
165163

166164
// call forward
@@ -255,13 +253,10 @@ void HandleSmokerSelfClear(int attacker, int victim, bool withShove = false)
255253
// report?
256254
if (g_cvarReport.BoolValue && g_cvarRepSelfClear.BoolValue && (!withShove || g_cvarRepSelfClearShove.BoolValue))
257255
{
258-
char Buffer[64];
259-
Format(Buffer, sizeof(Buffer), "%t", "Shoving");
260-
261256
if (IsValidClientInGame(attacker) && IsValidClientInGame(victim) && !IsFakeClient(victim))
262-
CPrintToChatAll("%t %t", "Tag++", "SelfClearedTongue", attacker, victim, (withShove) ? Buffer : "");
257+
CPrintToChatAll("%t %t", "Tag++", "SelfClearedTongue", attacker, victim, (withShove) ? "Shoving" : "Empty");
263258
else if (IsValidClientInGame(attacker))
264-
CPrintToChatAll("%t %t", "Tag++", "SelfClearedTongueBot", attacker, (withShove) ? Buffer : "");
259+
CPrintToChatAll("%t %t", "Tag++", "SelfClearedTongueBot", attacker, (withShove) ? "Shoving" : "Empty");
265260
}
266261

267262
// call forward
@@ -347,13 +342,10 @@ stock void HandleDeathCharge(int attacker, int victim, float height, float dista
347342
// report?
348343
if (g_cvarReport.BoolValue && g_cvarRepDeathCharge.BoolValue && height >= g_cvarDeathChargeHeight.FloatValue)
349344
{
350-
char Buffer[64];
351-
Format(Buffer, sizeof(Buffer), "%t", "Bowling");
352-
353345
if (IsValidClientInGame(attacker) && IsValidClientInGame(victim) && !IsFakeClient(attacker))
354-
CPrintToChatAll("%t %t", "Tag++++", "DeathCharged", attacker, victim, (bCarried) ? "" : Buffer, RoundFloat(height));
346+
CPrintToChatAll("%t %t", "Tag++++", "DeathCharged", attacker, victim, (bCarried) ? "Empty" : "Bowling", RoundFloat(height));
355347
else if (IsValidClientInGame(victim))
356-
CPrintToChatAll("%t %t", "Tag++++", "DeathChargedBot", victim, (bCarried) ? "" : Buffer, RoundFloat(height));
348+
CPrintToChatAll("%t %t", "Tag++++", "DeathChargedBot", victim, (bCarried) ? "Empty" : "Bowling", RoundFloat(height));
357349
}
358350

359351
Call_StartForward(g_hForwardDeathCharge);
@@ -426,7 +418,7 @@ stock void HandleVomitLanded(int attacker, int boomCount)
426418
stock void HandleBHopStreak(int survivor, int streak, float maxVelocity)
427419
{
428420
if (g_cvarRepBhopStreak.BoolValue && IsValidClientInGame(survivor) && !IsFakeClient(survivor) && streak >= g_cvarBHopMinStreak.IntValue)
429-
CPrintToChat(survivor, "%t %t", "Tag+", "BunnyHop", streak, (streak > 1) ? PluralCount() : "", maxVelocity);
421+
CPrintToChat(survivor, "%t %t", "Tag+", "BunnyHop", streak, (streak > 1) ? "PluralCount" : "Empty", maxVelocity);
430422

431423
Call_StartForward(g_hForwardBHopStreak);
432424
Call_PushCell(survivor);
@@ -487,31 +479,4 @@ stock void HandleCarAlarmTriggered(int survivor, int infected, int reason)
487479
Call_Finish();
488480
}
489481

490-
char[] Melee()
491-
{
492-
char sBuffer[32];
493-
Format(sBuffer, sizeof(sBuffer), "%t", "Melee");
494-
return sBuffer;
495-
}
496-
497-
char[] Headshot()
498-
{
499-
char sBuffer[32];
500-
Format(sBuffer, sizeof(sBuffer), "%t", "HeadShot");
501-
return sBuffer;
502-
}
503-
504-
char[] Grenade()
505-
{
506-
char sBuffer[32];
507-
Format(sBuffer, sizeof(sBuffer), "%t", "Grenade");
508-
return sBuffer;
509-
}
510-
511-
char[] PluralCount()
512-
{
513-
char sBuffer[32];
514-
Format(sBuffer, sizeof(sBuffer), "%t", "PluralCount");
515-
return sBuffer;
516-
}
517482

0 commit comments

Comments
 (0)