Raised This Month: $ Target: $400
 0% 

Name change problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
StickP0le
Senior Member
Join Date: Jan 2010
Location: cuantocabron.com
Old 12-14-2011 , 19:37   Name change problem
Reply With Quote #1

Can someone teach me how to change name while dead or being spectator or team_unassgined?

Last edited by StickP0le; 12-14-2011 at 19:40.
StickP0le is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-15-2011 , 00:54   Re: Name change problem
Reply With Quote #2

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

#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin("Dead Name Change"VERSION"ConnorMcLeod")
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged")
}

public 
ClientUserInfoChanged(id)
{
    new 
szOldName[32]
    
pev(idpev_netnameszOldNamecharsmax(szOldName))
    if( 
szOldName[0] && !is_user_alive(id) )
    {
        new 
szNewName[32]
        
get_user_info(id"name"szNewNamecharsmax(szNewName))
        if( !
equal(szOldNameszNewName) )
        {
            
set_pev(idpev_deadflagDEAD_NO)
            return 
FMRES_HANDLED
        
}
    }
    return 
FMRES_IGNORED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
StickP0le
Senior Member
Join Date: Jan 2010
Location: cuantocabron.com
Old 12-15-2011 , 15:09   Re: Name change problem
Reply With Quote #3

no, it doesn´t work, look the thing is that i have an account system and when somebody wants to create a new character, he has to change his name and re enter the server, and i want that instantly change his name, being spectating or unassigned team
StickP0le is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-16-2011 , 01:57   Re: Name change problem
Reply With Quote #4

Then you need to express yourself better.

SetUserName(index, "ConnorMcLeod") will change player name even if he is dead, unassigned, spec.

PHP Code:
SetUserName(idszNewName[], bool:bSilent falsebool:bDeadInstantChange true)
{
    new 
szOldName[32]
    
get_user_info(id"name"szOldNamecharsmax(szOldName))
    if( !
equal(szOldNameszNewName) )
    {
        
set_user_info(id"name"szNewName)

        if( 
is_user_connected(id) )
        {
            new 
iDeadFlag pev(idpev_deadflag)
            if( 
iDeadFlag != DEAD_NO )
            {
                if( 
bDeadInstantChange )
                {
                    
set_pev(idpev_netnameszNewName)
                    if( !
bSilent )
                    {
                        
set_pev(idpev_deadflagDEAD_NO)
                        
dllfunc(DLLFunc_ClientUserInfoChangedidengfunc(EngFunc_GetInfoKeyBufferid))
                        
set_pev(idpev_deadflagiDeadFlag)
                    }
                }
            }
            else if( 
bSilent )
            {
                
set_pev(idpev_netnameszNewName)
            }
        }
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
StickP0le
Senior Member
Join Date: Jan 2010
Location: cuantocabron.com
Old 12-16-2011 , 16:47   Re: Name change problem
Reply With Quote #5

thanks man!
StickP0le 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 11:53.


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