AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Catching flash (https://forums.alliedmods.net/showthread.php?t=205579)

bibu 01-12-2013 06:45

Catching flash
 
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



Arkshine 01-12-2013 07:09

Re: Catching flash
 
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.

bibu 01-12-2013 07:24

Re: Catching flash
 
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.

ConnorMcLeod 01-12-2013 07:37

Re: Catching flash
 
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.

bibu 01-12-2013 07:45

Re: Catching flash
 
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 )

ConnorMcLeod 01-12-2013 07:48

Re: Catching flash
 
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.

bibu 01-12-2013 07:49

Re: Catching flash
 
I never said anything about buying.

Arkshine 01-12-2013 07:55

Re: Catching flash
 
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.

bibu 01-12-2013 09:19

Re: Catching flash
 
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...

Arkshine 01-12-2013 09:45

Re: Catching flash
 
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.


All times are GMT -4. The time now is 13:44.

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