Jump to content
  • 0

Char Name filter


Gouki

Question


  • Group:  Members
  • Topic Count:  82
  • Topics Per Day:  0.06
  • Content Count:  241
  • Reputation:   11
  • Joined:  08/12/20
  • Last Seen:  

Hi all,

I was wondering if there is a feature that prohibits char name creation if the name consists of a word that is listed from a pool.

This is the closest sample code from Emistry but made back in 2013, but I'd like to have multiple words to prohibit not just the GM, and have the player rename rather than banning them.

OnPCLoginEvent:
if( !getgmlevel() && compare( strcharinfo(0),"GM " ) ){
    mes "You cant use 'GM' in your name.";
    sleep2 3000;
    atcommand "@ban "+strcharinfo(0);
}
end;


And this is Technokens script in 2017 that asks the player rename and kicks them after

-	script	namelengthchk	-1,{
OnPCLoginEvent:
OnPCStatCalcEvent:
OnRetry:
	.@charname$ = strcharinfo(0);
	if( getstrlen(.@charname$) > 4 )end;
	mes "Please rename your character,";
	mes "Enter new name:";
	input .@newname$;
	if( getstrlen(.@newname$) < 4 || getstrlen(.@newname$) > 23 ){
		mes "You cannot enter less than minimum of 4 and greater than maximum of 23 characters.";
		goto OnRetry;
	}
	.@gid = getcharid(2);
	if( .@GID ){
		mes "Please leave your guild first before you change name.";
		goto OnRetry;
	}
	query_sql "SELECT `name` FROM `char` WHERE `name` = '"+.@newname$+"'",.@existing$;
	if( .@newname$ == .@existing$){
		mes "Name already exists.";
		goto OnRetry;
	}				
	query_sql("UPDATE `name` FROM `char` SET `name`='"+.@newname$+"' WHERE `name`='"+strcharinfo(0)+"'");
	next;
	mes "Please relog for the changes to be applied.";
	mes "signing out....";
	sleep2 3000;
	atcommand "@kick " +strcharinfo(0);
	end;
}

Maybe someone could help merge the two, specially with the name detection part.

This script will mainly be used on players who names their characters inappropriately. 

  • Upvote 1
  • MVP 1
  • Like 1
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  211
  • Reputation:   17
  • Joined:  12/23/11
  • Last Seen:  

Best way - 

So you can't even create char with blocked word

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  82
  • Topics Per Day:  0.06
  • Content Count:  241
  • Reputation:   11
  • Joined:  08/12/20
  • Last Seen:  

5 minutes ago, botka4aet said:

Best way - 

So you can't even create char with blocked word

 

Ohh this is perfect! alright will give it a try, hopefully the array of words would work.  Like "GM","F*CK","dll"

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  211
  • Reputation:   17
  • Joined:  12/23/11
  • Last Seen:  

For every word you must add new check

Like

if (strstr(name, "GM") || strstr(name, "shit") || strstr(name, "crap"))

Also it case-sensitive, so it block only shit but not SHiT.

If you wanna ignore it - you must add new string varible and set it to lowcase name.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...