Raised This Month: $ Target: $400
 0% 

Blocking name change...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-12-2012 , 21:21   Blocking name change...
Reply With Quote #1

Which is the best way to do it?

I need to block name change if a var it is true. I know how, but is not the best way.
__________________

Last edited by Neeeeeeeeeel.-; 06-12-2012 at 21:22.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-12-2012 , 21:24   Re: Blocking name change...
Reply With Quote #2

PHP Code:
// plugin_init
register_clcmd("name""cmdName")

public 
cmdName(id)
    return 
PLUGIN_HANDLED 
give that a test.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-12-2012 , 21:33   Re: Blocking name change...
Reply With Quote #3

Do not work.
I meant with fakemeta.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-12-2012 , 21:42   Re: Blocking name change...
Reply With Quote #4

Use client_infochanged

Search, I barely recall this being addressed in the past
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-12-2012 , 21:52   Re: Blocking name change...
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
Use client_infochanged

Search, I barely recall this being addressed in the past
Yes i know that native but I what I'm looking for is how to block it, in client_infochanged or in fakemeta forward...
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-12-2012 , 22:03   Re: Blocking name change...
Reply With Quote #6

Please Search....

Also, why are you restricting yourself to fakemeta? What is wrong with the other modules?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-12-2012 , 23:53   Re: Blocking name change...
Reply With Quote #7

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

#pragma semicolon 1

public plugin_init()
{
    
register_plugin("No Name Change",AMXX_VERSION_STR,"????");
    
    
register_forward(FM_ClientUserInfoChanged,"fw_Client_InfoChanged");
}

public 
fw_Client_InfoChanged(Client,Buffer)
{
    if(!
is_user_connected(Client)) return FMRES_IGNORED;

    static 
Name[32];
    
get_user_name(Client,Name,charsmax(Name));
    
    static 
Value[32];
    
engfunc(EngFunc_InfoKeyValue,Buffer,"name",Value,charsmax(Value));
    
    if(
equal(Value,Name)) return FMRES_IGNORED;
    
    
engfunc(EngFunc_SetClientKeyValue,Client,Buffer,"name",Name);
    
client_cmd(Client,"name ^"%s^";setinfo name ^"%s^"",Name,Name);
    
    
console_print(Client,"[AMXX] Sorry, name change not allowed.");
    return 
FMRES_SUPERCEDE;

SEARCH
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 06-12-2012 at 23:55. Reason: console_print(Client,"[AMXX] Sorry, name change not allowed.");
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-13-2012 , 00:01   Re: Blocking name change...
Reply With Quote #8

I think nobody can understand me... Perhaps I could not explain well. I KNOW how to block name change, but I want the best way to do. Is that the best way? Thats what I want to know.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-13-2012 , 00:05   Re: Blocking name change...
Reply With Quote #9

Fakemeta its a best way, dont show any messages in chat unlike the client info changed.

SmileY changed name to Smileco
Smileco changed name to SmileY

client info changed its requires a:

PHP Code:
register_message(get_user_msgid("SayText"),"MessageSayText");

&&

public 
MessageSayText(iMsgId,iDest,iReceiver)
{
    static const 
Cstrike_Name_Change[ ] = "#Cstrike_Name_Change";
    
    static 
szMessage[sizeof(Cstrike_Name_Change) + 1];
    
get_msg_arg_string(2,szMessage,charsmax(szMessage));
    
    return 
equal(szMessage,Cstrike_Name_Change) ? PLUGIN_HANDLED PLUGIN_CONTINUE;

To dont show this message
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 06-13-2012 at 00:05.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-13-2012 , 00:43   Re: Blocking name change...
Reply With Quote #10

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

#define VERSION "0.0.1"

new g_iMaxPlayers
#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

static const name[] = "name"

new g_iChangeNickForward
new g_iFirstNickForward

new g_bitSilentNameChangeAtSpawn
#define MarkSilentNameChangeAtSpawn(%0)    g_bitSilentNameChangeAtSpawn |= 1<<(%0&31)
#define ClearSilentNameChangeAtSpawn(%0)    g_bitSilentNameChangeAtSpawn &= ~(1<<(%0&31))
#define IsSilentNameChangeAtSpawn(%0)            g_bitSilentNameChangeAtSpawn & 1<<(%0&31)

const XO_PLAYER 5
const XO_PLAYER_STRING 20
const m_bChangeNameAtRespawn 224
const m_szNewName 897 // 224,25 * 4

public plugin_init()
{
    
register_plugin("Name Change"VERSION"ConnorMcLeod")
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged")
    
RegisterHam(Ham_Spawn"player""CBasePlayer_Spawn_Pre"false)
    
g_iChangeNickForward CreateMultiForward("client_name_change"ET_STOPFP_CELLFP_STRINGFP_STRING)
    
g_iFirstNickForward CreateMultiForward("client_name_change"ET_IGNOREFP_CELLFP_STRINGFP_STRING)
    
g_iMaxPlayers get_maxplayers()
}

public 
plugin_natives()
{
    
register_library("clientname")
    
register_native("set_user_name""set_user_name")
}

public 
set_user_name(iPlugin /* , iParams */ // set_user_name(id, szName, bool:bSilent = false, bool:bDeadInstantChange = false)
{
    new 
id get_param(1)
    if( !
IsPlayer(id) )
    {
        
log_error(AMX_ERR_NATIVE"Player out of range (%d)"id)
    }
/*    if( !is_user_connected(id) )
    {
        log_error(AMX_ERR_NATIVE, "Invalid player %d", id)
    }*/
    
new szNewName[32]
    
get_string(2szNewNamecharsmax(szNewName))
    
set_user_info(idnameszNewName)
    if( 
get_param(3) )
    {
        if( 
is_user_alive(id) )
        {
            
set_pev(idpev_netnameszNewName)
        }
        else if( 
get_param(4) )
        {
            
MarkSilentNameChangeAtSpawn(id)
        }
    }
    else if( 
get_param(3) )
    {
        
MarkSilentNameChangeAtSpawn
    
}
    else if( 
get_param(4) )
    {
        
set_pev(idpev_deadflagDEAD_NO)
    }
    return 
1
}

public 
CBasePlayer_Spawn_Preid )
{
    if( 
IsSilentNameChangeAtSpawn(id) )
    {
        new 
szNewName[32]
        
get_pdata_string(idm_szNewNameszNewNamecharsmax(szNewName), 0XO_PLAYER_STRING)
        
set_pev(idpev_netnameszNewName)
        
set_pdata_string(idm_szNewName"", -1XO_PLAYER_STRING)
        
set_pdata_int(idm_bChangeNameAtRespawn,
            
get_pdata_int(idm_bChangeNameAtRespawnXO_PLAYER)  & ~(1<<0),
            
XO_PLAYER )
        
ClearSilentNameChangeAtSpawn(id)
    }
}

public 
ClientUserInfoChanged(id)
{
    new 
szOldName[32], szNewName[32]
    
pev(idpev_netnameszOldNamecharsmax(szOldName))
    if( 
szOldName[0] )
    {
    
/*    if( !is_user_alive(id) )
        {
            return FMRES_IGNORED
        }*/
        
get_user_info(idnameszNewNamecharsmax(szNewName))

        if( !
equal(szOldNameszNewName)
        &&    ( 
is_user_alive(id) || get_pdata_int(idm_bChangeNameAtRespawnXO_PLAYER)  & ~(1<<0) )    )
        {
            new 
iRet
            ExecuteForward
(g_iChangeNickForwardiRetidszOldNameszNewName)
            if( 
iRet == PLUGIN_HANDLED )
            {
                
set_user_info(idnameszOldName)
                return 
FMRES_HANDLED
            
}
        }
    }
    else if( 
get_user_info(idnameszNewNamecharsmax(szNewName)) )
    {
        new 
iRet
        ExecuteForward
(g_iFirstNickForwardiRetidszOldNameszNewName)
    }
    return 
FMRES_IGNORED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 06:16.


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