View Single Post
Author Message
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 01-01-2008 , 10:21   imessage random colors
Reply With Quote #1

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:
Code:
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])
Modified (added code):
Code:
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
}
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:
Code:
amx_imessage "Welcome to %hostname%" "256256256"
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet