|
Veteran Member
Join Date: Jul 2006
Location: France (95)
|

12-18-2011
, 07:45
Re: Why is this getting called multiple times?
|
#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(PLUGIN, VERSION, "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(2, szAudioString, charsmax(szAudioString)) LogToFile("TERRORISTs WIN slay CTs <%s>", szAudioString) new iPlayers[32], iNum get_players(iPlayers, iNum, "ae", "CT") for(--iNum; iNum>=0; iNum--) { user_kill(iPlayers[iNum], 1) } }
public Event_SendAudio_ctwin() { new szAudioString[32] read_data(2, szAudioString, charsmax(szAudioString)) LogToFile("CTs WIN slay TERRORISTs <%s>", szAudioString) new iPlayers[32], iNum get_players(iPlayers, iNum, "ae", "TERRORIST") for(--iNum; iNum>=0; iNum--) { 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", szLogFile, charsmax(szLogFile)) format(szLogFile, charsmax(szLogFile), "%s/slay_loosers_%s.log", szLogFile, date) }
new szLog[256] vformat(szLog, charsmax(szLog), fmt, 2)
get_time("%m/%d/%Y - %H:%M:%S", date, charsmax(date))
new fp = fopen(szLogFile, "at") fprintf(fp, "L %s - %f: %s^n", date, get_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(PLUGIN, VERSION, "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(2, szAudioString, charsmax(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(iPlayers, iNum, "ae", "CT") for(--iNum; iNum>=0; iNum--) { 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(iPlayers, iNum, "ae", "TERRORIST") for(--iNum; iNum>=0; iNum--) { 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", szLogFile, charsmax(szLogFile)) format(szLogFile, charsmax(szLogFile), "%s/slay_loosers_%s.log", szLogFile, date) }
new szLog[256] vformat(szLog, charsmax(szLog), fmt, 2)
get_time("%m/%d/%Y - %H:%M:%S", date, charsmax(date))
new fp = fopen(szLogFile, "at") fprintf(fp, "L %s - %f: %s^n", date, get_gametime(), szLog) fclose(fp) }
__________________
Last edited by ConnorMcLeod; 12-18-2011 at 08:01.
|
|