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

Name change limit...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
omer
Senior Member
Join Date: Nov 2011
Old 09-10-2012 , 08:45   Name change limit...
Reply With Quote #1

Hello,
Guys can anyone can make a script to add name change limit?
Any one cannot change name when he connect to server untill 80 seconds.
And if he change name he cannot change name untill 60 seconds...
Waiting for script
__________________

omer is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 09-10-2012 , 10:35   Re: Name change limit...
Reply With Quote #2

Try this:
Code:
#include <amxmodx> #include <fakemeta> new gNextUse[ 33 ]; public plugin_init() {     register_plugin( "Name change limiter", "1.0", "matsi" );         register_forward( FM_ClientUserInfoChanged, "FwdClientUserInfoChanged" ); } public client_putinserver( id )     gNextUse[ id ] = 80; public FwdClientUserInfoChanged( id ) {     if ( get_user_time( id ) <= gNextUse[ id ] )     {         client_print( id, print_chat, "[AMXX] Name change isn't allowed until %i seconds has passed.", gNextUse[ id ] - get_user_time( id ) );                 new szOldName[ 32 ];         pev( id, pev_netname, szOldName, charsmax( szOldName ) );                 if ( szOldName[ 0 ] && is_user_alive( id ) )         {             new szNewName[ 32 ]             get_user_info( id, "name", szNewName, charsmax( szNewName ) );             if ( ! equal( szOldName, szNewName ) )             {                 set_user_info( id, "name", szOldName );                 return FMRES_HANDLED;             }         }     }     else         gNextUse[ id ] = get_user_time( id ) + 60;             return FMRES_IGNORED; }

If someone got better method feel free to share...
__________________

Accepting all kinds of requests via private message.

Last edited by matsi; 09-10-2012 at 10:35.
matsi is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-10-2012 , 10:39   Re: Name change limit...
Reply With Quote #3

@matsi - You can remove fakemeta as it's kinda useless. Use client_infochanged() that does the same without using extra module. Also first check if info changed was related to name, UserInfoChanged it's called in more situations and FMRES_HANDLED should be FMRES_SUPERCEDE.
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 09-10-2012 at 10:44.
Alka is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 09-10-2012 , 10:45   Re: Name change limit...
Reply With Quote #4

Quote:
Originally Posted by Alka View Post
@matsi - You can remove fakemeta as it's kinda useless. Use client_infochanged() that does the same without using extra module. Also first check if info changed was related to name, UserInfoChanged it's called in more situations and FMRES_HANDLED should be FMRES_SUPERCEDE.
With client_infochanged() you have problems with the message when player changes his name, thats why i used fakemeta.

And about the return types i just used ConnorMcLeod code from here ( Also read somewhere that HANDLED was enough ):
http://forums.alliedmods.net/showpos...48&postcount=3

Probably should credit him...
__________________

Accepting all kinds of requests via private message.

Last edited by matsi; 09-10-2012 at 10:49.
matsi is offline
omer
Senior Member
Join Date: Nov 2011
Old 09-11-2012 , 07:52   Re: Name change limit...
Reply With Quote #5

@matsi
Code is working Thanks,
But there is some problem when we connect it automatically say the message...
I want it to be say when player try to change name...
Thanks,
Omer
__________________

omer 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 08:43.


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