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)

Karotte 03-03-2014 21:35

Re: [INC] Colors (1.0.5)
 
okay, but how is it possible then, that only i am able to see the other colors, when only i have it on my computer?

"on the computer that is doing the compiling" i cant compile it from sourcemod/compiler.php?

computer= my computer? xD i got colors.inc and morecolors.inc on my desktop btw

i go to bed now, its 3:35 AM, gonna read your message later, Thanks anyways

ddhoward 03-03-2014 21:38

Re: [INC] Colors (1.0.5)
 
Wow.


The server doesn't need the include file, as all the information on how to make colors GETS COMPILED INTO THE SMX. Once the SMX is created, the include is no longer needed for anything to function. All the "how do i colors" info that the plugin needs is IN THE PLUGIN.

Quote:

i cant compile it from sourcemod/compiler.php?
No.

Karotte 03-04-2014 06:08

Re: [INC] Colors (1.0.5)
 
3 Attachment(s)
okay thanks, how can i compile it then without the sourcemod compiler?

EDIT: i downloaded sourcemo 1.5.2 on my computer, went to sourcemod/scripting, added anticamp.sp. In include i added morecolors.inc. Then windows+R - cmd in scripting spcomp.exe anticamp.sp

*see attachment*

this is my new compiled anticamp.sp

*see attachment*

at this point, after cmd says, its compiled, morecolors.inc should be included or? If yes, then i tried to go to translations folder and added {cyan} or {olive}. But now the FULL message ingame is {DEFAULT}. Without the changes, the original anticamp.sp, its teamcolor and green in the message.

Ellie 03-14-2014 12:30

Re: [INC] Colors (1.0.5)
 
Hey, I was debating whether using this include or more colors. More colors works great with TF2 which I tested, but it doesn't work for non-source 2009 games like L4D2 (which is unbelievable since L4D2 was released in 2009 and is a source game). However, it has some stocks maybe that can be added to colors.inc such as:

Code:

/**
 * Shows admin activity with colors
 * 
 * @param client        Client performing an action
 * @param message        Message (formatting rules)
 * @noreturn
 */
stock CShowActivity(client, const String:message[], any:...)

/**
 * Shows admin activity with colors
 * 
 * @param client        Client performing an action
 * @param tag            Tag to prepend to the message (color tags supported)
 * @param message        Message (formatting rules)
 * @noreturn
 */
stock CShowActivityEx(client, const String:tag[], const String:message[], any:...)

/**
 * Shows admin activity with colors
 * 
 * @param client        Client performing an action
 * @param tag            Tag to prepend to the message (color tags supported)
 * @param message        Message (formatting rules)
 * @noreturn
 */
stock CShowActivity2(client, const String:tag[], const String:message[], any:...)

Can someone add those to colors.inc please :)

Powerlord 03-14-2014 15:03

Re: [INC] Colors (1.0.5)
 
Quote:

Originally Posted by Ellie (Post 2111397)
Hey, I was debating whether using this include or more colors. More colors works great with TF2 which I tested, but it doesn't work for non-source 2009 games like L4D2 (which is unbelievable since L4D2 was released in 2009 and is a source game). However, it has some stocks maybe that can be added to colors.inc such as:

Code:

/**
 * Shows admin activity with colors
 * 
 * @param client        Client performing an action
 * @param message        Message (formatting rules)
 * @noreturn
 */
stock CShowActivity(client, const String:message[], any:...)

/**
 * Shows admin activity with colors
 * 
 * @param client        Client performing an action
 * @param tag            Tag to prepend to the message (color tags supported)
 * @param message        Message (formatting rules)
 * @noreturn
 */
stock CShowActivityEx(client, const String:tag[], const String:message[], any:...)

/**
 * Shows admin activity with colors
 * 
 * @param client        Client performing an action
 * @param tag            Tag to prepend to the message (color tags supported)
 * @param message        Message (formatting rules)
 * @noreturn
 */
stock CShowActivity2(client, const String:tag[], const String:message[], any:...)

Can someone add those to colors.inc please :)

To get these working correctly requires a bit of effort. For example, just by looking at the code, I can tell you that translations don't work properly with morecolors.inc's CShowActivity functions simply because formatting is done before passing the message on to a function that sends messages to all players (this is why CPrintToChatAll manually loops through players one by one rather and does formatting there than just calling CPrintToChat for each player in colors.inc and morecolors.inc).

To do it properly is a bit of effort, because you have to essentially duplicate what SourceMod is doing for each of these functions. While not impossible, it's a bit of a pain, especially since only natives can pass ... parameters to other functions... because ShowActivity and ShowActivityEx are essentially the same function.

Sometimes I think Colors and MoreColors should just be plugins to deal with this sort of thing, but then you'd only be able to have one or the other loaded at a time.

Powerlord 03-14-2014 16:07

Re: [INC] Colors (1.0.5)
 
4 Attachment(s)
If you really want it, though, I've included a version here which duplicates what SourceMod does with ShowActivity.

While I was at it, I fixed a bug in ReplyToCommand not setting the translation target correctly and also added ReplyToCommandEx.

None of these has actually been tested, though.

colors-tester.smx is a quick plugin to test the CShowActivity, CShowActivityEx, and CShowActivity2 responses. Note that {teamcolor} is set to the client argument's color since it's logging what they are doing.

Powerlord 03-15-2014 02:15

Re: [INC] Colors (1.0.5)
 
3 Attachment(s)
The copy from my previous post was missing some color tag stripping before printing to the server or the console in the ShowActivity things. Whoops.

Still not thoroughly tested.

Ellie 03-15-2014 04:04

Re: [INC] Colors (1.0.5)
 
Quote:

Originally Posted by Powerlord (Post 2111467)
To get these working correctly requires a bit of effort. For example, just by looking at the code, I can tell you that translations don't work properly with morecolors.inc's CShowActivity functions simply because formatting is done before passing the message on to a function that sends messages to all players (this is why CPrintToChatAll manually loops through players one by one rather and does formatting there than just calling CPrintToChat for each player in colors.inc and morecolors.inc).

To do it properly is a bit of effort, because you have to essentially duplicate what SourceMod is doing for each of these functions. While not impossible, it's a bit of a pain, especially since only natives can pass ... parameters to other functions... because ShowActivity and ShowActivityEx are essentially the same function.

Yeah I was thinking this is why it hadn't been done before. And yes I do want it :D


Quote:

Originally Posted by Powerlord (Post 2111467)
Sometimes I think Colors and MoreColors should just be plugins to deal with this sort of thing, but then you'd only be able to have one or the other loaded at a time.

I had actually tested both includes with TF2 separately and then together just as a test, colors.inc always takes priority and morecolors.inc doesn't work. Well with Source 2009 games morecolors.inc is definitely the way to go, and all other games with colors.inc. I needed those stocks mainly for L4D2 since morecolors doesn't work with it. Who do we have to annoy, I mean ask, at Valve to have hex color codes added to L4D2 (the only actual source game released in 2009)?


Quote:

Originally Posted by Powerlord (Post 2111644)
The copy from my previous post was missing some color tag stripping before printing to the server or the console in the ShowActivity things. Whoops.

Still not thoroughly tested.

Many thank yous. :) I will test it and get back to you. Although I think it would be a good idea to remove the links from the older version and just point to your post below it.

Ellie 03-26-2014 12:52

Re: [INC] Colors (1.0.5)
 
Quote:

Originally Posted by Powerlord (Post 2111644)
The copy from my previous post was missing some color tag stripping before printing to the server or the console in the ShowActivity things. Whoops.

Still not thoroughly tested.


Ok been testing this with multiple plugins and it seems to have trouble with translations and ends up not printing anything. I used the slap.sp with playercommands from sourcemod as one of my tests and got this:

Code:

L 03/25/2014 - 11:29:56: [SM] Plugin encountered error 4: Invalid parameter or parameter type
L 03/25/2014 - 11:29:56: [SM] Native "VFormat" reported: Language phrase "%t" not found
L 03/25/2014 - 11:29:56: [SM] Displaying call stack trace for plugin "playercommands.smx":
L 03/25/2014 - 11:29:56: [SM]  [0]  Line 833, C:\Program Files\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\include\colors.inc::CShowActivity2()
L 03/25/2014 - 11:29:56: [SM]  [1]  Line 113, playercommands/slay.sp::MenuHandler_Slay()

The printochats and replytocommands work fine, it's just the showactivity ones not working.

Powerlord 03-26-2014 16:06

Re: [INC] Colors (1.0.5)
 
2 Attachment(s)
Quote:

Originally Posted by Ellie (Post 2116188)
Ok been testing this with multiple plugins and it seems to have trouble with translations and ends up not printing anything. I used the slap.sp with playercommands from sourcemod as one of my tests and got this:

Code:

L 03/25/2014 - 11:29:56: [SM] Plugin encountered error 4: Invalid parameter or parameter type
L 03/25/2014 - 11:29:56: [SM] Native "VFormat" reported: Language phrase "%t" not found
L 03/25/2014 - 11:29:56: [SM] Displaying call stack trace for plugin "playercommands.smx":
L 03/25/2014 - 11:29:56: [SM]  [0]  Line 833, C:\Program Files\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\include\colors.inc::CShowActivity2()
L 03/25/2014 - 11:29:56: [SM]  [1]  Line 113, playercommands/slay.sp::MenuHandler_Slay()

The printochats and replytocommands work fine, it's just the showactivity ones not working.

Looks like I passed the wrong argument to VFormat in CShowActivity2 and CShowActivityEx. Try this.

Edit: Spotted more errors. Fixing really quickly.

Edit 2: Fixed all 4 VFormat calls each for both CShowActivity2 and CShowActivityEx.

NOTE: This version is compiled for Debugging, so it has a lot of extra debugging messages output. I'll probably compile a non-debug version sometime soon (April 1).


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

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