AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block Changing Name (https://forums.alliedmods.net/showthread.php?t=299010)

PurposeLessx 06-29-2017 08:51

Block Changing Name
 
Hello Friends,
I know that it's already made. I was using that until I saw persons that are changing their name in my server.
I need a plugin that is blocking name.
When I use "name purposeless" or "setinfo name purposeless", in console it will say "Renaming is blocked"
And his name will not be changed.

eyal282 06-29-2017 09:00

Re: Block Changing Name
 
PHP Code:

set_user_info(id"name""purposeless"); 

Keep in mind that such thing is incredibly annoying if you wish to keep your players in the server.

PurposeLessx 06-29-2017 09:15

Re: Block Changing Name
 
Quote:

Originally Posted by eyal282 (Post 2532446)
PHP Code:

set_user_info(id"name""purposeless"); 

Keep in mind that such thing is incredibly annoying if you wish to keep your players in the server.

I know this code. set_user_info
But I don't know that control rename. Should I use fakemeta include?

OciXCrom 06-29-2017 09:23

Re: Block Changing Name
 
Search. It has been done 100 times.

PurposeLessx 06-29-2017 09:24

Re: Block Changing Name
 
Would it work?

PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init() {
    
register_plugin("No Change Nick""0.1.2""VEN"//Edited by PurposeLess

    
register_forward(FM_ClientUserInfoChanged"ForwardUserInfoChanged")
}

public 
ForwardUserInfoChanged(idbuffer)
{
    if(!
is_user_connected(id))
        return 
FMRES_IGNORED;

    static 
name[32]
    
get_user_name(idnamesizeof(name) - 1)

    
engfunc(EngFunc_SetClientKeyValueidbuffer"name"name)
    
client_cmd(id"name ^"%s^""name)
    
set_user_info(id"name"name)
    return 
FMRES_SUPERCEDE;



OciXCrom 06-29-2017 10:25

Re: Block Changing Name
 
Can't you test it?

Craxor 07-03-2017 05:14

Re: Block Changing Name
 
why you set 3 times the name ?

client_infochanged(id) is ok don't need fakemeta, also set_user_info is enough.

PurposeLessx 07-05-2017 06:37

Re: Block Changing Name
 
Why isn't it working?

PHP Code:

public client_infochanged(id)
{
    if(
get_pcvar_num(nickengel) == 1)
    {
        static 
oldname[32], newname[32]
        
get_user_name(idoldnamecharsmax(oldname) - 1)
        
get_user_info(id"name"newnamecharsmax(newname))
        
        if(
equal(newnameoldname))
            return 
PLUGIN_CONTINUE;
        
        if(
nick_flood[id]) {
            
console_print(id"[SERVER GUARD] You can change your name after %i minutes"nicksuresi[id])
            return 
PLUGIN_HANDLED;
        }
        else {
            
nick_flood[id] = true
            nicksuresi
[id] = nicktime
            set_task
(1.0"nickflood_control"id)
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
nickflood_control(id)
{
    if(
nicksuresi[id] == 0)
    {
        
nick_flood[id] = false
    
}
    else
    {
        
nicksuresi[id]--;

        
set_task(1.0"nickflood_control"id)
    }



fysiks 07-05-2017 09:30

Re: Block Changing Name
 
IIRC, you can't block anything with client_infochanged(), you have to use Fakemeta.

You should find one of the many "name change" plugins and see how it is done there.

Craxor 07-05-2017 10:15

Re: Block Changing Name
 
fyisiks, as i know you can 'block' changing name with client_infochanged.

@OP: You have also to use set_user_info to set the OldName as being the new name.


All times are GMT -4. The time now is 22:53.

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