Raised This Month: $32 Target: $400
 8% 

multilang message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mankled
Senior Member
Join Date: Oct 2019
Old 10-13-2019 , 14:43   multilang message
Reply With Quote #1

can someone help me to put ML in this code
PHP Code:
public client_authorized(id)
{
    if(
is_user_bot(id)) return PLUGIN_CONTINUE;

    new 
szUserName[33];
    
get_user_name(idszUserName32);

    new 
szAuthID[33];
    
get_user_ip(id szAuthID 32);
    
    new 
iPlayers[32], iNumi;
    
get_players(iPlayersiNum);

    for(
0<= iNumi++)
    {
        new 
iPlayers[i];

        if(!
is_user_connected(x) || is_user_bot(x)) continue;

        
client_cmd(x"spk %s"g_szSoundFile);

        new 
szMessage[164];
        
format(szMessage163"^x04%s (^x01%s^x04) Connected!!!"szUserName szAuthID);

        
message_beginMSG_ONEg_iMsgSayText, {0,0,0}, );
        
write_byte  );
        
write_stringszMessage );
        
message_end ();
    }

    return 
PLUGIN_CONTINUE;

i suck putting ml, i can only put it on client_print

line where i want ML
PHP Code:
format(szMessage163"^x04%s (^x01%s^x04) Connected!!!"szUserName szAuthID); 
Mankled is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 10-13-2019 , 15:22   Re: multilang message
Reply With Quote #2

take a look to this example :
https://forums.alliedmods.net/showpo...72&postcount=4
LearninG is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 10-13-2019 , 15:39   Re: multilang message
Reply With Quote #3

but can i use formatex instead format ?
Mankled is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-13-2019 , 17:31   Re: multilang message
Reply With Quote #4

Sure.

By the way, you have an error on this line.

PHP Code:
for(0<= iNumi++) 


PHP Code:
for(0iNumi++) 
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 10-13-2019 at 17:33.
iceeedr is offline
Send a message via Skype™ to iceeedr
Mankled
Senior Member
Join Date: Oct 2019
Old 10-13-2019 , 18:47   Re: multilang message
Reply With Quote #5

im having some difficulties with ML, i dont understand well, i saw this topic : https://forums.alliedmods.net/showth...ngual+tutorial on comments section YamiKaitou said:
Quote:
Originally Posted by YamiKaitou View Post
Use LANG_SERVER when you want to output the message in the language of the server.
Use LANG_PLAYER when you want to output the message to all users at once (ie, "client_print(0, ...." ) in their language
Use Player Index when you want to output the message to a specific user in their language
ok, everything that he said, i understood.

but fysiks said it:
Quote:
Originally Posted by fysiks View Post
And as a consequence, you cannot use LANG_PLAYER with format functions (format and formatex).
"you cannot use lang_player with format functions (format and formatex)

if i cannot use it, what should i use when i see it:
PHP Code:
format(szMessage163"^x04%s (^x01%s^x04) Connected!!!"szUserName szAuthID); 
Mankled is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-13-2019 , 20:57   Re: multilang message
Reply With Quote #6

You would use the player's index instead of LANG_PLAYER.
Also, you should use "formatex" and "charsmax" almost every time.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Mankled
Senior Member
Join Date: Oct 2019
Old 10-13-2019 , 21:55   Re: multilang message
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
You would use the player's index instead of LANG_PLAYER.
Also, you should use "formatex" and "charsmax" almost every time.
and what about he said here:

Quote:
Originally Posted by fysiks View Post
And as a consequence, you cannot use LANG_PLAYER with format functions (format and formatex).
Mankled is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-14-2019 , 01:13   Re: multilang message
Reply With Quote #8

PHP Code:
new TranslatedMessage[164]
    
formatex(TranslatedMessagecharsmax(TranslatedMessage), "%L"LANG_PLAYER"yourmessagename"szUserName szAuthID

ML File

Code:
[language name]
youmessagename = ^4%s (^1%s^4) Connected!!!
In plugin_init

PHP Code:
register_dictionary("myplugin.txt"
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Mankled
Senior Member
Join Date: Oct 2019
Old 10-14-2019 , 01:42   Re: multilang message
Reply With Quote #9

Quote:
Originally Posted by iceeedr View Post
PHP Code:
new TranslatedMessage[164]
    
formatex(TranslatedMessagecharsmax(TranslatedMessage), "%L"LANG_PLAYER"yourmessagename"szUserName szAuthID

ML File

Code:
[language name]
youmessagename = ^4%s (^1%s^4) Connected!!!
In plugin_init

PHP Code:
register_dictionary("myplugin.txt"

Thank you
Mankled is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-14-2019 , 22:03   Re: multilang message
Reply With Quote #10

Quote:
Originally Posted by iceeedr View Post
PHP Code:
new TranslatedMessage[164]
    
formatex(TranslatedMessagecharsmax(TranslatedMessage), "%L"LANG_PLAYER"yourmessagename"szUserName szAuthID
Perhaps you should read a little bit more closely, you did exactly what you can't do: You can't use LANG_PLAYER with format() or formatex(). You can only use it with client_print() (there might be some others but they have to print directly to the player).

So, in your case,
Quote:
Originally Posted by OciXCrom View Post
You would use the player's index instead of LANG_PLAYER.
__________________

Last edited by fysiks; 10-14-2019 at 22:16.
fysiks 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 04:25.


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