12/10/2018, 08:26 PM
buenas tengo este plugin lo que hace es colocarte tag a los admin me funciona bien pero me pueden ayudar a colocarle say de color que a cada tag de admin yo le pueda poner un color diferente en el say y que cuando escriba en say @hola este salga un hud ya que con este plugin no pasa eso
Código PHP:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Color de administradores"
#define VERSION "1.20"
#define AUTHOR "LegeND'"
new g_MsgSayText, g_MaxPlayers, g_AdminTag[33][10]
enum _:Data {
TAG[10],
FLAG
}
new const AdminsTags[][Data] = {
{ "[STAFF]", ADMIN_LEVEL_A },
{ "[ADMIN]", ADMIN_LEVEL_B },
{ "[SOCIO]", ADMIN_LEVEL_C },
{ "[VIP]", ADMIN_LEVEL_D },
{ "[DUEÑA]", ADMIN_LEVEL_E }
}
const SPECT = 3
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say", "cmdSay")
g_MaxPlayers = get_maxplayers()
g_MsgSayText = get_user_msgid("SayText")
}
public client_putinserver(id) {
if(!is_user_admin(id)) {
copy(g_AdminTag[id], charsmax(g_AdminTag[]), "[Jugador]")
return
}
new Flags = get_user_flags(id)
for(new i; i < sizeof AdminsTags; i++) {
if(Flags & AdminsTags[i][FLAG]) {
copy(g_AdminTag[id], charsmax(g_AdminTag[]), AdminsTags[i][TAG])
break;
}
}
}
public cmdSay(id)
{
static Text[192]
read_args(Text, charsmax(Text))
remove_quotes(Text)
replace_all(Text, charsmax(Text), "%", "")
if(!ValidMessage(Text))
return PLUGIN_HANDLED
static Name[32], Alive, Message[192]
get_user_name(id, Name, charsmax(Name))
Alive = is_user_alive(id)
formatex(Message, charsmax(Message), "^x04%s %s^x03%s^x01 : %s", g_AdminTag[id], get_user_team(id) == SPECT ? "^x01*Spectador* " : !Alive ? "^x01*Muerto* " : "", Name, Text)
for( new i = 1; i <= g_MaxPlayers; i++ ) {
if(!is_user_connected(i) || is_user_alive(i) != Alive)
continue;
message_begin(MSG_ONE_UNRELIABLE, g_MsgSayText, _, i)
write_byte(id)
write_string(Message)
message_end()
}
return PLUGIN_HANDLED;
}
ValidMessage(text[]) {
static len, i
len = strlen(text)
if(!len)
return false
for(i = 0; i < len; i++) {
if( text[i] != ' ' ) {
return true
}
}
return false
}