Raised This Month: $ Target: $400
 0% 

Dim a user's screen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dizzy
Veteran Member
Join Date: Jun 2004
Location: Massachusetts
Old 02-25-2006 , 21:18   Dim a user's screen
Reply With Quote #1

How would you go about dimming the user's screen as if they were wearing sun glasses?
__________________
My Plugins

Purchase Mod - Stable
Type Sounds - Stable
Monster Spawner - Stable
Nade Giver - Maintenance
Dizzy is offline
Send a message via AIM to Dizzy
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 02-25-2006 , 22:00  
Reply With Quote #2

Code:
message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id); write_short(~0) write_short(10) write_short(1<<12) write_byte(0)    //red write_byte(0)    //green write_byte(0)    //blue write_byte(100) //alpha (255 = whole screen is colorred, 0 = no color.) message_end()
Execute that every like 0.1 and the player cannot get flashed and his screen will be dulled as if he was wearing sun glasses.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
Dizzy
Veteran Member
Join Date: Jun 2004
Location: Massachusetts
Old 02-25-2006 , 22:27  
Reply With Quote #3

Thanks GHW
__________________
My Plugins

Purchase Mod - Stable
Type Sounds - Stable
Monster Spawner - Stable
Nade Giver - Maintenance
Dizzy is offline
Send a message via AIM to Dizzy
c0rdawg
Senior Member
Join Date: Jan 2006
Old 02-25-2006 , 23:34  
Reply With Quote #4

I'm new to amxx, can you explain what this stuff does?
Code:
message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id); write_short(~0) write_short(10) write_short(1<<12)
c0rdawg is offline
Send a message via AIM to c0rdawg Send a message via MSN to c0rdawg
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 02-26-2006 , 00:31  
Reply With Quote #5

the first short is the duration. the second is the hold time. these are in special format, basically ~0 means maximum. the third short is the flags. the following are available, just define these at the top of your script.

Code:
#define FFADE_IN    0x0000      // Just here so we don't pass 0 into the function #define FFADE_OUT   0x0001      // Fade out (not in) #define FFADE_MODULATE  0x0002      // Modulate (don't blend) #define FFADE_STAYOUT   0x0004      // ignores the duration, stays faded out until new ScreenFade message received

if you define those then you can use multiple flags like so:

Code:
write_short(FFADE_MODULATE | FFDATE_STAYOUT);
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
VEN
Veteran Member
Join Date: Jan 2005
Old 02-26-2006 , 14:31  
Reply With Quote #6

Also i do not see the reason why it's necessary to repeat that every 0.1 second. It could be a problem and maybe even reliable overflow. To overwrite default screen you can just hook ScreenFade event and execute your function.
VEN is offline
Des12
Senior Member
Join Date: Jan 2005
Old 02-26-2006 , 16:17  
Reply With Quote #7

with
Code:
#define FFADE_STAYOUT    0x0004        // ignores the duration, stays faded out until new ScreenFade message received

Does it work across plugins? Such as if in one plugin, a user types /fadered

Code:
message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id); write_short(~0) write_short(~0) write_short(FFADE_STAYOUT); // flags ) write_byte(255)    //red write_byte(0)    //green write_byte(0)    //blue write_byte(100) //alpha (255 = whole screen is colorred, 0 = no color.) message_end()

And in another plugin, /fadeoff



Code:
message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id); write_short(~0) write_short(~0) write_short(FFADE_STAYOUT); // flags ) write_byte(0)    //red write_byte(0)    //green write_byte(0)    //blue write_byte(0) //alpha (255 = whole screen is colorred, 0 = no color.) message_end()

Would that stay red until a user types /fadeoff?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 02-26-2006 , 16:50  
Reply With Quote #8

yes, unless another ScreenFade message is sent from somewhere else.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
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 20:19.


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