bool resetCustomTag(NetUser netuser) { if (getCP(netuser) is ChatPerson) { ChatPerson cp = (ChatPerson)getCP(netuser); cp.UpdateTag(); return(true); } return(false); }
bool resetDisplayName(NetUser netuser) { if (getCP(netuser) is ChatPerson) { ChatPerson cp = (ChatPerson)getCP(netuser); cp.displayName = netuser.displayName; cp.UpdateTag(); return(true); } return(false); }
bool resetSuffix(NetUser netuser) { if (getCP(netuser) is ChatPerson) { ChatPerson cp = (ChatPerson)getCP(netuser); cp.suffix = ""; cp.suffix_pr = 0; cp.UpdateTag(); return(true); } return(false); }
bool setSuffix(NetUser netuser, string suffix, int priority = 0) { if (getCP(netuser) is ChatPerson) { ChatPerson cp = (ChatPerson)getCP(netuser); if (priority >= cp.suffix_pr) { cp.suffix = suffix; cp.suffix_pr = priority; cp.UpdateTag(); return(true); } } return(false); }
bool OnPlayerChat(NetUser netuser, string message) { object obj = Interface.CallHook("ChatAPIPlayerChat", netuser, message); bool strip = true; if (obj is bool) { if ((bool)obj == false) { return(false); } } if (obj is string) { message = (string)obj; strip = false; } else { message = StripBBCode(message); } object cl = getCP(netuser); if (cl is bool) { return(false); } ChatPerson cp = (ChatPerson)cl; if (cp == null) { return(false); } string msg = string.Format(FormatMessage, cp.chatcolor, message).Trim(); string ctag = cp.tag; if (ctag == null) { cp.UpdateTag(); ctag = cp.tag; } if (cp.listenersplugin != null && cp.listoflisteners.Any()) { foreach (NetUser listener in cp.listoflisteners.ToList()) { if (listener == null) { continue; } rust.SendChatMessage(listener, ctag, msg); } } else { rust.BroadcastChat(ctag, msg); } Puts(ctag + " " + StripBBCode(message)); return(true); }