Raised This Month: $ Target: $400
 0% 

Fade code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zombieplague
Veteran Member
Join Date: Apr 2009
Old 07-01-2010 , 09:02   Fade code
Reply With Quote #1

Anyone have the fading code ? is like flash bang style, I want it fade the player screen and it will return to normal in 5 second time
zombieplague is offline
infek
Senior Member
Join Date: May 2009
Location: Behind you
Old 07-01-2010 , 14:00   Re: Fade code
Reply With Quote #2

This is how wrecked helped me a while back so here you go
PHP Code:
/**
 * Sends screenfade message to a player
 *
 * @param id        Player index to screenfade
 * @param r       Red value in rgb format
 * @param g       Green value in rgb format
 * @param b          Blue value in rgb format
 * @param alpha     Fade alpha
 * @param holdtime  Float on how long to hold
 */
 
stock ScreenFade(idrgbalphaFloat:holdtime)
{
    new 
_holdtime floatround(holdtime 10.0),
        
duration  floatround(_holdtime 1.25);
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid"ScreenFade" ), { 00}, id);
    
write_short(1<<duration); // duration
    
write_short(1<<_holdtime); // holdtime
    
write_short(2);    // fade out
    
write_byte(r);
    
write_byte(g);
    
write_byte(b);
    
write_byte(alpha);
    
message_end();

Usage example:
Code:
ScreenFade( id, 255, 0, 0, 120, 10.0 )
That would make a screenfade (red, semi-transparent) for 10 seconds. The 6th parameter must be a float.
__________________
"Domo Arigato, Mr. Roboto!"
PM me if you want to know a secret
infek is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-01-2010 , 15:01   Re: Fade code
Reply With Quote #3

http://forums.alliedmods.net/showthread.php?t=87623
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
shuttle_wave
Veteran Member
Join Date: Apr 2009
Location: New Zealand
Old 07-02-2010 , 03:39   Re: Fade code
Reply With Quote #4

this is how i do my screen fade

PHP Code:
new g_msgScreenFade;

public 
plugin_init
{
     
//..........YOU THINGS THERE...........

      
g_msgScreenFade    get_user_msgid("ScreenFade");

}

// Sets screen to white, then fades out
ScreenFade(index)
{
    
message_begin(MSG_ONE_UNRELIABLEg_msgScreenFade, {000}, index);
    
write_short(floatround((1<<12) * 0.5));
    
write_short(floatround((1<<12) * 0.1));
    
write_short(1<<12);
    
write_byte(255);
    
write_byte(255);
    
write_byte(255);
    
write_byte(255);
    
message_end();
}


// JUST USE ScreenFade(id); to make a screen fade 
__________________
JailBreak Mod with Plugin API ( 90% ) Public
shuttle_wave is offline
Reply



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:47.


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