Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <cstrike>
- #include <clientprefs>
- #include <multicolors>
- #include <basecomm>
- #pragma semicolon 1
- #pragma newdecls required
- StringMap tagClan;
- StringMap flagClan;
- StringMap cienClan;
- StringMap colorChatTag;
- StringMap colorChatNick;
- int ilosctagow;
- char TagClient[MAXPLAYERS + 1][64];
- char TagColor[MAXPLAYERS + 1][64];
- char NickColor[MAXPLAYERS + 1][64];
- bool AkceptTag[MAXPLAYERS + 1];
- bool TrybCieniaTag[MAXPLAYERS + 1];
- Handle iClientCookieTag;
- public Plugin myinfo =
- {
- name = "Tag Clan",
- author = "Yellon",
- description = "",
- };
- public void OnPluginStart()
- {
- if(GetEngineVersion() != Engine_CSGO)
- {
- SetFailState("This plugin works only on CS:GO");
- }
- tagClan = new StringMap();
- flagClan = new StringMap();
- cienClan = new StringMap();
- colorChatTag = new StringMap();
- colorChatNick = new StringMap();
- RegConsoleCmd("sm_trybcienia", TrybCienia);
- RegConsoleCmd("say", Command_SendToAll);
- RegAdminCmd("sm_reloadtag", ReloadTagAdmin, ADMFLAG_ROOT);
- iClientCookieTag = RegClientCookie("tag_tryb_cienia", "Tryb Cienia TAG", CookieAccess_Private);
- }
- public Action ReloadTagAdmin(int iClient, int iArg)
- {
- FileTag();
- SetClientClanTag(iClient);
- }
- public Action TrybCienia(int iClient, int iArg)
- {
- TrybCieniaTag[iClient] = !TrybCieniaTag[iClient];
- SetClientClanTag(iClient);
- if(TrybCieniaTag[iClient] == true)
- SetClientCookie(iClient, iClientCookieTag, "true");
- else SetClientCookie(iClient, iClientCookieTag, "false");
- PrintToChat(iClient, "\x01[\x0E TAG\x01 ]%s\x08 tryb Cienia", TrybCieniaTag[iClient] == true ? "\x06 Włączyłeś" : "\x07 Wyłączyłeś");
- }
- public void OnClientCookiesCached(int iClient) {
- char szBuffer[64];
- GetClientCookie(iClient, iClientCookieTag, szBuffer, sizeof(szBuffer));
- if(StrEqual(szBuffer, "") || StrEqual(szBuffer, "false"))
- {
- TrybCieniaTag[iClient] = false;
- }
- else if(StrEqual(szBuffer, "true"))
- {
- TrybCieniaTag[iClient] = true;
- }
- }
- public void OnConfigsExecuted()
- {
- FileTag();
- }
- public void OnClientDisconnect(int iClient)
- {
- strcopy(TagClient[iClient], 64, "");
- strcopy(TagColor[iClient], 64, "");
- strcopy(NickColor[iClient], 64, "");
- TrybCieniaTag[iClient] = false;
- AkceptTag[iClient] = false;
- }
- public void OnMapStart()
- {
- ilosctagow = 0;
- CreateTimer(2.0, Timer_SetClanTags, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
- }
- public void OnMapEnd()
- {
- ilosctagow = 0;
- }
- public void OnClientPostAdminCheck(int iClient)
- {
- SetClientClanTag(iClient);
- }
- public Action Timer_SetClanTags(Handle hTimer)
- {
- for(int i = 1; i <= MaxClients; i++)
- {
- if (IsClientInGame(i) && !IsFakeClient(i))
- {
- SetClientClanTag(i);
- }
- }
- return Plugin_Continue;
- }
- public Action SetClientClanTag(int iClient)
- {
- if(!IsFakeClient(iClient) && IsClientInGame(iClient))
- {
- AkceptTag[iClient] = false;
- char idtag[10], SID[64], TAG[64], FLAG[64], CIEN[10], NKOLOR[64], TKOLOR[64];
- char ExplodeFlag[25][64];
- GetClientAuthId(iClient, AuthId_Engine, SID, sizeof(SID));
- for (int i = 1; i <= ilosctagow; i++)
- {
- Format(idtag, 9, "%i", i);
- tagClan.GetString(idtag, TAG, sizeof(TAG));
- flagClan.GetString(idtag, FLAG, sizeof(FLAG));
- cienClan.GetString(idtag, CIEN, sizeof(CIEN));
- colorChatTag.GetString(idtag, TKOLOR, sizeof(TKOLOR));
- colorChatNick.GetString(idtag, NKOLOR, sizeof(NKOLOR));
- ExplodeString(FLAG, ";", ExplodeFlag, sizeof(ExplodeFlag), sizeof(ExplodeFlag[]));
- for (int j = 0; j < 25; j++)
- {
- if(AkceptTag[iClient] == false)
- {
- bool isFlag = CheckFlag(iClient, ExplodeFlag[j]);
- if(TrybCieniaTag[iClient] == false)
- {
- if(StrEqual(SID, ExplodeFlag[j]))
- {
- strcopy(TagClient[iClient], 64, TAG);
- strcopy(TagColor[iClient], 64, TKOLOR);
- strcopy(NickColor[iClient], 64, NKOLOR);
- AkceptTag[iClient] = true;
- }
- else if(isFlag == true)
- {
- strcopy(TagClient[iClient], 64, TAG);
- strcopy(TagColor[iClient], 64, TKOLOR);
- strcopy(NickColor[iClient], 64, NKOLOR);
- AkceptTag[iClient] = true;
- }
- else if(StrEqual(FLAG, ""))
- {
- strcopy(TagClient[iClient], 64, TAG);
- strcopy(TagColor[iClient], 64, TKOLOR);
- strcopy(NickColor[iClient], 64, NKOLOR);
- AkceptTag[iClient] = true;
- }
- }
- else
- {
- if(StrEqual(CIEN, "true"))
- {
- if(StrEqual(SID, ExplodeFlag[j]))
- {
- strcopy(TagClient[iClient], 64, TAG);
- strcopy(TagColor[iClient], 64, TKOLOR);
- strcopy(NickColor[iClient], 64, NKOLOR);
- AkceptTag[iClient] = true;
- }
- else if(isFlag == true)
- {
- strcopy(TagClient[iClient], 64, TAG);
- strcopy(TagColor[iClient], 64, TKOLOR);
- strcopy(NickColor[iClient], 64, NKOLOR);
- AkceptTag[iClient] = true;
- }
- else if(StrEqual(FLAG, ""))
- {
- strcopy(TagClient[iClient], 64, TAG);
- strcopy(TagColor[iClient], 64, TKOLOR);
- strcopy(NickColor[iClient], 64, NKOLOR);
- AkceptTag[iClient] = true;
- }
- }
- }
- }
- }
- }
- CS_SetClientClanTag(iClient, TagClient[iClient]);
- }
- return Plugin_Continue;
- }
- public Action Command_SendToAll(int client, int args)
- {
- if (IsValidClient(client))
- {
- char text[256];
- GetCmdArg(1, text, sizeof(text));
- if (text[0] == '/' || text[0] == '@' || text[0] == '!' || text[0] == 0 || IsChatTrigger() || BaseComm_IsClientGagged(client))
- {
- return Plugin_Handled;
- }
- if(IsPlayerAlive(client) && GetClientTeam(client) != 1)
- {
- CPrintToChatAll("\x01 {%s}%s\x01 {%s}%N: \x01%s",TagColor[client], TagClient[client], NickColor[client], client, text);
- return Plugin_Handled;
- }
- else if(!IsPlayerAlive(client) && GetClientTeam(client) != 1)
- {
- CPrintToChatAll("\x01*NIE ZYJE* {%s}%s\x01 {%s}%N: \x01%s",TagColor[client], TagClient[client], NickColor[client], client, text);
- return Plugin_Handled;
- }
- else if(!IsPlayerAlive(client) && GetClientTeam(client) == 1)
- {
- CPrintToChatAll("\x01*OBSERWATOR* {%s}%s\x01 {%s}%N: \x01%s",TagColor[client], TagClient[client], NickColor[client], client, text);
- return Plugin_Handled;
- }
- }
- return Plugin_Continue;
- }
- public void FileTag()
- {
- tagClan.Clear();
- flagClan.Clear();
- cienClan.Clear();
- colorChatTag.Clear();
- colorChatNick.Clear();
- char sPath[PLATFORM_MAX_PATH];
- Format(sPath, sizeof(sPath), "configs/TagClan.cfg");
- BuildPath(Path_SM, sPath, sizeof(sPath), sPath);
- if (!FileExists(sPath))
- return;
- KeyValues hKeyValues = CreateKeyValues("Tag");
- if (!hKeyValues.ImportFromFile(sPath))
- return;
- if(hKeyValues.GotoFirstSubKey())
- {
- do
- {
- char sSectionName[255];
- char stag[255];
- char sflag[255];
- char scien[10];
- char stagcolor[10];
- char snickcolor[10];
- hKeyValues.GetSectionName(sSectionName, sizeof(sSectionName));
- hKeyValues.GetString("tag", stag, sizeof(stag));
- hKeyValues.GetString("flag", sflag, sizeof(sflag));
- hKeyValues.GetString("cien", scien, sizeof(scien));
- hKeyValues.GetString("tag_color", stagcolor, sizeof(stagcolor));
- hKeyValues.GetString("nick_color", snickcolor, sizeof(snickcolor));
- tagClan.SetString(sSectionName, stag);
- flagClan.SetString(sSectionName, sflag);
- cienClan.SetString(sSectionName, scien);
- colorChatTag.SetString(sSectionName, stagcolor);
- colorChatNick.SetString(sSectionName, snickcolor);
- ilosctagow++;
- }
- while(hKeyValues.GotoNextKey(false));
- }
- hKeyValues.Close();
- }
- stock bool CheckFlag(int iClient, char[] flag)
- {
- if(StrEqual(flag, "a"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_RESERVATION)
- return true;
- else return false;
- } else if(StrEqual(flag, "b"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_GENERIC)
- return true;
- else return false;
- } else if(StrEqual(flag, "c"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_KICK)
- return true;
- else return false;
- } else if(StrEqual(flag, "d"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_BAN)
- return true;
- else return false;
- } else if(StrEqual(flag, "e"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_UNBAN)
- return true;
- else return false;
- } else if(StrEqual(flag, "f"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_SLAY)
- return true;
- else return false;
- } else if(StrEqual(flag, "g"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CHANGEMAP)
- return true;
- else return false;
- } else if(StrEqual(flag, "h"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CONVARS)
- return true;
- else return false;
- } else if(StrEqual(flag, "i"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CONFIG)
- return true;
- else return false;
- } else if(StrEqual(flag, "j"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CHAT)
- return true;
- else return false;
- } else if(StrEqual(flag, "k"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_VOTE)
- return true;
- else return false;
- } else if(StrEqual(flag, "l"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_PASSWORD)
- return true;
- else return false;
- } else if(StrEqual(flag, "m"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_RCON)
- return true;
- else return false;
- } else if(StrEqual(flag, "n"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CHEATS)
- return true;
- else return false;
- } else if(StrEqual(flag, "z"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_ROOT)
- return true;
- else return false;
- } else if(StrEqual(flag, "o"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CUSTOM1)
- return true;
- else return false;
- } else if(StrEqual(flag, "p"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CUSTOM2)
- return true;
- else return false;
- } else if(StrEqual(flag, "q"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CUSTOM3)
- return true;
- else return false;
- } else if(StrEqual(flag, "r"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CUSTOM4)
- return true;
- else return false;
- } else if(StrEqual(flag, "s"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CUSTOM5)
- return true;
- else return false;
- } else if(StrEqual(flag, "t"))
- {
- if(GetUserFlagBits(iClient) & ADMFLAG_CUSTOM6)
- return true;
- else return false;
- }
- return false;
- }
- stock bool IsValidClient(int client)
- {
- if(client >= 1 && client <= MaxClients && IsClientInGame(client) && !IsFakeClient(client))
- return true;
- return false;
- }
- public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
- {
- CreateNative("TagClan_Reload", Native_TagClanReload);
- return APLRes_Success;
- }
- public int Native_TagClanReload(Handle plugin, int numParams) {
- int client = GetNativeCell(1);
- FileTag();
- SetClientClanTag(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement