ok i need some help with this... i wanted it to show as it was real chat and not like client_print but i messed it up... i guess i have to use the same event as adminlisten is using but i hopefully dont need that so thats why im asking you guys for help :D
Code:
#include <amxmodx>
#include <amxmisc>
psycholisten_mode() {
new mode[4]
get_cvar_string("pd_listen_mode", mode, 3)
return read_flags(mode)
}
public func(id) { // yes, this is catching say.
new mode = psycholisten_mode()
if (! mode) {
// completely disabled
return PLUGIN_CONTINUE
}
new is_alive = is_user_alive(id)
new team = get_user_team(id)
new command[17]
read_argv(0, command, 16)
new is_team_msg = ! equal(command, "say")
new player_count = get_playersnum()
new players[32]
get_players(players, player_count, "c")
new message2[129]
read_argv(1, message2, 128)
new name[33]
get_user_name(id, name, 32)
// problem somewhere here
new channel[64]
if ( is_team_msg ) {
if ( team == 0 ) channel = "#Cstrike_Chat_Spec"
else if ( team == 1 ) channel = "#Cstrike_Chat_T"
else if ( team == 2 ) channel = "#Cstrike_Chat_CT"
}
else {
if ( is_user_alive(id) ) channel = "#Cstrike_Chat_All"
else channel = "#Cstrike_Chat_AllSpec"
}
// to here
for (new i = 0; i < player_count; i++) {
if ( !is_user_bot(i) ) {
if ( ( mode & 2 ) && ! is_user_alive(players[i]) && is_alive && (! is_team_msg || team == get_user_team(players[i]) ) ) {
// problem somewhere here
message_begin(MSG_ONE, get_user_msgid("SayText"),{0,0,0},players[i])
write_byte(id)
write_string(channel)
write_string(name)
write_string(message2)
message_end()
// to here
}
else if ( ( mode & 1 ) && ( get_user_flags(players[i] ) & ADMIN_LEVEL_B ) ) {
if ( ( is_user_alive(players[i]) && ! is_alive ) || (is_team_msg && team != get_user_team(players[i]))) {
// problem somewhere here
message_begin(MSG_ONE, get_user_msgid("SayText"),{0,0,0},players[i])
write_byte(id)
write_string(channel)
write_string(name)
write_string(message2)
message_end()
// to here
}
}
}
}
return PLUGIN_CONTINUE
}
public plugin_init() {
register_plugin("..." , "...", "...")
register_clcmd("say", "handle_say")
register_clcmd("say_team", "handle_say")
register_cvar("pd_listen_mode", "ab")
}