Skip to content

Commit

Permalink
Hopefully bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexer10 committed Nov 11, 2018
1 parent def69b0 commit 795afd2
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions addons/sourcemod/scripting/hextags.sp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
//#define DEBUG 1
#define DEBUG 1

#include <sourcemod>
#include <sdktools>
Expand Down Expand Up @@ -106,18 +106,6 @@ public void OnPluginStart()
RegAdminCmd("sm_reloadtags", Cmd_ReloadTags, ADMFLAG_GENERIC, "Reload HexTags plugin config");
RegConsoleCmd("sm_getteam", Cmd_GetTeam, "Get current team name");

LoadKv();

//LateLoad
if (bLate)
{
for (int i = 1; i <= MaxClients; i++)if (IsClientInGame(i))
{
OnClientPostAdminCheck(i);
Frame_SetTag(GetClientUserId(i));
}
}

//Timers
if (bCSGO)
CreateTimer(5.0, Timer_ForceTag, _, TIMER_REPEAT);
Expand All @@ -132,6 +120,10 @@ public void OnAllPluginsLoaded()

if (FindPluginByFile("custom-chatcolors-cp.smx") || LibraryExists("ccc"))
LogMessage("[HexTags] Found Custom Chat Colors running!\n Please avoid running it with this plugin!");


LoadKv();
for (int i = 1; i <= MaxClients; i++)if (IsClientInGame(i))OnClientPostAdminCheck(i);
}

public void OnLibraryAdded(const char[] name)
Expand Down Expand Up @@ -196,9 +188,8 @@ public Action OnClientCommandKeyValues(int client, KeyValues TagKv)
return Plugin_Continue;
}

public void Frame_SetTag(any iUserID)
public void Frame_SetTag(any client)
{
int client = GetClientOfUserId(iUserID);
LoadTags(client);
}

Expand Down Expand Up @@ -417,7 +408,7 @@ void LoadKv()

void LoadTags(int client, bool sub = false)
{
if (!client)
if (!IsValidClient(client, true, true))
return;

//Clear the tags when re-checking
Expand Down Expand Up @@ -521,14 +512,25 @@ bool Select_AdminGroup(int client)

bool Select_Flags(int client)
{
AdminId admin = GetUserAdmin(client);
if (admin == INVALID_ADMIN_ID)
return false;

static char sFlags[21] = "abcdefghijklmnopqrstz";

for (int i = sizeof(sFlags)-1; 0 <= i; i--)
{
char sFlag[1];
sFlag[0] = sFlags[i];

if (ReadFlagString(sFlag) & GetUserFlagBits(client))
AdminFlag flag;
if (!BitToFlag(ReadFlagString(sFlag), flag))
{
LogError("Failed to read flag: %s", sFlag);
return false;
}

if (admin.HasFlag(flag))
{
if (kv.JumpToKey(sFlag))
{
Expand Down

0 comments on commit 795afd2

Please sign in to comment.