Below is a code snippet to block "Fire in the hole" message display from all players. Can you guys clear me out the followings:
MsgTextMsg(msgid, dest, id) - params are not being used in the function, so its not required, not sure
get_msg_args() != 5 - why checking 5 arguments to be returned
get_msg_arg_string(5, arg, sizeof arg - 1) - why getting the 5th argument
new caller = str_to_num(arg) - why message argument is converted to number and used as id.
PHP Code:
public plugin_init()
{
register_message(get_user_msgid("TextMsg"), "MsgTextMsg")
}
public MsgTextMsg(msgid, dest, id)
{
if (get_msg_args() != 5 || get_msg_argtype(5) != ARG_STRING)
return PLUGIN_CONTINUE
static arg[32]
get_msg_arg_string(5, arg, sizeof arg - 1)
if (!equal(arg, "#Fire_in_the_hole"))
return PLUGIN_CONTINUE
get_msg_arg_string(5, arg, sizeof arg - 1) //if argument no is 2 is it possible to read the caller ?
new caller = str_to_num(arg)
if (!is_user_alive(caller))
return PLUGIN_CONTINUE
return PLUGIN_HANDLED
}