Raised This Month: $ Target: $400
 0% 

Names , blocking and changing both


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
m0v3
Member
Join Date: May 2009
Old 08-22-2010 , 19:01   Names , blocking and changing both
Reply With Quote #1

Hey.

I need some help on name changing. Saw some threads about names, points and stuff , but that's not exactly it. I need to block player from changing names, but still be able to change them myself when I need it.
This:
PHP Code:
public client_infochanged(id) {
    return 
PLUGIN_HANDLED

blocks everything , and I need to bypass it somehow.
m0v3 is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-22-2010 , 22:01   Re: Names , blocking and changing both
Reply With Quote #2

Just looked at the funcwiki, maybe u could do this?

PHP Code:
public client_infochanged(id)

    new 
newname[32],oldname[32
    
get_user_info(id"name"newname,31
    
get_user_name(id,oldname,31)
    if(!
equali(nameoldname) return PLUGIN_HANDLED

nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
m0v3
Member
Join Date: May 2009
Old 08-23-2010 , 03:57   Re: Names , blocking and changing both
Reply With Quote #3

Whats the point of this func ? It also blocks all name changes, just lets through if oldname == newname. I need a way server could recognize , where I change player name , and let me do it , but if a player tries to do it , stop him.

EDIT: Tried this:
PHP Code:
public client_infochanged(id) {
    
    if(!
get_pcvar_num(cvar))
        return 
PLUGIN_HANDLED
    
    
new newname[32]
    
get_user_info(id,"name",newname,31)
    
    new 
oldname[32]
    
get_user_name(id,oldname,31)
    
    if(!
equal(newname,oldname))
    {
        
set_user_info(id,"name",oldname)
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE

(code by #8 SickneSS)

thought if I changed oldname into the name I want , everything would work , but this func ended in an infinite loop , don't know how to get out of it. If someone could show me the right path in achieving what I want, I would be very grateful. Full code isn't needed , just a working idea. Thanks anybody in advance.

Last edited by m0v3; 08-23-2010 at 05:37.
m0v3 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 21:59.


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