Raised This Month: $ Target: $400
 0% 

[SOLVED] Why this message appears many times in chat?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shockblade
Member
Join Date: Dec 2012
Old 12-29-2012 , 14:36   [SOLVED] Why this message appears many times in chat?
Reply With Quote #1

Hello,
why in this function the message appears many times, when counter-terrorists win?

PHP Code:
public Event_SendAudio_CtsWin()
{
        for(new 
client FIRST_PLAYER_IDclient <= g_maxClientsclient++)
        {
                new 
Winner_XP get_pcvar_num(cvar_XP_Win)
            
                
/* if( IsUserConnected(client) && */
                
if( IsUserAuthorized(client) )
                {
                    if( 
cs_get_user_team(client) == CS_TEAM_CT )
                    {
                        
g_XP[client] += Winner_XP
                
                        
#if defined ADMIN_EXTRA_XP_WIN
                            
if( get_pcvar_num(cvar_Admin_Extra) && get_user_flags(client) & ADMIN_EXTRA )
                            {
                                
g_XP[client] += get_pcvar_num(cvar_Admin_Extra_XP)
                            }
                        
#endif
                    
}    
                    
Check_Level(client)
                }
                
client_print_color(0Blue"^4%s ^3Seekers ^1received ^4%i ^1XP for winning the round!"g_szPrefix, (get_pcvar_num(cvar_Admin_Extra) && get_user_flags(client) & ADMIN_EXTRA get_pcvar_num(cvar_Admin_Extra_XP) : 0) + Winner_XP)
        }

__________________
Spoiler

Last edited by Shockblade; 12-30-2012 at 20:34.
Shockblade is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 12-29-2012 , 15:17   Re: Why this message appears many times in chat?
Reply With Quote #2

Post the register_event first
__________________
simanovich is offline
Shockblade
Member
Join Date: Dec 2012
Old 12-29-2012 , 15:54   Re: Why this message appears many times in chat?
Reply With Quote #3

...
I want to fix the function only... In my plugin there is register_event.
__________________
Spoiler
Shockblade is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 12-29-2012 , 16:01   Re: Why this message appears many times in chat?
Reply With Quote #4

Look closer, you are printing a chat message in a loop ... try to get it out of it, then it will work fine.
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-29-2012 , 16:03   Re: Why this message appears many times in chat?
Reply With Quote #5

No, he is printing to everybody on every loop with user specific information. He should print the message to each individual player with user specific information.
__________________
fysiks is offline
Shockblade
Member
Join Date: Dec 2012
Old 12-29-2012 , 16:11   Re: Why this message appears many times in chat?
Reply With Quote #6

I tried to put message in the if( IsUserAuthorized(client) ) function and again it appears many times...
__________________
Spoiler
Shockblade is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-29-2012 , 16:15   Re: Why this message appears many times in chat?
Reply With Quote #7

Quote:
Originally Posted by Shockblade View Post
I tried to put message in the if( IsUserAuthorized(client) ) function and again it appears many times...
It's because you are printing it for everybody on every loop.
__________________
fysiks is offline
Shockblade
Member
Join Date: Dec 2012
Old 12-29-2012 , 16:16   Re: Why this message appears many times in chat?
Reply With Quote #8

how can I fix it?
__________________
Spoiler
Shockblade is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-29-2012 , 16:26   Re: Why this message appears many times in chat?
Reply With Quote #9

Quote:
Originally Posted by Shockblade View Post
how can I fix it?
Print the message only to the individual player ("client").
__________________
fysiks is offline
Shockblade
Member
Join Date: Dec 2012
Old 12-29-2012 , 16:36   Re: Why this message appears many times in chat?
Reply With Quote #10

Ok, but I want and the other team to see that message. How can I make that without problems?
__________________
Spoiler
Shockblade 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 13:46.


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