Download: https://github.com/srpg/chat_tag
Chat commands: color color name and tag tagname
For example color red changes you tag color to red and tag example changes tag to ['Example']Playername:message in chat
Custom chat tag
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: Custom chat tag
I have a couple tips for you, if you are interested. First, line 303 will error in CS:GO since the variable naco is only defined in the else clause (variable is named team_color, which does seem more appropriate anyway, for CS:GO):
https://github.com/srpg/chat_tag/blob/m ... #L297-L303
I would definitely recommend using proper names for variables instead of naco/chco. As line 7 of the Zen of Python states: "Readability counts".
I also created a similar plugin a while back:
https://github.com/satoon101/ChatPrefix
My plugin doesn't allow tags to be changed on the fly, so there are obvious differences between the two plugins. It hooks the usermessage itself instead of using a SayFilter, which will catch all of the intended recipients and the specific message formatting with location (when applicable). Feel free to use it as a guide and ask any questions if you have any.
I would also highly recommend using SayCommand or TypedSayCommand instead of a SayFilter for tag/color. Here is a more detailed tutorial about TypedSayCommand:
http://wiki.sourcepython.com/developing ... mands.html
If you need any examples of SayCommand, just search the forums.
I would also recommend building your menu once instead of every single time someone uses the 'color' command. Also, definitely look into f-strings in Python, they're much cleaner than using %s everywhere.
https://github.com/srpg/chat_tag/blob/m ... #L297-L303
I would definitely recommend using proper names for variables instead of naco/chco. As line 7 of the Zen of Python states: "Readability counts".
I also created a similar plugin a while back:
https://github.com/satoon101/ChatPrefix
My plugin doesn't allow tags to be changed on the fly, so there are obvious differences between the two plugins. It hooks the usermessage itself instead of using a SayFilter, which will catch all of the intended recipients and the specific message formatting with location (when applicable). Feel free to use it as a guide and ask any questions if you have any.
I would also highly recommend using SayCommand or TypedSayCommand instead of a SayFilter for tag/color. Here is a more detailed tutorial about TypedSayCommand:
http://wiki.sourcepython.com/developing ... mands.html
If you need any examples of SayCommand, just search the forums.
I would also recommend building your menu once instead of every single time someone uses the 'color' command. Also, definitely look into f-strings in Python, they're much cleaner than using %s everywhere.
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: Custom chat tag
satoon101 wrote:I have a couple tips for you, if you are interested. First, line 303 will error in CS:GO since the variable naco is only defined in the else clause (variable is named team_color, which does seem more appropriate anyway, for CS:GO):
https://github.com/srpg/chat_tag/blob/m ... #L297-L303
I would definitely recommend using proper names for variables instead of naco/chco. As line 7 of the Zen of Python states: "Readability counts".
I also created a similar plugin a while back:
https://github.com/satoon101/ChatPrefix
My plugin doesn't allow tags to be changed on the fly, so there are obvious differences between the two plugins. It hooks the usermessage itself instead of using a SayFilter, which will catch all of the intended recipients and the specific message formatting with location (when applicable). Feel free to use it as a guide and ask any questions if you have any.
I would also highly recommend using SayCommand or TypedSayCommand instead of a SayFilter for tag/color. Here is a more detailed tutorial about TypedSayCommand:
http://wiki.sourcepython.com/developing ... mands.html
If you need any examples of SayCommand, just search the forums.
I would also recommend building your menu once instead of every single time someone uses the 'color' command. Also, definitely look into f-strings in Python, they're much cleaner than using %s everywhere.
Thanks for the tips, i just updated the code fix for csgo.
I also changed code use f-strings instead use %s.
Here can see the commit
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: Custom chat tag
Update:
- Fixed sending too many times a message when is more than 1 player at the server.
- Fixed sending too many times a message when is more than 1 player at the server.
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: Custom chat tag
How to change color of players name ?, like {EXILE}™GuitarSlayer in red.
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: Custom chat tag
daren adler wrote:How to change color of players name ?, like {EXILE}™GuitarSlayer in red.
You can't, i didn't make players name color changeable.
Only things can change is tag and tag color
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: Custom chat tag
OK, np, works good.
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: Custom chat tag
Does the database save correctly in hl2dm?
Since it only get saved when player disconnect and round end.
If doesn't save correctly then i can make update to ensure to save database.
Since it only get saved when player disconnect and round end.
If doesn't save correctly then i can make update to ensure to save database.
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: Custom chat tag
I do know that when i leave and come back my stuff stays the same. other then that i dont know,,i do know that i got no menu that comes up or anything
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: Custom chat tag
daren adler wrote:I do know that when i leave and come back my stuff stays the same. other then that i dont know,,i do know that i got no menu that comes up or anything
I just made update that ensures now when player change tag/tag color the database is saved.
In github can download the update i just made
Edit:
I just noticed my small mistake, that i just fixed
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: Custom chat tag
OK. ty
Who is online
Users browsing this forum: No registered users and 4 guests