AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Mic Proximity (https://forums.alliedmods.net/showthread.php?t=53637)

Styles 04-08-2007 00:04

Mic Proximity
 
Okay, there is an approved plugin called Mic Proximity. I have it on my server but people cut in and out. Why?
Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Voice Proximity"
#define VERSION "1.0"
#define AUTHOR "29th ID"

new g_enabled, g_distance

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        g_enabled  = register_cvar("amx_voiceprox", "0")
        g_distance = register_cvar("amx_voiceprox_distance", "600")
       
        register_forward(FM_PlayerPreThink, "forward_player_prethink")
}

public forward_player_prethink(id) {
        if( (get_pcvar_num(g_enabled)) && (is_user_alive(id)) )
                check_area(id)
}

public check_area(id) {
        new players[32]
        new i, pNum
        get_players(players, pNum, "a")
        for (i=0; i < pNum; i++) {
                if(players[i] == id) continue
               
                engfunc(EngFunc_SetClientListening, id, players[i], (entity_distance_stock(id, players[i]) <= get_pcvar_num(g_distance)) ? 1 : 0)
        }
}

stock Float:vecdist(Float:vec1[3], Float:vec2[3])
{
        new Float:x = vec1[0] - vec2[0]
        new Float:y = vec1[1] - vec2[1]
        new Float:z = vec1[2] - vec2[2]
        x*=x;
        y*=y;
        z*=z;
        return floatsqroot(x+y+z);
}
 
stock Float:entity_distance_stock(ent1, ent2)
{
        new Float:orig1[3]
        new Float:orig2[3]
 
        pev(ent1, pev_origin, orig1)
        pev(ent2, pev_origin, orig2)
 
        return vecdist(orig1, orig2)
}


Nican 04-08-2007 00:40

Re: Mic Proximity
 
What do you mean by "people cut in and out"

Styles 04-08-2007 00:53

Re: Mic Proximity
 
like the mic turns on and off really fast then finally it works right and perfectly.

Wilson [29th ID] 04-08-2007 19:00

Re: Mic Proximity
 
Yes, I made Voice Proximity. The reason they are cutting out is because they're not supposed to be heard. The plugin basically catches up with the server/voice codec and that's why they get cut off.

I reccomend turning off "All Talk" for the plugin - that decreases the cut out to the point where it's hardly noticable. You will still be able to hear your enemies talking if they are near you - the plugin overrides "all talk" but the server stops transmitting signals from those far away so it cuts those "cut outs" in half.

Voi 04-08-2007 19:47

Re: Mic Proximity
 
does it makes u hear enemy radio(microphone) ?

Wilson [29th ID] 04-08-2007 19:50

Re: Mic Proximity
 
yeah


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

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