Raised This Month: $ Target: $400
 0% 

Color print from language file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
-=hunter=-
Senior Member
Join Date: Jul 2008
Old 02-16-2009 , 06:38   Color print from language file
Reply With Quote #1

Hello all! Can you help me with little problem?
I don't know how to print in chat color message from language file.
Example language file:
Code:
[en]
HELLO = ^x03Hello
Example script file:
Code:
new msg[100];
format(msg,99,"%L",LANG_PLAYER,"HELLO");
message_begin( MSG_ONE, svc_saytext, { 0, 0, 0 }, plr );
write_byte( plr );
write_string( msg );
message_end( );
I can't understand but prints "^x03Hello". I want that prints "Hello" in blue color.
-=hunter=- is offline
Send a message via ICQ to -=hunter=- Send a message via Skype™ to -=hunter=-
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 02-16-2009 , 07:18   Re: Color print from language file
Reply With Quote #2

you have id you dont need to do LANG_PLAYER


format(msg, 99, "^x03%L", plr,"HELLO");

PS: in txt you cant put ^x03 you must put in the format
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
-=hunter=-
Senior Member
Join Date: Jul 2008
Old 02-16-2009 , 08:03   Re: Color print from language file
Reply With Quote #3

Quote:
Originally Posted by AntiBots
PS: in txt you cant put ^x03 you must put in the format
Yes, this is a problem.
If i put ^x03 in format(...,...,...) then server prints fine color text. If i put ^x03 in language file then server prints simple(not color) text
There is a magic method to solve this problem (maybe with help of other function)?

Last edited by -=hunter=-; 02-16-2009 at 08:05.
-=hunter=- is offline
Send a message via ICQ to -=hunter=- Send a message via Skype™ to -=hunter=-
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 02-16-2009 , 08:56   Re: Color print from language file
Reply With Quote #4

with ^^x03 you test?
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
-=hunter=-
Senior Member
Join Date: Jul 2008
Old 02-16-2009 , 09:21   Re: Color print from language file
Reply With Quote #5

I was wrong in first post - server printed x03Hello.
I tested ^^x03, but server prints ^x03
-=hunter=- is offline
Send a message via ICQ to -=hunter=- Send a message via Skype™ to -=hunter=-
Old 02-16-2009, 14:11
xPaw
This message has been deleted by xPaw. Reason: nvm
-=hunter=-
Senior Member
Join Date: Jul 2008
Old 02-18-2009 , 06:43   Re: Color print from language file
Reply With Quote #6

I think that this is a bug of amxmodx so ^n works from lang file but ^x not works.
I solved this problem, but this method not good.
If in lang file to use ,example, ^^x03 then
in script should to add:
Code:
while( contain (msg, "^^x03" ) != -1 )
    	replace(msg,99, "^^x03", "^x03" )
-=hunter=- is offline
Send a message via ICQ to -=hunter=- Send a message via Skype™ to -=hunter=-
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-18-2009 , 06:51   Re: Color print from language file
Reply With Quote #7

Why would you want such replacement to define color ?

It would be more easy to use !g for green color, !t for team color etc.. ( or anything in this way ) Why do you bother with ^x03 and such. -_-
Arkshine is offline
-=hunter=-
Senior Member
Join Date: Jul 2008
Old 02-18-2009 , 07:22   Re: Color print from language file
Reply With Quote #8

arkshine
I tested !g but not works for me
Can you to print your code with !g ? Please
-=hunter=- is offline
Send a message via ICQ to -=hunter=- Send a message via Skype™ to -=hunter=-
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-18-2009 , 07:36   Re: Color print from language file
Reply With Quote #9

Before sending your message just replace the code.

replace(msg,99, "!g", "^x03" )
Arkshine is offline
-=hunter=-
Senior Member
Join Date: Jul 2008
Old 02-18-2009 , 07:42   Re: Color print from language file
Reply With Quote #10

Thanks
-=hunter=- is offline
Send a message via ICQ to -=hunter=- Send a message via Skype™ to -=hunter=-
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 16:52.


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