AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Special multilingual (https://forums.alliedmods.net/showthread.php?t=120596)

KadiR 03-06-2010 12:38

Special multilingual
 
I would like to see / know, how this would be with multilingual support.

PHP Code:

format(HUD100"You suck since %s rounds!",Rounds); 


Exolent[jNr] 03-06-2010 12:45

Re: Special multilingual
 
PHP Code:

// print to all
format(HUD100"%L"LANG_PLAYER"LANG_KEY"Rounds);
// print to id
format(HUD100"%L"id"LANG_KEY"Rounds); 


KadiR 03-08-2010 11:49

Re: Special multilingual
 
Works perfectly, can you help me with this also please? :)

PHP Code:

ColorChat(0PINK"^x04The suckest map is: ^x03%s"szMap


Arkshine 03-08-2010 12:34

Re: Special multilingual
 
You have a brain, right ? Is it that hard to reproduce from the xolent's exemple ?!!

KadiR 03-08-2010 12:41

Re: Special multilingual
 
Quote:

Originally Posted by Arkshine (Post 1111881)
Is it that hard to reproduce from the xolent's exemple ?!!

Yes it is. So I would not ask him.

Exolent[jNr] 03-08-2010 17:42

Re: Special multilingual
 
If you use ^x04 or any other colors like that in the ML file, you will have to fix them with the plugin.

Code:
FixMLColor( const szKey[ ], szFixedKey[ ], const iFixedKeyLen ) {     static const szReplaces[ ][ 2 ][ ] =     {         { "^^x04", "^4" },         { "^^x03", "^3" },         { "^^x01", "^1" },         { "^^4", "^4" },         { "^^3", "^3" },         { "^^1", "^1" },         { "!g", "^4" },         { "!t", "^3" },         { "!y", "^1" }     };         copy( szFixedKey, iFixedKeyLen, szKey );         for( new i = 0; i < sizeof( szReplaces ); i++ )     {         replace_all( szFixedKey, iFixedKeyLen, szReplaces[ i ][ 0 ], szReplaces[ i ][ 1 ] );     }         return strlen( szFixedKey ); }

Language file:
Code:

[en]
SUCKEST_MAP = ^x04The suckest map is: ^x03%s
-- or --
SUCKEST_MAP = ^4The suckest map is: ^3%s
-- or --
SUCKEST_MAP = !gThe suckest map is: !t%s

Usage:
Code:
new szMessage[ 192 ]; formatex( szMessage, charsmax( szMessage ), "%L", id, "SUCKEST_MAP", szMap ); FixMLColor( szMessage, szMessage, charsmax( szMessage ) ); message_begin( MSG_ONE, g_iMsgID_SayText, _, id ); write_byte( id ); write_string( szMessage ); message_end( );

KadiR 03-09-2010 01:01

Re: Special multilingual
 
Thanks Exolent, but I am getting some errors:

Quote:

Error: Undefined symbol "id" on line 62:
PHP Code:

formatexszMessagecharsmaxszMessage ), "%L"id"SUCKEST_MAP"szMap ); 

Quote:

Error: Undefined symbol "g_iMsgID_SayText"
PHP Code:

message_beginMSG_ONEg_iMsgID_SayText_id ); 


lazarev 03-09-2010 01:34

Re: Special multilingual
 
PHP Code:

new g_iMsgID_SayText
//===========
//in plugin_init()
//===========
g_iMsgID_SayText get_user_msgid"SayText" ); 


ConnorMcLeod 03-09-2010 02:08

Re: Special multilingual
 
And with id == 0 you have to loop through all players and format the string each time replacing LANG_PLAYER with player ID.

fysiks 03-09-2010 18:41

Re: Special multilingual
 
Quote:

Originally Posted by ConnorMcLeod (Post 1112486)
And with id == 0 you have to loop through all players and format the string each time replacing LANG_PLAYER with player ID.

The variable isn't even defined.

@Kadir, You'll either need to declare and assign "id" or figure out what variable is used as the players' entity number.


All times are GMT -4. The time now is 08:41.

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