Raised This Month: $ Target: $400
 0% 

flashing through wall


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
padilha007
Senior Member
Join Date: Jul 2008
Old 01-01-2009 , 01:48   flashing through wall
Reply With Quote #1

Is possible make flash granade with this event?
__________________

padilha007 is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 01-01-2009 , 09:21   Re: flashing through wall
Reply With Quote #2

Exaplain a bit more what do you want to do.
__________________

anakin_cstrike is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 01-01-2009 , 09:33   Re: flashing through wall
Reply With Quote #3

I want to make a wall that does not prevent the light from the flash bang stop. Only a blind person even if he is behind the wall.

__________________

padilha007 is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 01-01-2009 , 18:20   Re: flashing through wall
Reply With Quote #4

Ya you could, what you would probably do is as the

RegisterHam(Ham_Think,"grenade","hGernadeThin k",0);

Then, get the entity of the flash nades origin, pev_origin, then, for each person in the server get their radius, subtract it, if their within the radius, turn their screen white, you will probabaly have to do some math to detect deepening on fair. Look at the HL SDK, I mean this is how I would do it, I might be going over board lol.
Styles is offline
Send a message via AIM to Styles
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-01-2009 , 18:31   Re: flashing through wall
Reply With Quote #5

Or, make the wall entity SOLID_NOT when the flash goes off, then add a 0.1 second delay for the entity to be SOLID_BBOX.
Only problem with that is that players would get stuck if they were running against it while the flash went off.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 01-01-2009 , 19:34   Re: flashing through wall
Reply With Quote #6

Quote:
Originally Posted by Exolent[jNr] View Post
Or, make the wall entity SOLID_NOT when the flash goes off, then add a 0.1 second delay for the entity to be SOLID_BBOX.
Only problem with that is that players would get stuck if they were running against it while the flash went off.
But that wouldn't work if he wanted it to go through a main game map
Styles is offline
Send a message via AIM to Styles
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-01-2009 , 22:42   Re: flashing through wall
Reply With Quote #7

This plugin allows flashbang effects to work as if there are no walls between you and the flashbang.
There is only one problem. It doesn't make it partial alpha if you aren't looking at it.

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

// From testing, I got these results:
// 
// Max distance was ~1460
// Max duration was 12
// 
// Duration -    max / (max - distance)
// HoldTime -    1 ( in register_message(), holdtime is not 1, but it is in register_event() )
// Flags -    0
// Red -    255
// Green -    255
// Blue -    255
// Alpha -    255 (200 if angle of aim is 90 degrees or more away from the flashbang)

#define seconds_to_units(%1) (%1 * (1<<12))

#define MAX_DISTANCE        1460
#define MAX_DURATION        12

#define FLASH_HOLDTIME_FAKE    1
#define FLASH_FLAGS        0
#define FLASH_RED        255
#define FLASH_GREEN        255
#define FLASH_BLUE        255
#define FLASH_ALPHA1        200
#define FLASH_ALPHA2        255

new bool:g_allow_flashbang[33];
new 
g_flash_distance[33];

new 
ScreenFade;

new 
g_max_clients;

public 
plugin_init()
{
    
register_plugin("Flashbang Through Walls""0.1""Exolent");
    
    
RegisterHam(Ham_Think"grenade""FwdGrenadeThink");
    
    
register_message((ScreenFade get_user_msgid("ScreenFade")), "MessageScreenFade");
    
    
g_max_clients get_maxplayers();
}

public 
client_connect(client)
{
    
g_allow_flashbang[client] = false;
}

public 
FwdGrenadeThink(ent)
{
    
// HamSandwich should provide valid entities
    // but I wanna be safe
    
if( !pev_valid(ent) ) return;
    
    static 
Float:dmgtime;
    
pev(entpev_dmgtimedmgtime);
    
    if( 
dmgtime get_gametime() ) return;
    
    static 
model[32];
    
pev(entpev_modelmodelsizeof(model) - 1);
    
    if( 
containi(model"flashbang") == -) return; 
    
    
// make sure we only detect 1 explosion per flash
    
if( pev(entpev_bInDuck) ) return;
    
set_pev(entpev_bInDuck1);
    
    static 
Float:ent_origin[3];
    
pev(entpev_originent_origin);
    
    static 
aliveFloat:client_origin[3], Float:angles[3];
    for( new 
client 1client <= g_max_clientsclient++ )
    {
        if( !
is_user_connected(client) ) continue;
        
        if( 
is_user_alive(client) )
        {
            
alive client;
        }
        else
        {
            
alive pev(clientpev_iuser1);
            if( !
is_user_alive(alive) )
            {
                
alive client;
            }
        }
        
        
engfunc(EngFunc_GetBonePositionalive8client_originangles);
        
        
g_flash_distance[client] = min(floatround(get_distance_f(ent_originclient_origin) / 10.0floatround_ceil) * 10MAX_DISTANCE);
        
        
// 0.1 is the delay I found between the explosion and blinding
        
set_task(0.1"TaskDoFlashbang"client);
    }
}

public 
MessageScreenFade(msgiddestclient)
{
    if( !(
<= client <= g_max_clients)
    || 
get_msg_arg_int(3) != FLASH_FLAGS
    
|| get_msg_arg_int(4) != FLASH_RED
    
|| get_msg_arg_int(5) != FLASH_GREEN
    
|| get_msg_arg_int(6) != FLASH_BLUE )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    new 
alpha get_msg_arg_int(7);
    if( 
alpha != FLASH_ALPHA1 && alpha != FLASH_ALPHA2 ) return PLUGIN_CONTINUE;
    
    if( 
g_allow_flashbang[client] )
    {
        
g_allow_flashbang[client] = false;
        return 
PLUGIN_CONTINUE;
    }
    
    return 
PLUGIN_HANDLED;
}

public 
TaskDoFlashbang(client)
{
    new 
duration seconds_to_units(floatround(float(MAX_DISTANCE g_flash_distance[client]) / float(MAX_DISTANCE) * MAX_DURATION));
    
    
g_allow_flashbang[client] = true;
    
    
emessage_begin(MSG_ONEScreenFade_client);
    
ewrite_short(duration);
    
ewrite_short(FLASH_HOLDTIME_FAKE);
    
ewrite_short(FLASH_FLAGS);
    
ewrite_byte(FLASH_RED);
    
ewrite_byte(FLASH_GREEN);
    
ewrite_byte(FLASH_BLUE);
    
ewrite_byte(FLASH_ALPHA2); // TODO: Add support for 200 alpha (FLASH_ALPHA1)
    
emessage_end();

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 01-02-2009 at 00:08.
Exolent[jNr] is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 01-01-2009 , 21:18   Re: flashing through wall
Reply With Quote #8

someone can give my a exemple?
__________________

padilha007 is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 01-02-2009 , 10:04   Re: flashing through wall
Reply With Quote #9

works perfect, i can use no_flash_team with this plugin?

+K
__________________

padilha007 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-02-2009 , 10:05   Re: flashing through wall
Reply With Quote #10

Yes, because it sends a flashbang event that can be caught by other plugins.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 09:04.


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