AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [Req] Execute different say commands for different lang users (https://forums.alliedmods.net/showthread.php?t=316336)

Snake. 05-18-2019 10:03

[Req] Execute different say commands for different lang users
 
Hi there. I want to execute different say commands in nightvision for different lang speakers. Is it possible ? For example en lang users open /en for nightvision or tr users open /tr..

gabuch2 05-18-2019 11:45

Re: [Req] Execute different say commands for different lang users
 
Just register different client commands with the same callback.

Snake. 05-18-2019 12:33

Re: [Req] Execute different say commands for different lang users
 
Quote:

Originally Posted by Gabe Iggy (Post 2652155)
Just register different client commands with the same callback.

Can you basically do that ? I cannot code.

redivcram 05-18-2019 12:58

Re: [Req] Execute different say commands for different lang users
 
PHP Code:

#include <amxmodx>

new const g_szCommands[][] = {
    
"/en""/tr" // etc
};

public 
plugin_init() {
    
    
register_plugin("Just""A""Test");
    
    
register_clcmd("say""cmdHookChat");
    
register_clcmd("say_team""cmdHookChat");
}

public 
cmdHookChat(id) {
    
    new 
szArgs[4];
    
    
read_args(szArgscharsmax(szArgs);
    
    for(new 
0sizeof(g_szCommands); i++) {
        
        if(
equal(szArgsg_szCommands[i])) {
            
            
myFunction(id);
            break;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
myFunction(id) {
    
    
// Do something...
    
    
return PLUGIN_HANDLED;



Snake. 05-19-2019 05:56

Re: [Req] Execute different say commands for different lang users
 
Quote:

Originally Posted by redivcram (Post 2652164)
PHP Code:

#include <amxmodx>

new const g_szCommands[][] = {
    
"/en""/tr" // etc
};

public 
plugin_init() {
    
    
register_plugin("Just""A""Test");
    
    
register_clcmd("say""cmdHookChat");
    
register_clcmd("say_team""cmdHookChat");
}

public 
cmdHookChat(id) {
    
    new 
szArgs[4];
    
    
read_args(szArgscharsmax(szArgs);
    
    for(new 
0sizeof(g_szCommands); i++) {
        
        if(
equal(szArgsg_szCommands[i])) {
            
            
myFunction(id);
            break;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
myFunction(id) {
    
    
// Do something...
    
    
return PLUGIN_HANDLED;



I did not understand anything from this. Are you sure you understood my reqeust ? When they type their nightvision, say /en will be executed on [en] lang users, say /tr will be executed on [tr] lang users.

redivcram 05-19-2019 06:51

Re: [Req] Execute different say commands for different lang users
 
Quote:

Originally Posted by Snake. (Post 2652266)
I did not understand anything from this. Are you sure you understood my reqeust ? When they type their nightvision, say /en will be executed on [en] lang users, say /tr will be executed on [tr] lang users.

As far as I know, there is no way to get a player's current language.
The code calls your desired function whenever someone types /en or /tr or whatever you would like to add more. It does the same action from different inputs.

<VeCo> 05-19-2019 07:22

Re: [Req] Execute different say commands for different lang users
 
Quote:

Originally Posted by redivcram (Post 2652270)
As far as I know, there is no way to get a player's current language.
The code calls your desired function whenever someone types /en or /tr or whatever you would like to add more. It does the same action from different inputs.

Player language is saved into a "lang" setinfo value.

redivcram 05-19-2019 09:18

Re: [Req] Execute different say commands for different lang users
 
Quote:

Originally Posted by <VeCo> (Post 2652273)
Player language is saved into a "lang" setinfo value.

Provide an example.

OciXCrom 05-19-2019 09:37

Re: [Req] Execute different say commands for different lang users
 
get_user_info(id, "lang", buffer, len)

redivcram 05-19-2019 12:25

Re: [Req] Execute different say commands for different lang users
 
Quote:

Originally Posted by OciXCrom (Post 2652289)
get_user_info(id, "lang", buffer, len)

What are the possible values that are being returned? That is not an example.


All times are GMT -4. The time now is 13:11.

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