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

CS:GO Print to team chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phire
Junior Member
Join Date: May 2016
Location: Scotland, United Kingdom
Old 12-04-2016 , 00:57   CS:GO Print to team chat
Reply With Quote #1

I've written a chat plugin and it all works perfectly except for team chat, I can't get that to work. The only issue I'm having with it is that I don't know how to print the team message to just the clients team. Any assistance is greatly appreciated.
Phire is offline
Walgrim
AlliedModders Donor
Join Date: Dec 2015
Location: France
Old 12-04-2016 , 03:24   Re: CS:GO Print to team chat
Reply With Quote #2

You can use simple chat processor(redux) to do that, there's some good functions in it (I believe).
__________________

Last edited by Walgrim; 12-04-2016 at 03:28.
Walgrim is offline
Phire
Junior Member
Join Date: May 2016
Location: Scotland, United Kingdom
Old 12-04-2016 , 10:10   Re: CS:GO Print to team chat
Reply With Quote #3

Quote:
Originally Posted by Walgrim View Post
You can use simple chat processor(redux) to do that, there's some good functions in it (I believe).
Yes however I have written my own chat processor and the only thing I can't do is print to the client's team chat.
Phire is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-04-2016 , 11:07   Re: CS:GO Print to team chat
Reply With Quote #4

we can't help you unless you show us your codes
__________________
8guawong is offline
Phire
Junior Member
Join Date: May 2016
Location: Scotland, United Kingdom
Old 12-04-2016 , 17:21   Re: CS:GO Print to team chat
Reply With Quote #5

Quote:
Originally Posted by 8guawong View Post
we can't help you unless you show us your codes
I don't really see any need to show the entirety of my code - and I also don't want to but I'll show the parts I need help with.

PHP Code:
#include <sourcemod>
#include <cstrike>

public Plugin myinfo =
{
    
name "Sulphox Chat Controller",
    
description "Processes chat and tags.",
    
author "Phire",
    
version "10.3",
    
url "www.sulphox.com"
};

public 
void OnPluginStart()
{
    
AddCommandListener(SayTeamHook"say_team");
}

public 
Action SayTeamHook(int client, const char[] commandint argc)
{
    

Basically, I don't know what to use to print a message to chat, like
PHP Code:
PrintToChat(client"Hello"); 
would print to the client but I don't know what to use for team.
__________________
root@phire:~# sudo apt-get install life
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package life
Phire is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 12-04-2016 , 17:55   Re: CS:GO Print to team chat
Reply With Quote #6

Something like this.

Code:
#include <sourcemod> 
#include <cstrike> 

public Plugin myinfo = 
{ 
    name = "Sulphox Chat Controller", 
    description = "Processes chat and tags.", 
    author = "Phire", 
    version = "10.3", 
    url = "www.sulphox.com" 
}; 

public Action OnClientSayCommand(int client, const char[] command, const char[] args)
{ 
	if (!IsValidClient(client))
		return Plugin_Continue;
		
	if(!StrEqual(command, "say_team"))
		return Plugin_Continue;
	
	decl String:name[MAX_NAME_LENGTH];
	GetClientName(client, name, sizeof(name));
	
	new team = GetClientTeam(client);
	
	for(new i = 1;i <= MaxClients;i++)
		if(IsValidClient(i) && GetClientTeam(i) == team)
			PrintToChat(i, "%s : %s", name, args);
	
	return Plugin_Stop;
}  

bool:IsValidClient(client)
{
	if(!(1 <= client <= MaxClients) || !IsClientInGame(client))
		return false;

	return true;
}
__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards 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 04:40.


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