Hola :3 como todos sabrán, existen stock o includes para mandar un mensaje con color, bueno.. no me gusta ninguno así que me arme este xD; soporta todos los colores.. aca les dejo unas imágenes
Saludos :3
- Imágenes
- Inc.-
- Stock
- Ejemplo con Include
Código PHP:
#include <amxmodx>
#include <printf>
#define PLUGIN "Test Stock Chat Color"
#define VERSION "1.0"
#define AUTHOR "[R]ak"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say test", "cmdTest")
register_clcmd("say test2", "cmdTest2")
}
public cmdTest(id) {
printf(id, DEFAULT, "%s Acme Inc.- %s", AUTHOR, PLUGIN) // comun
printf(id, RED, "%s Acme Inc.- %s", AUTHOR, PLUGIN) // rojo
printf(id, BLUE, "%s Acme Inc.- %s", AUTHOR, PLUGIN) // azul
printf(id, GRAY, "%s Acme Inc.- %s", AUTHOR, PLUGIN) // gris
printf(id, GREEN, "^%s Acme Inc.- %s", AUTHOR, PLUGIN) // verde
return PLUGIN_HANDLED
}
public cmdTest2(id) {
printf(id, DEFAULT, "^x04%s^x03 Acme Inc.- ^x01%s", AUTHOR, PLUGIN) // comun
printf(id, RED, "^x04%s^x03 Acme Inc.- ^x01%s", AUTHOR, PLUGIN) // rojo
printf(id, BLUE, "^x04%s^x03 Acme Inc.- ^x01%s", AUTHOR, PLUGIN) // azul
printf(id, GRAY, "^x04%s^x03 Acme Inc.- ^x01%s", AUTHOR, PLUGIN) // gris
printf(id, GREEN, "%s^x03 Acme Inc.- ^x01%s", AUTHOR, PLUGIN) // verde
return PLUGIN_HANDLED
}
- Ejemplo con Stock
Código PHP:
#include <amxmodx>
#define PLUGIN "Test Stock Chat Color"
#define VERSION "1.0"
#define AUTHOR "[R]ak"
enum {
DEFAULT,
RED,
BLUE,
GRAY,
GREEN
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say test", "cmdTest")
register_clcmd("say test2", "cmdTest2")
}
public cmdTest(id) {
printf(id, DEFAULT, "%s Acme Inc.- %s", AUTHOR, PLUGIN) // comun
printf(id, RED, "%s Acme Inc.- %s", AUTHOR, PLUGIN) // rojo
printf(id, BLUE, "%s Acme Inc.- %s", AUTHOR, PLUGIN) // azul
printf(id, GRAY, "%s Acme Inc.- %s", AUTHOR, PLUGIN) // gris
printf(id, GREEN, "^%s Acme Inc.- %s", AUTHOR, PLUGIN) // verde
return PLUGIN_HANDLED
}
public cmdTest2(id) {
printf(id, DEFAULT, "^x04%s^x03 Acme Inc.- ^x01%s", AUTHOR, PLUGIN) // comun
printf(id, RED, "^x04%s^x03 Acme Inc.- ^x01%s", AUTHOR, PLUGIN) // rojo
printf(id, BLUE, "^x04%s^x03 Acme Inc.- ^x01%s", AUTHOR, PLUGIN) // azul
printf(id, GRAY, "^x04%s^x03 Acme Inc.- ^x01%s", AUTHOR, PLUGIN) // gris
printf(id, GREEN, "%s^x03 Acme Inc.- ^x01%s", AUTHOR, PLUGIN) // verde
return PLUGIN_HANDLED
}
stock printf(id, color, const msg[], any:...) {
static Buffer[192], MsgSayText, MsgTeamInfo, Team[11]
if(!MsgSayText) {
MsgTeamInfo = get_user_msgid("TeamInfo")
MsgSayText = get_user_msgid("SayText")
}
vformat(Buffer[1], charsmax(Buffer) - 1, msg, 4)
static const Teams[4][11] = {
"UNASSIGNED",
"TERRORIST",
"CT",
"SPECTATOR"
}
if(color) {
if(color == GREEN) {
Buffer[0] = 0x04
message_begin(MSG_ONE_UNRELIABLE, MsgSayText, _, id)
write_byte(id)
write_string(Buffer)
message_end()
}
else {
Buffer[0] = 0x03
get_user_team(id, Team, charsmax(Team))
message_begin(MSG_ONE_UNRELIABLE, MsgTeamInfo, _, id)
write_byte(id)
write_string(Teams[color])
message_end()
message_begin(MSG_ONE_UNRELIABLE, MsgSayText, _, id)
write_byte(id)
write_string(Buffer)
message_end()
message_begin(MSG_ONE_UNRELIABLE, MsgTeamInfo, _, id)
write_byte(id)
write_string(Team)
message_end()
}
}
else {
Buffer[0] = 0x01
message_begin(MSG_ONE_UNRELIABLE, MsgSayText, _, id)
write_byte(id)
write_string(Buffer)
message_end()
}
}
Saludos :3
Hi Milashkasiya
Soy un #Panda.. Soy solo un tipo que parece #común pero soy todo lo contrario; alguien #atípico en esta sociedad actual
Link
Soy un #Panda.. Soy solo un tipo que parece #común pero soy todo lo contrario; alguien #atípico en esta sociedad actual
Link