AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [INC] Colors (1.0.5) (https://forums.alliedmods.net/showthread.php?t=96831)

exvel 12-12-2009 14:20

Re: [INC] Colors (1.0.2)
 
Quote:

Originally Posted by xbatista (Post 1013607)
Can you make that we can use more than 1? Or it's impossible?

It is engine limitation. Can't do anything. :(
Quote:

Originally Posted by mrj (Post 1014207)
sure, compilator → no errors

Then I have no idea why it doesn't work for you.
Just tested on my local server, works fine:

[IMG]http://img3.**************/img3/8236/redtext.png[/IMG]
PHP Code:

CPrintToChatAll("{red}Admin cache refreshed"); 


Asgardcfr 12-14-2009 12:19

Re: [INC] Colors (1.0.2)
 
Color {olive} {red} doesn't work with l4d2 with this plugin

only {green} (orange in game) work
someone have already tested ?
Thanks

exvel 12-14-2009 12:44

Re: [INC] Colors (1.0.2)
 
Quote:

Originally Posted by Asgardcfr (Post 1016833)
Color {olive} {red} doesn't work with l4d2 with this plugin

only {green} (orange in game) work
someone have already tested ?
Thanks

Advertisements plugin doesn't use colors.inc.

Asgardcfr 12-14-2009 13:06

Re: [INC] Colors (1.0.2)
 
Text is in white without colors.inc

Orange ({green}) when I put colors.inc
coincidence may be

exvel 12-14-2009 13:54

Re: [INC] Colors (1.0.2)
 
Quote:

Originally Posted by Asgardcfr (Post 1016874)
Text is in white without colors.inc

Orange ({green}) when I put colors.inc
coincidence may be

Read description. Green tag is orange (yellow) in L4D.

From the FAQ:
Quote:

Why red/blue colors sometimes show as green?

There must be at least one player in each team for proper red and blue colors working. Otherwise these tags will be replaced with green

Poheart 12-17-2009 09:57

Re: [INC] Colors (1.0.2)
 
is that support [ShowActivity2] ?

exvel 12-18-2009 15:00

Re: [INC] Colors (1.0.2)
 
Quote:

Originally Posted by Poheart (Post 1019735)
is that support [ShowActivity2] ?

No. It is quite hard to implement. Maybe there will be a such feature in the future.

Master53 12-23-2009 17:41

Re: [INC] Colors (1.0.2)
 
need help with
OverflowMessage(Client, "\x04[RP]\x01 - Press <ESC> to access the menu");

i want to make the [RP] to red how would your or i do this

exvel 12-24-2009 06:12

Re: [INC] Colors (1.0.2)
 
Quote:

Originally Posted by Master53 (Post 1028878)
need help with
OverflowMessage(Client, "\x04[RP]\x01 - Press <ESC> to access the menu");

i want to make the [RP] to red how would your or i do this

PHP Code:

CPrintToChat(client"{red}[RP]{default} - Press <ESC> to access the menu"); 

p.s. remember, this will only works if there will be at least one player in T (Red) team

Master53 12-26-2009 15:51

Re: [INC] Colors (1.0.2)
 
but with cprittochat. it spams the menu. becuse if you select a menu item, it repeats and repeats this. and it gets really anoying and looks unprofesinal

[RP] - Press <ESC> to access the menu

bl4nk 12-26-2009 16:45

Re: [INC] Colors (1.0.2)
 
You're probably putting stuff in the wrong place.

Master53 12-28-2009 12:38

Re: [INC] Colors (1.0.2)
 
IM not. PrintToChat does not have the same effect as OverflowMessage. But i want the coloured chat to be in OverflowMessage.

exvel 12-28-2009 13:03

Re: [INC] Colors (1.0.2)
 
What is OverflowMessage? This is not a documented SM function.

Master53 12-28-2009 13:55

Re: [INC] Colors (1.0.2)
 
yes it is. this is the full ... for it

//////////////////////////////////////////////////////////////////////////////////
stock DrawMenu(Client, String:Buffers[7][64], MenuHandler:MenuHandle, Variables[7] = {0, 0, 0, 0, 0, 0, 0}, String:Title[32])
{

//Declare:
decl Handle:Panel;

//Initialize:
Panel = CreatePanel();

//Print:
OverflowMessage(Client, "\x03[RP]\x04 - Press <ESC> to access the menu");

//Display:
for(new X = 0; X < 7; X++) if(strlen(Buffers[X]) > 0)
{

//Add:
DrawPanelItem(Panel, Buffers[X]);

//Var:
SelectedBuffer[X][Client] = Variables[X];
}
//Title
SetPanelTitle(Panel, Title);

//Draw:
SendPanelToClient(Panel, Client, MenuHandle, 30);

//Close:
CloseHandle(Panel);
}
//////////////////////////////////////////////////////////////////////////////////

exvel 12-28-2009 15:13

Re: [INC] Colors (1.0.2)
 
Where it is from? Third party's code? I still have no idea what is OverflowMessage.

Master53 12-28-2009 15:14

Re: [INC] Colors (1.0.2)
 
its for the roleplay mod

http://forums.alliedmods.net/showthread.php?t=78380

exvel 12-29-2009 09:49

Re: [INC] Colors (1.0.2)
 
well, here is an actual code of OverflowMessage:
PHP Code:

stock OverflowMessage(Client, const String:Contents[255])
{

    
//Anti-Spam:
    
if(GameTime[Client] <= (GetGameTime() - 10))
    {

        
//Print:
        
PrintToChat(ClientContents);

        
//Save:
        
GameTime[Client] = GetGameTime();
    }


it is in the scripting/include/rp_stocks.inc
This is the place where you should change PrintToChat to CPrintToChat.

Master53 12-31-2009 09:44

Re: [INC] Colors (1.0.2)
 
okay thanks

theY4Kman 01-16-2010 12:43

Re: [INC] Colors (1.0.2)
 
I have added this library to Yak's FAQs :)

exvel 01-16-2010 12:53

Re: [INC] Colors (1.0.2)
 
Quote:

Originally Posted by theY4Kman (Post 1057150)
I have added this library to Yak's FAQs :)

Thank you. :)

bshenkd 02-08-2010 13:40

Re: [INC] Colors (1.0.2)
 
This is probably a stupid question, but can I use this with Connect Announce? I want my connect announcements to be in blue. Is this possible?

exvel 02-08-2010 14:03

Re: [INC] Colors (1.0.2)
 
Yes, sure.

bshenkd 02-08-2010 17:40

Re: [INC] Colors (1.0.2)
 
I tried using colors.inc with the connect announce sourcemod plugin, but it's not working.

Code:

"CountryShow"
{
        "messages"
        {
                "playerjoin"                "{BLUE}{PLAYERNAME} [{DEFAULT}{STEAMID}{BLUE}] has connected from ({DEFAULT}{PLAYERCOUNTRYSHORT}{BLUE})."
                "playerdisc"                "{BLUE}{PLAYERNAME} [{DEFAULT}{STEAMID}{BLUE}] has disconnected ({DEFAULT}{DISC_REASON}{BLUE})."
        }
        "messages_admin"
        {
                "playerjoin"                "{BLUE}{PLAYERTYPE} {PLAYERNAME} [{DEFAULT}{STEAMID}{BLUE}] has connected from ({DEFAULT}{PLAYERCOUNTRYSHORT}{BLUE})."
                "playerdisc"                "{BLUE}{PLAYERTYPE} {PLAYERNAME} [{DEFAULT}{STEAMID}{BLUE}] has disconnected ({DEFAULT}{DISC_REASON}{BLUE})."
        }

Whenever someone connects, it just reads {BLUE} as if it was normal text and not changing the color to blue.

theY4Kman 02-08-2010 18:44

Re: [INC] Colors (1.0.2)
 
How are you "using colors.inc with the connect announce sourcemod plugin"? For the colors to work, the plug-in must be rewritten to use the colors.inc functions (for example, by changing PrintToChatAll to CPrintToChatAll).

DieterM75 02-11-2010 14:00

Re: [INC] Colors (1.0.2)
 
hm my text does not even get blue nor read, simply LIGHTGREEN :/

PrintToChatAll ("\x01 1 .. \x02 2 .. \x03 3 .. \x04 4 .. \x05 5 .. \x06 6 .. \x07 7 .. \x08 8");

this neither.
mod is counterstrike source

exvel 02-11-2010 14:32

Re: [INC] Colors (1.0.2)
 
Quote:

Originally Posted by DieterM75 (Post 1085697)
hm my text does not even get blue nor read, simply LIGHTGREEN :/

PrintToChatAll ("\x01 1 .. \x02 2 .. \x03 3 .. \x04 4 .. \x05 5 .. \x06 6 .. \x07 7 .. \x08 8");

this neither.
mod is counterstrike source

Post the code.

DieterM75 02-11-2010 14:46

Re: [INC] Colors (1.0.2)
 
PrintToChat(client,"\x04[VIP-Message] \x03%s\x01: \x03%s", name, text[startidx+1]);

this should print blue text on the %s if i am ct, but it does not.
colors.inc doesnt format anything just repeats the text

#include <colors>
...
CPrintToChatAll("{GREEN}[VIP-Message]{TEAMCOLOR}%s{DEFAULT}:{TEAMCOLOR}%s",name,te xt);


//EDIT: this works like a charm...

stock SayText2All(author, const String:message[])
{
new Handle:buffer = StartMessageAll("SayText2");
if ( buffer != INVALID_HANDLE )
{
BfWriteByte(buffer, author);
BfWriteByte(buffer, true);
BfWriteString(buffer, message);
EndMessage();
}
}

exvel 02-11-2010 15:23

Re: [INC] Colors (1.0.2)
 
You should use CPrintToChatAllEx.

crazytina 02-14-2010 14:50

Re: [INC] Colors (1.0.2)
 
sorry if sound dume but were you put it ??? ^^ for give me

exvel 02-15-2010 04:17

Re: [INC] Colors (1.0.2)
 
Quote:

5. How to install it?

Put colors.inc into sourcemod/scripting/include folder.
Add this into the code:
PHP Code:

#include <colors> 



kiwi87 02-15-2010 05:25

Re: [INC] Colors (1.0.2)
 
I love the idea of being able to set the colors in the plugins i use but i'm having a problem using CPrintToAllChatEx.
CPrintToAllChat works fine though. :)

Whenever i use CPrintToAllChatEx it gives me :
error 035: argument type mismatch <argument 1>

case 2:
{
if(IsFakeClient(playerClient))
return Plugin_Continue;

CPrintToChatAllEx("{green}%N {teamcolor}joined Survivor Team.", playerClient)
}

What extra steps do i have to do to make Ex work? Teamcolor is pretty useful :)

exvel 02-15-2010 05:53

Re: [INC] Colors (1.0.2)
 
You've forgot to specify argument "author". If you want {teamcolor} to be the same color as "playerClient" you should use it like that:
PHP Code:

CPrintToChatAllEx(playerClient"{green}%N {teamcolor}joined Survivor Team."playerClient); 


kiwi87 02-15-2010 08:14

Re: [INC] Colors (1.0.2)
 
Quote:

Originally Posted by exvel (Post 1089412)
You've forgot to specify argument "author". If you want {teamcolor} to be the same color as "playerClient" you should use it like that:
PHP Code:

CPrintToChatAllEx(playerClient"{green}%N {teamcolor}joined Survivor Team."playerClient); 


Works great now, thanks! :mrgreen:

kiwi87 02-15-2010 08:57

Re: [INC] Colors (1.0.2)
 
Hello again,
Whats wrong here, i got the same error >.<

error 035: argument type mismatch <argument 1>

if (Mode > 2)
{
GetClientName(Attacker, AttackerName, sizeof(AttackerName));
CPrintToChatAllEx(AttackerName,"\x04[\x03RANK\x04] {teamcolor}%s \x01has earned \x04%i \x01points for killing%s \x05%s\x01!", AttackerName, Score, (VictimIsBot ? " a" : ""), VictimName);
}

exvel 02-15-2010 11:58

Re: [INC] Colors (1.0.2)
 
First argument should be an integer (number - that is client's index) but you have specified a player's name (string).
Also you don't have to use \x0.. codes, use color tags.

kexz 03-01-2010 14:15

Re: [INC] Colors (1.0.2)
 
Just a heads up for those using colors in uppercase - colors.inc converts string color codes only if all letters are in lower case! This should be probably fixed...

Greyscale 03-01-2010 14:30

Re: [INC] Colors (1.0.2)
 
Easy fix exvel;

Code:

native ReplaceString(String:text[], maxlength, const String:search[], const String:replace[], bool:caseSensitive=true);

psychonic 03-01-2010 14:32

Re: [INC] Colors (1.0.2)
 
Quote:

Originally Posted by kexz (Post 1104566)
Just a heads up for those using colors in uppercase - colors.inc converts string color codes only if all letters are in lower case! This should be probably fixed...

What needs fixed about it? The first post documents the tags that work. Upper case is not mentioned anywhere so there is no reason to suspect it would work. Doing a case insensitive check would just slow down the replacements.

Greyscale 03-01-2010 15:23

Re: [INC] Colors (1.0.2)
 
Since in a lot of cases the end user is using these tags, I would make them case insensitive. It would be a different story if it were for developers only.

Copying files is hard enough for some server admins.

exvel 03-03-2010 11:52

Re: [INC] Colors (1.0.2)
 
I'll add a bool to determine if it must be case sensitive or not. =)


All times are GMT -4. The time now is 22:58.

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