Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-15-2011 , 12:26   Re: [REQ] cs flashbangs- all players dissapear no white screen
Reply With Quote #1

Try :

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>
#include <hamsandwich>

#define VERSION "0.1.0"
#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 MAX_PLAYERS 32

const ALPHA_FULLBLINDED 255

new g_bitFlashedPlayers
#define MarkPlayerFlashed(%0)        g_bitFlashedPlayers |= 1<<(%0&31)
#define ClearPlayerFlashed(%0)    g_bitFlashedPlayers &= ~(1<<(%0&31))
#define IsPlayerFlashed(%0)        g_bitFlashedPlayers & 1<<(%0&31)

enum mFlashDatas
{
    
Float:_flFlashedUntil,
    
Float:_flFlashedAt,
    
Float:_flFlashHoldTime,
    
Float:_flFlashDuration,
    
_iFlashAlpha
}

new 
g_iPlayerFlashDatas[MAX_PLAYERS+1][mFlashDatas]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_message(get_user_msgid("ScreenFade"), "Message_ScreenFade")
    
RegisterHam(Ham_CS_Player_Blind"player""CBasePlayer_Blind_Post"1)
}

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 
CBasePlayer_Blind_Post(id)
{
    
g_iPlayerFlashDatas[id][_flFlashedUntil] = _:get_pdata_float(idm_flFlashedUntilXO_PLAYER)
    
g_iPlayerFlashDatas[id][_flFlashedAt] = _:get_pdata_float(idm_flFlashedAtXO_PLAYER)
    
g_iPlayerFlashDatas[id][_flFlashHoldTime] = _:get_pdata_float(idm_flFlashHoldTimeXO_PLAYER)
    
g_iPlayerFlashDatas[id][_flFlashDuration] = _:get_pdata_float(idm_flFlashDurationXO_PLAYER)
    
g_iPlayerFlashDatas[id][_iFlashAlpha] = get_pdata_int(idm_iFlashAlphaXO_PLAYER)
    
MarkPlayerFlashed(id)
    
CheckForward()
}

public 
client_disconnect(id)
{
    
ClearPlayerFlashedid )
    
CheckForward()
}

public 
client_connect(id)
{
    
ClearPlayerFlashedid )
    
CheckForward()
}

CheckForward()
{
    static 
_AddToFullPack
    
if( g_bitFlashedPlayers )
    {
        if( !
_AddToFullPack )
        {
            
_AddToFullPack register_forward(FM_AddToFullPack"AddToFullPack_Post"1)
        }
    }
    else if( 
_AddToFullPack )
    {
        
unregister_forward(FM_AddToFullPack_AddToFullPack1)
        
_AddToFullPack 0
    
}
}

public 
AddToFullPack_Post(eseiEntidhostflagsplayerpSet)
{
    if( 
player /*&& id != iEnt */&& IsPlayerFlashed(id) && get_orig_retval() && is_user_alive(id) )
    {
        static 
iFlashiPercent
        iFlash 
get_user_flashed(idiPercent)
        if( 
iPercent )
        {
            if( 
id == iEnt )
            {
                static 
r
                r 
= (iPercent 255) / 100
                set_hudmessage
(r255-r00.950.7500.00010.10.00010.0001, -1)
                
show_hudmessage(id"Flash : %d%%"iPercent)
            }
            else
            {
                
set_es(esES_RenderModekRenderTransAlpha)
                
set_es(esES_RenderAmt255 - (iFlash iPercent) / 100)
            }
        }
        else
        {
            
ClearPlayerFlashedid )
            
CheckForward()
        }
    }
}

get_user_flashed(id, &iPercent=0)
{
    new 
Float:flFlashedAt g_iPlayerFlashDatas[id][_flFlashedAt]

    if( !
flFlashedAt )
    {
        return 
0
    
}

    new 
Float:flGameTime get_gametime()
    new 
Float:flTimeLeft flGameTime flFlashedAt
    
new Float:flFlashDuration g_iPlayerFlashDatas[id][_flFlashDuration]
    new 
Float:flFlashHoldTime g_iPlayerFlashDatas[id][_flFlashHoldTime]
    new 
Float:flTotalTime flFlashHoldTime flFlashDuration

    
if( flTimeLeft flTotalTime )
    {
        return 
0
    
}

    new 
iFlashAlpha g_iPlayerFlashDatas[id][_iFlashAlpha]

    if( 
iFlashAlpha == ALPHA_FULLBLINDED )
    {
        if( 
g_iPlayerFlashDatas[id][_flFlashedUntil] - 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 -
ConnorMcLeod is offline
csykosoma
Member
Join Date: Dec 2011
Old 12-15-2011 , 17:52   Re: [REQ] cs flashbangs- all players dissapear no white screen
Reply With Quote #2

this version is near flawless.

the new flash meter has a problem when you die while flashed. the next round the flash meter is stuck on the percent you had at death and when you get flashed the new message will overlap on the old stuck message so you cannot read the percent.


otherwise, this plugin is perfect and all my players are really enjoying it.

edit: this is more of a minor adjustment, when you are about 30-50% flashed you can see the other players. i notice that the flash meter turns green at a very low percent. maybe 1-49% green, 50-99% orange, 100 red.

Last edited by csykosoma; 12-15-2011 at 18:05.
csykosoma is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-15-2011 , 18:06   Re: [REQ] cs flashbangs- all players dissapear no white screen
Reply With Quote #3

Try
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>
#include <hamsandwich>

#define VERSION "0.1.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 MAX_PLAYERS 32

const ALPHA_FULLBLINDED 255

new g_bitFlashedPlayers
#define MarkPlayerFlashed(%0)        g_bitFlashedPlayers |= 1<<(%0&31)
#define ClearPlayerFlashed(%0)    g_bitFlashedPlayers &= ~(1<<(%0&31))
#define IsPlayerFlashed(%0)        g_bitFlashedPlayers & 1<<(%0&31)

enum mFlashDatas
{
    
Float:_flFlashedUntil,
    
Float:_flFlashedAt,
    
Float:_flFlashHoldTime,
    
Float:_flFlashDuration,
    
_iFlashAlpha
}

new 
g_iPlayerFlashDatas[MAX_PLAYERS+1][mFlashDatas]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_message(get_user_msgid("ScreenFade"), "Message_ScreenFade")
    
RegisterHam(Ham_CS_Player_Blind"player""CBasePlayer_Blind_Post"1)
    
RegisterHam(Ham_Killed"player""CBasePlayer_Killed_Post"true)
}

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 
CBasePlayer_Blind_Post(id)
{
    
g_iPlayerFlashDatas[id][_flFlashedUntil] = _:get_pdata_float(idm_flFlashedUntilXO_PLAYER)
    
g_iPlayerFlashDatas[id][_flFlashedAt] = _:get_pdata_float(idm_flFlashedAtXO_PLAYER)
    
g_iPlayerFlashDatas[id][_flFlashHoldTime] = _:get_pdata_float(idm_flFlashHoldTimeXO_PLAYER)
    
g_iPlayerFlashDatas[id][_flFlashDuration] = _:get_pdata_float(idm_flFlashDurationXO_PLAYER)
    
g_iPlayerFlashDatas[id][_iFlashAlpha] = get_pdata_int(idm_iFlashAlphaXO_PLAYER)
    
MarkPlayerFlashed(id)
    
CheckForward()
}

public 
client_disconnect(id)
{
    
ClearPlayerFlashedid )
    
CheckForward()
}

public 
client_connect(id)
{
    
ClearPlayerFlashedid )
    
CheckForward()
}

public 
CBasePlayer_Killed_Postid )
{
    
ClearPlayerFlashedid )
    
CheckForward()
}

CheckForward()
{
    static 
_AddToFullPack
    
if( g_bitFlashedPlayers )
    {
        if( !
_AddToFullPack )
        {
            
_AddToFullPack register_forward(FM_AddToFullPack"AddToFullPack_Post"1)
        }
    }
    else if( 
_AddToFullPack )
    {
        
unregister_forward(FM_AddToFullPack_AddToFullPack1)
        
_AddToFullPack 0
    
}
}

public 
AddToFullPack_Post(eseiEntidhostflagsplayerpSet)
{
    if( 
player /*&& id != iEnt */&& IsPlayerFlashed(id) && get_orig_retval() && is_user_alive(id) )
    {
        static 
iFlashiPercent
        iFlash 
get_user_flashed(idiPercent)
        if( 
iPercent )
        {
            if( 
id == iEnt )
            {
                static 
r
                r 
= (iPercent 255) / 100
                set_hudmessage
(r255-r00.950.7500.00010.10.00010.0001, -1)
                
show_hudmessage(id"Flash : %d%%"iPercent)
            }
            else
            {
                
set_es(esES_RenderModekRenderTransAlpha)
                
set_es(esES_RenderAmt255 - (iFlash iPercent) / 100)
            }
        }
        else
        {
            
ClearPlayerFlashedid )
            
CheckForward()
        }
    }
}

get_user_flashed(id, &iPercent=0)
{
    new 
Float:flFlashedAt g_iPlayerFlashDatas[id][_flFlashedAt]

    if( !
flFlashedAt )
    {
        return 
0
    
}

    new 
Float:flGameTime get_gametime()
    new 
Float:flTimeLeft flGameTime flFlashedAt
    
new Float:flFlashDuration g_iPlayerFlashDatas[id][_flFlashDuration]
    new 
Float:flFlashHoldTime g_iPlayerFlashDatas[id][_flFlashHoldTime]
    new 
Float:flTotalTime flFlashHoldTime flFlashDuration

    
if( flTimeLeft flTotalTime )
    {
        return 
0
    
}

    new 
iFlashAlpha g_iPlayerFlashDatas[id][_iFlashAlpha]

    if( 
iFlashAlpha == ALPHA_FULLBLINDED )
    {
        if( 
g_iPlayerFlashDatas[id][_flFlashedUntil] - 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 -
ConnorMcLeod is offline
Lolz0r
Veteran Member
Join Date: Nov 2010
Location: Balgaria
Old 02-08-2012 , 19:27   Re: [REQ] cs flashbangs- all players dissapear no white screen
Reply With Quote #4

Connor, plugin can not compile:



Fix it, please!

Last edited by Lolz0r; 02-08-2012 at 19:27.
Lolz0r is offline
Reply



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