Hey,
I modified the chat system to give players different chatranks with different colors for my ranking system with SayText2 but I noticed that the console is empty when a player writes something. (Ingame works everything fine, except the chat message into the console)
So how can I actually send something to a clients console? Do i need to use PlayerIter too?
Print to client console?
This should still work: https://github.com/necavi/sp_utils/blob/master/utils.py#L78
Thank you, works!
But before I wanna use that im just asking if its kinda possible that for example SayText2 color codes can be stripped for the console?
I remember that for example es(c).tell it stripped all the color codes for the console
But before I wanna use that im just asking if its kinda possible that for example SayText2 color codes can be stripped for the console?
Code: Select all
FFFFFFfix pls [FF0000ECN Frag [LF1]FFFFFF] : FFFFFFNice record, dude!
I remember that for example es(c).tell it stripped all the color codes for the console
Syntax: Select all
# > Find Colors
re1='(#)' # Any Single Character 1
re2='(\\d+)' # Integer Number 1
re3='(,)' # Any Single Character 2
re4='(\\d+)' # Integer Number 2
re5='(,)' # Any Single Character 3
re6='(\\d+)' # Integer Number 3
rg = re.compile(re1+re2+re3+re4+re5+re6,re.IGNORECASE|re.DOTALL)
m = re.findall(rg,message)
ESC never stripped any colors, because it never sent them to the console. The (non-complete) code you have posted is used to replace occurences like #255,0,0 with the proper color code. Try this:
Syntax: Select all
import re
RE_STRIP_COLORS = re.compile(r'\x07[a-fA-F0-9]{6}|\x08[a-fA-F0-9]{8}')
def strip_colors(msg):
"""Strip all colors starting with \x07 or \x08 from the given string."""
return RE_STRIP_COLORS.sub('', msg)
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 67 guests