title says all. When i type something in chat, the prefix and colors are correct, but it's showing the message twice, why?
PHP Code:
#include <amxmodx>
#define VERSION "1.0"
new szSayText, szMaxPlayers
public plugin_init() {
register_plugin("AdminChat", VERSION, "NapoleoN#")
register_clcmd("say", "HandleSay")
szSayText = get_user_msgid("SayText")
szMaxPlayers = get_maxplayers()
register_message(szSayText, "MsgDuplicate")
}
public MsgDuplicate(id) {
return PLUGIN_HANDLED
}
public HandleSay(id) {
new arg[100], szName[32]; get_user_name(id, szName, charsmax(szName))
read_args(arg, charsmax(arg))
remove_quotes(arg)
if(get_user_flags(id) & ADMIN_KICK && is_valid_msg(arg)) {
( is_user_alive(id) ? format(arg, charsmax(arg), "^x04[Admin]^x03 %s: %s", szName, arg) : format(arg, charsmax(arg), "^x03*DEAD*^x04 [Admin]^x03 %s: %s", szName, arg))
}
for(new i = 1; i <= szMaxPlayers; i++) {
if(!is_user_connected(i))
continue
if(is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i)) {
message_begin(MSG_ONE, szSayText, {0, 0, 0}, i)
write_byte(id)
write_string(arg)
message_end();
}
}
return PLUGIN_CONTINUE;
}
bool:is_valid_msg(const arg[]) {
if(arg[0] == '@' || !strlen(arg)) {
return false
}
return true
}
__________________