PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <cstrike>
#define TAG_SIZE 64
new Handle:enabled = INVALID_HANDLE;
new Handle:castSens = INVALID_HANDLE;
new Handle:flagBit = INVALID_HANDLE;
new String:tags[32][TAG_SIZE];
public Plugin:myinfo =
{
name = "ClanTag Detection",
author = "Mini",
description = "Sets admin flags based on clantag",
version = "1.0",
url = "http://sourcemod.net"
};
public OnPluginStart()
{
enabled = CreateConVar("clantagdetect_enabled", "1", "Enabled");
HookConVarChange(CreateConVar("clantagdetect_tag", "myTag,myTagVIP", "The clan tags to search for seperated with a comma (\",\")"), TagListChange);
castSens = CreateConVar("clantagdetect_case", "1", "Should the search be case sensitive?");
flagBit = CreateConVar("clantagdetect_flag", "ar", "What admin flags to add?");
AutoExecConfig(true, "clantag_detect");
}
public TagListChange(Handle:conVar, const String:oldValue[], const String:newValue[])
{
ExplodeString(newValue, ",", tags, sizeof(tags), sizeof(tags[]));
}
public OnClientPostAdminFilter(client)
{
if (GetConVarBool(enabled))
{
new String:tag[TAG_SIZE];
CS_GetClientClanTag(client, tag, sizeof(tag));
new bool:bCaseSens = GetConVarBool(castSens);
new String:flagString[TAG_SIZE];
GetConVarString(flagBit, flagString, sizeof(flagString));
new flags = ReadFlagString(flagString);
for (new i = 1; i < sizeof(tags); i++)
{
if (strcmp(tag, tags[i], bCaseSens) == 0)
{
SetUserFlagBits(client, GetUserFlagBits(client) | flags);
PrintToChat(client, "Welcome! You have been given extra privilages because of your clan tag!");
}
}
}
}
I quickly made this. It only checks for tags in the clantag, but it should work. It did compile for me but I didn't test it, so there may be some bugs that I'm unaware of.
__________________