Page 1 of 1

Custom chat tag

Posted: Mon Jan 11, 2021 3:36 pm
by cssbestrpg
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

Re: Custom chat tag

Posted: Wed Oct 20, 2021 2:17 pm
by satoon101
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.

Re: Custom chat tag

Posted: Wed Oct 20, 2021 4:54 pm
by cssbestrpg
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

Re: Custom chat tag

Posted: Sat Oct 23, 2021 7:26 pm
by cssbestrpg
Update:
- Fixed sending too many times a message when is more than 1 player at the server.

Re: Custom chat tag

Posted: Tue Oct 26, 2021 10:33 pm
by daren adler
How to change color of players name ?, like {EXILE}â„¢GuitarSlayer in red.

Re: Custom chat tag

Posted: Wed Oct 27, 2021 4:34 am
by cssbestrpg
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

Re: Custom chat tag

Posted: Wed Oct 27, 2021 6:49 am
by daren adler
OK, np, works good.

Re: Custom chat tag

Posted: Wed Oct 27, 2021 7:28 am
by cssbestrpg
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.

Re: Custom chat tag

Posted: Wed Oct 27, 2021 2:59 pm
by daren adler
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

Re: Custom chat tag

Posted: Wed Oct 27, 2021 3:35 pm
by cssbestrpg
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

Re: Custom chat tag

Posted: Wed Oct 27, 2021 10:29 pm
by daren adler
OK. ty