Raised This Month: $ Target: $400
 0% 

Mic Proximity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 04-08-2007 , 00:04   Mic Proximity
Reply With Quote #1

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)
}
Styles is offline
Send a message via AIM to Styles
 



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 06:44.


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