text
stringlengths 0
692
|
|---|
}
|
else
|
{
|
// Display usage information
|
console_print(id, "Usage: amx_msglog <command> [argument]")
|
console_print(id, "Valid commands are: ")
|
console_print(id, " start [msg name or id] - Starts logging given message or all if no argument")
|
console_print(id, " stop [msg name or id] - Stops logging given message or all if no argument")
|
console_print(id, " list [page] - Displays list of messages and their logging status")
|
}
|
return PLUGIN_HANDLED
|
}
|
/* Forward for hooked messages */
|
public message_forward(msgid, msgDest, msgEnt) {
|
if (!g_msgLogging[msgid]) return PLUGIN_CONTINUE
|
new entFilter = get_pcvar_num(g_cvarFilter)
|
/* If value of amx_ml_filter isn't a valid entity index (0 is accepted in order to log ALL)
|
Then stop all logging */
|
if (entFilter != 0 && !pev_valid(entFilter)) {
|
set_msglog_status(0, MSGLOG_STOPPED)
|
log_msgf("Logging stopped for all messages because entity index ^"%d^" is not valid", entFilter)
|
return PLUGIN_CONTINUE
|
}
|
// If not filtering by entity and the receiver entity doesn't match the filter, don't log message
|
if (entFilter != 0 && msgEnt != 0 && msgEnt != entFilter)
|
return PLUGIN_CONTINUE
|
new msgname[32], id[4], argcount, dest[15], Float:msgOrigin[3], entStr[7], entClassname[32], entNetname[32]
|
// Get message name
|
copy(msgname, 31, g_msgCache[msgid])
|
// If message has no name, then set the name to message ID
|
if (!msgname[0])
|
{
|
num_to_str(msgid, id, 3)
|
copy(msgname, 31, id)
|
}
|
// Get number of message arguments
|
argcount = get_msg_args()
|
// Determine the destination of the message
|
switch (msgDest) {
|
case MSG_BROADCAST:
|
copy(dest, 9, "Broadcast")
|
case MSG_ONE:
|
copy(dest, 3, "One")
|
case MSG_ALL:
|
copy(dest, 3, "All")
|
case MSG_INIT:
|
copy(dest, 4, "Init")
|
case MSG_PVS:
|
copy(dest, 3, "PVS")
|
case MSG_PAS:
|
copy(dest, 3, "PAS")
|
case MSG_PVS_R:
|
copy(dest, 12, "PVS Reliable")
|
case MSG_PAS_R:
|
copy(dest, 12, "PAS Reliable")
|
case MSG_ONE_UNRELIABLE:
|
copy(dest, 14, "One Unreliable")
|
case MSG_SPEC:
|
copy(dest, 4, "Spec")
|
default:
|
copy(dest, 7, "Unknown")
|
}
|
// Get the origin of the message (only truly valid for PVS through PAS_R)
|
get_msg_origin(msgOrigin)
|
// Get the receiving entity's classname and netname
|
if (msgEnt != 0) {
|
num_to_str(msgEnt, entStr, 6)
|
pev(msgEnt, pev_classname, entClassname, 31)
|
pev(msgEnt, pev_netname, entNetname, 31)
|
if (!entNetname[0])
|
copy(entNetname, 31, NULL_STR)
|
} else {
|
copy(entStr, 6, NULL_STR)
|
copy(entClassname, 6, NULL_STR)
|
copy(entNetname, 6, NULL_STR)
|
}
|
// Log message information (MessageBegin)
|
log_msgf("MessageBegin (%s ^"%d^") (Destination ^"%s<%d>^") (Args ^"%d^") (Entity ^"%s^") (Classname ^"%s^") (Netname ^"%s^") (Origin ^"%f %f %f^")",
|
msgname, msgid, dest, msgDest, argcount, entStr, entClassname, entNetname, msgOrigin[0], msgOrigin[1], msgOrigin[2])
|
static str[256]
|
// Log all argument data
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.