Raised This Month: $ Target: $400
 0% 

Country on name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ebraheem2
BANNED
Join Date: Aug 2011
Old 07-15-2012 , 03:10   Country on name
Reply With Quote #1

Hey...
can anybody make new country on name and make it just on chat like country chat

i don't want it full country but i need it part of country name like : UZ , PS not full name

Country on name code : (part of name)

PHP Code:
#include < amxmodx >
#include < geoip >
#define VERSION "1.0"
new g_country33 ][ ];
public 
plugin_init( ) 
{
 
register_plugin"Country name - Abo Zanih"VERSION"......" );
 
 
register_cvar"country_on_name"VERSIONFCVAR_SERVER FCVAR_SPONLY );
 
set_cvar_string"country_on_name"VERSION );
}
public 
client_putinserverid )
{
 new 
ip32 ], country];
 
get_user_ipidipcharsmaxip ) );
 
 if( 
geoip_code2_exipcountry ) )
 {
  
formatg_countryid ], charsmaxg_country[ ] ), "[%s]"country );
 }
 else
 {
  
g_countryid ] = "??";
 }
}
public 
client_disconnectid )
{
 
g_countryid ][ ] = EOS;
}
#define has_good_name(%1) ( %1[ 0 ] == '[' && %1[ 3 ] == ']' && ( %1[ 1 ] == g_country[ id ][ 1 ] || %1[ 1 ] == '?' ) && ( %1[ 2 ] == g_country[ id ][ 2 ]  || %1[ 2 ] == '?' ) )
public client_infochangedid )
{
 if( 
g_countryid ][ ] )
 {
  new 
newname32 ];
  
get_user_infoid"name"newnamecharsmaxnewname ) );
  
  if( !
has_good_namenewname ) )
  {
   
formatnewnamecharsmaxnewname ), "%s %s"g_countryid ], newname );
   
set_user_infoid"name"newname );
   
   return 
PLUGIN_HANDLED;
  }
 }
  
 return 
PLUGIN_CONTINUE;



Country chat with full name :

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <geoip>
#define PLUGIN_NAME "country chat"
#define PLUGIN_VERSION "1.1"
#define PLUGIN_AUTHOR "K.K.Lv"
new players[33][32]
new 
num[33]
public 
plugin_init()
{
 
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
 
 
register_clcmd("say""hook_say")
 
register_clcmd("say_team""hook_team_say")
}
public 
hook_say(id)
{
 new 
chat[192]
 
read_args(chat191)
 
remove_quotes(chat)
 
 new 
name[32], userip[16], usercountry[46], message[256]
 
get_user_name(idname31)
 
get_user_ip(iduserip151)
 
geoip_country(useripusercountry45)
 
 new 
CsTeams:userteam =cs_get_user_team(id)
 if(
equal(chat""))
  return 
PLUGIN_HANDLED
 
 
if (is_user_alive(id))
 {
  
format(message255"^x04[%s]^x03%s^x01: %s"usercountrynamechat)
  
color_chat(0idmessage)
 }
 else if (!
is_user_alive(id) && userteam != CS_TEAM_SPECTATOR)
 {
  
format(message255"^x04[%s]^x01*DEAD*^x03%s^x01: %s"usercountry,  namechat)
  
color_chat(0idmessage)
 }
 else 
 {
  
format(message255"^x04[%s]^x01*SPEC*^x03%s^x01: %s"usercountry,  namechat)
  
color_chat(0idmessage)
 }
 return 
PLUGIN_HANDLED
}
public 
hook_team_say(id)
{
 new 
chat[192]
 
read_args(chat191)
 
remove_quotes(chat)
 
 new 
name[32], userip[16], usercountry[46], message[256], team[32]
 
get_user_name(idname31)
 
get_user_ip(iduserip151)
 
geoip_country(useripusercountry45)
 
 if(
equal(chat""))
  return 
PLUGIN_HANDLED
 
 
new CsTeams:userteam =cs_get_user_team(id)
 if (
userteam == CS_TEAM_T)
 {
  
get_players(players[id], num[id], _"TERRORIST")
  
team "(Terrorist)"
 
}
 else if (
userteam == CS_TEAM_CT)
 {
  
get_players(players[id], num[id], _"CT")
  
team "(Counter-Terrorist)"
 
}
 else
 {
  
get_players(players[id], num[id], _"SPECTATOR")
  
team "(Spectator)"
 
}
 for (new 
0num[id]; ++a)
 {
  new 
players[id][a]
  if (
is_user_alive(id))
  {
   
format(message255"^x04[%s]^x01%s^x03%s^x01: %s"usercountryteamnamechat)
   
color_chat(iidmessage)
  }
  else if (!
is_user_alive(id) && userteam != CS_TEAM_SPECTATOR)
  {
   
format(message255"^x04[%s]^x01*DEAD*%s^x03%s^x01: %s"usercountryteamnamechat)
   
color_chat(iidmessage)
  }
  else
  {
   
format(message255"^x04[%s]^x01%s^x03%s^x01: %s"usercountryteamnamechat)
   
color_chat(iidmessage)
  }
 }
 return 
PLUGIN_HANDLED
}
public 
color_chat(playeridcoloridmessage[])
{
 
message_begin(playerid?MSG_ONE:MSG_ALLget_user_msgid("SayText"), {000}, playerid)
 
write_byte(colorid)
 
write_string(message)
 
message_end()
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg936\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
*/ 

thanks
ebraheem2 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-15-2012 , 04:08   Re: Country on name
Reply With Quote #2

You can update GeoIP.dat here : http://www.maxmind.com/download/geoi...eoLiteCountry/

You can remove the chat plugin.
Once country name is install, chat is affected as well.
Try this :

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <geoip>

#define VERSION "0.0.2"
#define PLUGIN "Country Name"

const MAX_PLAYERS 32

new g_szCountry[MAX_PLAYERS+1][5]

new const 
name[] = "name"

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
register_forward(FM_ClientConnect"OnClientConnect_Post"true)
    
register_forward(FM_ClientUserInfoChanged"OnClientUserInfoChanged")
}

public 
client_disconnectid )
{
    
g_szCountry[id][0] = EOS
}

public 
OnClientConnect_Post(id, const szName[], const szAddress[], szRejectReason[128])
{
    static 
szCountry[3]
    if( !
geoip_code2_ex(szAddressszCountry) )
    {
        
szCountry[0] = szCountry[1] = '-'
    
}
    
formatex(g_szCountry[id], charsmax(g_szCountry[]), "[%s]"szCountry)

    if( !
equal(szNameg_szCountry[id], charsmax(g_szCountry[])) )
    {
        new 
szNewName[32]
        
formatex(szNewNamecharsmax(szNewName), "[%s] %s"szCountryszName)
        
set_user_info(idnameszNewName)
        
set_pev(idpev_netnameszNewName)
    }
}

public 
OnClientUserInfoChanged(idinfobuffer[])
{
    static 
szOldName[32], szNewName[32], szCountry[5]
    
    
szCountry g_szCountry[id]

    if(        
szCountry[0]
    &&    ( 
pev(idpev_netnameszOldNamecharsmax(szOldName)) != get_user_info(idnameszNewNamecharsmax(szNewName)) || !equal(szOldNameszNewName) )        )
    {
        if( !
equal(szNewNameszCountrycharsmax(szCountry)) )
        {
            
format(szNewNamecharsmax(szNewName), "%s %s"szCountryszNewName)
            
set_user_info(idnameszNewName)
            return 
FMRES_HANDLED
        
}
    }
    return 
FMRES_IGNORED

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-21-2012 at 08:29.
ConnorMcLeod is offline
ebraheem2
BANNED
Join Date: Aug 2011
Old 07-15-2012 , 05:06   Re: Country on name
Reply With Quote #3

omg i get on my name this

[] [] [] [] [] [] [] [] [] : Hi

Q: is your geoIP New or the same on on modules?

that is already instaled?
ebraheem2 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-15-2012 , 05:13   Re: Country on name
Reply With Quote #4

Dunno, i have it from dev builds h24

Code:
         [ 5] GeoIP                   1.8.2-dev   AMX Mod X Dev Team   running
http://www.amxmodx.org/snapshots.php

Be sure you don't have a plugin that conflicts with that one.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ebraheem2
BANNED
Join Date: Aug 2011
Old 07-15-2012 , 05:42   Re: Country on name
Reply With Quote #5

i want it prefix in chat only i don't want his name to change
ebraheem2 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-15-2012 , 06:21   Re: Country on name
Reply With Quote #6

It's better to have it directly on name, make the plugin use less cpu and be more efficient.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ebraheem2
BANNED
Join Date: Aug 2011
Old 07-15-2012 , 14:25   Re: Country on name
Reply With Quote #7

well, i saw xPaw's DR server!!
i want some plugins from his DR server like drshop menu and he has already made this plugin

i want it just on the chat

can u talk with xPaw to post his plugins here ?
ebraheem2 is offline
Old 07-23-2012, 05:17
ebraheem2
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
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 00:04.


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