Raised This Month: $12 Target: $400
 3% 

multilang message


Post New Thread Reply   
 
Thread Tools Display Modes
Mankled
Senior Member
Join Date: Oct 2019
Old 10-14-2019 , 23:53   Re: multilang message
Reply With Quote #11

Quote:
Originally Posted by fysiks View Post
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,
iceeedr's code didn't work.


how can i print direcly to the players, the code is making a loop where i want to put ML
entire plugin:
PHP Code:
#include <amxmodx>

#define    PLUGIN    "Connect Announce"
#define    VERSION    "0.2"
#define    AUTHOR    "v3x"

new g_iMsgSayTextg_szSoundFile[] = "buttons/blip1.wav";

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_dictionary("connect_annouce.txt")
    
g_iMsgSayText get_user_msgid("SayText");
}

public 
plugin_precache()
{
    
precache_sound(g_szSoundFile);
}

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(
0iNumi++)
    {
        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;

line where i want to put ML
PHP Code:
format(szMessage163"^x04%s (^x01%s^x04) Connected!!!"szUserName szAuthID); 

@EDIT
maybe i can put ML like this. Does it look a good code ?
PHP Code:
client_printcolor(0,"!g%s (!y%s!g) %L"szUserName szAuthIDLANG_PLAYER"ANNOUNCE"); 

Last edited by Mankled; 10-15-2019 at 00:16.
Mankled is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-15-2019 , 12:25   Re: multilang message
Reply With Quote #12

Change LANG_PLAYER to player index.
__________________








CrazY. is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 10-15-2019 , 13:14   Re: multilang message
Reply With Quote #13

Quote:
Originally Posted by CrazY. View Post
Change LANG_PLAYER to player index.
it didn't work properly, when my ML is set to EN, that messase is printing in another languangue EX: RU(Russian)
Mankled is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-15-2019 , 15:05   Re: multilang message
Reply With Quote #14

Quote:
Originally Posted by CrazY. View Post
Change LANG_PLAYER to player index.
No. When the receiver's index is 0, you use LANG_PLAYER. But, "client_printcolor" is a custom function that probably doesn't support LANG_PLAYER, so he needs to loop all players and send the message to every "id" and use the same "id" instead of LANG_PLAYER.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-15-2019 , 21:30   Re: multilang message
Reply With Quote #15

You combine this

Quote:
Originally Posted by iceeedr View Post
PHP Code:
new TranslatedMessage[164]
    
formatex(TranslatedMessagecharsmax(TranslatedMessage), "%L"LANG_PLAYER"yourmessagename"szUserName szAuthID
and this
Quote:
Originally Posted by OciXCrom View Post
You would use the player's index instead of LANG_PLAYER.
(though you'd need to change "TranslatedMessage" to "szMessage" if you want it to fit into the exiting code)

Don't make things hard on yourself by trying to add color into it before you get the multi-lingual stuff working. Once you get this working you can easily replace the message_begin/message_end part with any custom client_print() like color chat.
__________________
fysiks is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 10-15-2019 , 23:16   Re: multilang message
Reply With Quote #16

Quote:
Originally Posted by fysiks View Post
You combine this


and this


(though you'd need to change "TranslatedMessage" to "szMessage" if you want it to fit into the exiting code)

Don't make things hard on yourself by trying to add color into it before you get the multi-lingual stuff working. Once you get this working you can easily replace the message_begin/message_end part with any custom client_print() like color chat.
it didn't work too, i put like this:
PHP Code:
        new szMessage[164]
        
formatex(szMessagecharsmax(szMessage), "%s (%s) %L"szUserName szAuthIDid"ANNOUNCE"
Mankled is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-16-2019 , 15:27   Re: multilang message
Reply With Quote #17

Quote:
No. When the receiver's index is 0, you use LANG_PLAYER.


I didn't even look at the code tbh.
__________________









Last edited by CrazY.; 10-16-2019 at 15:29.
CrazY. is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-16-2019 , 15:29   Re: multilang message
Reply With Quote #18

Quote:
Originally Posted by CrazY. View Post
Code:
No. When the receiver's index is 0, you use LANG_PLAYER.



I didn't even look at the code tbh.
It's 0 in the code he posted.

Quote:
client_printcolor(0,"!g%s (!y%s!g) %L", szUserName , szAuthID, LANG_PLAYER, "ANNOUNCE");
So your comment here is wrong.

Quote:
Change LANG_PLAYER to player index.
But, again - this is a custom function, so he can't use 0 with neither LANG_PLAYER or player index.
__________________

Last edited by OciXCrom; 10-16-2019 at 15:29.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-16-2019 , 15:34   Re: multilang message
Reply With Quote #19

I was talking about this part of the code
Code:
for(i = 0; i < iNum; i++)     {         new x = iPlayers[i];         if(!is_user_connected(x) || is_user_bot(x)) continue;         client_cmd(x, "spk %s", g_szSoundFile);         new szMessage[164];         format(szMessage, 163, "^x04%s (^x01%s^x04) Connected!!!", szUserName , szAuthID);         message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x );         write_byte  ( x );         write_string( szMessage );         message_end ();     }
__________________








CrazY. is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-16-2019 , 16:58   Re: multilang message
Reply With Quote #20

Nevermind then.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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 07:47.


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