Raised This Month: $ Target: $400
 0% 

Info about register_dictionary


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-21-2009 , 13:44   Info about register_dictionary
Reply With Quote #1

I see a bunch of people using register_dictionary, and including text files in their plugins. What does this do? I amxmod funcwiki'd it but it just said that it registers a dictionary, which isnt very informative. I understand they are used to make things multi-lingual(I think), But what do they really do?

P.S. Sorry for making another thread, I just figured if someone searched for this they would find it easier(Like another newbie that needs the answer )
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-21-2009 , 13:57   Re: Info about register_dictionary
Reply With Quote #2

A dictionary file contains a bunch of text tokens for different languages. For example, if I want to translate my previous sentence into French, I would first put this in a dictionary file:

Code:
[en]
HAWK_TALK = A dictionary file contains a bunch of text tokens for different languages.

[fr]
HAWK_TALK = Un dictionaire containez some bullshit and I suck at translating French so fuck this.
Then, I can put this in my plugin:

PHP Code:
client_printidprint_chat"Hawk552: %L"LANG_PLAYER"HAWK_TALK" 
or

PHP Code:
client_printidprint_chat"Hawk552: %L"LANG_SERVER"HAWK_TALK" 
Anyway, your %L token will be replaced with the given dictionary entry. For example, if the server's language is English, but the client's is French, then it'll print to them in French with the first example and English with the second.
__________________

Last edited by Hawk552; 10-21-2009 at 14:33.
Hawk552 is offline
Send a message via AIM to Hawk552
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-21-2009 , 14:09   Re: Info about register_dictionary
Reply With Quote #3

So if I make a dictionary file like this:
Code:
[en]
OML_TALK = Hello!

[fr]
OML TALK = Some french word!
Then made a VERY simple plugin like this:
PHP Code:
/* Sample plugin */
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd"say /talk" "plugin_talk");
    
register_dictionary("dictionary_talk.txt")
}

public 
plugin_talk (id) {
    
client_printidprint_chat"Server says: %L"LANG_PLAYER"OML_TALK"id )

It would do
Quote:
if the server's language is English, but the client's is French, then it'll print to them in French
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-21-2009 , 14:19   Re: Info about register_dictionary
Reply With Quote #4

Yes.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-21-2009 , 14:29   Re: Info about register_dictionary
Reply With Quote #5

Oops, you can scratch that ID stuff. I just looked it up to make sure I was right. I've never used ML before as I think everyone should use English, so you can call me an idiot at this.

LANG_PLAYER seems to only work in functions where an id is passed into them, such as client_print(). Otherwise, you should use LANG_SERVER. There's no id parameter after either of them.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-21-2009 , 14:36   Re: Info about register_dictionary
Reply With Quote #6

Ahh I see so I use:

client_print( id, print_chat, "Hawk552: %L", LANG_PLAYER, "HAWK_TALK" )

Instead the other one?>
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-21-2009 , 14:39   Re: Info about register_dictionary
Reply With Quote #7

Yes.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-21-2009 , 14:44   Re: Info about register_dictionary
Reply With Quote #8

Ok, thanks for your help
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-21-2009 , 14:48   Re: Info about register_dictionary
Reply With Quote #9

It should be client_print( id, print_chat, "Hawk552: %L", id, "HAWK_TALK" ) ; LANG_PLAYER has to be used only when 0 is passed as id.
__________________
Arkshine 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 17:46.


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