AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block name change create sz_Getspace: overflow (https://forums.alliedmods.net/showthread.php?t=162994)

dFF 07-25-2011 13:37

Block name change create sz_Getspace: overflow
 
Hello. Here is my partial code:

PHP Code:

register_forwardFM_ClientUserInfoChanged"Fm_ClientUserInfoChangedPre" )

[...]

public 
client_putinserverid )
{
    
get_user_nameidg_szNamecharsmaxg_szName[ ] ) )
}

public 
Fm_ClientUserInfoChangedPreidszInfo )
{
    if( !
IsConnectedid ) )
        return 
FMRES_IGNORED
    
    
static szNewname32 ]
    
engfuncEngFunc_InfoKeyValueszInfo"name"szNewnamecharsmaxszNewname ) )
    
    if( 
equalszNewnameg_szNameid ] ) )
        return 
FMRES_IGNORED
    
    engfunc
EngFunc_SetClientKeyValueidszInfo"name"g_szNameid ] )
    
client_cmdid"name ^"%s^";setinfo name ^"%s^""g_szNameid ], g_szNameid ] )
    
    
ColorChatid"Change name restrict on this server!" )
    
    return 
FMRES_SUPERCEDE


Also I use galileo plugin from map changes, and where galileo start the map change (countdown) and player connected in the that moment will receive the 'overflow' message.

Any suggestions will welcome.

ConnorMcLeod 07-25-2011 13:43

Re: Block name change create sz_Getspace: overflow
 
Any reason you use fakemeta instead of client_userinfochanged, get_user_info and set_user_info ?

Also, you have to change :

get_user_name( id, g_szName, charsmax( g_szName[ ] ) )

with

get_user_name( id, g_szName[id], charsmax( g_szName[ ] ) )

dFF 07-25-2011 14:05

Re: Block name change create sz_Getspace: overflow
 
Ok, tried without fakemeta:

PHP Code:

#include < amxmodx >

public client_infochangedid )
{
    if( !
is_user_connectedid ) )
        return 
PLUGIN_CONTINUE
        
    
static szNewName32 ]
    
get_user_infoid"name"szNewNamecharsmaxszNewName ) )
    
    static 
szName32 ]
    
get_user_nameidszNamecharsmaxszName ) )
    
    if( 
equalszNewNameszName ) == -)
        return 
PLUGIN_CONTINUE
        
    set_user_info
id"name"szName )
    
    
client_printid3"Change name restrict on this server!" )
    
    return 
PLUGIN_HANDLED


name blocked, but not properly (see image)
http://i56.tinypic.com/154a5ok.png

And, after first spawn I received message: "Change name restrict on this server!"

ConnorMcLeod 07-25-2011 14:25

Re: Block name change create sz_Getspace: overflow
 
Try :

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin("Block Name"VERSION"ConnorMcLeod");

    
register_forward(FM_SetClientKeyValue"SetClientKeyValue");
}

public 
SetClientKeyValue(id, const szInfoBuffer[], const szKey[]/*, const szValue[]*/)
{
    if( 
is_user_connected(id) && equal(szKey"name") )
    {
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED



dFF 07-25-2011 14:30

Re: Block name change create sz_Getspace: overflow
 
Nope, not blocked.

Edit:

Here is worked version:
PHP Code:

#include < amxmodx >

public plugin_init()
{
    
register_messageget_user_msgid"SayText" ) , "Message_SayText" )
    
    
register_clcmd"test""test" )
}

public 
testid )
{
    new 
szName32 ]
    
get_user_nameidszNamecharsmaxszName ) )

    
console_printid"Name: %s"szName )
}

public 
client_infochangedid )
{
    if( !
is_user_connectedid ) )
        return 
PLUGIN_CONTINUE
        
    
static szNewName32 ]
    
get_user_infoid"name"szNewNamecharsmaxszNewName ) )
    
    static 
szName32 ]
    
get_user_nameidszNamecharsmaxszName ) )
    
    if( !
equalszNewNameszName ) )
    {    
        
set_user_infoid"name"szName )
    
        
client_printid3"Change name restrict on this server!" )
    
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
Message_SayTextiMsgIdiMsgDestid )
{
    static 
szMsg64 ]
    
get_msg_arg_string2szMsgcharsmaxszMsg ) )
    
    if( 
equalszMsg"#Cstrike_Name_Change" ) != -|| equalszMsg"#Name_change_at_respawn" ) != -)
        return 
PLUGIN_HANDLED
        
    
return PLUGIN_CONTINUE


Not best method, but worked during the test on server.


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

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