AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] Colored Chat & Code Feedback (https://forums.alliedmods.net/showthread.php?t=296032)

LegacyCode 04-10-2017 13:39

[Help] Colored Chat & Code Feedback
 
1 Attachment(s)
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:
http://i.imgur.com/QeMZUrx.jpg
http://i.imgur.com/VdY2u32.jpg


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

EFFx 04-10-2017 14:49

Re: [Help] Colored Chat
 
Code:
                client_print( 0, print_chat, "^x01Command: %s", g_ChatCmd )                 client_print( 0, print_chat, "^x01Argument: %s", g_ChatArg )

LegacyCode 04-10-2017 14:58

Re: [Help] Colored Chat
 
Quote:

Originally Posted by EFFx (Post 2511016)
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

fysiks 04-10-2017 20:09

Re: [Help] Colored Chat & Code Feedback
 
Unless there is a very significant reason to write your own color chat, use an existing color chat, no need to reinvent the wheel.

LegacyCode 04-10-2017 21:22

Re: [Help] Colored Chat & Code Feedback
 
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

Natsheh 04-11-2017 06:01

Re: [Help] Colored Chat & Code Feedback
 
Quote:

Originally Posted by LegacyCode (Post 2511116)
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

LegacyCode 04-11-2017 09:58

Re: [Help] Colored Chat & Code Feedback
 
Quote:

Originally Posted by Natsheh (Post 2511177)
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

wickedd 04-11-2017 10:22

Re: [Help] Colored Chat & Code Feedback
 
Quote:

Alternatively, a specific team color can be enforced using the print_team_* constants in amxconst.inc
Quote:

Originally Posted by LegacyCode (Post 2511231)
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()

LegacyCode 04-11-2017 10:40

Re: [Help] Colored Chat & Code Feedback
 
Quote:

Originally Posted by wickedd (Post 2511235)
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

wickedd 04-11-2017 10:45

Re: [Help] Colored Chat & Code Feedback
 
That's because they are not in 1.8.2 the latest stable version. They were added in 1.8.3.

Dev Build


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

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