Raised This Month: $51 Target: $400
 12% 

black screen fade


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 06-18-2008 , 19:35   black screen fade
Reply With Quote #1

what is the script to fade a person screen black for 15 seconds?
whosyourdaddy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-18-2008 , 21:02   Re: black screen fade
Reply With Quote #2

What to add in plugin:
Code:
new g_MaxPlayers;
new g_msgScreenFade;

public plugin_init()
{
    g_MaxPlayers = get_maxplayers();
    g_msgScreenFade = get_user_msgid("ScreenFade");
}

make_ScreenFade(plr, Float:fDuration, red, green, blue, alpha)
{
	new i = plr ? plr : get_player();
	if( !i )
	{
		return 0;
	}
	
	message_begin(plr ? MSG_ONE : MSG_ALL, g_msgScreenFade, {0, 0, 0}, plr);
	write_short(floatround(4096.0 * fDuration, floatround_round));
	write_short(floatround(4096.0 * fDuration, floatround_round));
	write_short(4096);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	message_end();
	
	return 1;
}

get_player()
{
	for( new plr = 1; plr <= g_MaxPlayers; plr++ )
	{
		if( is_user_connected(plr) )
		{
			return plr;
		}
	}
	
	return 0;
}
How to use:
Code:
// plr is the player index
// fDuration is the time in seconds to be displayed
// red, green, and blue are the RGB colors for the final color
// alpha is the transparency of the color
Example:
Code:
public my_func(id)
{
    make_ScreenFade(id, 15.0, 0, 0, 0, 255);
}
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 06-19-2008 at 00:47. Reason: changed [pawn] to [code]
Exolent[jNr] is offline
Old 06-19-2008, 00:38
whosyourdaddy
This message has been deleted by whosyourdaddy.
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-19-2008 , 00:46   Re: black screen fade
Reply With Quote #3

Well, apparently, you can't copy my code correctly.
So, I'll change the tags to [code] tags.

And the id is the index that you are using in the plugin.
If you don't know how to use simple functions, I can't help you.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 06-19-2008 , 00:48   Re: black screen fade
Reply With Quote #4

lol sorry i kidna think i found out how to use it but can u make it [code] please, im just a little tired
whosyourdaddy is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 06-19-2008 , 01:37   Re: black screen fade
Reply With Quote #5

it works great thank you alot
whosyourdaddy is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 06-19-2008 , 03:09   Re: black screen fade
Reply With Quote #6

im kinda having a time issue im using this atm
Code:
make_ScreenFade(id, get_cvar_float("rules_hudmessage_time"), 0, 0, 0, 255);
and my rules_hudmessage_time is 35, i also tried switching it with 35.0 but the black screen seems to be workign only for 3 seconds and then it fades away

edited* i noticed u cant do more then 30 seconds so i thought i could do like a set_task but im not sure how to do it.. this is what im currently doing
Code:
public my_func(id)
{
  make_ScreenFade(id, 29.0, 0, 0, 0, 255);
      set_task(24, my_funcc(id))
 
}
 
public my_funcc(id)
{
  make_ScreenFade(id, 10.0, 0, 0, 0, 255);
 
}
but of course the set_task is wrong, how would i fix it

Last edited by whosyourdaddy; 06-19-2008 at 03:42.
whosyourdaddy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-19-2008 , 12:05   Re: black screen fade
Reply With Quote #7

Code:
public my_func(id)
{
    new Float:length = get_cvar_float("rules_hudmessage_time");
    /* you should convert this to pcvar */
    
    make_ScreenFade(id, length, 0, 0, 0, 255);
    set_task(length, "task_Blind", id);
}

public task_Blind(id)
{
    new Float:length = <your value here>;
    make_ScreenFade(id, length, 0, 0, 0, 255);
}
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 06-19-2008 , 14:11   Re: black screen fade
Reply With Quote #8

woot it works perfectly now, but is there a way to put something in it so it waits till the player is dead and then it does the screen fades?
whosyourdaddy is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 06-19-2008 , 14:13   Re: black screen fade
Reply With Quote #9

Quote:
till the player is dead and then it does the screen fades?
Your english is bad... maybe you want
Code:
mp_fadetoblack 1
?
Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 06-19-2008 , 14:15   Re: black screen fade
Reply With Quote #10

well what i doing is having a black screen pop up and then the rules for our server in a hud message but i want this to happen once the player dies, think you can write what i need to put in the script please.

mabye something like

if(!is_user_alive(id))
{
my_func(id)
}

or put like a set task on it so it will wait till the user dies or something and then does my function

Last edited by whosyourdaddy; 06-19-2008 at 14:36.
whosyourdaddy 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 06:20.


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