Raised This Month: $ Target: $400
 0% 

Catching flash


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 01-12-2013 , 06:45   Catching flash
Reply With Quote #1

I would like to catch and block the flash. I have found a way to hook ScreenFade, but I think this one from ham is much more reliable, though I couldn't get it to work or I am doing something wrong. Tried to hook it as post and as pre:

PHP Code:
RegisterHam(Ham_CS_Player_Blind"player""Player_Blind"0)

public 
Player_Blind(id)
{
    if(
is_user_alive(id))
    {
        
client_print(idprint_chat"Flashed")
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED

__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-12-2013 , 07:09   Re: Catching flash
Reply With Quote #2

Blind() is called from RadiusFlash(), at the end after all the stuffs done (Calculation/ScreenFade, etc.). What does Blind is to just to set some offsets to be used mainly for bots.

To block the flash, some random ideas :

- blocking RadiusFlash() with orpheu/rage ; the best/efficient way.
- grenade_throw() + check grenade type + blocking ScreenFade
- grenade_throw() + check grenade type + hooking FindEntityInSphere and returning 0 + unhooking

Though I say grenate_throw(), but would be better to be precise and hooking things when grenade is about to explode only, with pev_dmgtime.
__________________
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 01-12-2013 , 07:24   Re: Catching flash
Reply With Quote #3

Ok, that's stupid now...

So I will choose the most realiable way with Orpheu/Rage. I use both, but since I have no idea with both of them, but doing something with Orpheu is easier AFAIK, I will see what I can do with it.

Thanks.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-12-2013 , 07:37   Re: Catching flash
Reply With Quote #4

If you want to block for specific players, just block the ScreenFade message.
If you gonna block all flashes for a specific players you don't need to supercede Player_Blind, but if you want to block for example player A being flashed by player B, and then let player A being flashed by player C, then it is better to also supercede Player_Blind.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 01-12-2013 , 07:45   Re: Catching flash
Reply With Quote #5

Alright gonna use ScreenFade then. Btw, would Orpheu even work for this? Since the function contains vector:

Quote:
RadiusFlash( Vector vecSource, entvars_t* pGrenade, entvars_t *pevOwner, iDamage )
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-12-2013 , 07:48   Re: Catching flash
Reply With Quote #6

I don't see how orpheu could be usefull there.
If you want to prevent a player from using flash nades, just prevent him from buy some.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 01-12-2013 , 07:49   Re: Catching flash
Reply With Quote #7

I never said anything about buying.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-12-2013 , 07:55   Re: Catching flash
Reply With Quote #8

Connor is right, was not remembering clearly the Blind code. RadiusFlash will loop for all found players ; if the purpose is per-player, hooking this function seems pointless.
You should explain what you want really to do.
__________________

Last edited by Arkshine; 01-12-2013 at 07:56.
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 01-12-2013 , 09:19   Re: Catching flash
Reply With Quote #9

I just want to block the flash effect for individual players.
Searched again for ScreenFade. (http://forums.alliedmods.net/showpos...19&postcount=2)

PHP Code:
register_event("ScreenFade""EventFlashbang""b""4=255""5=255""6=255""7=200""7=255")

public 
EventFlashbang(id)
{
    
client_print(0print_chat"event flash")
    if(
is_user_alive(id))
    {
        
client_print(idprint_chat"block flash")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE

Both messages get called, but the flash is still there...
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-12-2013 , 09:45   Re: Catching flash
Reply With Quote #10

You have to use register_message() to hook an event as pre. register_event() hooks as post, so you can't block since the event has been already executed.
__________________

Last edited by Arkshine; 01-12-2013 at 09:45.
Arkshine 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 13:43.


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