Raised This Month: $ Target: $400
 0% 

[REQ] cs flashbangs- all players dissapear no white screen


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-14-2011 , 01:23   Re: [REQ] cs flashbangs- all players dissapear no white screen
Reply With Quote #2

Nice idea.
Try the following code, if it works as expected and if you can install hamsandwich UPDATED module, i can simplfy the code a bit to be more efficient.

PHP Code:
/*    Formatright @ 2011, ConnorMcLeod

    This plugin is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this plugin; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"
#define PLUGIN "Flash Disappear Players"

const XO_PLAYER 5
const m_flFlashedUntil 514
const m_flFlashedAt 515
const m_flFlashHoldTime 516
const m_flFlashDuration 517
const m_iFlashAlpha 518

const ALPHA_FULLBLINDED 255

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_forward(FM_AddToFullPack"AddToFullPack_Post"1)
    
register_message(get_user_msgid("ScreenFade"), "Message_ScreenFade")
}

public 
Message_ScreenFade()
{
    if(    
get_msg_arg_int(4) == 255
    
&&    get_msg_arg_int(5) == 255
    
&&    get_msg_arg_int(6) == 255
    
&&    get_msg_arg_int(7) > 199    )
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
AddToFullPack_Post(eseiEntidhostflagsplayerpSet)
{
    if( 
player && id != iEnt && get_orig_retval() && is_user_alive(id) )
    {
        static 
iFlashiPercent
        iFlash 
get_user_flashed(idiPercent)
        if( 
iPercent )
        {
            
set_es(esES_RenderModekRenderTransAlpha)
            
set_es(esES_RenderAmt255 - (iFlash iPercent) / 100)
        }
    }
}

get_user_flashed(id, &iPercent=0)
{
    new 
Float:flFlashedAt get_pdata_float(idm_flFlashedAtXO_PLAYER)

    if( !
flFlashedAt )
    {
        return 
0
    
}

    new 
Float:flGameTime get_gametime()
    new 
Float:flTimeLeft flGameTime flFlashedAt
    
new Float:flFlashDuration get_pdata_float(idm_flFlashDurationXO_PLAYER)
    new 
Float:flFlashHoldTime get_pdata_float(idm_flFlashHoldTimeXO_PLAYER)
    new 
Float:flTotalTime flFlashHoldTime flFlashDuration

    
if( flTimeLeft flTotalTime )
    {
        return 
0
    
}

    new 
iFlashAlpha get_pdata_int(idm_iFlashAlphaXO_PLAYER)

    if( 
iFlashAlpha == ALPHA_FULLBLINDED )
    {
        if( 
get_pdata_float(idm_flFlashedUntilXO_PLAYER) - flGameTime 0.0 )
        {
            
iPercent 100
        
}
        else
        {
            
iPercent 100-floatround(((flGameTime - (flFlashedAt flFlashHoldTime))*100.0)/flFlashDuration)
        }
    }
    else
    {
        
iPercent 100-floatround(((flGameTime flFlashedAt)*100.0)/flTotalTime)
    }

    return 
iFlashAlpha

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 12-14-2011 at 01:24.
ConnorMcLeod is offline
 



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 00:26.


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