View Single Post
USSNUKE9
New Member
Join Date: Sep 2009
Old 09-02-2009 , 07:01   Re: [TF2] Team Talk (team voicechat when alltalk on)
Reply With Quote #9

I think I may have implemented a toggle, but I haven't tested it yet. Let me know if this looks like it will work, or test it and see if it does. I've also disabled the sounds and replaced them with a chat message that notifies you of your status when toggling.

You should now be able to bind a key to toggle teamtalk like so:
Code:
bind f teamtalk
Quote:
Originally Posted by ratty View Post
If anyone has a way to do it in a single bind, that would be awesome!
That's what I've tried to do here. The toggle is now a single bind (bind f teamtalk).

Quote:
Originally Posted by alinayg View Post
Can you make it so it does not make the beep?
This is in my code. Sort of wish this was a convar, but in my version it's simply disabled. In replace is a chat message alerting you of teamtalk status.

My source below:

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

#define PLUGIN_VERSION "1.0"

new bool:teamtalking = false;

public Plugin:myinfo =
{
        name = "Team talk",
        author = "Ratty",
        description = "Lets you talk to just your team when alltalk enabled",
        version = PLUGIN_VERSION,
        url = "http://www.nom-nom-nom.us"
}

public OnPluginStart()
{
        RegConsoleCmd("+teamtalk", teamtalkon,  "use in conjunction with +voicerecord", FCVAR_GAMEDLL);
        RegConsoleCmd("-teamtalk", teamtalkoff, "use in conjunction with +voicerecord", FCVAR_GAMEDLL);
        RegConsoleCmd("teamtalk", teamtalktoggle, "toggles teamtalk on/off", FCVAR_GAMEDLL);
}

public Action:teamtalkon(client, args) {
  new myteam = GetClientTeam(client);
        
  teamtalking = true;
    
  switch (myteam) {
    case 2:
      DoTeamTalk(client,3);
    case 3:
      DoTeamTalk(client,2);
    default:
       PrintToChat(client, "You must be on a team to use team chat. Spectators hear and talk to everybody.");
  }
  return Plugin_Handled;
}

DoTeamTalk(client,team) {
  for (new i = 1; i <= GetMaxClients(); i++) {
    if (IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == team)
      SetClientListening(i,client,true);
  }
}

public Action:teamtalkoff(client, args) {
  teamtalking = false;
  for (new i = 1; i <= GetMaxClients(); i++) {
    if (IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i)) {
      SetClientListening(i,client,false);
    }
  }
  
  return Plugin_Handled;
}

public Action:teamtalktoggle(client, args)
{
    if (!teamtalking){
        teamtalkon(client, args);
        PrintToChat(client,"\x01\x04[SM] Now talking to team only.")
    }
    else {
        teamtalkoff(client, args);
        PrintToChat(client,"\x01\x04[SM] Now talking to everyone.")
    }
    return;
}
Attached Files
File Type: smx teamtalk.smx (2.7 KB, 652 views)
File Type: sp Get Plugin or Get Source (teamtalk.sp - 1742 views - 1.9 KB)

Last edited by USSNUKE9; 09-09-2009 at 05:02.
USSNUKE9 is offline