Raised This Month: $ Target: $400
 0% 

[Help] Colored Chat & Code Feedback


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LegacyCode
Member
Join Date: Apr 2017
Old 04-10-2017 , 13:39   [Help] Colored Chat & Code Feedback
Reply With Quote #1

Hello World,

I've gone through some plugins, trying to understand them. For practice I've started to work on a chat plugin, you can find the code below.

My problem is that coloring the "all" chat (#Cstrike_Chat_All) doesn't work, only team messages work.

Screenshots:




Also I copied code from here and there, trying to rewrite some of it the way I would've done it with my current knowledge.

I would love some feedback of what I did wrong and where I can improve the current code.

Thanks for your time!

- LegacyCode

//e: source code:
Spoiler
Attached Files
File Type: sma Get Plugin or Get Source (chat_testing.sma - 548 views - 4.1 KB)

Last edited by LegacyCode; 04-10-2017 at 15:31. Reason: included source code directly, too
LegacyCode is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-10-2017 , 14:49   Re: [Help] Colored Chat
Reply With Quote #2

Code:
                client_print( 0, print_chat, "^x01Command: %s", g_ChatCmd )                 client_print( 0, print_chat, "^x01Argument: %s", g_ChatArg )
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
LegacyCode
Member
Join Date: Apr 2017
Old 04-10-2017 , 14:58   Re: [Help] Colored Chat
Reply With Quote #3

Quote:
Originally Posted by EFFx View Post
Code:
client_print( 0, print_chat, "^x01Command: %s", g_ChatCmd ) client_print( 0, print_chat, "^x01Argument: %s", g_ChatArg )

Hey man,

that's just a debug part which isn't important to my problem mentioned.

- LegacyCode
LegacyCode is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-10-2017 , 20:09   Re: [Help] Colored Chat & Code Feedback
Reply With Quote #4

Unless there is a very significant reason to write your own color chat, use an existing color chat, no need to reinvent the wheel.
__________________
fysiks is offline
LegacyCode
Member
Join Date: Apr 2017
Old 04-10-2017 , 21:22   Re: [Help] Colored Chat & Code Feedback
Reply With Quote #5

Hey,

the reason is to learn writing and understanding plugins.
Colored chat seemed to be one of the simpler stuff, so I'm going with this one first.

- LegacyCode
LegacyCode is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-11-2017 , 06:01   Re: [Help] Colored Chat & Code Feedback
Reply With Quote #6

Quote:
Originally Posted by LegacyCode View Post
Hey,

the reason is to learn writing and understanding plugins.
Colored chat seemed to be one of the simpler stuff, so I'm going with this one first.

- LegacyCode
Everything is simple just read the documentation files to learn more
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
LegacyCode
Member
Join Date: Apr 2017
Old 04-11-2017 , 09:58   Re: [Help] Colored Chat & Code Feedback
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
Everything is simple just read the documentation files to learn more
Hey,

I don't think the documentation covers everything, otherwise I wouldn't have to guess how to use emessage_* properly. It surely does describe the arguments and what the function does (sometimes not even that, "no description available"), but not when and how to use some stuff. Also it seems to be incomplete for me here and there, e.g. the client_print_color function mentions:

Quote:
Alternatively, a specific team color can be enforced using the print_team_* constants in amxconst.inc
But there are no print_team_* constants.
Correct me if I'm wrong, please, but I'm kinda lost.

//e:
I bet the HL SDK would help me a lot to understand what's going on under the hood, but I don't know how to "use" it to answer the questions I have while coding.

- LegacyCode

Last edited by LegacyCode; 04-11-2017 at 10:13.
LegacyCode is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-11-2017 , 10:22   Re: [Help] Colored Chat & Code Feedback
Reply With Quote #8

Quote:
Alternatively, a specific team color can be enforced using the print_team_* constants in amxconst.inc
Quote:
Originally Posted by LegacyCode View Post
But there are no print_team_* constants.
Correct me if I'm wrong, please, but I'm kinda lost.
What you quoted tells you to look in the Amxconst.inc file. Read it and you will find them, Color types for client_print_color()
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 04-11-2017 at 10:25.
wickedd is offline
LegacyCode
Member
Join Date: Apr 2017
Old 04-11-2017 , 10:40   Re: [Help] Colored Chat & Code Feedback
Reply With Quote #9

Quote:
Originally Posted by wickedd View Post
What you quoted tells you to look in the Amxconst.inc file. Read it and you will find them, Color types for client_print_color()
Seems like my *.inc files are outdated, although I downloaded the latest stable AMXX. Weird, thanks for the heads up.

//e:
v1.8.2 doesn't seem to be the latest version then. Is the stable version not the one I want for developing plugins?

- LegacyCode

Last edited by LegacyCode; 04-11-2017 at 10:43.
LegacyCode is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-11-2017 , 10:45   Re: [Help] Colored Chat & Code Feedback
Reply With Quote #10

That's because they are not in 1.8.2 the latest stable version. They were added in 1.8.3.

Dev Build
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 04-11-2017 at 10:52.
wickedd is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode