#include <amxmodx>
#define PLUGIN "bienvenida"
#define VERSION "1.0"
#define AUTHOR "Alta-Fruta"
new const PREFIX[] = "^4[Alta-Fruta]^1"
new const FORO[] = "www.alta-fruta.net"
new g_welcome
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
server_cmd("amx_pausecfg add ^"%s^"", PLUGIN)
g_welcome = register_cvar("amx_welcomemsg","1")
}
public client_putinserver(id)
{
if (get_pcvar_num(g_welcome))
{
if (!is_user_bot(id))
{
set_task(10.0,"WelcomeMsj", id)
}
}
return;
}
public client_disconnect(id)
{
remove_task(id)
}
public WelcomeMsj(id)
{
new ip[32], name[32], host[32]
get_user_name(id, name, 31)
get_cvar_string("hostname", host, 31)
get_cvar_string("net_address", ip, 31)
ChatColor(id, "%s Bienvenid@ ^4%s^1 a nuestra comunidad. ", PREFIX, name)
ChatColor(id, "%s Estas jugando en: ^4%s", PREFIX, host)
ChatColor(id, "%s La ^4IP^1 de este servidor es: ^4%s", PREFIX, ip)
ChatColor(id, "%s No te olvides de visitar nuestro foro: ^4%s", PREFIX, FORO);
return PLUGIN_HANDLED
}
stock ChatColor(id, const input[], any:...) {
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", "^4"); // Verde
replace_all(msg, 190, "!y", "^1"); // Default
replace_all(msg, 190, "!t", "^3"); // Color del Equipo
if (id) players[0] = id; else get_players(players, count, "ch"); {
for (new i = 0; i < count; i++) {
if (is_user_connected(players[i])) {
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}