Raised This Month: $ Target: $400
 0% 

Removing FadeScreen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
malec321
Senior Member
Join Date: May 2009
Location: Los Angeles
Old 09-15-2012 , 22:17   Removing FadeScreen
Reply With Quote #1

Okay guys need help really quick!


Code:
public BlindUser(id){
    message_begin(MSG_ONE,g_msg_screen_fade,{0,0,0},id);
    write_short( 1<<15 );
    write_short( 1<<10 );
    write_short( 1<<12 );
    write_byte( 0 );
    write_byte( 0 );
    write_byte( 0 );
    write_byte( 255 );
    message_end();
}
If that fades somebody, how can I make a lets say: public UnBlindUser(id)

Don't make fun of me but I'm gonna throw out a guess:

Code:
    message_begin(MSG_ONE,g_msg_screen_fade,{255,255,255},id);
    write_short( 1<<15 );
    write_short( 1<<10 );
    write_short( 1<<12 );
    write_byte( 0 );
    write_byte( 0 );
    write_byte( 0 );
    write_byte( 255 );
    message_end();
Anyway thanks in regards!
__________________
Ayyylmao
malec321 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 09-15-2012 , 22:22   Re: Removing FadeScreen
Reply With Quote #2

Try out your guess, it might work.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 09-15-2012 , 23:16   Re: Removing FadeScreen
Reply With Quote #3

PHP Code:
#include < amxmodx >
#include < fakemeta >
 
#define ONE_SECOND ( 1 << 12 ) /* 4096 */
 
#define FADE_PERMANENTLY 0x0004 /* 4 */
#define FADE_TEMPORARY 0x0001 /* 1 */
 
#define MEM_ALLOCATED 2
 
enum {
  
Blind_Permanently/* 0 */
  
Unblind/* 1 */
  
Blind_Temporary /* 2 */
};
 
new 
gRgGgBgA 255;
 
boolSendScreenFadeiReceiveriTypeiTime ONE_SECOND ) {
    static 
iScreenFade;
 
    if( !
iScreenFade )
        
iScreenFade get_user_msgid"ScreenFade" );
 
    if( !
iScreenFade || pev_validiReceiver ) != MEM_ALLOCATED /* Object's memory is still allocated! */
        
return false;
 
    
message_beginMSG_ONE_UNRELIABLEiScreenFade_iReceiver );
 
    if( 
iType == Blind_Permanently || iType == Unblind ) {
        
write_short);
        
write_short);
 
        
write_shortiType == Unblind FADE_TEMPORARY FADE_PERMANENTLY );
    }
 
    else if( 
iType == Blind_Temporary ) {
        
write_shortiTime );
        
write_shortiTime );
 
        
write_shortFADE_TEMPORARY );
    }
 
    
write_bytegR );
    
write_bytegG );
    
write_bytegB );
 
    
write_bytegA );
 
    
message_end( );
 
    return 
true;
}
 
SetColor/* red *//* green *//* blue *//* alpha [ blind's intensity ] */ ) {
  
gR clampR0255 ), gG clampG0255 ), gB clampB0255 ), gA clampA0255 );
}
 
/*
  To blind: SendScreenFade( iTarget, Blind_Temporary, ONE_SECOND * 0.2 )
  To blind permanently: SendScreenFade( iTarget, Blind_Permanently )
  To unblind: SendScreenFade( iTarget, Unblind )
  To change blind color: SetColor( 255, 0, 0, 255 )
*/ 
__________________

Last edited by claudiuhks; 09-17-2012 at 16:07.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
malec321
Senior Member
Join Date: May 2009
Location: Los Angeles
Old 09-15-2012 , 23:42   Re: Removing FadeScreen
Reply With Quote #4

Thanks for the replies, but not exactly what I'm looking for :S

Code:
      message_begin(MSG_ONE, g_msg_screen_fade, {0, 0, 0}, id);
	write_short(20000);
	write_short(30000);	
	write_short(4096);	
	write_byte(0);
	write_byte(0);
	write_byte(0);
	write_byte(0);
	message_end();
I wan't this to set you blind (all black screen until I remove the task).

I figured out how to remove the task myself, but as of now this still leaves you with complete vision. Kinda worked backwards o_O

EDIT:
Using the original message_begin code, it gets you blind for like half a second and goes away, doesn't stay permanently until task removes it
Code:
  message_begin(MSG_ONE,g_msg_screen_fade,{0,0,0},id);
    write_short( 1<<15 );
    write_short( 1<<10 );
    write_short( 1<<12 );
    write_byte( 0 );
    write_byte( 0 );
    write_byte( 0 );
    write_byte( 255 );
    message_end();
__________________
Ayyylmao

Last edited by malec321; 09-15-2012 at 23:46.
malec321 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-15-2012 , 23:52   Re: Removing FadeScreen
Reply With Quote #5

PHP Code:
UnBlindid )
{
    
message_begin(MSG_ONE,g_msg_screen_fade,{0,0,0},id);
    
write_short);
    
write_short);
    
write_short);
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte);
    
message_end();

You could use this for easier use : http://forums.alliedmods.net/showthread.php?t=87623
In that case, to reset players screen just send UTIL_ScreenFade( id ) with no parameter.
And blind : UTIL_ScreenFade(id,{0,0,0}, 5.0, 7.0, 0, FFADE_STAYOUT).

Because actually the 3rd param you use in message_begin is completely wrong, should be 0 1, 2, 4 or addition of those values, not 4096 or any other value.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-15-2012 at 23:59.
ConnorMcLeod is offline
malec321
Senior Member
Join Date: May 2009
Location: Los Angeles
Old 09-16-2012 , 00:03   Re: Removing FadeScreen
Reply With Quote #6

I got it to work guys! thanks for any help

Just one thing.. Can anyone tell me what these write shorts mean?
Code:
    write_short( 1<<15 );
    write_short( 1<<10 );
    write_short( 1<<12 );
__________________
Ayyylmao
malec321 is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-16-2012 , 00:09   Re: Removing FadeScreen
Reply With Quote #7

Quote:
Originally Posted by malec321 View Post
I got it to work guys! thanks for any help

Just one thing.. Can anyone tell me what these write shorts mean?
Code:
    write_short( 1<<15 );
    write_short( 1<<10 );
    write_short( 1<<12 );
This tells you everything you need to know about screen fade.
And the basic function of messages.

http://forums.alliedmods.net/showthread.php?t=49828
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-16-2012 , 00:47   Re: Removing FadeScreen
Reply With Quote #8

Quote:
Originally Posted by Liverwiz View Post
This tells you everything you need to know about screen fade.
And the basic function of messages.

http://forums.alliedmods.net/showthread.php?t=49828
Bad example, 3rd arg is false, as said above, should be 0, 1, 2, 4, or those bits combinaisons.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-16-2012 , 08:21   Re: Removing FadeScreen
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
Bad example, 3rd arg is false, as said above, should be 0, 1, 2, 4, or those bits combinaisons.
Then i believe the tutorial should be updated to contain true information!
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-16-2012 , 08:37   Re: Removing FadeScreen
Reply With Quote #10

Quote:
Originally Posted by Liverwiz View Post
Then i believe the tutorial should be updated to contain true information!
Also 1<<300 doesn't exist...

I can't believe hawk wrote such a think, may be a fast copy/paste.
Edited with some explaination on ScreenFade message even if it's not the purpose of the tut.
__________________
- 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 08:21.


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