Raised This Month: $170 Target: $400
 42% 

Don't get flashed when not looking at the flashbang


Post New Thread Reply   
 
Thread Tools Display Modes
sekac
Senior Member
Join Date: Nov 2016
Old 06-15-2018 , 15:03   Re: Don't get flashed when not looking at the flashbang
Reply With Quote #11

That works fine, but can you make the flash effect shorter and not more transparent?
sekac is offline
sekac
Senior Member
Join Date: Nov 2016
Old 06-15-2018 , 15:10   Re: Don't get flashed when not looking at the flashbang
Reply With Quote #12

Wait, why can't we just reduce the duration of the effect by some X?
Like write_short(read_data(1) - X);
sekac is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-15-2018 , 15:41   Re: Don't get flashed when not looking at the flashbang
Reply With Quote #13

We can. No one said we can't, you asked that it is more transparent, so i made it transparent

Also you probably don't want to subtract, you wan't to divide it by X.
__________________
stuff

Last edited by maqi; 06-15-2018 at 15:42.
maqi is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-15-2018 , 15:47   Re: Don't get flashed when not looking at the flashbang
Reply With Quote #14

Here you go, with some new cvars, so you can adjust it as you like ( 1.0 = Normal, 0.5 = Half the time, 2.0 = Twice the time )

flash_alpha 199
flash_duration_multiplier 0,5
flash_hold_multiplier 0.5

PHP Code:
#include <amxmodx>
#include <amxmisc>

#include <engine>
#include <fakemeta>
#include <fakemeta_util>

#pragma semicolon 1

new const    plugin[]        =    "Advanced Flash",
        
version[]        =    "2.1a",
        
author[]        =    "maqi";
        
#define MAX_PLAYERS 32

new     g_Msg_ScreenFade,
    
g_iLastGrenade;
    
new    
g_Cvar_Alpha,
    
g_Cvar_Duration,
    
g_Cvar_Hold;

public 
plugin_init( )
{
    
register_pluginpluginversionauthor );
    
    
register_forwardFM_SetModel"Fw_SetModel" );
    
    
register_event"ScreenFade","Event_Flash","be","1>0","2>0","3=0","4=255","5=255","6=255","7>199" );
        
    
g_Msg_ScreenFade get_user_msgid"ScreenFade" );
}

public 
plugin_precache( )
{
    
g_Cvar_Alpha register_cvar"flash_alpha""199" );
    
g_Cvar_Duration register_cvar"flash_duration_multiplier""0,5" );
    
g_Cvar_Hold register_cvar"flash_hold_multiplier""0.5" );
}

public 
Fw_SetModeliEnt, const sModel[] )
{
    if( !
pev_valid(iEnt) )
        return 
FMRES_IGNORED;
        
    if( !
equal(sModel"models/w_flashbang.mdl" ) )
        return 
FMRES_IGNORED;
    
    
g_iLastGrenade iEnt;

    return 
FMRES_IGNORED;
}
 
 public 
Event_FlashiIndex )
{
    if( !
pev_valid(g_iLastGrenade) ) 
        return;
    
    new 
Float:fOrigins[3]; pevg_iLastGrenadepev_originfOrigins );
        
    if( 
is_in_viewconeiIndexfOrigins) && fm_is_ent_visibleiIndexg_iLastGrenade ) ) 
        return;
    
    new 
Aplha     get_pcvar_num(g_Cvar_Alpha);
    new 
Duration     floatround(read_data(1) * get_pcvar_float(g_Cvar_Duration));
    new 
Hold    floatround(read_data(2) * get_pcvar_float(g_Cvar_Hold));
    
    
message_beginMSG_ONEg_Msg_ScreenFade_iIndex );
    
write_short(Duration);
    
write_short(Hold);
    
write_short(read_data(3));
    
write_byte(255);
    
write_byte(255);
    
write_byte(255);
    
write_byte(Aplha);
    
message_end();        

__________________
stuff
maqi is offline
sekac
Senior Member
Join Date: Nov 2016
Old 06-15-2018 , 16:12   Re: Don't get flashed when not looking at the flashbang
Reply With Quote #15

Thanks! What is the difference between duration and hold?
sekac is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-15-2018 , 16:24   Re: Don't get flashed when not looking at the flashbang
Reply With Quote #16

You want to play around with it and see, I can't really explain it well. For what you need, id suggest playing around with the hold primarily. Cheers
__________________
stuff
maqi is offline
Reply


Thread Tools
Display Modes

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 15:17.


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