Raised This Month: $ Target: $400
 0% 

How do i show the messages only for my team?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 04-30-2012 , 16:50   How do i show the messages only for my team?
Reply With Quote #1

Hello there,

How can i show messages to only my team, i tryed:

PHP Code:
if (get_user_team(id) == 1)
{
    
ColorChat(0GREY"Only terrorists are suppose to see this message!")
}
else if (
get_user_team(id) == 2)
{
    
ColorChat(0GREY"Only counter terrorists are suppose to see this message!")

Am i doing this right?
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.

Last edited by Bilal Pro; 04-30-2012 at 16:51.
Bilal Pro is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-30-2012 , 16:54   Re: How do i show the messages only for my team?
Reply With Quote #2

looks right to me. though i'd suggest adding in another one in case they're talking from spec. That is, if your server and logic allows.
Liverwiz is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 04-30-2012 , 17:19   Re: How do i show the messages only for my team?
Reply With Quote #3

are you sure this is fine?
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.
Bilal Pro is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-30-2012 , 17:19   Re: How do i show the messages only for my team?
Reply With Quote #4

Quote:
Originally Posted by Bilal Pro View Post
Hello there,

How can i show messages to only my team, i tryed:

PHP Code:
if (get_user_team(id) == 1)
{
    
ColorChat(0GREY"Only terrorists are suppose to see this message!")
}
else if (
get_user_team(id) == 2)
{
    
ColorChat(0GREY"Only counter terrorists are suppose to see this message!")

Am i doing this right?
No. In both cases you are sending it to everybody (that's what 0 means!). You have to loop through all players and if they are on the team that you want to see the message then show the message.
__________________
fysiks is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 04-30-2012 , 17:24   Re: How do i show the messages only for my team?
Reply With Quote #5

How will i check if they are on my team?
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.
Bilal Pro is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 04-30-2012 , 17:38   Re: How do i show the messages only for my team?
Reply With Quote #6

i didn't come further then this..

PHP Code:
new players[32], pnum
get_players
(playerspnum"ae""TERRORIST")

for (new 
ii<pnumi++)

__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.

Last edited by Bilal Pro; 04-30-2012 at 17:38.
Bilal Pro is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-30-2012 , 17:42   Re: How do i show the messages only for my team?
Reply With Quote #7

Quote:
Originally Posted by Bilal Pro View Post
How will i check if they are on my team?
Wow, these questions . . .

Use get_players() without flags then check their team and if it is the same as your team then show the message. Very simple.
__________________
fysiks is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-30-2012 , 17:59   Re: How do i show the messages only for my team?
Reply With Quote #8

Quote:
Originally Posted by Bilal Pro View Post
are you sure this is fine?
Quote:
Originally Posted by fysiks View Post
No. In both cases you are sending it to everybody (that's what 0 means!). You have to loop through all players and if they are on the team that you want to see the message then show the message.
Oh...i assumed you were just posting super-simple code.
go with what fysiks is telling you.

cheating, so you don't have to think:
PHP Code:
new players[32], p_playerCnt
get_players
(playersp_playerCnt"ch")

for(new 
i=1i<p_playerCnti++)
{
    if(
get_user_team(players[i]) == 1)
        
client_print_color(0DontChange"^3Only terrorists are suppose to see this message!")  //using DontChange will print the message in the team color. Just for fun. ^3 signifies to use team color
    
else if(get_user_team(players[i]) == 2)
        
client_print_color(0DontChange"^3Only counter terrorists are suppose to see this message!")
    else
        
client_print_color(0DontChange"^3Only spectators are suppose to see this message!")

I apologize for earlier. ColorChat isn't a function, its an include file.
Liverwiz is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 04-30-2012 , 18:10   Re: How do i show the messages only for my team?
Reply With Quote #9

PHP Code:
        new players[32], pnum
        get_players
(playerspnum"ch")
        
        for (new 
ii<pnumi++)
        {  
            if (
get_user_team(players[i]) == 1)
            {
                if (
is_user_alive(id))
                {
                    if (
get_user_flags(id) & ADMIN_MENU)
                    {
                        
ColorChat(0RED"^1(Terrorists) ^3%s^1 :  ^4%s"namemessage)
                        return 
PLUGIN_HANDLED
                    
}
                    else
                    {
                        
ColorChat(0RED"^1(Terrorists) ^3%s^1 :  ^1%s"namemessage)
                        return 
PLUGIN_HANDLED
                    
}
                }
                if (!
is_user_alive(id))
                {
                    if (
get_user_flags(id) & ADMIN_MENU)
                    {
                        
ColorChat(0RED"^1(Terrorists) ^1*DEAD* ^3%s^1 :  ^4%s"namemessage)
                        return 
PLUGIN_HANDLED
                    
}
                    else
                    {
                        
ColorChat(0RED"^1(Terrorists) ^1*DEAD* ^3%s^1 :  ^1%s"namemessage)
                        return 
PLUGIN_HANDLED
                    
}
                }
            }
            
            if (
get_user_team(players[i]) == 2)
            {
                if (
is_user_alive(id))
                {
                    if (
get_user_flags(id) & ADMIN_MENU)
                    {
                        
ColorChat(0BLUE"^1(Counter-Terrorists) ^3%s^1 :  ^4%s"namemessage)
                        return 
PLUGIN_HANDLED
                    
}
                    else
                    {
                        
ColorChat(0BLUE"^1(Counter-Terrorists) ^3%s^1 :  ^1%s"namemessage)
                        return 
PLUGIN_HANDLED
                    
}
                }
                if (!
is_user_alive(id))
                {
                    if (
get_user_flags(id) & ADMIN_MENU)
                    {
                        
ColorChat(0BLUE"^1(Counter-Terrorists) *DEAD* ^3%s^1 :  ^4%s"namemessage)
                        return 
PLUGIN_HANDLED
                    
}
                    else
                    {
                        
ColorChat(0BLUE"^1(Counter-Terrorists) *DEAD* ^3%s^1 :  ^1%s"namemessage)
                        return 
PLUGIN_HANDLED
                    
}
                }
            }
            if (
get_user_team(players[i]) == 0)
            {
                if (
get_user_flags(id) & ADMIN_MENU)
                {
                    
ColorChat(0GREY"^1(Spectator) *SPECTATOR* ^3%s^1 :  ^4%s"namemessage)
                    return 
PLUGIN_HANDLED
                
}
                else
                {
                    
ColorChat(0GREY"^1(Spectator) *SPECTATOR* ^3%s^1 :  ^1%s"namemessage)
                    return 
PLUGIN_HANDLED
                
}
            }
        }
        
    }
    return 
PLUGIN_HANDLED

Doesn't work still shows for everyone.
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.
Bilal Pro is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-30-2012 , 18:38   Re: How do i show the messages only for my team?
Reply With Quote #10

I suck, my mind is on other thing, sorry to confuse you. instead of using 0, use players[i]

0 prints to EVERYONE
you need to specify the ID of the person you want to print to. That is why you're doing this complicated for loop bullshit.
Liverwiz is offline
Reply


Thread Tools
Display Modes

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 07:42.


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