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

[Req] Execute different say commands for different lang users


Post New Thread Reply   
 
Thread Tools Display Modes
E1_531G
Senior Member
Join Date: Dec 2017
Old 05-19-2019 , 13:25   Re: [Req] Execute different say commands for different lang users
Reply With Quote #11

Quote:
Originally Posted by redivcram View Post
What are the possible values that are being returned? That is not an example.
Language in 2 letters format: en, ru, bg, tr, ro, fr, de, ...
__________________
My English is A0

Last edited by E1_531G; 05-19-2019 at 13:25.
E1_531G is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 05-19-2019 , 13:40   Re: [Req] Execute different say commands for different lang users
Reply With Quote #12

Remember that lang is not set as default unless the player explicitly did so using amx_langmenu or a similar plugin. They might not have this setinfo value.
__________________
gabuch2 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-19-2019 , 14:09   Re: [Req] Execute different say commands for different lang users
Reply With Quote #13

Quote:
Originally Posted by Gabe Iggy View Post
Remember that lang is not set as default unless the player explicitly did so using amx_langmenu or a similar plugin. They might not have this setinfo value.
Which in that case will default to "en".
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 05-19-2019 , 19:45   Re: [Req] Execute different say commands for different lang users
Reply With Quote #14

Since no one else decided to put everything together, here:

PHP Code:
#include <amxmodx> 

#define _MAX_PLAYERS 32 

new g_szUserLang[_MAX_PLAYERS 1][3]; 

public 
plugin_init() { 

    
register_plugin("Just""Another""Test"); 
     
    
register_clcmd("say""cmdHookSay"); 
    
register_clcmd("say_team""cmdHookSay"); 


public 
client_putinserver(id) { 
     
    
get_user_info(id"lang"g_szUserLang[id], 3); 


public 
cmdHookSay(id) {

    new 
szArgs[4], szFormat[4]; 
     
    
read_args(szArgscharsmax(szArgs)); 
    
format(szFormatcharsmax(szFormat), "/%s"g_szUserLang[id]); 
     
    if(
equal(szArgsszFormat)) { 
     
        
// Do stuff... 
    

     
    return 
PLUGIN_CONTINUE


Last edited by redivcram; 05-20-2019 at 17:17.
redivcram is offline
Snake.
Senior Member
Join Date: Jul 2017
Old 05-20-2019 , 15:19   Re: [Req] Execute different say commands for different lang users
Reply With Quote #15

Quote:
Originally Posted by redivcram View Post
Since no one else decided to put everything together, here:

PHP Code:
#include <amxmodx>

#define _MAX_PLAYERS 32

new g_szUserLang[_MAX_PLAYERS 1][3];

public 
plugin_init() {

    
register_plugin("Just""Another""Test");
    
    
register_clcmd("say""cmdHookSay");
    
register_clcmd("say_team""cmdHookSay");
}

public 
client_putinserver(id) {
    
    
get_user_info(id"lang"g_szUserLang[id], charsmax(g_szUserLang[id]);
}

public 
cmdHookSay(id) [

    new 
szArgs[4], szFormat[4];
    
    
get_args(szArgscharsmax(szArgs));
    
format(szFormatcharsmax(szFormat), "/%s"g_szUserLang[id]);
    
    if(
equal(szArgsszFormat)) {
    
        
// Do stuff...
    
}
    
    return 
PLUGIN_CONTINUE;

Cant compile it..
Snake. is offline
Send a message via Skype™ to Snake.
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 05-20-2019 , 17:17   Re: [Req] Execute different say commands for different lang users
Reply With Quote #16

Quote:
Originally Posted by Snake. View Post
Cant compile it..
Updated my post. Try now.
redivcram is offline
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 09:42.


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