FM_PlaybackEvent for receiver

Сообщения
219
Реакции
42
I want to use FM_PlaybackEvent
Код:
(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2)
but NOT for invoker, only for receiver.

Because I need to set SUPERCEDE to block sound.
Is there any way?
 
Сообщения
673
Реакции
242
Помог
11 раз(а)
unfortunately I dropped the topic, maybe get some information


solve
 
Сообщения
219
Реакции
42
Well, looking at code. It seems that if invoker and receiver have different groupinfo, the playbackevent function will be stopped for receiver. I will test tomorrow.

Anyways, did you test if RH_SV_StartSound is called for weapon shoot sounds?
 
Последнее редактирование:
Сообщения
219
Реакции
42
It might be FEV_HOSTONLY and change invoker for every receiver in a loop that isn't mute
Well, this method not working.

Limbooc I found method. This seems to be working, changing groupinfo:
Код:
#include <amxmodx>
#include <fakemeta>

new g_iMaxPlayers;

new g_iPlayersDisable;
new g_iMuted[33];

new const g_guns_events[][] =
{
    "events/awp.sc",
    "events/g3sg1.sc",
    "events/ak47.sc",
    "events/scout.sc",
    "events/m249.sc",
    "events/m4a1.sc",
    "events/sg552.sc",
    "events/aug.sc",
    "events/sg550.sc",
    "events/m3.sc",
    "events/xm1014.sc",
    "events/usp.sc",
    "events/mac10.sc",
    "events/ump45.sc",
    "events/fiveseven.sc",
    "events/p90.sc",
    "events/deagle.sc",
    "events/p228.sc",
    "events/glock18.sc",
    "events/mp5n.sc",
    "events/tmp.sc",
    "events/elite_left.sc",
    "events/elite_right.sc",
    "events/galil.sc",
    "events/famas.sc"
};

new g_guns_eventids_bitsum , g_fwid;

public plugin_precache()
{
    g_fwid = register_forward( FM_PrecacheEvent , "fwPrecacheEvent" , 1 );
}

public fwPrecacheEvent( type , const name[] )
{
    for (new i = 0; i < sizeof g_guns_events; ++i)
    {
        if ( equal( g_guns_events[ i ] , name ) )
        {
            g_guns_eventids_bitsum |= ( 1 << get_orig_retval() );
            return FMRES_HANDLED;
        }
    }

    return FMRES_IGNORED;
}

public plugin_init() {
    register_plugin("Player Disable Fire Sound", "0.1", "RauliTop")

    register_clcmd("say /test", "clcmd_saytest")

    register_forward(FM_ClientDisconnect, "fw_ClientDisconnect")

    unregister_forward( FM_PrecacheEvent , g_fwid , 1 );
    register_forward( FM_PlaybackEvent , "fwPlaybackEvent_Pre" );
    register_forward( FM_PlaybackEvent , "fwPlaybackEvent_Post", 1 );

    g_iMaxPlayers = get_maxplayers()
}

public clcmd_saytest(id)
{
    g_iMuted[id] = !(g_iMuted[id])

    if (g_iMuted[id])
    {
        g_iPlayersDisable++
        client_print(id, print_center, "Fire Weapon Sound: OFF")
    }
    else
    {
        g_iPlayersDisable--
        client_print(id, print_center, "Fire Weapon Sound: ON")
    }

    return PLUGIN_HANDLED;
}

public fw_ClientDisconnect(id)
{
    if (g_iMuted[id]) g_iPlayersDisable--
    g_iMuted[id] = false
}

public fwPlaybackEvent_Pre( flags, invoker, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2 )
{
    if ( !( g_guns_eventids_bitsum & ( 1 << eventid ) ) || !( 1 <= invoker <= g_iMaxPlayers ) )
        return FMRES_IGNORED;

    if (!g_iPlayersDisable)
        return FMRES_IGNORED;

    set_pev(invoker, pev_groupinfo, 1)

    for (new i = 1; i <= g_iMaxPlayers; i++)
    {
        if (/*is_user_bot(i) || */i == invoker)
            continue;

        if (g_iMuted[i]) // is connected and muted
        {
            set_pev(i, pev_groupinfo, 2) // different groupinfo
        }
    }

    return FMRES_IGNORED;
}

public fwPlaybackEvent_Post( flags, invoker, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2 )
{
    if ( !( g_guns_eventids_bitsum & ( 1 << eventid ) ) || !( 1 <= invoker <= g_iMaxPlayers ) )
        return FMRES_IGNORED;

    if (!g_iPlayersDisable)
        return FMRES_IGNORED;

    set_pev(invoker, pev_groupinfo, 0)

    for (new i = 1; i <= g_iMaxPlayers; i++)
    {
        if (/*is_user_bot(i) || */i == invoker)
            continue;

        if (g_iMuted[i]) // is connected and muted
        {
            set_pev(i, pev_groupinfo, 0)
        }
    }

    return FMRES_IGNORED;
}
 
Последнее редактирование:

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу