Raised This Month: $ Target: $400
 0% 

[CSGO] PrintToChat, displaying messages to players problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spyrek
Senior Member
Join Date: Jun 2009
Old 01-16-2015 , 18:10   [CSGO] PrintToChat, displaying messages to players problem
Reply With Quote #1

Hello,
I got few problems with PrintToChat function in CSGO.
1st problem:
How can I send message to specific team?
I got something like this:

Code:
new clientTeam = GetClientTeam(client); 
for(new i = 1; i <= MaxClients; i++) 
{ 
       if(IsClientInGame(i)) 
       { 
             new iTeam = GetClientTeam(i); 
             if(iTeam == clientTeam) 
             { 
                  PrintToChat(i, "text"); 
             } 
    } 
}
Something is wrong cause both teams see the message.

2nd problem:
I'm changing messages sent by players, how can I show this messages to be logged by hlstatsx in chat history?

3rd problem:
IsPlayerAlive(client) sometimes returns true even when player is dead.


Thanks for help.

Last edited by Spyrek; 05-08-2015 at 12:38.
Spyrek is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 01-16-2015 , 19:56   Re: [CSGO] PrintToChat, displaying messages to players problem
Reply With Quote #2

For 1: Maybe because you print the same exact message "text" to everyone, so it *looks* like both teams get the same message? Use this instead:

Code:
PrintToChat(i, "text\tClient: %d", i);
and see if it prints the client index to the correct or wrong player(s).
Potato Uno is offline
Spyrek
Senior Member
Join Date: Jun 2009
Old 05-08-2015 , 10:11   Re: [CSGO] PrintToChat, displaying messages to players problem
Reply With Quote #3

Still don't know what I'm doing wrong. I want to print message to the client team.

I have tried:

if(iTeam == clientTeam) - sends message to both teams.

if(iTeam === clientTeam) - sends message to both teams.

if(iTeam & clientTeam) - sends message to both teams.
Spyrek is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 05-08-2015 , 10:28   Re: [CSGO] PrintToChat, displaying messages to players problem
Reply With Quote #4

I guess you could try seeing what the values are: PrintToChat(i, "%d, %d", clientTeam, iTeam);
Miu is offline
cam0
Senior Member
Join Date: Feb 2015
Old 05-08-2015 , 11:15   Re: [CSGO] PrintToChat, displaying messages to players problem
Reply With Quote #5

Code:
new clientTeam = GetClientTeam(client); for(new i = 1; i <= MaxClients; i++) {     if(IsClientInGame(i))     {         new iTeam = GetClientTeam(i);         if(iTeam == clientTeam)         {             PrintToChat(i, "text");         }     } }
You were missing a bracket in your code and you can use pawn tags instead of code tags to include indention.

I believe Simple Chat Processor's OnChatMessage forward will change the message before it is sent elsewhere (perhaps not), I would look into that.

You could always try GetClientHealth(client) > 0 instead of IsPlayerAlive() but that could give you the same issue.

Last edited by cam0; 05-08-2015 at 11:18.
cam0 is offline
Dr. Api
BANNED
Join Date: Mar 2015
Location: France
Old 05-08-2015 , 17:12   Re: [CSGO] PrintToChat, displaying messages to players problem
Reply With Quote #6

PHP Code:
for(new 1<= MaxClientsi++)
{
    if(
IsClientInGame(i))
    {
        
//GetClientTeam(client) == GetClientTeam(i)
        
if(GetClientTeam(i) == 2)
        {
            
PrintToChat(i"text");
        }
    }

IsPlayerAlive will always return the truth so you dont use correctly.

So, 1 = Spec
2 = Terro
3 = CT

If you use include cstrike you can use CS_TEAM_CT...instead of 1, 2, 3

After you do that GetClientTeam(client) == GetClientTeam(i)

Last edited by Dr. Api; 05-08-2015 at 17:23.
Dr. Api is offline
Spyrek
Senior Member
Join Date: Jun 2009
Old 05-12-2015 , 15:18   Re: [CSGO] PrintToChat, displaying messages to players problem
Reply With Quote #7

Quote:
Originally Posted by Dr. Api View Post
PHP Code:
for(new 1<= MaxClientsi++)
{
    if(
IsClientInGame(i))
    {
        
//GetClientTeam(client) == GetClientTeam(i)
        
if(GetClientTeam(i) == 2)
        {
            
PrintToChat(i"text");
        }
    }

IsPlayerAlive will always return the truth so you dont use correctly.

So, 1 = Spec
2 = Terro
3 = CT

If you use include cstrike you can use CS_TEAM_CT...instead of 1, 2, 3

After you do that GetClientTeam(client) == GetClientTeam(i)

Thanks for help. It works.
Code:
GetClientTeam(client) == GetClientTeam(i)
Spyrek 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 02:43.


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