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

Modified country on name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Point
Junior Member
Join Date: Oct 2014
Old 09-14-2018 , 00:01   Modified country on name
Reply With Quote #1

I need some help with this.

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

#define VERSION "1.0"

new g_country33 ][ ];

public 
plugin_init( ) 
{
    
register_plugin"Country On Name"VERSION"Bboy Grun" );
    
    
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;

Any ideas how can i change it to display anything else instead of country name ?

PHP Code:
#include <amxmodx>

new g_name33 ][ ];

new const 
display[][] = {"blabla""lel""help""yas"};

public 
plugin_init() {
    
register_plugin("display""0""")
}

??????????????????
// #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_name[id][0])
    {
        new 
newname[32];
        if( !
has_good_namenewname ) ) // ?????????? ^
        
{
            
get_user_info(id"name"newnamecharsmax(newname));
        
            
format(newnamecharsmax(newname), "%s %s"displaynewname);
            
set_user_info(id"name"newname);
            
        return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;

I'm really confused xD. if anyone can show me, thanks in advance
Point is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-14-2018 , 05:19   Re: Modified country on name
Reply With Quote #2

PHP Code:
format(newnamecharsmax(newname), "%s %s"displaynewname); 
->
PHP Code:
format(newnamecharsmax(newname), "%s %s"display[0], newname); 
__________________
Airkish is offline
Point
Junior Member
Join Date: Oct 2014
Old 09-14-2018 , 09:19   Re: Modified country on name
Reply With Quote #3

Quote:
Originally Posted by Airkish View Post
PHP Code:
format(newnamecharsmax(newname), "%s %s"displaynewname); 
->
PHP Code:
format(newnamecharsmax(newname), "%s %s"display[0], newname); 
PHP Code:
#include <amxmodx> 
#include <amxmisc> 

new const ClassNames[][] = { "xx""xx""xx""xx"};

native get_user_class(id);

public 
plugin_init() 

    
register_clcmd("say /put""Command_Put");


public 
client_putinserver(idCommand_Put(id);

public 
client_infochanged(idCommand_Put(id);


public 
Command_Put(id) {

    new 
g_class get_user_class(id);
    
client_print_color(idprint_team_default"^4Your class: %s!"ClassNames[g_class]);
    
    static 
szName[32];
    
get_user_info(id"name"szName,charsmax(szName));
    
    if(
containi(szNameClassNames[g_class]) == -1)
    { 
        
format(szName,charsmax(szName),"%s %s"ClassNames[g_class], szName);
        
set_user_info(id"name"szName);
    } 

I wanna retrieve the class names from other plugin and display them in scoreboard. It works but after i change the class it keeps adding class names instead of switching like :
[Class1] Player
[Class1][Class2] Player
and so on.
Also how can i make it display only on scoreboard and remove from chat? Ty

Last edited by Point; 09-14-2018 at 09:27. Reason: typo
Point is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-14-2018 , 10:53   Re: Modified country on name
Reply With Quote #4

Quote:
Originally Posted by Point View Post
[PHP]#include <amxmodx>
I wanna retrieve the class names from other plugin and display them in scoreboard. It works but after i change the class it keeps adding class names instead of switching like :
[Class1] Player
[Class1][Class2] Player
and so on.
Also how can i make it display only on scoreboard and remove from chat? Ty
You need to store original player's name in global variable (something like g_szName[33][32]).
Set value of g_szName on client_connect(id).
On Command_put format name using g_szName.

To not show in chat, you have took hook say, and replace class with empty string "";
__________________
Airkish is offline
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 18:52.


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