Raised This Month: $32 Target: $400
 8% 

Solved Anti flash VIP (team+enemy)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sanimare
Senior Member
Join Date: Sep 2010
Old 01-23-2018 , 06:08   Anti flash VIP (team+enemy)
Reply With Quote #1

Hi,

I need little help with this:

PHP Code:
// Внимание, это специальная редакция плагина, в которой не слепит только ВИП-игроков (от флешки тиммейтов).
// Обычная версия доступна здесь: https://vk.com/cs_rain?w=wall-68026790_684

/*
    // // // // //
    
    AntiFlash v5.0 FINAL by Leo_[BH]
    
    Описание плагина:
    Не слепит товарищей по команде от Flash-гранаты.
    Финальная стабильная версия плагина, исправлены все баги и недочёты предыдущих версий других авторов.

    // // // // //
    
    Давайте припустим такую ситуацию:
    1) Вас слепит противник
    2) Товарищ по команде кидает флеш-гранату, и при взрыве она оказывается в зоне вашего зрения.
    3) Вуаля, вы снова все видете!
    
    Так вот в данном плагине этот баг исправлен.
    И сделана небольшая оптимизация.
    
    // // // // //
    
    Автор плагина: Leo_[BH]
    
    В ходе создания плагина были использованы части кода:
    - AntiFlash by CrAsH
    - Zombie Plague by MeRcyLeZZ
    За что им большое спасибо.
    
    // // // // //
    
    Написание плагинов на заказ: http://vk.com/cs_rain
    
    // // // // //
*/

#include <amxmodx>
#include <fakemeta> 
#include <hamsandwich>

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

const PEV_NADE_TYPE pev_flTimeStepSound
const NADE_TYPE_FLASH 3333

new g_msgid_ScreenFade
new g_PlayerFlasher

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

public plugin_init()
{
    
register_plugin("AntiFlash FINAL VIP""5.0""Leo_[BH]")
    
    
g_msgid_ScreenFade get_user_msgid("ScreenFade")

    
register_message(g_msgid_ScreenFade"message_screenfade");

    
register_forward(FM_SetModel"fw_SetModel")
    
RegisterHam(Ham_Think"grenade""fw_ThinkGrenade")
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

public message_screenfade(msg_idmsg_destmsg_entity)
{
    if (
get_msg_arg_int(4) != 255 || get_msg_arg_int(5) != 255 || get_msg_arg_int(6) != 255 || get_msg_arg_int(7) < 200)
        return 
PLUGIN_CONTINUE;
    
    new 
id msg_entity
    
    
if (id != g_PlayerFlasher && get_user_team(id) == get_user_team(g_PlayerFlasher))
    {
        if(
get_user_flags(id) & ADMIN_LEVEL_H)
        {
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

public fw_SetModel(entityszModel[]) 
{
    if(!
equal(szModel"models/w_flashbang.mdl")) 
        return 
FMRES_IGNORED;
    
    
set_pev(entityPEV_NADE_TYPENADE_TYPE_FLASH)

    return 
FMRES_IGNORED;


public 
fw_ThinkGrenade(entity)
{
    if (!
pev_valid(entity)) return HAM_IGNORED;
    
    static 
Float:dmgtime
    pev
(entitypev_dmgtimedmgtime)
    
    if (
dmgtime get_gametime())
        return 
HAM_IGNORED;
    
    switch (
pev(entityPEV_NADE_TYPE))
    {
        case 
NADE_TYPE_FLASH// Flash Grenade
        
{
            
g_PlayerFlasher pev(entitypev_owner)
            return 
HAM_IGNORED;
        }
    }
    
    return 
HAM_IGNORED;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

// Написание плагинов на заказ: http://vk.com/cs_rain

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
I think it need to be changed this line:
if (id != g_PlayerFlasher && get_user_team(id) == get_user_team(g_PlayerFlasher))
I'm not sure, but I want this to work for team and enemy, and here its only type get_user_team so I tried to edit after == but not working.
This is plugin that antiflash VIP with flag "t" by teammates, but I need to work and when enemy team throw flash too.

Thank's!

Last edited by sanimare; 01-23-2018 at 15:26. Reason: solved
sanimare is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-23-2018 , 08:05   Re: Anti flash VIP (team+enemy)
Reply With Quote #2

replace whole message_screenfade() function with this:
PHP Code:
public message_screenfade(msg_idmsg_destid

    if (
get_msg_arg_int(4) != 255 || get_msg_arg_int(5) != 255 || get_msg_arg_int(6) != 255 || get_msg_arg_int(7) < 200
        return 
PLUGIN_CONTINUE;
     
    if(
get_user_flags(id) & ADMIN_LEVEL_H)
        return 
PLUGIN_HANDLED;
     
    return 
PLUGIN_CONTINUE

__________________
retired chump
DjSoftero is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 01-23-2018 , 12:24   Re: Anti flash VIP (team+enemy)
Reply With Quote #3

I replaced, compiled, and I got error:
warning 204: symbol is assigned a value that is never used: "g_PlayerFlasher"
When I remove it from the begin of code, that line I got new errors because there is in code PlayerFlasher:
g_PlayerFlasher = pev(entity, pev_owner)
Plugin is working. What should I do?

Thank you very much.

Last edited by sanimare; 01-23-2018 at 12:31. Reason: fix
sanimare is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-23-2018 , 12:30   Re: Anti flash VIP (team+enemy)
Reply With Quote #4

does the unedited plugin work in the first place?
__________________
retired chump
DjSoftero is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 01-23-2018 , 12:42   Re: Anti flash VIP (team+enemy)
Reply With Quote #5

Plugin is now working, I edited my post, just few errors If they can be fixed. Plugin is now no flashing player with flag "t" and he can't flash himself too, so he is resistant to flash in any way.
sanimare is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-23-2018 , 12:44   Re: Anti flash VIP (team+enemy)
Reply With Quote #6

try this:
Spoiler

and if it doesn't work, this:
Spoiler

Now i'm quite lost. Under what specific circumstances should the player be immune to flashbang? because right now player won't get flashed at all if he is vip. Do you want to resist flashbang if teamate flashed a non-vip player too?
__________________
retired chump

Last edited by DjSoftero; 01-23-2018 at 12:51.
DjSoftero is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 01-23-2018 , 13:07   Re: Anti flash VIP (team+enemy)
Reply With Quote #7

First code is working, I didn't check second, but in first I removed this "new g_msgid_ScreenFade" is that alright? Because there is an error when I compile for that - symbol is never used.
You can add too for resistant on team flash for player without vip flag.
sanimare is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-23-2018 , 13:21   Re: Anti flash VIP (team+enemy)
Reply With Quote #8

try this:
Spoiler
__________________
retired chump
DjSoftero is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 01-23-2018 , 13:37   Re: Anti flash VIP (team+enemy)
Reply With Quote #9

It's working how we mentioned. Thank's
When I add this plugin https://forums.alliedmods.net/showthread.php?t=15241 VIP players can be flashed again and player can be flashed too with this new plugin you just added.
Can you fix that too? because I want to use black flash, white is blinding me, im already almost blind so I want to make all black version, thank you very much for everything.
sanimare is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-23-2018 , 13:39   Re: Anti flash VIP (team+enemy)
Reply With Quote #10

delete this:
PHP Code:
if (get_msg_arg_int(4) != 255 || get_msg_arg_int(5) != 255 || get_msg_arg_int(6) != 255 || get_msg_arg_int(7) < 200
        return 
PLUGIN_CONTINUE 
it checks for white color
__________________
retired chump
DjSoftero 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 15:55.


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