imessage random colors
Posted: Tue Aug 18, 2026 5:55 am
This is a simple plugin mod to optionally change your imessages from the boring same old colors, to random colors each new map. Any one or all colors can be made to randomize. To accomplish this, edit the stock imessage.sma setMessage() routine as so:
Original:
Modified (added code):
Then, for a random color(s) in your imessage(s), edit your amxx.cfg amx_imessage statements by replacing any RRR/GGG/BBB color with the value 256.
Example:
Original:
Code: Select all
read_argv(2, mycol, 11) // RRRGGGBBB
g_Values[g_MessagesNum][2] = str_to_num(mycol[6])
mycol[6] = 0
g_Values[g_MessagesNum][1] = str_to_num(mycol[3])
mycol[3] = 0
g_Values[g_MessagesNum][0] = str_to_num(mycol[0])Code: Select all
read_argv(2, mycol, 11) // RRRGGGBBB
g_Values[g_MessagesNum][2] = str_to_num(mycol[6])
if (g_Values[g_MessagesNum][2] == 256)
g_Values[g_MessagesNum][2] = random(200) + 25
mycol[6] = 0
g_Values[g_MessagesNum][1] = str_to_num(mycol[3])
if (g_Values[g_MessagesNum][1] == 256)
g_Values[g_MessagesNum][1] = random(200) + 25
mycol[3] = 0
g_Values[g_MessagesNum][0] = str_to_num(mycol[0])
if (g_Values[g_MessagesNum][0] == 256)
g_Values[g_MessagesNum][0] = random(200) + 25
}Example:
Code: Select all
amx_imessage "Welcome to %hostname%" "256256256"