Raised This Month: $ Target: $400
 0% 

Fade code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
infek
Senior Member
Join Date: May 2009
Location: Behind you
Old 07-01-2010 , 14:00   Re: Fade code
Reply With Quote #1

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 #2

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

- my plugins -
ConnorMcLeod 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