ACMD(setcolor) {
unsigned short msg_len = 1;
char mout[40];
unsigned char cc = script->add_str("CHAT_COLOR$");
if( !message || !*message ) {
clif->message(fd, "Usage: @setcolor <color>");
clif->message(fd, "<color> must be in hex format. Starting with 0x");
clif->message(fd, "Example: @color 0x00FF00");
return 0;
//if(pc_readglobalreg_str(sd,script->add_str("CHAT_COLOR$")) = "") {
// clif->message(fd, "Defaulting your color to green.");
// sd->fontcolor = 0;
// return 1;
//}
}
if( message[0] == '0' ) {
sd->fontcolor = 0;
return true;
}
pc_setglobalreg_str(sd, cc, message);
sd->fontcolor = pc_readglobalreg_str(sd, cc);
//sd->fontcolor = pc_readglobalreg_str(sd, cc);
msg_len += sprintf(mout, "Color changed to '%s'", cc);
WFIFOHEAD(fd,msg_len + 12);
WFIFOW(fd,0) = 0x2C1;
WFIFOW(fd,2) = msg_len + 12;
WFIFOL(fd,4) = 0;
WFIFOL(fd,8) = sd->fontcolor;
safestrncpy((char*)WFIFOP(fd,12), mout, msg_len);
WFIFOSET(fd, msg_len + 12);
return true;
}