Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
fix SayText2 Client index 0 is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
Exle committed Apr 1, 2018
1 parent 9618c8d commit c5a27f0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions addons/sourcemod/scripting/anc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ public Action SayText2(UserMsg msg_id, Handle msg, const int[] players, int play
bf.ReadString(name, MAX_NAME_LENGTH);
}

if (!IsFakeClient(client) && !(GetUserFlagBits(client) & anc_adminflags) && StrContains(message, "Name_Change") != -1 && (FindName(client, name) || FindName(client, oldname)))
if (client && !IsFakeClient(client) && GetUserFlagBits(client) & anc_adminflags)
{
return Plugin_Continue;
}
else if (StrContains(message, "Name_Change") != -1 && (FindName(client, name) || FindName(client, oldname)))
{
return Plugin_Handled;
}
Expand Down Expand Up @@ -275,6 +279,10 @@ bool FindInWhiteList(int client, const char[] name)
{
strcopy(string, MAX_NAME_LENGTH, name);
}
else if (!client)
{
break;
}
else
{
GetClientAuthId(client, view_as<AuthIdType>(i), string, MAX_NAME_LENGTH);
Expand All @@ -300,12 +308,9 @@ bool FindInArray(int index, const char[] name, int flags = 0)

if (index != ARRAY_WHITELIST)
{
if (!GetParam(string, "new", newname, MAX_NAME_LENGTH))
if (!GetParam(string, "new", newname, MAX_NAME_LENGTH) && !GetRandomStringFromArray(anc_arrays[index + 2], newname, MAX_NAME_LENGTH))
{
if (!GetRandomStringFromArray(anc_arrays[index + 2], newname, MAX_NAME_LENGTH))
{
strcopy(newname, MAX_NAME_LENGTH, "undefined");
}
strcopy(newname, MAX_NAME_LENGTH, "undefined");
}

GetParam(string, "mode", buffer, 16);
Expand Down

0 comments on commit c5a27f0

Please sign in to comment.