Raised This Month: $ Target: $400
 0% 

Why is this getting called multiple times?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-18-2011 , 07:45   Re: Why is this getting called multiple times?
Reply With Quote #8

I get this log file :
Code:
L 12/18/2011 - 13:42:08 - 20.087203: Round Start
L 12/18/2011 - 13:42:45 - 56.659656: TERRORISTs WIN slay CTs <%!MRAD_terwin>
L 12/18/2011 - 13:42:45 - 56.659656: TERRORISTs WIN slay CTs <%!MRAD_terwin>
L 12/18/2011 - 13:42:45 - 56.659656: TERRORISTs WIN slay CTs <%!MRAD_terwin>
L 12/18/2011 - 13:42:45 - 56.659656: Round End
L 12/18/2011 - 13:42:45 - 56.659656: CTs WIN slay TERRORISTs <#Target_Bombed>
L 12/18/2011 - 13:42:45 - 56.659656: Round End
L 12/18/2011 - 13:42:50 - 61.662677: New Round
With plugin :

PHP Code:
#include <amxmodx>

#define VERSION "0.0.1"
#define PLUGIN "Slay Loosers Debug"

new bool:g_bRestarting

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_logevent("LogEvent_Round_Start"2"1=Round_Start")
    
register_logevent("Logevent_Round_End"2"1=Round_End")
    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w")
    
register_event("SendAudio""Event_SendAudio_terwin""a""2=%!MRAD_terwin")
    
register_event("SendAudio""Event_SendAudio_ctwin""a""2=%!MRAD_ctwin")
    
LogToFile("NEW MAP")
}

public 
Event_SendAudio_terwin()
{
    new 
szAudioString[32]
    
read_data(2szAudioStringcharsmax(szAudioString))
    
LogToFile("TERRORISTs WIN slay CTs <%s>"szAudioString)
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"ae""CT")
    for(--
iNumiNum>=0iNum--)
    {
        
user_kill(iPlayers[iNum], 1)
    }
}

public 
Event_SendAudio_ctwin()
{
    new 
szAudioString[32]
    
read_data(2szAudioStringcharsmax(szAudioString))
    
LogToFile("CTs WIN slay TERRORISTs <%s>"szAudioString)
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"ae""TERRORIST")
    for(--
iNumiNum>=0iNum--)
    {
        
user_kill(iPlayers[iNum], 1)
    }
}

public 
Event_TextMsg_Restart()
{
    
g_bRestarting true
    LogToFile
("Restart has been triggered")
}

public 
Event_HLTV_New_Round()
{
    if( 
g_bRestarting )
    {
        
LogToFile("New Round (RESTARTED)")
        
g_bRestarting false
    
}
    else
    {
        
LogToFile("New Round")
    }
}

public 
LogEvent_Round_Start()
{
    
LogToFile("Round Start")
}

public 
Logevent_Round_End()
{
    
LogToFile("Round End")
}

LogToFile(const fmt[], any:...)
{
    static 
szLogFile[64]
    static 
date[64]
    if( !
szLogFile[0] )
    {
        
get_localinfo("amxx_logs"szLogFilecharsmax(szLogFile))
        
format(szLogFilecharsmax(szLogFile), "%s/slay_loosers_%s.log"szLogFiledate)
    }

    new 
szLog[256]
    
vformat(szLogcharsmax(szLog), fmt2)

    
get_time("%m/%d/%Y - %H:%M:%S"datecharsmax(date))

    new 
fp fopen(szLogFile"at")
    
fprintf(fp"L %s - %f: %s^n"dateget_gametime(), szLog)
    
fclose(fp)


So, yes, i guess there is a problem with amxx.

Have you tried with last official amxx release ?


EDIT :

I've fixed with rechecking in callback.
I still log Round_End 2 times...

PHP Code:
#include <amxmodx>

#define VERSION "0.0.2"
#define PLUGIN "Slay Loosers Debug"

new bool:g_bRestarting

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_logevent("LogEvent_Round_Start"2"1=Round_Start")
    
register_logevent("Logevent_Round_End"2"1=Round_End")
    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w")
    
register_event("SendAudio""Event_SendAudio""a")
    
LogToFile("NEW MAP")
}

public 
Event_SendAudio()
{
    new 
szAudioString[32], Float:flGameTime get_gametime()
    
read_data(2szAudioStringcharsmax(szAudioString))
    if( 
equal(szAudioString"%!MRAD_terwin") )
    {
        static 
Float:flOldTerGameTime
        
if( flGameTime flOldTerGameTime )
        {
            
flOldTerGameTime flGameTime
            LogToFile
("TERRORISTs WIN slay CTs <%s>"szAudioString)
            new 
iPlayers[32], iNum
            get_players
(iPlayersiNum"ae""CT")
            for(--
iNumiNum>=0iNum--)
            {
                
user_kill(iPlayers[iNum], 1)
            }
        }
    }
    else if( 
equal(szAudioString"%!MRAD_ctwin" ) )
    {
        static 
Float:flOldCtGameTime
        
if( flGameTime flOldCtGameTime )
        {
            
flOldCtGameTime flGameTime
            LogToFile
("CTs WIN slay TERRORISTs <%s>"szAudioString)
            new 
iPlayers[32], iNum
            get_players
(iPlayersiNum"ae""TERRORIST")
            for(--
iNumiNum>=0iNum--)
            {
                
user_kill(iPlayers[iNum], 1)
            }
        }
    }
}

public 
Event_TextMsg_Restart()
{
    
g_bRestarting true
    LogToFile
("Restart has been triggered")
}

public 
Event_HLTV_New_Round()
{
    if( 
g_bRestarting )
    {
        
LogToFile("New Round (RESTARTED)")
        
g_bRestarting false
    
}
    else
    {
        
LogToFile("New Round")
    }
}

public 
LogEvent_Round_Start()
{
    
LogToFile("Round Start")
}

public 
Logevent_Round_End()
{
    
LogToFile("Round End")
}

LogToFile(const fmt[], any:...)
{
    static 
szLogFile[64]
    static 
date[64]
    if( !
szLogFile[0] )
    {
        
get_localinfo("amxx_logs"szLogFilecharsmax(szLogFile))
        
format(szLogFilecharsmax(szLogFile), "%s/slay_loosers_%s.log"szLogFiledate)
    }

    new 
szLog[256]
    
vformat(szLogcharsmax(szLog), fmt2)

    
get_time("%m/%d/%Y - %H:%M:%S"datecharsmax(date))

    new 
fp fopen(szLogFile"at")
    
fprintf(fp"L %s - %f: %s^n"dateget_gametime(), szLog)
    
fclose(fp)

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 12-18-2011 at 08:01.
ConnorMcLeod is offline
 



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