Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Prints the Matchmaking Ranks on scoreboard, based on points stats by a certain r
- [Kento RankMe](https://forums.alliedmods.net/showthread.php?t=290063)
- [Game Me](https://www.gameme.com/)
- [HLStatsX](https://github.com/NomisCZ/hlstatsx-community-edition) (version 1.7+, upgrade daemon and use hlstatsx_api plugin)
- [Multi1v1](https://github.com/splewis/csgo-multi-1v1/)
- [Levels Ranks](https://github.com/levelsranks/levels-ranks-core)

The following is just for those who want to compile the plugin:
- [Overlays](https://forums.alliedmods.net/showthread.php?p=2526683);
Expand All @@ -22,7 +24,7 @@ The following is just for those who want to compile the plugin:

### ConVars

- **ranks_matchmaking_typeofrank** (Default: 0) - Type of Rank that you want to use for this plugin (0 for Kento Rankme, 1 for GameMe, 2 for ZR Rank, 3 for HLStatsX)
- **ranks_matchmaking_typeofrank** (Default: 0) - Type of Rank that you want to use for this plugin (0 for Kento Rankme, 1 for GameMe, 2 for ZR Rank, 3 for HLStatsX, 4 for Multi1v1 Stats, 5 for Levels Ranks)
- **ranks_matchmaking_prefix** (Default: "[{purple}Fake Ranks{default}]") - Chat Prefix
- **ranks_matchmaking_flag** (Default: 0) - Flag to restrict the ranks to certain players (0 enable the ranks for everyone)
- **ranks_matchmaking_point_s1** (Default: 100) - Number of Points to reach Silver I
Expand Down
Binary file removed addons/sourcemod/compiled/ranks_matchmaking.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/ranks_matchmaking.smx
Binary file not shown.
2 changes: 0 additions & 2 deletions addons/sourcemod/scripting/.gitignore

This file was deleted.

36 changes: 33 additions & 3 deletions addons/sourcemod/scripting/ranks_matchmaking.sp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <gameme>
#include <zr_rank>
#include <hlstatsx_api>
#include <multi1v1>
#include <lvl_ranks>
#define REQUIRE_PLUGIN

#pragma newdecls required
Expand Down Expand Up @@ -44,6 +46,8 @@ bool g_zrank;
bool g_kentorankme;
bool g_gameme;
bool g_hlstatsx;
bool g_multi1v1;
bool g_levelsranks;

char RankStrings[19][256];
char RankOverlays[18][PLATFORM_MAX_PATH];
Expand All @@ -65,7 +69,7 @@ public void OnPluginStart()
HookEvent("player_disconnect", Event_Disconnect, EventHookMode_Pre);

// ConVar to check which rank you want
g_CVAR_RankPoints_Type = CreateConVar("ranks_matchmaking_typeofrank", "0", "Type of Rank that you want to use for this plugin (0 for Kento Rankme, 1 for GameMe, 2 for ZR Rank, 3 for HLStatsX)", _, true, 0.0, true, 3.0);
g_CVAR_RankPoints_Type = CreateConVar("ranks_matchmaking_typeofrank", "0", "Type of Rank that you want to use for this plugin (0 for Kento Rankme, 1 for GameMe, 2 for ZR Rank, 3 for HLStatsX, 4 for Multi1v1 Stats, 5 for Levels Ranks)", _, true, 0.0, true, 5.0);
g_CVAR_RankPoints_Prefix = CreateConVar("ranks_matchmaking_prefix", "[{purple}Fake Ranks{default}]", "Chat Prefix");
g_CVAR_RankPoints_Flag = CreateConVar("ranks_matchmaking_flag", "", "Flag to restrict the ranks to certain players (leave it empty to enable for everyone)");
g_CVAR_RankPoints_HudOverlay = CreateConVar("ranks_matchmaking_hudoverlay" , "1", "Chooses between a HUD Text Message (0) or an Overlay (1)", _, true, 0.0, true, 1.0);
Expand Down Expand Up @@ -104,6 +108,8 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
MarkNativeAsOptional("RankMe_OnPlayerLoaded");
MarkNativeAsOptional("RankMe_GetPoints");
MarkNativeAsOptional("QueryGameMEStats");
MarkNativeAsOptional("Multi1v1_GetRating");
MarkNativeAsOptional("LR_GetClientInfo");
return APLRes_Success;
}

Expand All @@ -117,6 +123,10 @@ public void OnLibraryAdded(const char[] name)
g_gameme = true;
} else if (StrEqual(name, "hlstatsx_api")) {
g_hlstatsx = true;
} else if (StrEqual(name, "multi1v1")) {
g_multi1v1 = true;
} else if (StrEqual(name, "levelsranks")) {
g_levelsranks = true;
}
}

Expand All @@ -130,6 +140,10 @@ public void OnLibraryRemoved(const char[] name)
g_gameme = false;
} else if (StrEqual(name, "hlstatsx_api")) {
g_hlstatsx = false;
} else if (StrEqual(name, "multi1v1")) {
g_multi1v1 = false;
} else if (StrEqual(name, "levelsranks")) {
g_levelsranks = false;
}
}

Expand Down Expand Up @@ -244,6 +258,14 @@ public void OnClientPostAdminCheck(int client)
} else if (g_hlstatsx && g_RankPoints_Type == 3) {

HLStatsX_Api_GetStats("playerinfo", client, _HLStatsX_API_Response, 0);
} else if (g_multi1v1 && g_RankPoints_Type == 4) {

int points = RoundToNearest(Multi1v1_GetRating(client));
CheckRanks(client, points);
} else if (g_levelsranks && g_RankPoints_Type == 5) {

int points = LR_GetClientInfo(client, ST_EXP);
CheckRanks(client, points);
}
}
}
Expand Down Expand Up @@ -329,6 +351,14 @@ public void CheckPoints(int client)
} else if (g_hlstatsx && g_RankPoints_Type == 3) {

HLStatsX_Api_GetStats("playerinfo", client, _HLStatsX_API_Response, 0);
} else if (g_multi1v1 && g_RankPoints_Type == 4) {

int points = RoundToNearest(Multi1v1_GetRating(client));
CheckRanks(client, points);
} else if (g_levelsranks && g_RankPoints_Type == 5) {

int points = LR_GetClientInfo(client, ST_EXP);
CheckRanks(client, points);
}
}

Expand Down Expand Up @@ -461,10 +491,10 @@ public Action Menu_Points(int client, int args)
menu.AddItem("1", buffer);

char S_i[2];
for(int i = 1; i < 17; i++)
for(int i = 1; i <= 17; i++)
{
IntToString(i, S_i, sizeof(S_i));
Format(buffer, sizeof(buffer), "%t", "Between X and Y", RankStrings[i], RankPoints[i - 1], (RankPoints[i + 1] - 1));
Format(buffer, sizeof(buffer), "%t", "Between X and Y", RankStrings[i], RankPoints[i - 1], (RankPoints[i] - 1));
menu.AddItem(S_i, buffer);
}
Format(buffer, sizeof(buffer), "%t", "More Than X Points", RankStrings[18], (RankPoints[17] - 1));
Expand Down
4 changes: 2 additions & 2 deletions cfg/sourcemod/ranks_matchmaking.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// This file was auto-generated by SourceMod (v1.9.0.6276)
// ConVars for plugin "ranks_matchmaking.smx"

// Type of Rank that you want to use for this plugin (0 for Kento Rankme, 1 for GameMe, 2 for ZR Rank, 3 for HLStatsX)
// Type of Rank that you want to use for this plugin (0 for Kento Rankme, 1 for GameMe, 2 for ZR Rank, 3 for HLStatsX, 4 for Multi1v1 Stats, 5 for Levels Ranks)
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "3.000000"
// Maximum: "5.000000"
ranks_matchmaking_typeofrank "0"

// Number of Points to reach Silver I
Expand Down