Skip to content

Commit 8f7aebb

Browse files
committed
Fix invalid convar handle
1 parent 7237818 commit 8f7aebb

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

addons/sourcemod/scripting/hextags.sp

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ Handle hSelTagCookie;
5959

6060
ConVar cv_sDefaultGang;
6161
ConVar cv_bParseRoundEnd;
62-
ConVar cv_bDisableRankme;
6362
ConVar cv_bEnableTagsList;
6463

6564
bool bCSGO;
@@ -83,6 +82,7 @@ ArrayList userTags[MAXPLAYERS+1];
8382
CustomTags selectedTags[MAXPLAYERS+1];
8483
KeyValues tagsKv;
8584

85+
8686
//Plugin info
8787
public Plugin myinfo =
8888
{
@@ -147,6 +147,7 @@ public void OnPluginStart()
147147

148148
#if defined DEBUG
149149
RegConsoleCmd("sm_gettagvars", Cmd_GetVars);
150+
RegConsoleCmd("sm_firesel", Cmd_FireSel);
150151
#endif
151152
}
152153

@@ -186,7 +187,7 @@ public void OnLibraryAdded(const char[] name)
186187
{
187188
bMostActive = true;
188189
}
189-
else if (StrEqual(name, "rankme") && !cv_bDisableRankme.BoolValue)
190+
else if (StrEqual(name, "rankme"))
190191
{
191192
bRankme = true;
192193
}
@@ -429,6 +430,19 @@ public Action Cmd_GetVars(int client, int args)
429430
ReplyToCommand(client, selectedTags[client].NameColor);
430431
return Plugin_Handled;
431432
}
433+
434+
public Action Cmd_FireSel(int client, int args)
435+
{
436+
int count = pfCustomSelector.FunctionCount;
437+
int res;
438+
439+
Call_StartForward(pfCustomSelector);
440+
Call_PushCell(client);
441+
Call_PushString("thistoggle");
442+
Call_Finish(res);
443+
ReplyToCommand(client, "[SM] Fire %i functions, res: %i!", count, res);
444+
return Plugin_Handled;
445+
}
432446
#endif
433447

434448
//Events
@@ -500,9 +514,9 @@ public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
500514
for (int i = 1; i <= MaxClients; i++)if (IsClientInGame(i))OnClientPostAdminCheck(i);
501515
}
502516

503-
504517
public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstring, char[] name, char[] message, bool& processcolors, bool& removecolors)
505518
{
519+
Debug_Setup(true, false, false, true); // Disable chat.
506520
if (bHideTag[author])
507521
{
508522
return Plugin_Continue;
@@ -527,6 +541,7 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
527541
// Rainbow name
528542
if (StrEqual(selectedTags[author].NameColor, "{rainbow}"))
529543
{
544+
Debug_Print("Rainbow name");
530545
char sTemp[MAXLENGTH_MESSAGE];
531546

532547
int color;
@@ -550,6 +565,7 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
550565
}
551566
else if (StrEqual(selectedTags[author].NameColor, "{random}")) //Random name
552567
{
568+
Debug_Print("Random name");
553569
char sTemp[MAXLENGTH_MESSAGE];
554570

555571
int len = strlen(name);
@@ -572,6 +588,7 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
572588
}
573589
else
574590
{
591+
Debug_Print("Default name");
575592
Format(sNewName, MAXLENGTH_NAME, "%s%s%s{default}", selectedTags[author].ChatTag, selectedTags[author].NameColor, name);
576593
}
577594
Format(sNewMessage, MAXLENGTH_MESSAGE, "%s%s", selectedTags[author].ChatColor, message);
@@ -592,6 +609,7 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
592609

593610
if (bGangs)
594611
{
612+
Debug_Print("Apply gans");
595613
static char sGang[32];
596614
Gangs_HasGang(author) ? Gangs_GetGangName(author, sGang, sizeof(sGang)) : cv_sDefaultGang.GetString(sGang, sizeof(sGang));
597615

@@ -601,6 +619,7 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
601619

602620
if (bRankme)
603621
{
622+
Debug_Print("Apply rankme");
604623
static char sPoints[16];
605624
IntToString(RankMe_GetPoints(author), sPoints, sizeof(sPoints));
606625
ReplaceString(sNewName, sizeof(sNewName), "{rmPoints}", sPoints);
@@ -615,6 +634,7 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
615634
//Rainbow Chat
616635
if (StrEqual(selectedTags[author].ChatColor, "{rainbow}", false))
617636
{
637+
Debug_Print("Rainbow chat");
618638
ReplaceString(sNewMessage, sizeof(sNewMessage), "{rainbow}", "");
619639
char sTemp[MAXLENGTH_MESSAGE];
620640

@@ -641,6 +661,7 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
641661
//Random Chat
642662
if (StrEqual(selectedTags[author].ChatColor, "{random}", false))
643663
{
664+
Debug_Print("Random chat");
644665
ReplaceString(sNewMessage, sizeof(sNewMessage), "{random}", "");
645666
char sTemp[MAXLENGTH_MESSAGE];
646667

@@ -691,6 +712,7 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
691712
}
692713
else
693714
{
715+
Debug_Setup();
694716
return Plugin_Continue;
695717
}
696718

@@ -704,6 +726,9 @@ public Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstr
704726
Call_PushString(sPassedMessage);
705727
Call_Finish();
706728

729+
730+
Debug_Print("Message sent");
731+
Debug_Setup();
707732
return Plugin_Changed;
708733
}
709734

0 commit comments

Comments
 (0)