Raised This Month: $ Target: $400
 0% 

Why is this getting called multiple times?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 12-13-2011 , 16:31   Why is this getting called multiple times?
Reply With Quote #1

Ok, I would like to hook, when T's and CT's win. Doing it right now like that:

PHP Code:
public plugin_init()
{
    
register_event("SendAudio""t_win""a""2&%!MRAD_terwin")
    
register_event("SendAudio""ct_win""a""2&%!MRAD_ctwin")
}

public 
t_win()
{
    
client_print(0print_chat"[Team] T's win!")
}

public 
ct_win()
{
    
client_print(0print_chat"[Team] CT's win!")

This works perfectly, and both get called once when their team wins. However, when I add some more stuff, it does give the winner team another +1 round as win, and all players die when there was a bomb explosion, all players were outside of the range for sure. And also, it calls sometimes both events multiple times. Could anyone help me with that? There are no other 3rd party plugins installed.

PHP Code:
public plugin_init()
{
    
register_event("SendAudio""t_win""a""2&%!MRAD_terwin")
    
register_event("SendAudio""ct_win""a""2&%!MRAD_ctwin")
}

public 
t_win()
{
    
client_print(0print_chat"[Team] All CTs should die now!")
    
    
cvar get_pcvar_num(amx_sl_silentkill)
    
    new 
iPlayers[32], iNumid 
    get_players
(iPlayersiNum
    for(new 
ii<iNumi++) 
    {
        
id iPlayers[i]
        
        if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
        {
            if(
cvar)
            {
                
user_silentkill(id)
            }
            else
            {
                
user_kill(id1)
            }
        }
    }
}

public 
ct_win()
{
    
client_print(0print_chat"[Team] All T's should die now!")
    
    
cvar get_pcvar_num(amx_sl_silentkill)
    
    new 
iPlayers[32], iNumid 
    get_players
(iPlayersiNum
    for(new 
ii<iNumi++) 
    {
        
id iPlayers[i]
        
        if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)
        {
            if(
cvar)
            {
                
user_silentkill(id)
            }
            else
            {
                
user_kill(id1)
            }
        }
    }

__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
 


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 11:55.


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