Raised This Month: $51 Target: $400
 12% 

SetClientListeningFlags Problems/Bugs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blackops7799
Senior Member
Join Date: May 2006
Old 03-14-2009 , 18:08   SetClientListeningFlags Problems/Bugs
Reply With Quote #1

Okay, so. A server than I have admin on wanted a mod that allowed all the dead people to chat with all of the other dead people while the alive players could talk with other alive players and not head the dead players.

Here's what I made. It works fine just like how it should, the only thing is, players can't personally mute anyone through the Player List found in the escape menu, and admins cant globally mute anyone.

Am I doing something wrong?

Code:
#include <sourcemod>
#include <sdktools>

#define VOICE_NORMAL		0	/* Allow the client to listen and speak normally. */
#define VOICE_MUTED			1	/* Mutes the client from speaking to everyone. */
#define VOICE_SPEAKALL		2	/* Allow the client to speak to everyone. */
#define VOICE_LISTENALL		4	/* Allow the client to listen to everyone. */
#define VOICE_TEAM			8	/* Allow the client to always speak to team, even when dead. */
#define VOICE_LISTENTEAM	16	/* Allow the client to always hear teammates, including dead ones. */

public Plugin:myinfo = 
{
	name = "Dead Alltalk",
	author = "BlackOps",
	description = "Let dead people talk to other dead people while the alive players can continue playing",
	version = "1",
	url = ""
}

public OnPluginStart()
{
	HookEvent("player_spawn", SpawnEvent)
	HookEvent("player_death", DeathEvent)
	HookEvent("player_team", TeamEvent)
	
}

public SpawnEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"))
	SetClientListeningFlags(client, VOICE_SPEAKALL)
}

public DeathEvent(Handle:event, const String:name[], bool:dontBroadcast)
{	
	new client = GetClientOfUserId(GetEventInt(event, "userid"))
	SetClientListeningFlags(client, VOICE_LISTENALL)
	PrintToChat(client, "\x04[DeadChat] \x03You are now dead. You can voice-chat with other dead players. Alive players can't hear you.");
}

public TeamEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"))
	new team = GetEventInt(event, "team")

	if(client)
		if (team == 1)
		{
			SetClientListeningFlags(client, VOICE_SPEAKALL|VOICE_LISTENALL)
			PrintToChat(client, "\x04[SpecChat] \x03You are now a spectator. You can talk and listen to everyone!!!");
		}
		else
			SetClientListeningFlags(client, VOICE_LISTENALL)
}
blackops7799 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 17:09.


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