Guest Aurela Posted September 2, 2014 (edited) 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 September 3, 2014 by Aurela Quote Share this post Link to post Share on other sites
0 AnnieRuru 958 Posted September 3, 2014 (edited) weird ... when I look at the ascii table http://www.cdrummond.qc.ca/cegep/informat/professeurs/alain/Images/ascii2.gif Alt+160 is actually -> á but how come in the game it works different -.-" prontera,156,173,4 script sdfkhfksd 100,{ input .@a$; if ( .@a$ == "x3A" ) dispbottom ":"; if ( .@a$ == "x3B" ) dispbottom ";"; if ( .@a$ == "x20" ) dispbottom "[space]"; if ( .@a$ == "xA0" ) dispbottom "Alt+03232"; setarray .@b$, "x20x3Ax20", "x20x3AxA0", "x20x3Bx20", "x20x3BxA0", "xA0x3Ax20", "xA0x3AxA0", "xA0x3Bx20", "xA0x3BxA0"; for ( .@i = 0; .@i < 8; .@i++ ) if ( compare( .@a$, .@b$[.@i] ) ) dispbottom "failed"; end;} Edited September 3, 2014 by AnnieRuru Quote Share this post Link to post Share on other sites
0 Guest Aurela Posted September 4, 2014 (edited) 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 September 4, 2014 by Aurela Quote Share this post Link to post Share on other sites
0 Luffy 14 Posted September 9, 2014 can i just use the plugin? or i'll have to put the patch too? Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted September 9, 2014 You can use just the plugin. The patch is an optional method for those who can't or have trouble installing plugins. Quote Share this post Link to post Share on other sites
0 Luffy 14 Posted September 9, 2014 Thank you for insight Quote Share this post Link to post Share on other sites
0 Garr 117 Posted September 11, 2014 (edited) 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 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 September 11, 2014 by Garr Quote Share this post Link to post Share on other sites
0 AnnieRuru 958 Posted September 11, 2014 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 charactersAlt + ???? 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);} 2 Nova and evilpuncker reacted to this Quote Share this post Link to post Share on other sites
0 Garr 117 Posted September 11, 2014 (edited) 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 September 11, 2014 by Garr Quote Share this post Link to post Share on other sites
0 Nova 4 Posted February 13, 2015 Thanks a lot for the script Annie, it's working like a charm. Quote Share this post Link to post Share on other sites
0 evilpuncker 504 Posted January 14, 2016 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 charactersAlt + ???? 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 Quote Share this post Link to post Share on other sites
0 AnnieRuru 958 Posted March 27, 2019 bump https://github.com/AnnieRuru/Release/blob/master/plugins/GM_impersonate/GM_impersonate_0.5.c - fix this and use in latest hercules just want to get through the bottom of this ... Quote Share this post Link to post Share on other sites
0 vBrenth 39 Posted March 27, 2019 8 hours ago, AnnieRuru said: bump https://github.com/AnnieRuru/Release/blob/master/plugins/GM_impersonate/GM_impersonate_0.5.c - fix this and use in latest hercules just want to get through the bottom of this ... This is good, thanks to this. 1 AnnieRuru reacted to this Quote Share this post Link to post Share on other sites
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 AurelaShare this post
Link to post
Share on other sites