Raised This Month: $32 Target: $400
 8% 

imessage random colors


Post New Thread Reply   
 
Thread Tools Display Modes
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
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 01-02-2008 , 06:28   Re: imessage random colors
Reply With Quote #2

Small differences in AMX MOD X v1.8.1

Original:
Code:
read_argv(2, mycol, 11)        // RRRGGGBBB
    vals[2] = str_to_num(mycol[6])
    
    mycol[6] = 0
    vals[1] = str_to_num(mycol[3])
    
    mycol[3] = 0
    vals[0] = str_to_num(mycol[0])
Modified (added code):
Code:
    read_argv(2, mycol, 11)        // RRRGGGBBB
    vals[2] = str_to_num(mycol[6])
    if (vals[2] == 256)
        vals[2] = random(200) + 25
    
    mycol[6] = 0
    vals[1] = str_to_num(mycol[3])
    if (vals[1] == 256)
        vals[1] = random(200) + 25
    
    mycol[3] = 0
    vals[0] = str_to_num(mycol[0])
    if (vals[0] == 256)
        vals[0] = random(200) + 25

Last edited by Sn!ff3r; 01-02-2008 at 06:31.
Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 01-02-2008 , 11:14   Re: imessage random colors
Reply With Quote #3

Good find, nice to know.
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
Old 01-02-2008, 23:16
Lee
This message has been deleted by Lee.
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 01-12-2008 , 11:06   Re: imessage random colors
Reply With Quote #4

this only works map by map?...

1) i change to de_dust2, random color
2) i change to de_inferno, another color

it's possible to change when the messages appears every time?
__________________
IneedHelp is offline
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 01-13-2008 , 00:40   Re: imessage random colors
Reply With Quote #5

All the imessages (thus color values) are read at the map start via amxx.cfg. If you want random colors each time, you'd need a different plugin. I'd be suprised if one wasn't already been written to do that. This thread just demonstrates a simple modification to a stock plugin.
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode