AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   screen fade (https://forums.alliedmods.net/showthread.php?t=213510)

Intouchable 04-15-2013 12:37

screen fade
 
On start round on player puts red screen.So before ending round if player gets other screen - green and when round starts disappears black screen. How to fix that on round stars always puts the black screen if in the end of round you get other screen?

hornet 04-15-2013 12:39

Re: screen fade
 
Show your code.

Intouchable 04-15-2013 12:53

Re: screen fade
 
PHP Code:

public hPlayerSpawn(id)
{
   new 
iDuration = (get_pcvar_num(cScreenTime) + get_pcvar_num(cFreezeTime)) - iScreenTimeiHoldTime
  
    
if(iScreenTime 0iHoldTime 0
    
else iHoldTime get_pcvar_num(cFreezeTime) + (get_pcvar_num(cScreenTime) / 2)
    
    
message_begin(MSG_ONEmsgScreenFade_id)
    
write_short(SPECIAL_UNIT iDuration// duration
    
write_short(SPECIAL_UNIT iHoldTime// hold time
    
write_short(FFADE_IN// flags
    
write_byte(0// color r
    
write_byte(0// color g
    
write_byte(0// color b
    
write_byte(255// alpha
    
message_end()



didoWEE 04-15-2013 13:43

Re: screen fade
 
We need more information, especially about cScreenTime, cFreezeTime and iScreenTime

Intouchable 04-15-2013 14:25

Re: screen fade
 
PHP Code:

(get_pcvar_num(cScreenTime) + get_pcvar_num(cFreezeTime)) - iScreenTime

cScreenTime   
=  register_cvar("creenfadetime""5")
cFreezeTime 1

iScreenTime 



didoWEE 04-15-2013 14:49

Re: screen fade
 
Can you explain again what's the problem, please. I didn't understand it.

BTW
cFreezeTime
= 1
why you use get_pcvar_num, it's not cvar.
Why you decrease the value with 0
iScreenTime = 0
(get_pcvar_num(cScreenTime) + get_pcvar_num(cFreezeTime)) - iScreenTime
Also you use ( ) for addition and subtraction, why ?

hornet 04-16-2013 01:02

Re: screen fade
 
Sorry, I fell asleep after I posted my first message.

Do you mean something like this?

Code:
#include <amxmodx> #include <hamsandwich> new g_msgScreenFade, bool:g_bGetBlackScreen[ 33 ]; public plugin_init() {     RegisterHam( Ham_Spawn, "player", "CBase_PlayerSpawn_Post", 1 );         register_logevent( "Event_RoundEnd", 2, "1=Round_End" );         g_msgScreenFade = get_user_msgid( "ScreenFade" );   } public CBase_PlayerSpawn_Post( id ) {     if( is_user_alive( id ) )     {         if( g_bGetBlackScreen[ id ] )         {             Message_ScreenFade( id, 0, 0, 1<<2, 0, 0, 0, 255 );             g_bGetBlackScreen[ id ] = false;         }         else    Message_ScreenFade( id, 6<<12, 0, 0, 255, 0, 0, 255 );      } } public Event_RoundEnd() {     new Players[ 32 ], iNum;     get_players( Players, iNum, "ach" );         for( new i ; i < iNum ; i ++ )     {         //if get green screen         {             Message_ScreenFade( Players[ i ], 6<<12, 0, 0, 0, 155, 0, 255 );             g_bGetBlackScreen[ Players[ i ] ] = true;         }     } } public Message_ScreenFade( id, iDuration, iHold, FadeMode, iRed, iGreen, iBlue, iAlpha ) {     message_begin( MSG_ONE_UNRELIABLE, g_msgScreenFade,{ 0, 0, 0 }, id );     write_short( iDuration );     write_short( iHold );     write_short( FadeMode );     write_byte( iRed );     write_byte( iGreen );     write_byte( iBlue );     write_byte( iAlpha );     message_end(); }

Intouchable 05-25-2013 00:37

Re: screen fade
 
sorry for writing too late but that doesn't work. I mean still bugging.

hornet 05-25-2013 03:52

Re: screen fade
 
Try explaining again. Shouldn't be anything wrong with the code provided - only flaw is the understanding of your question.


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

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