diff --git a/UNLOZE_Clantag/scripting/UNLOZE_Clantag.sp b/UNLOZE_Clantag/scripting/UNLOZE_Clantag.sp index 64ed672a..1028e02f 100644 --- a/UNLOZE_Clantag/scripting/UNLOZE_Clantag.sp +++ b/UNLOZE_Clantag/scripting/UNLOZE_Clantag.sp @@ -13,6 +13,8 @@ public Plugin myinfo = url = "" }; +bool post_filter_admin[MAXPLAYERS + 1]; + public void OnPluginStart() { /* Handle late load */ @@ -25,9 +27,15 @@ public void OnPluginStart() } } +public void OnClientDisconnect(int client) +{ + post_filter_admin[client] = false; +} + public void OnClientPostAdminFilter(int client) { - CheckClantag(client); + post_filter_admin[client] = true; + CheckClantag(client); } public void OnClientSettingsChanged(int client) @@ -37,33 +45,37 @@ public void OnClientSettingsChanged(int client) void CheckClantag(int client) { - if(!IsClientAuthorized(client)) - return; + if(!IsClientAuthorized(client)) + return; + if (!post_filter_admin[client]) + { + return; + } - char sClanID[32]; - GetClientInfo(client, "cl_clanid", sClanID, sizeof(sClanID)); + char sClanID[32]; + GetClientInfo(client, "cl_clanid", sClanID, sizeof(sClanID)); - if(!StrEqual(sClanID, CLANID)) - return; + if(!StrEqual(sClanID, CLANID)) + return; - AdminId AdmID; - GroupId GrpID; + AdminId AdmID; + GroupId GrpID; - if ((AdmID = GetUserAdmin(client)) == INVALID_ADMIN_ID) - { - LogMessage("Creating new admin for %L", client); + if ((AdmID = GetUserAdmin(client)) == INVALID_ADMIN_ID) + { + LogMessage("Creating new admin for %L", client); - AdmID = CreateAdmin(""); - SetUserAdmin(client, AdmID, true); - } + AdmID = CreateAdmin(""); + SetUserAdmin(client, AdmID, true); + } - if ((GrpID = FindAdmGroup(GROUP)) != INVALID_GROUP_ID) - { - if (AdminInheritGroup(AdmID, GrpID)) - LogMessage("%L added to group %s", client, GROUP); - } - else - { - LogMessage("%L group not found %s", client, GROUP); - } + if ((GrpID = FindAdmGroup(GROUP)) != INVALID_GROUP_ID) + { + if (AdminInheritGroup(AdmID, GrpID)) + LogMessage("%L added to group %s", client, GROUP); + } + else + { + LogMessage("%L group not found %s", client, GROUP); + } }