Raised This Month: $ Target: $400
 0% 

ScreenFade And How to Control it!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 02-27-2005 , 21:25   Re: ScreenFade And How to Control it!
Reply With Quote #4

Quote:
Originally Posted by TotalNoobScripter
... and instead of a number why is it 1<<2 ?
1<<2 is basically 4, so you could just put the number 4 there...

That is called bit-shifting, and the math is basically:

1<<X

1 * 2 ^ X
or
1 * 2 to the power of X

Example:

1<<3
1 * 2 ^ 3
1 * 2 * 2 * 2
= 8


Also, I have been working on the ScreenFade myself for a new plugin Im making, I wrote this bit of code to test the different uses of the screenfade:
Code:
#include <amxmodx> public plugin_init() {     register_clcmd( "amx_fade", "DoFade" ) } public DoFade( id ) {     new iArgs[7] = { 9000, 1000, 5, 0, 0, 0, 255 }     if( read_argc() > 1 )     {         new szArgs[7][5]         for( new i = 0; i < 7; i++ )         {             read_argv( (i+1), szArgs[i], 4 )             iArgs[i] = str_to_num( szArgs[i] )         }     }     UAIO_FadeScreen( id, iArgs )     return PLUGIN_HANDLED } stock UAIO_FadeScreen( iUser, iArgs[] ) {     message_begin( MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, iUser )     write_short( iArgs[0] )     // Fade Time     write_short( iArgs[1] )     // Fade Hold     write_short( iArgs[2] )     // Fade Type (in/out)     write_byte ( iArgs[3] )     // Red     write_byte ( iArgs[4] )     // Green     write_byte ( iArgs[5] )     // Blue     write_byte ( iArgs[6] )     // Alpha     message_end()     return }

Its usage is simple:
amx_fade <time> <hold> <type> <r> <g> [b] <a>

A good example would be:
Fade Into Black: 9000 1000 5 0 0 0 255
Fade Back Out: 9000 1000 2 0 0 0 255

The 9000 gives it a nice long fade time, but in my experiments, anything over 9999 gave a shorter fade time.. weird...

Also, I was trying to make one command do the same as both, Fade in, Hold fade, then Fade out... But it seems you have to Fade in, Hold and then Fade back out on your own..
xeroblood is offline
Send a message via MSN to xeroblood
 



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 14:07.


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