AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Removing FadeScreen (https://forums.alliedmods.net/showthread.php?t=196137)

malec321 09-15-2012 22:17

Removing FadeScreen
 
Okay guys need help really quick! :D


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! :)

Napoleon_be 09-15-2012 22:22

Re: Removing FadeScreen
 
Try out your guess, it might work.

claudiuhks 09-15-2012 23:16

Re: Removing FadeScreen
 
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 )
*/ 


malec321 09-15-2012 23:42

Re: Removing FadeScreen
 
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();


ConnorMcLeod 09-15-2012 23:52

Re: Removing FadeScreen
 
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.

malec321 09-16-2012 00:03

Re: Removing FadeScreen
 
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 );


Liverwiz 09-16-2012 00:09

Re: Removing FadeScreen
 
Quote:

Originally Posted by malec321 (Post 1800373)
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

ConnorMcLeod 09-16-2012 00:47

Re: Removing FadeScreen
 
Quote:

Originally Posted by Liverwiz (Post 1800377)
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.

Liverwiz 09-16-2012 08:21

Re: Removing FadeScreen
 
Quote:

Originally Posted by ConnorMcLeod (Post 1800393)
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!

ConnorMcLeod 09-16-2012 08:37

Re: Removing FadeScreen
 
Quote:

Originally Posted by Liverwiz (Post 1800562)
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.


All times are GMT -4. The time now is 08:21.

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