text
stringlengths
0
692
if (argcount > 0)
{
for (new i = 1; i <= argcount; i++) {
switch (get_msg_argtype(i)) {
case ARG_BYTE:
log_msgf("Arg %d (Byte ^"%d^")", i, get_msg_arg_int(i))
case ARG_CHAR:
log_msgf("Arg %d (Char ^"%d^")", i, get_msg_arg_int(i))
case ARG_SHORT:
log_msgf("Arg %d (Short ^"%d^")", i, get_msg_arg_int(i))
case ARG_LONG:
log_msgf("Arg %d (Long ^"%d^")", i, get_msg_arg_int(i))
case ARG_ANGLE:
log_msgf("Arg %d (Angle ^"%f^")", i, get_msg_arg_float(i))
case ARG_COORD:
log_msgf("Arg %d (Coord ^"%f^")", i, get_msg_arg_float(i))
case ARG_STRING:
{
get_msg_arg_string(i, str, 255)
replace_all(str, 254, "^t", "^^t")
replace_all(str, 254, "^n", "^^n")
replace_all(str, 254, "%", "%%")
log_msgf("Arg %d (String ^"%s^")", i, str)
}
case ARG_ENTITY:
log_msgf("Arg %d (Entity ^"%d^")", i, get_msg_arg_int(i))
default:
log_msgf("Arg %d (Unknown ^"%d^")", i, get_msg_arg_int(i))
}
}
}
else
{
log_msgf("Message contains no arguments")
}
// Log that the message ended (MessageEnd)
log_msgf("MessageEnd (%s ^"%d^")", msgname, msgid)
return PLUGIN_CONTINUE
}
/***************** Other Functions *****************/
/* Fills g_msgCache with message names for faster look up
Return value: Number of messages that are valid */
generate_msg_table() {
for (new i = MAX_ENGINE_MESSAGES + 1; i <= MAX_POSSIBLE_MESSAGES; i++)
{
// Store the message name in the cache for faster lookup
if (!get_user_msgname(i, g_msgCache[i], 31))
return i - 1
}
return MAX_POSSIBLE_MESSAGES
}
/* Returns true if msgid is a valid message */
bool:is_msg_valid(msgid)
{
return (msgid > 0 && msgid <= g_maxMessages)
}
/* Returns message ID from string */
str_to_msgid(const str[]) {
new n = str_to_num(str)
if (n <= 0 )
return get_user_msgid(str)
return n
}
/* Gets logging status of message */
get_msglog_status(msgid)
{
return g_msgLogging[msgid] ? MSGLOG_STARTED : MSGLOG_STOPPED
}
/* Sets logging status of message
If msgid = 0, status will be applied to all messages */
set_msglog_status(msgid, status)
{
if (msgid > 0) // Individual message
{
g_msgLogging[msgid] = (status == MSGLOG_STARTED)
if (!g_msgRegistered[msgid])
{
register_message(msgid, "message_forward")
g_msgRegistered[msgid] = true
}
}
else // ALL messages
{
for (new i = 1; i <= g_maxMessages; i++)
{
g_msgLogging[i] = (status == MSGLOG_STARTED)