Raised This Month: $51 Target: $400
 12% 

Colored Text Commands


Post New Thread Reply   
 
Thread Tools Display Modes
TheHardstyleBro
Senior Member
Join Date: Jun 2012
Location: Netherlands
Old 10-12-2012 , 03:37   Re: Colored Text Commands
Reply With Quote #11

PHP Code:
#include <regex>
#include <scp>
#include <morecolors>
new const String:PLUGIN_VERSION[10] = "1.1.0.SCP";
new 
Handle:hRegex INVALID_HANDLE;

public 
Plugin:myinfo =
{
    
name "[Any] Arbitrary Chat Colours",
    
author "DarthNinja",
    
description "Colours!  Everywhere!",
    
version PLUGIN_VERSION,
    
url "DarthNinja.com"
}

public 
OnPluginStart()
{
    
LoadTranslations("common.phrases");
    
CreateConVar("chatcolours_version"PLUGIN_VERSION"Plugin Version"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
    
hRegex CompileRegex("(#[A-Fa-f0-9]{6})");
}

//Using Simple Chat Processor
public Action:OnChatMessage(&clientHandle:recipientsString:name[], String:message[])
{
    if (!
CheckCommandAccess(client"chat_colour_override"0true))
        return 
Plugin_Continue;    //No access, so leaf it alone

    
decl String:matchedTag[64];
    
decl String:Copy[64];
    while (
MatchRegex(hRegexmessage) > 0)
    {
        
GetRegexSubString(hRegex0matchedTagsizeof(matchedTag));
        new 
location StrContains(messagematchedTag);
        if (
location == -1)
            break; 
// Something bad happened, run away!

        
strcopy(Copysizeof(Copy), matchedTag);
        
        
ReplaceStringEx(Copysizeof(Copy), "#""\x07");
        
CRemoveTags(Copysizeof(Copy));
        
ReplaceStringEx(messageMAXLENGTH_MESSAGEmatchedTagCopy);
    }
    return 
Plugin_Changed;

I think this is more easier

I only added
Original: CRemoveTags to not see the console #FF9201 for example
http://forums.alliedmods.net/showthread.php?t=186784
__________________

Last edited by TheHardstyleBro; 10-12-2012 at 03:38.
TheHardstyleBro is offline
sdz
Senior Member
Join Date: Feb 2012
Old 03-28-2013 , 23:28   Re: Colored Text Commands
Reply With Quote #12

That doesn't work on any Source 2009 Games, from my personal experience, whereas mine works with every Source engine revision based game.(Running SM 1.2+ w/ MM:S). I'll plan to update/rework this plugin ASAP, aswell as removing the "Reasoning" requirement from arg1

Last edited by sdz; 03-28-2013 at 23:30.
sdz is offline
Mayu
SourceMod Donor
Join Date: Feb 2011
Location: Germany
Old 03-29-2013 , 10:52   Re: Colored Text Commands
Reply With Quote #13

Working nice in TF2, i tryed to set the {default} to {teamcolor}, but sadly the plugin isn't compiling.

any chance u could setup a version for tf2 with teamcolored names b4 the colorchat output? right now it's just white^^



greetz

Last edited by Mayu; 03-29-2013 at 10:57.
Mayu is offline
sdz
Senior Member
Join Date: Feb 2012
Old 03-29-2013 , 13:30   Re: Colored Text Commands
Reply With Quote #14

It will work in TF2 Reguardless, and that was going to be a top priority, only second to fixing the quote requirement.
sdz is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 03-31-2013 , 11:52   Re: Colored Text Commands
Reply With Quote #15

A suggestion: As already said, make it a toggle for players. That way they do not have to always type it in. Instead of making a lot of commands, why not one command with the argument as a color?

Does this put the color code into console? If so, remind me and I will give you the code to fix it!

*Edit*

I didn't want to double post, so here we go. I don't know if you want it, but I went ahead and added my suggestions to it. You can do with it what you wish. I removed the MoreColors include (whenever I try to compile it I get errors from the inc file), and I have added what I use in my scripts for color--much the same as MoreColors.

There is 1 command now: sm_color <color|off>. The same colors from the original are there, and I added off to turn it off. When you set a color, every time you type you are using that color. It will automatically filter out things beginning with ! or / (admin commands). I don't know if it showed the color codes in console before, but it doesn't now.

Hope someone enjoys it, lol!
Attached Files
File Type: sp Get Plugin or Get Source (colorchat.sp - 258 views - 4.3 KB)
File Type: smx colorchat.smx (4.8 KB, 112 views)

Last edited by Marcus_Brown001; 03-31-2013 at 12:38.
Marcus_Brown001 is offline
behrentzs
Member
Join Date: Jan 2012
Old 04-12-2013 , 16:40   Re: Colored Text Commands
Reply With Quote #16

The plugin failed to compile. When i try to do it for myself, i get this error.

Code:
/home/groups/sourcemod/upload_tmp/phpV7DeUe.sp(3) : fatal error 120: cannot read from file: "morecolors"

Compilation aborted.
1 Error.

Last edited by behrentzs; 04-12-2013 at 16:40.
behrentzs is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-12-2013 , 16:51   Re: Colored Text Commands
Reply With Quote #17

Quote:
Originally Posted by behrentzs View Post
The plugin failed to compile. When i try to do it for myself, i get this error.

Code:
/home/groups/sourcemod/upload_tmp/phpV7DeUe.sp(3) : fatal error 120: cannot read from file: "morecolors"

Compilation aborted.
1 Error.
Both are because it requires MoreColors.

Incidentally, the compiled plugin is attached to the first post for this reason.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 04-12-2013 at 16:52.
Powerlord 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 21:43.


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