AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Names , blocking and changing both (https://forums.alliedmods.net/showthread.php?t=136096)

m0v3 08-22-2010 19:01

Names , blocking and changing both
 
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.

nikhilgupta345 08-22-2010 22:01

Re: Names , blocking and changing both
 
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



m0v3 08-23-2010 03:57

Re: Names , blocking and changing both
 
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.


All times are GMT -4. The time now is 21:59.

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