AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   FATAL ERROR User Msg 'ScreenFade' (https://forums.alliedmods.net/showthread.php?t=64894)

taheri6 12-26-2007 20:17

FATAL ERROR User Msg 'ScreenFade'
 
Hi Guys,

I got an interesting error that until recently I had never seen before. I ran it by a few guys who run game servers (not really coders) and they havent seen it before either.

I asked about it here several days ago and got a response about changing a value to 0 but that didnt help.

Here is the error message:
Code:

17:03:11 og L 12/26/2007 - 16:58:21: FATAL ERROR (shutting down): User Msg 'ScreenFade': 12 bytes written, expected 10
Here is my code - this is the only place in my code where this is called.
Code:

//This is global
new gmsgFade;

//This is set in plugin init
gmsgFade                = get_user_msgid ( "ScreenFade" );

//Seperate function
        message_begin( MSG_ONE, gmsgFade, { 0, 0, 0 }, id );
        write_short( 1<<10 ); // fade lasts this long duration
        write_short( 1<<10 ); // fade lasts this long hold time
        write_short( 1<<12 ); // fade type ( in / out )
        write_byte( 0 ); // fade red
        write_byte( 255 ); // fade green
        write_byte( 150 ); // fade blue
        write_byte( iglow[id][0] ); // fade alpha
        message_end( );

It has been recomended to change write_short( 1<<12 ); to 1<<10, even 0 but I would like to know why this occurs (beyond the obvious description in the error message. This is called in several places in other plugins code and has never crashed the server before, I am just wondering if perhaps I am doing something wrong somewhere.... ?

Arkshine 12-26-2007 20:56

Re: FATAL ERROR User Msg 'ScreenFade'
 
Quote:

write_short( 1<<12 ); // fade type ( in / out )
1<<12 ?? You're wrong.

Here the correct flag:

Quote:

FFADE_IN 0x0000 // Just here so we don't pass 0 into the function
FFADE_OUT 0x0001 // Fade out (not in)
FFADE_MODULATE 0x0002 // Modulate (don't blend)
FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received

Do something like:

Code:
    #define FFADE_IN   0x0000     #define FFADE_OUT  0x0001     // ...         message_begin( MSG_ONE, gmsgFade, _, id );     write_short( 1<<10 ); // fade lasts this long duration     write_short( 1<<10 ); // fade lasts this long hold time     write_short( FFADE_IN ); // fade type ( in / out )     write_byte( 0 );      // fade red     write_byte( 255 );    // fade green     write_byte( 150 );    // fade blue     write_byte( iglow[id][0] ); // fade alpha     message_end( );

taheri6 12-31-2007 15:46

Re: FATAL ERROR User Msg 'ScreenFade'
 
Thanks, I am in no way an expert in coding, but what does
write_short( 1<<12 )

Do in that case?


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

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