I wanted to modify admin chat to display a amx_chat message if you type @message in say if you have ADMIN_CHAT flag or just @message in normal say chat if yo don't.
Code:
public plugin_init()
{
register_clcmd("say", "chat123", ADMIN_ALL, "@stuff")
}
public chat123(id, level, cid)
{
if(get_user_flags(id) & ADMIN_CHAT)
return PLUGIN_CONTINUE
new said[2]
read_argv(1, said, 1)
if (said[0] != '@')
return PLUGIN_CONTINUE
new message[192], name[32], players[32], inum, authid[32], userid
read_args(message, 191)
remove_quotes(message)
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
userid = get_user_userid(id)
get_players(players, inum)
log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message)
log_message("^"%s<%d><%s><>^" triggered ^"admin_chat^" (text ^"%s^")", name, userid, authid, message)
format(message, 191, "(Admin Chat) %s : %s", name, message[1])
console_print(id, "%s", message)
for (new i = 0; i < inum; ++i)
{
if (access(players[i], ADMIN_CHAT))
client_print(players[i], print_chat, "%s", message)
}
return PLUGIN_HANDLED
}
It works when i have the chat flag but wen i don't it doesn't display anything and i get this in the server's console:
One more thing, after reading the info from the return constants i still don't know how to use the correctly. Can someone explain and perhaps give me 3 examples for PLUGIN_CONTINUE, PLUGIN_HANDLED, PLUGIN_HANDLED_MAIN?