Raised This Month: $51 Target: $400
 12% 

[REQ] Name change DELAY


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
botz
AlliedModders Donor
Join Date: Jan 2015
Old 10-03-2015 , 12:58   [REQ] Name change DELAY
Reply With Quote #1

I want a plugin that gives us 10 sec delay for changing name, so if change ur name every sec it wont work, it will keep saying u on message area "[AMXX] Name can be only changed every 20 second." There are exploits which u can change your name every sec. Thats why i need this delay.

I did check other plugins similiar to this some that were approved dont even work, some that had this function has more and alot more stuff that i dont need. Please someone make me this

Thanks for the help
__________________
botz is offline
Hartmann
Senior Member
Join Date: Nov 2014
Old 10-03-2015 , 16:59   Re: [REQ] Name change DELAY
Reply With Quote #2

Try...

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

new cName[33];

public 
plugin_init() {
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged")     
}
public 
ClientUserInfoChanged(usr
{
    static const 
name[] = "name" 
    
static szOldName[32], szNewName[32
    
pev(usrpev_netnameszOldNamecharsmax(szOldName)) 
    if( 
szOldName[0] ) 
    { 
        
get_user_info(usrnameszNewNamecharsmax(szNewName)) 
        if(
cName[usr]){
            if( !
equal(szOldNameszNewName)) { 
                
set_user_info(usrnameszOldName); 
                
client_print(usr,print_chat"Wait to pass 20 seconds of last change.");
                return 
FMRES_HANDLED
            } 
        } 
        else 
        {
            
cName[usr] = true;
            
set_task(20.0"change"usr);
            
client_print(usr,print_chat"Name change allowed for 20 seconds."); 
        } 
    }
    return 
FMRES_IGNORED 
}  
public 
change(usr){ 
    
cName[usr] = false;
}
public 
client_putinserver(usr){ 
    
cName[usr] = false;

__________________

RETAKES v1.0
github.com/alghtryer/retakes

Contact : [email protected]

BTC Donate: 1QAh1NLmeHy81LF9r8PaeGjYqHL2BBcJTx

Hartmann is offline
botz
AlliedModders Donor
Join Date: Jan 2015
Old 10-05-2015 , 22:39   Re: [REQ] Name change DELAY
Reply With Quote #3

Hey i need a bit more edit

When he changes name in less then 20 secs it should tell him "[AMXX] Name Change Delay, You can only change name manually every 20 secs." IN Console and in Chat area, whenever he tries when the time hasnt passed

It shouldnt change his next name automatic in next 20 secs but tell him to try again changing in 20 secs, he should try again manually

Thanks for the great work sir
__________________
botz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-05-2015 , 23:31   Re: [REQ] Name change DELAY
Reply With Quote #4

Here's a simpler, more compact and more efficient version:

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

new g_szNameChangeMessage[] = "Name change denied.  You can only change name manually every 20 seconds."

public plugin_init()
{
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged")
}

public 
ClientUserInfoChanged(idbuffer)
{
    static 
szOldName[32], szNewName[32]
    static 
iTime[33]

    if( !
is_user_connected(id) || is_user_bot(id) || !is_user_alive(id) )
        return 
FMRES_IGNORED
    
    get_user_name
(idszOldNamecharsmax(szOldName))
    
engfunc(EngFunc_InfoKeyValuebuffer"name"szNewNamecharsmax(szNewName))
    if( !
equal(szOldNameszNewName))
    {
        if( 
get_systime() < iTime[id] )
        {  
// Name change not allowed, override the name change request to request the same name
            
engfunc(EngFunc_SetClientKeyValueidbuffer"name"szOldName)
            
console_print(idg_szNameChangeMessage)
            
client_print(idprint_chatg_szNameChangeMessage)
            return 
FMRES_SUPERCEDE
        
}
        else
        {  
// Name change allowed, update the time for the next name change
            
iTime[id] = get_systime() + 20
        
}
    }
    return 
FMRES_IGNORED

You can change the string for g_szNameChangeMessage to whatever message you want.

P.S. This is based on other name change plugins that I have but I didn't explicitly test this on. Let me know if it doesn't work.
__________________

Last edited by fysiks; 10-08-2015 at 19:51.
fysiks is offline
botz
AlliedModders Donor
Join Date: Jan 2015
Old 10-06-2015 , 20:53   Re: [REQ] Name change DELAY
Reply With Quote #5

Buggy

People have changed to other peoples name, or when u join u have a diff name to same as others, and the other guys switch auto matic, sometimes new people have same name as old people that were in server and had left, so new one joins has hiss name

Also when you fix can you update the message and time

Time: 5 secs , manually
Message:
[AMXX] Name change request refused. You can only change name manually every 5 seconds.

Thanks for the work
__________________

Last edited by botz; 10-06-2015 at 20:54.
botz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-07-2015 , 20:29   Re: [REQ] Name change DELAY
Reply With Quote #6

Quote:
Originally Posted by botz View Post
Buggy
How so?

Quote:
Originally Posted by botz View Post
People have changed to other peoples name, or when u join u have a diff name to same as others, and the other guys switch auto matic, sometimes new people have same name as old people that were in server and had left, so new one joins has hiss name
This plugin has nothing to do with multiple players having the same name.

Quote:
Originally Posted by botz View Post
Also when you fix can you update the message and time

Time: 5 secs , manually
Message:
[AMXX] Name change request refused. You can only change name manually every 5 seconds.
I made it EXTREMELY easy for you to do that on your own.
__________________
fysiks is offline
botz
AlliedModders Donor
Join Date: Jan 2015
Old 10-08-2015 , 15:32   Re: [REQ] Name change DELAY
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
How so?



This plugin has nothing to do with multiple players having the same name.



I made it EXTREMELY easy for you to do that on your own.

I mean that the bug is, when player enters his name is changed to anothers players name who had "LEFT" the server. Automatically thats bug.

I know u made it so easy but what i meant is that for the new plugin you make after knowing this bugs, please add those new settings i listed above.

Thanks for helping, love your work
__________________
botz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-08-2015 , 19:52   Re: [REQ] Name change DELAY
Reply With Quote #8

Quote:
Originally Posted by botz View Post
I mean that the bug is, when player enters his name is changed to anothers players name who had "LEFT" the server. Automatically thats bug.
I'm not sure how that is possible but I added an extra check which I think might help. I posted the new code in the post above.
__________________
fysiks 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 19:31.


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