AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Dim a user's screen (https://forums.alliedmods.net/showthread.php?t=24542)

Dizzy 02-25-2006 21:18

Dim a user's screen
 
How would you go about dimming the user's screen as if they were wearing sun glasses?

GHW_Chronic 02-25-2006 22:00

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.

Dizzy 02-25-2006 22:27

Thanks GHW :)

c0rdawg 02-25-2006 23:34

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)

Kraugh 02-26-2006 00:31

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);

VEN 02-26-2006 14:31

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.

Des12 02-26-2006 16:17

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?

Kraugh 02-26-2006 16:50

yes, unless another ScreenFade message is sent from somewhere else.


All times are GMT -4. The time now is 20:19.

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