diff --git a/RaceTimer/scripting/racetimer_rank.sp b/RaceTimer/scripting/racetimer_rank.sp index ed3a770a..87f1b4db 100644 --- a/RaceTimer/scripting/racetimer_rank.sp +++ b/RaceTimer/scripting/racetimer_rank.sp @@ -18,12 +18,19 @@ Database g_hDatabase; public void OnPluginStart() { - RegConsoleCmd("sm_lvl", Command_LVLTag, "Turns the LVL tag feature on or off"); + RegConsoleCmd("sm_lvl", Command_LvTag, "Turns the Lv. tag feature on or off"); if (!g_hDatabase) { Database.Connect(SQL_OnDatabaseConnect, "racetimercss"); return; } + for(int client = 1; client <= MaxClients; client++) + { + if(IsClientInGame(client)) + { + OnClientPostAdminFilter(client); + } + } } public void OnMapStart() @@ -53,7 +60,7 @@ public void SQL_OnDatabaseConnect(Database db, const char[] error, any data) } } -public Action Command_LVLTag(int client, int args) +public Action Command_LvTag(int client, int args) { if (!g_hDatabase) { @@ -241,7 +248,7 @@ public int OnTransferResponse(char[] sData, int iSerial) { if (player_has_no_chattag(client)) { - set_level_tag(client, I_player_points/1000); + set_level_tag(client, I_player_points/1000, I_rank); } } json_cleanup_and_delete(obj); @@ -255,16 +262,47 @@ public bool player_has_no_chattag(int client) return strlen(tag) < 2; } -public void set_level_tag(int client, int lvl) +public void set_level_tag(int client, int lvl, int I_rank) { - char tag[64]; - Format(tag, sizeof(tag), "[LVL %i] ", lvl); - CCC_SetTag(client, tag); - char hexadecimals[16]; + char hexadecimals2[16]; + char hexadecimals3[16]; int red = (lvl * 17) % 256; int green = ((lvl + 50) * 13) % 256; int blue = ((lvl + 100) * 19) % 256; Format(hexadecimals, sizeof(hexadecimals), "%02X%02X%02X", red, green, blue); - CCC_SetColor(client, CCC_TagColor, StringToInt(hexadecimals, 16), false); + if (I_rank > 250) + { + CCC_SetColor(client, CCC_TagColor, StringToInt(hexadecimals, 16), false); + return; + } + + red = (lvl * 27) % 256; + green = ((lvl + 50) * 23) % 256; + blue = ((lvl + 100) * 29) % 256; + Format(hexadecimals2, sizeof(hexadecimals2), "%02X%02X%02X", red, green, blue); + + red = (lvl * 37) % 256; + green = ((lvl + 50) * 33) % 256; + blue = ((lvl + 100) * 39) % 256; + Format(hexadecimals3, sizeof(hexadecimals3), "%02X%02X%02X", red, green, blue); + + char tag[128]; + char charlvl[16]; + IntToString(lvl, charlvl, sizeof(charlvl)); + + char coloured_numbers[32]; + for (int i = 0; i < strlen(charlvl); i++) + { + int i2 = i + 2; + i2 = i * i; + char number_hexa[16]; + red = (lvl * (i2 * 37)) % 256; + green = ((lvl + (i2 * 50)) * 33) % 256; + blue = ((lvl + (i2 * 100)) * 39) % 256; + Format(number_hexa, sizeof(number_hexa), "%02X%02X%02X", red, green, blue); + Format(coloured_numbers, sizeof(coloured_numbers), "%s\x07%s%c", coloured_numbers, number_hexa, charlvl[i]); + } + Format(tag, sizeof(tag), "\x07%s[L\x07%sV\x07%sL %s] ", hexadecimals, hexadecimals2, hexadecimals3, coloured_numbers); + CCC_SetTag(client, tag); }