Jump to content
  • 0
Sign in to follow this  
Guest Aurela

Chat space limitation!/Scammer avoid *Will pay for help*

Question

Guest Aurela

Hello, c;

 

I need a limitation for spaces in chat.


For example:

 

Name : Hello my   name   is   l   l   l   l

 

You're only allowed to do max 3 spaces in a row. 

If anyone would be able to help me out I'd be very happy.

 

Also, I will pay for this if needed.

Edited by Aurela

Share this post


Link to post
Share on other sites

37 answers to this question

Recommended Posts

  • 0

I hope this is final one that will work

 

patch

 src/map/clif.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)diff --git a/src/map/clif.c b/src/map/clif.cindex d9acf07..5b3418e 100644--- a/src/map/clif.c+++ b/src/map/clif.c@@ -9110,6 +9110,22 @@ bool clif_process_message(struct map_session_data *sd, int format, char **name_, 	*namelen_ = namelen; 	*message_ = message; 	*messagelen_ = messagelen;++	{+		int i, l = strlen(message);+		for ( i = 0; i <= l; i++ )+			if ( message[i] == 'xA0' )+				message[i] = 'x20'; // replace Alt+0160 into [space]+		if ( stristr( message, "    " ) ) {+			clif->colormes( sd->fd, COLOR_RED, "You are only allow to type maximum of 3 spaces in a dialog." );+			return false;+		}+		if ( stristr( message, "x20x3Ax20" ) || stristr( message, "x20x3Bx20" ) ) { // type " : " OR " ; " will be blocked+			clif->colormes( sd->fd, COLOR_RED, "You can't impersonate other players !" );+			return false;+		}+	}+ 	return true; } 
plugin
#include <stdio.h>#include <stdlib.h>#include <string.h>#include "../map/pc.h"#include "../map/clif.h"#include "../common/HPMi.h"#include "../common/socket.h"#include "../common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)HPExport struct hplugin_info pinfo = {	"GM_impersonate",	// Plugin name	SERVER_TYPE_MAP,// Which server types this plugin works with?	"0.1",			// Plugin version	HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)};bool clif_process_message_spaces( int retVal, struct map_session_data *sd, int format, char **name_, size_t *namelen_, char **message_, size_t *messagelen_) {	if ( retVal == true ) {		char* message = (char*)RFIFOP( sd->fd ,4) + strnlen(sd->status.name, NAME_LENGTH-1) + 3;		int i, l = strlen(message);		for ( i = 0; i <= l; i++ )			if ( message[i] == 'xA0' )				message[i] = 'x20'; // replace Alt+0160 into [space]		if ( stristr( message, "    " ) ) {			clif->colormes( sd->fd, COLOR_RED, "You are only allow to type maximum of 3 spaces in a dialog." );			return false;		}		if ( stristr( message, "x20x3Ax20" ) || stristr( message, "x20x3Bx20" ) ) { // type " : " OR " ; " will be blocked			clif->colormes( sd->fd, COLOR_RED, "You can't impersonate other players !" );			return false;		}	}	return true;}HPExport void plugin_init (void) {	clif = GET_SYMBOL("clif");	session = GET_SYMBOL("session");	strlib = GET_SYMBOL("strlib");	addHookPost("clif->process_message", clif_process_message_spaces);}
.

.

as it turns out, I just have to replace Alt+0160 into [space], then just block players from typing " : " is already enough

no need some kind of blocklist after all

Share this post


Link to post
Share on other sites
  • 0
Guest Aurela

Alright so: 

You can't use more than 3 spaces anymore.

You can't use : and ; between two words anymore. 
You can't use alt+0160 anymore.

 

I think that's perfect. We also removed [] from the character creation list to avoid that the scammer creates chars with this symbols. 

 

Thank you so much AnnieRuru and to the rest too. ♥

Edited by Aurela

Share this post


Link to post
Share on other sites
  • 0

Recently I came along this line in char.c:

#define TRIM_CHARS "255xA0032tx0Ax0D " //The following characters are trimmed regardless because they cause confusion and problems on the servers. [Skotlex]

So there we have few more candidates to be replaced with space :D

 

So we have:

if ( message[i] == 'xA0' || message[i] == '255' || message[i] == '032' || message[i] == 't' || message[i] == 'x0A' || message[i] == 'x0D' )	message[i] = 'x20'; // replace invisible chars with space.
Edited by Garr

Share this post


Link to post
Share on other sites
  • 0

Recently I came along this line in char.c:

#define TRIM_CHARS "255xA0032tx0Ax0D " //The following characters are trimmed regardless because they cause confusion and problems on the servers. [Skotlex]

 

 

I'm more interested to know how to type those characters

Alt + ????

 

those are actually meant for names

use together with

normalize_name( message, "255xA0032tx0Ax0D " );
they are automatically trim into 1 single space

 

oh well

patch

 src/map/clif.c | 7 +++++++ 1 file changed, 7 insertions(+)diff --git a/src/map/clif.c b/src/map/clif.cindex d9acf07..0118856 100644--- a/src/map/clif.c+++ b/src/map/clif.c@@ -9110,6 +9110,13 @@ bool clif_process_message(struct map_session_data *sd, int format, char **name_, 	*namelen_ = namelen; 	*message_ = message; 	*messagelen_ = messagelen;++	normalize_name( message, "255xA0032tx0Ax0D " );+	if ( stristr( message, "x20x3Ax20" ) || stristr( message, "x20x3Bx20" ) ) { // type " : " OR " ; " will be blocked+		clif->colormes( sd->fd, COLOR_RED, "You can't impersonate other players !" );+		return false;+	}+ 	return true; } 
plugin
#include <stdio.h>#include <stdlib.h>#include <string.h>#include "../map/pc.h"#include "../map/clif.h"#include "../common/HPMi.h"#include "../common/socket.h"#include "../common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)HPExport struct hplugin_info pinfo = {	"GM_impersonate",	// Plugin name	SERVER_TYPE_MAP,// Which server types this plugin works with?	"0.1",			// Plugin version	HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)};bool clif_process_message_spaces( int retVal, struct map_session_data *sd, int format, char **name_, size_t *namelen_, char **message_, size_t *messagelen_) {	if ( retVal == true ) {		char* message = (char*)RFIFOP( sd->fd ,4) + strnlen(sd->status.name, NAME_LENGTH-1) + 3;		normalize_name( message, "255xA0032tx0Ax0D " );		if ( stristr( message, "x20x3Ax20" ) || stristr( message, "x20x3Bx20" ) ) { // type " : " OR " ; " will be blocked			clif->colormes( sd->fd, COLOR_RED, "You can't impersonate other players !" );			return false;		}	}	return true;}HPExport void plugin_init (void) {	clif = GET_SYMBOL("clif");	session = GET_SYMBOL("session");	strlib = GET_SYMBOL("strlib");	addHookPost("clif->process_message", clif_process_message_spaces);}

Share this post


Link to post
Share on other sites
  • 0

If I understoof those right, they are typed with either alt+number if there's no x before, otherwise number is translated fro hex to dec and used that way.

Like Alt+010 (x0A) gave me new line, same with Alt+013 (x0D), I guess one os them is n, other is r? But not sure.

Alt+160 is some "Soft Hyphen", but you know that one already(xA0). (255) is unbreakable space, alt+255. 032 is actually space itself.

 

ETA: New version seems much cleaner *_*

Edited by Garr

Share this post


Link to post
Share on other sites
  • 0

 

Recently I came along this line in char.c:

#define TRIM_CHARS "255xA0032tx0Ax0D " //The following characters are trimmed regardless because they cause confusion and problems on the servers. [Skotlex]

 

I'm more interested to know how to type those characters

Alt + ????

 

those are actually meant for names

use together with

normalize_name( message, "255xA0032tx0Ax0D " );
they are automatically trim into 1 single space

 

oh well

patch

 src/map/clif.c | 7 +++++++ 1 file changed, 7 insertions(+)diff --git a/src/map/clif.c b/src/map/clif.cindex d9acf07..0118856 100644--- a/src/map/clif.c+++ b/src/map/clif.c@@ -9110,6 +9110,13 @@ bool clif_process_message(struct map_session_data *sd, int format, char **name_, 	*namelen_ = namelen; 	*message_ = message; 	*messagelen_ = messagelen;++	normalize_name( message, "255xA0032tx0Ax0D " );+	if ( stristr( message, "x20x3Ax20" ) || stristr( message, "x20x3Bx20" ) ) { // type " : " OR " ; " will be blocked+		clif->colormes( sd->fd, COLOR_RED, "You can't impersonate other players !" );+		return false;+	}+ 	return true; } 
plugin
#include <stdio.h>#include <stdlib.h>#include <string.h>#include "../map/pc.h"#include "../map/clif.h"#include "../common/HPMi.h"#include "../common/socket.h"#include "../common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)HPExport struct hplugin_info pinfo = {	"GM_impersonate",	// Plugin name	SERVER_TYPE_MAP,// Which server types this plugin works with?	"0.1",			// Plugin version	HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)};bool clif_process_message_spaces( int retVal, struct map_session_data *sd, int format, char **name_, size_t *namelen_, char **message_, size_t *messagelen_) {	if ( retVal == true ) {		char* message = (char*)RFIFOP( sd->fd ,4) + strnlen(sd->status.name, NAME_LENGTH-1) + 3;		normalize_name( message, "255xA0032tx0Ax0D " );		if ( stristr( message, "x20x3Ax20" ) || stristr( message, "x20x3Bx20" ) ) { // type " : " OR " ; " will be blocked			clif->colormes( sd->fd, COLOR_RED, "You can't impersonate other players !" );			return false;		}	}	return true;}HPExport void plugin_init (void) {	clif = GET_SYMBOL("clif");	session = GET_SYMBOL("session");	strlib = GET_SYMBOL("strlib");	addHookPost("clif->process_message", clif_process_message_spaces);}

 

hey annie sorry for the necrobump but mind updating your post again? I was about to search for it :P

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.