AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   show country chat (https://forums.alliedmods.net/showthread.php?t=173272)

RuRuRu612754 12-02-2011 22:23

show country chat
 
Hi.

Code:

#include <amxmodx>
#include <amxmisc>
#include <geoip>

new countries[33][46]
new ips[33][30]

public plugin_init()
{
        register_clcmd("say", "cmdSay")
}

public client_connect(id)
{
        get_user_ip(id, ips[id], charsmax(ips))
        geoip_country(ips[id], countries[id], charsmax(countries))
}

public cmdSay(id)
{
        new message2[200]
        read_args(message2, charsmax(message2))
               
        new name[32]
        get_user_name(id, name, 31)

        new country[46]
        copy(country, charsmax(country), countries[id])
                       
        client_print(0, print_chat, "[%s] %s : %s", country, name, message2[1])
}

The result is like this.

[Japan] Player : Hello
Player : Hello

The original chat "Player : Hello" Please tell me how to delete the

K.K.Lv 12-02-2011 23:11

Re: show country chat
 
Code:
#include <amxmodx> #include <amxmisc> #include <geoip> new countries[33][46] new ips[33][30] public plugin_init() {     register_clcmd("say", "cmdSay") } public client_connect(id) {     get_user_ip(id, ips[id], charsmax(ips))     geoip_country(ips[id], countries[id], charsmax(countries)) } public cmdSay(id) {     new message2[200]     read_args(message2, charsmax(message2))       new name[32]     get_user_name(id, name, 31)     new country[46]     copy(country, charsmax(country), countries[id])         client_print(0, print_chat, "[%s] %s : %s", country, name, message2[1])     return PLUGIN_HANDLED }

RuRuRu612754 12-02-2011 23:51

Re: show country chat
 
K.K.Lv

thanks!!

The result is like this.

[Japan] Player : Hello"

Why?

delete the "

client_print(0, print_chat, "[%s] %s : %s", country, name, message2[1])

K.K.Lv 12-03-2011 04:16

Re: show country chat
 
Code:
//Plugin passes through operation.  Whatever called it continues. #define PLUGIN_CONTINUE          0 //Plugin halts continued operation (plugins following in the plugins.ini won't be called). //Whatever called it will eventually supercede. #define PLUGIN_HANDLED      1 //Continue calling plugins but halt the operation #define PLUGIN_HANDLED_MAIN 2

RuRuRu612754 12-03-2011 05:10

Re: show country chat
 
K.K.Lv

thanks

However, the result is as follows.

[Japan] Player : Hello"

Code:

#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <geoip>

//Plugin passes through operation.  Whatever called it continues.
#define PLUGIN_CONTINUE          0
//Plugin halts continued operation (plugins following in the plugins.ini won't be called).
//Whatever called it will eventually supercede.

#define PLUGIN_HANDLED    1

//Continue calling plugins but halt the operation

#define PLUGIN_HANDLED_MAIN 2

new countries[33][46]
new ips[33][30]

public plugin_init()
{
        register_clcmd("say", "cmdSay")
}

public client_connect(id)
{
        get_user_ip(id, ips[id], charsmax(ips))
        geoip_country(ips[id], countries[id], charsmax(countries))
}

public cmdSay(id)
{
        new message2[200]
        read_args(message2, charsmax(message2))
                       
        new name[32]
        get_user_name(id, name, 31)

        new country[46]
        copy(country, charsmax(country), countries[id])

        ColorChat(0, TEAM_COLOR, "^x01[%s] ^x03%s ^x01: %s", country, name, message2[1])
        client_print(0, print_chat, "[%s] %s : %s", country, name, message2[1])

        return PLUGIN_HANDLED
}


Xpawn 12-03-2011 06:22

Re: show country chat
 
This is Incorrect your's postreply

this is the correct

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <geoip>

new countries[33][46]
new 
ips[33][30]

public 
plugin_init()
{
    
register_clcmd("say""cmdSay")
}

public 
client_connect(id)
{
    
get_user_ip(idips[id], charsmax(ips))
    
geoip_country(ips[id], countries[id], charsmax(countries))
}

public 
cmdSay(id)
{
    new 
message2[200]
    
read_args(message2charsmax(message2))
            
    new 
name[32]
    
get_user_name(idname31)

    new 
country[46]
    
copy(countrycharsmax(country), countries[id])
    
    
client_print(0print_chat"[%s] %s : %s"countrynamemessage2[1])

    return 
PLUGIN_HANDLED


No colored chat !!!

But there is an error with IP And country

I tested the plugin and this is what I do
Quote:

] say
[error] LR Gaming|[E]cho_CStr!Ke
the plugin say
[error] LR Gaming|[E]cho_CStr!Ke


The name is correct but IP and country are false

ConnorMcLeod 12-03-2011 07:48

Re: show country chat
 
PHP Code:

/*    Formatright ɠ2010, ConnorMcLeod

    This plugin is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this plugin; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <geoip>

#define MAX_PLAYERS        32

new g_szCountry[MAX_PLAYERS+1][46]

#define VERSION "0.0.1"
#define PLUGIN "Country Chat"

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_message(get_user_msgid("SayText"), "Message_SayText")
}

public 
client_putinserver(id)
{
    static 
szIp[16]
    
get_user_ip(idszIpcharsmax(szIp), 1)
    
geoip_country(szIpg_szCountry[id], charsmax(g_szCountry[]))
}

public 
Message_SayText()
{
    new 
id get_msg_arg_int(1)
    new 
szChannel[40]
    
get_msg_arg_string(2szChannelcharsmaxszChannel ) )
    if( 
equal(szChannel"#Cstrike_Chat"13) )
    {
        if( 
equal(szChannel"#Cstrike_Chat_All") )
        {
            
format(szChannelcharsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2"g_szCountry[id])
        }
        else
        {
            
format(szChannelcharsmax(szChannel), "^4[%s] %s"g_szCountry[id], szChannel)
        }
        
set_msg_arg_string(2szChannel)
    }



Xpawn 12-03-2011 11:31

Re: show country chat
 
GooD job ConnorMcLeod :up:

PHP Code:

/*    Formatright ɠ2010, ConnorMcLeod 

    This plugin is free software; 
    you can redistribute it and/or modify it under the terms of the 
    GNU General Public License as published by the Free Software Foundation. 

    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    GNU General Public License for more details. 

    You should have received a copy of the GNU General Public License 
    along with this plugin; if not, write to the 
    Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
    Boston, MA 02111-1307, USA. 
*/ 

#include <amxmodx> 
#include <geoip> 

#define MAX_PLAYERS        32 

new g_szCountry[MAX_PLAYERS+1][46

#define VERSION "0.0.1" 
#define PLUGIN "Country Chat" 

public plugin_init() 

    
register_plugin(PLUGINVERSION"ConnorMcLeod"
    
register_message(get_user_msgid("SayText"), "Message_SayText"


public 
client_putinserver(id

    static 
szIp[16
    
get_user_ip(idszIpcharsmax(szIp), 1
    
geoip_country(szIpg_szCountry[id], charsmax(g_szCountry[])) 


public 
Message_SayText() 

    new 
id get_msg_arg_int(1
    new 
szChannel[40
    
get_msg_arg_string(2szChannelcharsmaxszChannel ) ) 
    if( 
equal(szChannel"#Cstrike_Chat"13) ) 
    { 
        if( 
equal(szChannel"#Cstrike_Chat_All") ) 
        { 
            
format(szChannelcharsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2"g_szCountry[id]) 
        } 
        else 
        { 
            
format(szChannelcharsmax(szChannel), "^4[%s] %s"g_szCountry[id], szChannel
        } 
        
set_msg_arg_string(2szChannel
    } 



.Dare Devil. 12-03-2011 13:06

Re: show country chat
 
Quote:

Originally Posted by ConnorMcLeod (Post 1606853)
PHP Code:

/*    Formatright ɠ2010, ConnorMcLeod
 
    This plugin is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this plugin; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
 
#include <amxmodx>
#include <geoip>
 
#define MAX_PLAYERS        32
 
new g_szCountry[MAX_PLAYERS+1][46]
 
#define VERSION "0.0.1"
#define PLUGIN "Country Chat"
 
public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_message(get_user_msgid("SayText"), "Message_SayText")
}
 
public 
client_putinserver(id)
{
    static 
szIp[16]
    
get_user_ip(idszIpcharsmax(szIp), 1)
    
geoip_country(szIpg_szCountry[id], charsmax(g_szCountry[]))
}
 
public 
Message_SayText()
{
    new 
id get_msg_arg_int(1)
    new 
szChannel[40]
    
get_msg_arg_string(2szChannelcharsmaxszChannel ) )
    if( 
equal(szChannel"#Cstrike_Chat"13) )
    {
        if( 
equal(szChannel"#Cstrike_Chat_All") )
        {
            
format(szChannelcharsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2"g_szCountry[id])
        }
        else
        {
            
format(szChannelcharsmax(szChannel), "^4[%s] %s"g_szCountry[id], szChannel)
        }
        
set_msg_arg_string(2szChannel)
    }



Quote:

Originally Posted by Xpawn (Post 1606995)
GooD job ConnorMcLeod :up:

PHP Code:

/*    Formatright ɠ2010, ConnorMcLeod 
 
    This plugin is free software; 
    you can redistribute it and/or modify it under the terms of the 
    GNU General Public License as published by the Free Software Foundation. 
 
    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    GNU General Public License for more details. 
 
    You should have received a copy of the GNU General Public License 
    along with this plugin; if not, write to the 
    Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
    Boston, MA 02111-1307, USA. 
*/ 
 
#include <amxmodx> 
#include <geoip> 
 
#define MAX_PLAYERS        32 
 
new g_szCountry[MAX_PLAYERS+1][46
 
#define VERSION "0.0.1" 
#define PLUGIN "Country Chat" 
 
public plugin_init() 

    
register_plugin(PLUGINVERSION"ConnorMcLeod"
    
register_message(get_user_msgid("SayText"), "Message_SayText"

 
public 
client_putinserver(id

    static 
szIp[16
    
get_user_ip(idszIpcharsmax(szIp), 1
    
geoip_country(szIpg_szCountry[id], charsmax(g_szCountry[])) 

 
public 
Message_SayText() 

    new 
id get_msg_arg_int(1
    new 
szChannel[40
    
get_msg_arg_string(2szChannelcharsmaxszChannel ) ) 
    if( 
equal(szChannel"#Cstrike_Chat"13) ) 
    { 
        if( 
equal(szChannel"#Cstrike_Chat_All") ) 
        { 
            
format(szChannelcharsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2"g_szCountry[id]) 
        } 
        else 
        { 
            
format(szChannelcharsmax(szChannel), "^4[%s] %s"g_szCountry[id], szChannel
        } 
        
set_msg_arg_string(2szChannel
    } 



LOL

Edit, the plugin is great ( Do not undestand a wrong way connor ( : ) but xpawn, you are just so funny : )
And stupid...

RuRuRu612754 12-04-2011 02:40

Re: show country chat
 
Thanks for ConnorMcLeod

and all answer thanks

ConnorMcLeod is Very nice AMX plugin maker
I will respect him


All times are GMT -4. The time now is 08:30.

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