diff --git a/RaceTimer/scripting/racetimer_rank.sp b/RaceTimer/scripting/racetimer_rank.sp index b705b05..8fb6e60 100644 --- a/RaceTimer/scripting/racetimer_rank.sp +++ b/RaceTimer/scripting/racetimer_rank.sp @@ -3,21 +3,31 @@ #include #include #include +#include public Plugin myinfo = { name = "Racetimer Rank", author = "jenz", description = "Give racetimer points as a level clan tag to players, also for chat tag", - version = "1.1", + version = "1.2", url = "" }; bool g_b_ignoring_tags[MAXPLAYERS + 1]; Database g_hDatabase; +ConVar g_Cvar_TierChatLVL; +ConVar g_Cvar_TierChatLVLMultiColor; +ConVar g_Cvar_TierChatLVLAllColor; +ConVar g_Cvar_TierClanLVL; public void OnPluginStart() { + g_Cvar_TierClanLVL = CreateConVar("sm_display_lvl_clan", "5", "Tier required to display your LVL as clan tag"); + g_Cvar_TierChatLVL = CreateConVar("sm_display_lvl_chat", "8", "Tier required to display your LVL in chat"); + g_Cvar_TierChatLVLMultiColor = CreateConVar("sm_display_lvl_chat_multi_colour", "10", "Tier required to display your LVL with multi colours"); + g_Cvar_TierChatLVLAllColor = CreateConVar("sm_display_lvl_chat_all_colour", "12", "Tier required to display your LVL with all possible colour combinations"); + RegConsoleCmd("sm_lvl", Command_LvTag, "Turns the Lv. tag feature on or off"); if (!g_hDatabase) { @@ -28,9 +38,10 @@ public void OnPluginStart() { if(IsClientInGame(client)) { - OnClientPostAdminFilter(client); + OnClientPostAdminCheck(client); } } + } public void OnMapStart() @@ -55,7 +66,7 @@ public void SQL_OnDatabaseConnect(Database db, const char[] error, any data) { if(IsClientInGame(client)) { - OnClientPostAdminFilter(client); + OnClientPostAdminCheck(client); } } } @@ -66,6 +77,15 @@ public Action Command_LvTag(int client, int args) { return Plugin_Handled; } + + int tier_required = GetConVarInt(g_Cvar_TierClanLVL); + int client_tier = GetPlayerTier_native(client); + if (tier_required > client_tier) + { + PrintToChat(client, "You are Tier %i and need Tier %i for using this command", client_tier, tier_required); + return Plugin_Handled; + } + //i am only adding this shit because lighty wanted it to be turn-off able, after half a year probably only 7 people will have made use of it. //kinda hate wasting time on pointless stuff like this. char sSID[64]; @@ -107,7 +127,7 @@ public void SQL_FinishedQuery(Database db, DBResultSet results, const char[] err else { PrintToChat(client, "Now displaying LVL tag again."); - OnClientPostAdminFilter(client); + OnClientPostAdminCheck(client); } } @@ -116,20 +136,18 @@ public void OnClientDisconnect(int client) g_b_ignoring_tags[client] = false; } -public void OnClientPostAdminFilter(int client) +public void OnClientPostAdminCheck(int client) { if(!IsClientAuthorized(client) || IsClientSourceTV(client)) return; if (IsFakeClient(client)) { - char tag[64]; - Format(tag, sizeof(tag), "[LVL 1]"); - CS_SetClientClanTag(client, tag); return; } g_b_ignoring_tags[client] = false; + check_ignoring_tags(client); } @@ -236,19 +254,22 @@ public int OnTransferResponse(char[] sData, int iSerial) I_player_points = 1000; //setting level 1 } - if (!HasClanTag(client)) + int tier_required = GetConVarInt(g_Cvar_TierClanLVL); + int client_tier = GetPlayerTier_native(client); + if (!HasClanTag(client) && client >= tier_required) { char tag[64]; Format(tag, sizeof(tag), "[LVL %i]", I_player_points/1000); CS_SetClientClanTag(client, tag); } - int I_rank = obj.GetInt("Rank") //if no endpoint for steamID default value is -1 - if (0 < I_rank < 1000) //only give chat tag to top 1000 + tier_required = GetConVarInt(g_Cvar_TierChatLVL); + client_tier = GetPlayerTier_native(client); + if (client_tier >= tier_required) { if (player_has_no_chattag(client)) { - set_level_tag(client, I_player_points/1000, I_rank); + set_level_tag(client, I_player_points/1000); } } json_cleanup_and_delete(obj); @@ -262,7 +283,7 @@ public bool player_has_no_chattag(int client) return strlen(tag) < 2; } -public void set_level_tag(int client, int lvl, int I_rank) +public void set_level_tag(int client, int lvl) { char hexadecimals[16]; char hexadecimals2[16]; @@ -271,7 +292,11 @@ public void set_level_tag(int client, int lvl, int I_rank) int green = ((lvl + 50) * 13) % 256; int blue = ((lvl + 100) * 19) % 256; Format(hexadecimals, sizeof(hexadecimals), "%02X%02X%02X", red, green, blue); - if (I_rank > 250) + + int tier_required = GetConVarInt(g_Cvar_TierChatLVLMultiColor); + int client_tier = GetPlayerTier_native(client); + //we display LVL with one colour + if (client_tier < tier_required) { char tag[64]; Format(tag, sizeof(tag), "[LVL %i] ", lvl); @@ -279,7 +304,9 @@ public void set_level_tag(int client, int lvl, int I_rank) CCC_SetColor(client, CCC_TagColor, StringToInt(hexadecimals, 16), false); return; } - if (I_rank > 50) + tier_required = GetConVarInt(g_Cvar_TierChatLVLAllColor); + //we display LVL with some of the multi colour combinations + if (client_tier < tier_required) { red = (lvl * 27) % 256; green = ((lvl + 50) * 23) % 256; @@ -312,6 +339,8 @@ public void set_level_tag(int client, int lvl, int I_rank) return; } + //we display LVL with ALL of the multi colour combinations + red = (GetRandomInt(0, 255)) % 256; green = (GetRandomInt(0, 255)) % 256; blue = (GetRandomInt(0, 255)) % 256; diff --git a/discord_verificiation/scripting/unloze_player_time.sp b/discord_verificiation/scripting/unloze_player_time.sp index 98e3557..14d335d 100644 --- a/discord_verificiation/scripting/unloze_player_time.sp +++ b/discord_verificiation/scripting/unloze_player_time.sp @@ -288,8 +288,6 @@ public int Native_GetPlayerWorthRTV_boost(Handle plugin, int numParams) return view_as(-1); } - int avg = GetAveragePlayerActiveTimeServer(); - //give vips the rtv/nomination/mapvote boost by default AdminId id = GetUserAdmin(client); if (id != INVALID_ADMIN_ID && GetAdminFlag(id, Admin_Reservation)) @@ -303,20 +301,7 @@ public int Native_GetPlayerWorthRTV_boost(Handle plugin, int numParams) return g_iPlayerRTVCapacity; } - if (g_iPlayerTimeServer[client] <= avg || avg == 0 || is_bot_player[client] || IsFakeClient(client)) - { - return 1; - } - if ((float(g_iPlayerTimeServer[client]) / float(avg)) > g_iPlayerRTVCapacity) - { - return g_iPlayerRTVCapacity; //1.0-5.0 booster probably - } - int val = RoundToFloor((g_iPlayerTimeServer[client]) / float(avg)); - if (val < 1) - { - val = 1; - } - return val; + return 1; } public void OnPluginEnd() @@ -722,6 +707,18 @@ public void PrintClientGroupOverrides(int client) char multi_nomination_tier[32]; Format(multi_nomination_tier, sizeof(multi_nomination_tier), "tier%i", FindConVar("mce_multiple_nominations_tier").IntValue); + char lvl_chat_tag[32]; + Format(lvl_chat_tag, sizeof(lvl_chat_tag), "tier%i", FindConVar("sm_display_lvl_chat").IntValue); + + char lvl_clan_tag[32]; + Format(lvl_clan_tag, sizeof(lvl_clan_tag), "tier%i", FindConVar("sm_display_lvl_clan").IntValue); + + char lvl_chat_tag_multicolour[32]; + Format(lvl_chat_tag_multicolour, sizeof(lvl_chat_tag_multicolour), "tier%i", FindConVar("sm_display_lvl_chat_multi_colour").IntValue); + + char lvl_chat_tag_allcolour[32]; + Format(lvl_chat_tag_allcolour, sizeof(lvl_chat_tag_allcolour), "tier%i", FindConVar("sm_display_lvl_chat_all_colour").IntValue); + menu.AddItem("-1", "Several tiers: playermodels in !zclass.", ITEMDRAW_DISABLED); menu.AddItem("-1", "Several tiers: grenade skins in !grenadeskins.", ITEMDRAW_DISABLED); @@ -746,6 +743,23 @@ public void PrintClientGroupOverrides(int client) { Format(entry, sizeof(entry), "%s%s: Multiple nominations, ", entry, g_GroupNames[i]); } + if (StrEqual(g_GroupNames[i], lvl_chat_tag)) + { + Format(entry, sizeof(entry), "%s%s: LVL chat tag with one colour, ", entry, g_GroupNames[i]); + } + if (StrEqual(g_GroupNames[i], lvl_clan_tag)) + { + Format(entry, sizeof(entry), "%s%s: LVL clan tag, ", entry, g_GroupNames[i]); + } + if (StrEqual(g_GroupNames[i], lvl_chat_tag_multicolour)) + { + Format(entry, sizeof(entry), "%s%s: LVL chat tag with multi colours, ", entry, g_GroupNames[i]); + } + if (StrEqual(g_GroupNames[i], lvl_chat_tag_allcolour)) + { + Format(entry, sizeof(entry), "%s%s: LVL chat tag with all colours, ", entry, g_GroupNames[i]); + } + if (g_GroupFlags[i][0] != '\0' && StrEqual(g_GroupFlags[i], "aop")) { Format(entry, sizeof(entry), "%s%s: VIP, ", entry, g_GroupNames[i]);