From 0f0d634a8de9b19b09e2d71e443f3d631266b760 Mon Sep 17 00:00:00 2001 From: jenz Date: Sat, 27 Apr 2024 02:49:59 +0200 Subject: [PATCH] added randomized multi colour for top 50 --- RaceTimer/scripting/racetimer_rank.sp | 57 +++++++++++++++++++++------ 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/RaceTimer/scripting/racetimer_rank.sp b/RaceTimer/scripting/racetimer_rank.sp index 87f1b4db..f17e9a83 100644 --- a/RaceTimer/scripting/racetimer_rank.sp +++ b/RaceTimer/scripting/racetimer_rank.sp @@ -276,15 +276,52 @@ 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) + { + 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 * 27) % 256; - green = ((lvl + 50) * 23) % 256; - blue = ((lvl + 100) * 29) % 256; + 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); + return; + } + + red = (GetRandomInt(0, 255)) % 256; + green = (GetRandomInt(0, 255)) % 256; + blue = (GetRandomInt(0, 255)) % 256; + Format(hexadecimals, sizeof(hexadecimals), "%02X%02X%02X", red, green, blue); + + red = (GetRandomInt(0, 255)) % 256; + green = (GetRandomInt(0, 255)) % 256; + blue = (GetRandomInt(0, 255)) % 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; + red = (GetRandomInt(0, 255)) % 256; + green = (GetRandomInt(0, 255)) % 256; + blue = (GetRandomInt(0, 255)) % 256; Format(hexadecimals3, sizeof(hexadecimals3), "%02X%02X%02X", red, green, blue); char tag[128]; @@ -294,12 +331,10 @@ public void set_level_tag(int client, int lvl, int I_rank) 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; + red = (GetRandomInt(0, 255)) % 256; + green = (GetRandomInt(0, 255)) % 256; + blue = (GetRandomInt(0, 255)) % 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]); }