Raised This Month: $32 Target: $400
 8% 

no name changer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
oFF
Member
Join Date: Oct 2012
Old 01-01-2013 , 17:31   no name changer
Reply With Quote #1

how can i add exception of amx_nick command in this plugin ? i cannot change name of a player as high admin so.... i need to do it with amx_nick ... but this plugin block all nick changes , thats why i need to add amx_nick as exception






#include <amxmodx>
#include <fakemeta>
#include <amxmisc>

#define PLUGIN_NAME "No Name Change"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "VEN"

new const g_reason[] = "It is NOT allowed to change nick names."

new const g_name[] = "name"

public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_forward(FM_ClientUserInfoChanged, "fwClientUserInfoChanged")
}

public
fwClientUserInfoChanged(id, buffer) {
if (!
is_user_connected(id))
return
FMRES_IGNORED;
if (
is_user_admin ( id ) )
return
PLUGIN_HANDLED;

static
name[32], val[32]
get_user_name(id, name, sizeof name - 1)
engfunc(EngFunc_InfoKeyValue, buffer, g_name, val, sizeof val - 1)
if (
equal(val, name))
return
FMRES_IGNORED;

engfunc(EngFunc_SetClientKeyValue, id, buffer, g_name, name)
console_print(id, "%s", g_reason)

return
FMRES_SUPERCEDE;
}
oFF is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 01-01-2013 , 20:17   Re: no name changer
Reply With Quote #2

So I guess you mean..
Admins can still change names?

For that, remove this:
PHP Code:
is_user_admin id ) )
return 
PLUGIN_HANDLED
__________________
Retired.
Xalus is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-01-2013 , 20:35   Re: no name changer
Reply With Quote #3

Quote:
Originally Posted by Xalus View Post
So I guess you mean..
Admins can still change names?

For that, remove this:
PHP Code:
is_user_admin id ) )
return 
PLUGIN_HANDLED
No. He want's to be able to use amx_nick on other players but he can't because this plugin blocks all name changes. You probably need to recode this plugin with a boolean that you can disable it's functionality before using amx_nick and then re-enabling it when amx_nick has finished. Might not be the most elegant solution but I can't think of any other method.

So, this requires modifying both amx_nick (or making a new command) and also modifying the "No Name Change" plugin.
__________________
fysiks is offline
oFF
Member
Join Date: Oct 2012
Old 01-01-2013 , 23:36   Re: no name changer
Reply With Quote #4

true true the amx_nick is from admincmd.amxx , i don't have separate plugin for that , i tried to put before and after it but nothing ... maybe i should put a plugin with amx_nick ... so when in use it pause nonamechange.amxx ?
admins can change name...it's not problem because i gave admin on name so if admin change it deactivate his accesses but i want for players who join with innapropriate nicknames like swears,spam,advertising


and btw xalus :
if (!is_user_connected(id))
return
FMRES_IGNORED;
if (
is_user_admin ( id ) )
return
PLUGIN_HANDLED;


IF USER = DENY NAME CHANGE
IF USE_ADMIN PLUGIN ALLOW CHANGING , so no line need to be deleted

Last edited by oFF; 01-01-2013 at 23:43.
oFF is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-01-2013 , 23:48   Re: no name changer
Reply With Quote #5

Put this at the top of your plugins.ini:

PHP Code:
Code removeddoes not work as intended.  See below for newest version
__________________

Last edited by fysiks; 01-02-2013 at 00:21.
fysiks is offline
oFF
Member
Join Date: Oct 2012
Old 01-02-2013 , 00:09   Re: no name changer
Reply With Quote #6

fysiks +1 , happy new year...i edit this after testing 1 more question , how to disable nickchange even to admins with admin_immunity flag ... so they cannot change name , but they can access amx_nick if they want ...


#EDIT : NOT WORKIN , sorry ... it shows in console
[AMXX] Changed nick of Andr to "test"
ADMIN HakimAkli: change nick of Andr to "test

but nothing happens...

Last edited by oFF; 01-02-2013 at 00:22.
oFF is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-02-2013 , 00:20   Re: no name changer
Reply With Quote #7

It turns out that the code that I gave you does not work. Here is a much much better version that I created with testing:

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

#define PLUGIN_NAME "No Name Change"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "VEN"

new const g_reason[] = "It is NOT allowed to change nick names."
new const g_name[] = "name"
new g_iTarget 0

public plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_forward(FM_ClientUserInfoChanged"fwClientUserInfoChanged")
    
register_concmd("amx_nick""cmdNick"ADMIN_SLAY"<name or #userid> <new nick>")
}

public 
cmdNick(idlevelcid)
{
    if (!
cmd_access(idlevelcid3))
        return 
PLUGIN_HANDLED

    
new arg1[32], arg2[32], authid[32], name[32], authid2[32], name2[32]

    
read_argv(1arg131)
    
read_argv(2arg231)

    new 
player cmd_target(idarg1CMDTARGET_OBEY_IMMUNITY CMDTARGET_ALLOW_SELF)

    if (!
player)
        return 
PLUGIN_HANDLED

    get_user_authid
(idauthid31)
    
get_user_name(idname31)
    
get_user_authid(playerauthid231)
    
get_user_name(playername231)

    
g_iTarget player
    set_user_info
(player"name"arg2)

    
log_amx("Cmd: ^"%s<%d><%s><>^" change nick to ^"%s^" ^"%s<%d><%s><>^""nameget_user_userid(id), authidarg2name2get_user_userid(player), authid2)

    
show_activity_key("ADMIN_NICK_1""ADMIN_NICK_2"namename2arg2);

    
console_print(id"[AMXX] %L"id"CHANGED_NICK"name2arg2)

    return 
PLUGIN_HANDLED
}


public 
fwClientUserInfoChanged(idbuffer)
{
    if(!
is_user_connected(id) || is_user_admin(id))
        return 
FMRES_IGNORED;

    static 
name[32], val[32]
    
get_user_name(idnamesizeof name 1)
    
engfunc(EngFunc_InfoKeyValuebufferg_namevalsizeof val 1)
    if(
equal(valname))
        return 
FMRES_IGNORED;

    if( 
g_iTarget != id )
    {
        
engfunc(EngFunc_SetClientKeyValueidbufferg_namename)
        
console_print(id"%s"g_reason)
        return 
FMRES_SUPERCEDE;
    }
    
g_iTarget 0
    
return FMRES_IGNORED

__________________

Last edited by fysiks; 01-02-2013 at 00:22.
fysiks is offline
oFF
Member
Join Date: Oct 2012
Old 01-02-2013 , 00:29   Re: no name changer
Reply With Quote #8

yes...it works....thank you so much ... i just tested ... please tell me wich line i should edit when i don't want admins can change name with regular console : name "newname" ....
oFF is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-02-2013 , 00:30   Re: no name changer
Reply With Quote #9

Remove: " || is_user_admin(id)"
__________________
fysiks is offline
oFF
Member
Join Date: Oct 2012
Old 01-02-2013 , 00:35   Re: no name changer
Reply With Quote #10

god bless you
oFF 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 10:52.


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