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

max.character in nickname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BackStats
Senior Member
Join Date: Oct 2008
Old 06-09-2011 , 23:11   max.character in nickname
Reply With Quote #1

how to force to a maximum of 15 characters per nickname?
if the player has more than that, the plugin does not let the rest of the characters appear.
BackStats is offline
5c0r-|3i0
Veteran Member
Join Date: Nov 2008
Location: Việt Nam
Old 06-09-2011 , 23:34   Re: max.character in nickname
Reply With Quote #2

http://amxmodx.org/funcwiki.php?sear...name&go=search

Get_user_name => check lenght => get_user_name with 15 characters => set player name again...
5c0r-|3i0 is offline
Old 06-10-2011, 00:15
DjOptimuS
This message has been deleted by DjOptimuS.
DjOptimuS
Senior Member
Join Date: Jan 2009
Old 06-10-2011 , 00:20   Re: max.character in nickname
Reply With Quote #3

PHP Code:
/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN    "New Plugin"
#define AUTHOR    "Unknown"
#define VERSION    "1.0"

#define NAME_LENGHT 15

static name[32];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id)
{
    
get_user_name(idnamesizeof (name) - 1);
    
    if(
strlen(name) > NAME_LENGHT)
    {
        
name[NAME_LENGHT] = '^0';
        
set_user_info(id"name"name);
    }

i didn't tested it, i hope it works

Last edited by DjOptimuS; 06-10-2011 at 00:22.
DjOptimuS is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-10-2011 , 02:29   Re: max.character in nickname
Reply With Quote #4

get_user_name returns the amount of characters, so it is redundant to do strlen
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
BackStats
Senior Member
Join Date: Oct 2008
Old 06-10-2011 , 08:47   Re: max.character in nickname
Reply With Quote #5

It works only when the player enters the server.
If the player change nicknames after the plugin does nothing.
BackStats is offline
DjOptimuS
Senior Member
Join Date: Jan 2009
Old 06-10-2011 , 12:29   Re: max.character in nickname
Reply With Quote #6

new newname[32], oldname[32];
get_user_info(id, "name", newname, 31);
get_user_name(id, oldname, 31);

at public client_infochange and the same check as i did at connect
DjOptimuS is offline
Old 06-10-2011, 12:40
nnajko
This message has been deleted by nnajko.
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-10-2011 , 14:43   Re: max.character in nickname
Reply With Quote #7

PHP Code:
#include <amxmodx>

#define VERSION "0.0.1"
#define PLUGIN ""

#define MAX_NAME_LENGTH 15

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
}

public 
client_infochangedid )
{
    static 
szName[32]
    static const 
name[] = "name"
    
if( get_user_info(idnameszNamecharsmax(szName)) > MAX_NAME_LENGTH )
    {
        
szName[MAX_NAME_LENGTH] = EOS
        set_user_info
(idnameszName)
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 06-10-2011 , 16:55   Re: max.character in nickname
Reply With Quote #8

What does the EOS Stands for in this code ?
reinert is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-10-2011 , 17:04   Re: max.character in nickname
Reply With Quote #9

End Of String
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 17:15.


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