Raised This Month: $71 Target: $400
 17% 

[CSGO] Chat TAGs by ranking


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
napster_10
Member
Join Date: May 2016
Old 10-14-2018 , 06:57   [CSGO] Chat TAGs by ranking
Reply With Quote #1

hi guys..

what about a plugin which manages chat tags by ranking like the kztimer plugin has but for a ranking plugin like RankMe sodstats hlstatX gameme etc..

the code should be all there (in the kztimer plugin) .. someone just needs to put it together or would that be too complicated? only adjustment would be to get the ranks/points out of the rankMe mysql database instead!

so the idea is
- the plugin gets the playerranking and points from the mysql database from the ranking system (RankMe)
- a config file which sets up the skillgroups/chattags and either how much points or ranking is needed to get them

like top10(>2000points) [PRO]
rank 20-30 (1500-2000points) [SEMIPRO] and so on...

scripting/kztimerGlobal/misc.sp
Code:
public SetSkillGroups()
{
	//Map Points
	new mapcount;
	if (g_pr_MapCount < 1)
		mapcount = 1;
	else
		mapcount = g_pr_MapCount;
	g_pr_PointUnit = 1;
	new Float: MaxPoints = float(mapcount) * 1300.0 + 4000.0; //1300 = map max, 4000 = jumpstats max
	new g_RankCount = 0;

	decl String:sPath[PLATFORM_MAX_PATH], String:sBuffer[32];
	BuildPath(Path_SM, sPath, sizeof(sPath), "configs/kztimer/skillgroups.cfg");

	if (FileExists(sPath))
	{
		new Handle:hKeyValues = CreateKeyValues("KZTimer.SkillGroups");
		if(FileToKeyValues(hKeyValues, sPath) && KvGotoFirstSubKey(hKeyValues))
		{
			do
			{
				if (g_RankCount <= 8)
				{
					KvGetString(hKeyValues, "name", g_szSkillGroups[g_RankCount], 32);
					KvGetString(hKeyValues, "percentage", sBuffer,32);
					if (g_RankCount != 0)
						g_pr_rank_Percentage[g_RankCount] = RoundToCeil(MaxPoints * StringToFloat(sBuffer));
				}
				g_RankCount++;
			}
			while (KvGotoNextKey(hKeyValues));
		}
		if (hKeyValues != INVALID_HANDLE)
			CloseHandle(hKeyValues);
	}
	else
		SetFailState("<KZTIMER> addons/sourcemod/configs/kztimer/skillgroups.cfg not found.");
}

public SetPlayerRank(client)
{
	if (!IsValidClient(client) || IsFakeClient(client) || g_pr_Calculating[client])
		return;
	if (g_bPointSystem)
	{
		if (g_pr_points[client] < g_pr_rank_Percentage[1])
		{
			g_Skillgroup[client] = 1;
			Format(g_pr_rankname[client], 32, "%s",g_szSkillGroups[0]);
			Format(g_pr_chat_coloredrank[client], 32, "[%c%s%c]",WHITE,g_szSkillGroups[0],WHITE);
		}
		else
		if (g_pr_rank_Percentage[1] <= g_pr_points[client] && g_pr_points[client] < g_pr_rank_Percentage[2])
		{
			g_Skillgroup[client] = 2;
			Format(g_pr_rankname[client], 32, "%s",g_szSkillGroups[1]);
			Format(g_pr_chat_coloredrank[client], 32, "[%c%s%c]",WHITE,g_szSkillGroups[1],WHITE);
		}
		else
		if (g_pr_rank_Percentage[2] <= g_pr_points[client] && g_pr_points[client] < g_pr_rank_Percentage[3])
		{
			g_Skillgroup[client] = 3;
			Format(g_pr_rankname[client], 32, "%s",g_szSkillGroups[2]);
			Format(g_pr_chat_coloredrank[client], 32, "[%c%s%c]",GRAY,g_szSkillGroups[2],WHITE);
		}
		else
		if (g_pr_rank_Percentage[3] <= g_pr_points[client] && g_pr_points[client] < g_pr_rank_Percentage[4])
		{
			g_Skillgroup[client] = 4;
			Format(g_pr_rankname[client], 32, "%s",g_szSkillGroups[3]);
			Format(g_pr_chat_coloredrank[client], 32, "[%c%s%c]",LIGHTBLUE,g_szSkillGroups[3],WHITE);
		}
		else
		if (g_pr_rank_Percentage[4] <= g_pr_points[client] && g_pr_points[client] < g_pr_rank_Percentage[5])
		{
			g_Skillgroup[client] = 5;
			Format(g_pr_rankname[client], 32, "%s",g_szSkillGroups[4]);
			Format(g_pr_chat_coloredrank[client], 32, "[%c%s%c]",BLUE,g_szSkillGroups[4],WHITE);
		}
		else
		if (g_pr_rank_Percentage[5] <= g_pr_points[client] && g_pr_points[client] < g_pr_rank_Percentage[6])
		{
			g_Skillgroup[client] = 6;
			Format(g_pr_rankname[client], 32, "%s",g_szSkillGroups[5]);
			Format(g_pr_chat_coloredrank[client], 32, "[%c%s%c]",DARKBLUE,g_szSkillGroups[5],WHITE);
		}
		else
		if (g_pr_rank_Percentage[6] <= g_pr_points[client] && g_pr_points[client] < g_pr_rank_Percentage[7])
		{
			g_Skillgroup[client] = 7;
			Format(g_pr_rankname[client], 32, "%s",g_szSkillGroups[6]);
			Format(g_pr_chat_coloredrank[client], 32, "[%c%s%c]",PINK,g_szSkillGroups[6],WHITE);
		}
		else
		if (g_pr_rank_Percentage[7] <= g_pr_points[client] && g_pr_points[client] < g_pr_rank_Percentage[8])
		{
			g_Skillgroup[client] = 8;
			Format(g_pr_rankname[client], 32, "%s",g_szSkillGroups[7]);
			Format(g_pr_chat_coloredrank[client], 32, "[%c%s%c]",LIGHTRED,g_szSkillGroups[7],WHITE);
		}
		else
		if (g_pr_points[client] >= g_pr_rank_Percentage[8])
		{
			g_Skillgroup[client] = 9;
			Format(g_pr_rankname[client], 32, "%s",g_szSkillGroups[8]);
			Format(g_pr_chat_coloredrank[client], 32, "[%c%s%c]",DARKRED,g_szSkillGroups[8],WHITE);
		}
	}
	else
	{
		g_Skillgroup[client] = 0;
		Format(g_pr_rankname[client], 32, "");
	}


	// DEV Tags -- 1NutWunder, Klyve & Sikari
	if (StrEqual(g_szSteamID[client],"STEAM_1:1:73507922") || StrEqual(g_szSteamID[client],"STEAM_1:0:36685029") || StrEqual(g_szSteamID[client],"STEAM_1:1:21505111"))
	{
		Format(g_pr_chat_coloredrank[client], 32, "%s %cDEV%c",g_pr_chat_coloredrank[client],RED,WHITE);

		if (g_bVipClantag && (GetUserFlagBits(client) & ADMFLAG_RESERVATION) && !(GetUserFlagBits(client) & ADMFLAG_ROOT) && !(GetUserFlagBits(client) & ADMFLAG_GENERIC))
		{
			Format(g_pr_rankname[client], 32, "VIP");
		}

		else if (g_bAdminClantag && (GetUserFlagBits(client) & ADMFLAG_ROOT || GetUserFlagBits(client) & ADMFLAG_GENERIC))
		{
			Format(g_pr_rankname[client], 32, "ADMIN");
		}

		return;
	}

	// GLOBAL Tags
	if (StrEqual(g_szSteamID[client],"STEAM_1:1:43259299") ||
		StrEqual(g_szSteamID[client],"STEAM_1:0:31861748") ||
		StrEqual(g_szSteamID[client],"STEAM_1:0:31339383") ||
		StrEqual(g_szSteamID[client],"STEAM_1:0:16599865") ||
		StrEqual(g_szSteamID[client],"STEAM_1:0:8845346")  ||
		StrEqual(g_szSteamID[client],"STEAM_1:1:11374239"))
		{
			Format(g_pr_chat_coloredrank[client], 32, "%s %cGLOBAL%c",g_pr_chat_coloredrank[client],DARKRED,WHITE);

			if (g_bVipClantag && (GetUserFlagBits(client) & ADMFLAG_RESERVATION) && !(GetUserFlagBits(client) & ADMFLAG_ROOT) && !(GetUserFlagBits(client) & ADMFLAG_GENERIC))
			{
				Format(g_pr_rankname[client], 32, "VIP");
			}

			else if (g_bAdminClantag && (GetUserFlagBits(client) & ADMFLAG_ROOT || GetUserFlagBits(client) & ADMFLAG_GENERIC))
			{
				Format(g_pr_rankname[client], 32, "ADMIN");
			}

			return;
		}

	// VIP tag
	if (g_bVipClantag)
	{
		if ((GetUserFlagBits(client) & ADMFLAG_RESERVATION) && !(GetUserFlagBits(client) & ADMFLAG_ROOT) && !(GetUserFlagBits(client) & ADMFLAG_GENERIC))
		{
			Format(g_pr_chat_coloredrank[client], 32, "%s %cVIP%c",g_pr_chat_coloredrank[client],YELLOW,WHITE);
			Format(g_pr_rankname[client], 32, "VIP");
		}
	}

	//ADMIN tag
	if (g_bAdminClantag)
	{
		if (GetUserFlagBits(client) & ADMFLAG_ROOT || GetUserFlagBits(client) & ADMFLAG_GENERIC)
		{
			Format(g_pr_chat_coloredrank[client], 32, "%s %cADMIN%c",g_pr_chat_coloredrank[client],LIMEGREEN,WHITE);
			Format(g_pr_rankname[client], 32, "ADMIN");
		}
	}

  // Mapper tag
  for(new x = 0; x < 100; x++)
	{
		if ((StrContains(g_szMapmakers[x],"STEAM",true) != -1))
		{
			if (StrEqual(g_szMapmakers[x],g_szSteamID[client]))
			{
				Format(g_pr_chat_coloredrank[client], 32, "%s %cMAPPER%c",g_pr_chat_coloredrank[client],LIMEGREEN,WHITE);
				Format(g_pr_rankname[client], 32, "MAPPER");
				break;
			}
		}
	}
}
scripting/kztimerGlobal/commands.sp
Code:
public Action:Client_Ranks(client, args)
{
	if (IsValidClient(client))
		PrintToChat(client, "[%cKZ%c] %c%s (0p)  %c%s%c (%ip)   %c%s%c (%ip)   %c%s%c (%ip)   %c%s%c (%ip)   %c%s%c (%ip)   %c%s%c (%ip)   %c%s%c (%ip)   %c%s%c (%ip)",
		MOSSGREEN,WHITE, WHITE, g_szSkillGroups[0],WHITE,g_szSkillGroups[1],WHITE,g_pr_rank_Percentage[1], GRAY, g_szSkillGroups[2],GRAY,g_pr_rank_Percentage[2],LIGHTBLUE,
		g_szSkillGroups[3],LIGHTBLUE,g_pr_rank_Percentage[3],BLUE, g_szSkillGroups[4],BLUE,g_pr_rank_Percentage[4],DARKBLUE,g_szSkillGroups[5],DARKBLUE,g_pr_rank_Percentage[5],
		PINK,g_szSkillGroups[6],PINK,g_pr_rank_Percentage[6],LIGHTRED,g_szSkillGroups[7],LIGHTRED,g_pr_rank_Percentage[7],DARKRED,g_szSkillGroups[8],DARKRED,g_pr_rank_Percentage[8]);
	return Plugin_Handled;
}
configs/kztimer/skillgroups.cfg
Code:
//Points for skill group 2-9: percentage * (MaxPointsFromMaps +MaxPointsFromJumpstats) [Requires map restart]
//MaxPointsFromMaps = MapCount * 1300p
//MaxPointsFromJumpstats = 7 * 500p (500p per JumpStats type)
"KZTimer.SkillGroups"
{
	"1"
	{
		"name"				"NEWB"
	}	
	"2"
	{
		"name"				"SCRUB"
		"percentage"        "0.00005"
	}
	"3"
	{
		"name"				"TRAINEE"
		"percentage"        "0.003"
	}	
	"4"
	{
		"name"				"CASUAL"
		"percentage"        "0.01"
	}	
	"5"
	{
		"name"				"REGULAR"
		"percentage"        "0.017"
	}	
	"6"
	{
		"name"				"SKILLED"
		"percentage"        "0.05"
	}	
	"7"
	{
		"name"				"EXPERT"
		"percentage"        "0.12"
	}	
	"8"
	{
		"name"				"SEMIPRO"
		"percentage"        "0.16"
	}	
	"9"
	{
		"name"				"PRO"
		"percentage"        "0.25"
	}	
}

Last edited by napster_10; 10-14-2018 at 07:05.
napster_10 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:40.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode