Raising the letter count limit
#1

Hello.
Recently, I have asked for help to make the message player sends divided to two lines, so you can use /me and /do without loosing letters, and I got an answer - https://sampforum.blast.hk/showthread.php?tid=269653

However, now I need to raise the limit of letters, because when I write something, it cuts in the end and when I do this:

* Homerman sniffs, as he reaches inside his duty belt, then takes out a ticket book along with a pen and starts writing down a ticket.

It shows like

* Name_Surname sniffs, as he reaches inside his duty belt, then takes out a ticket book along with a pen and starts writ

You know what I mean...
I tried to change it by increasing the string limit, didn't help, anyone has idea how to solve it?
I know I'm lame, but... whatever.

Код:
SendCustomPlayerMessage(playerid, color, text[])
{
    if(strlen(text) > 112)
    {
        new text1[112],
            text2[224],
			string[224];

        strmid(text1, text, 0, 112);
        strmid(text2, text, 111, 224);
        
        format(string, 224, "%s...", text1);
        SendClientMessage(playerid, color, string);

        format(string, 224, "...%s", text2);
        SendClientMessage(playerid, color, string);
    }
    else SendClientMessage(playerid, color, text);
}
Just like LS:RP.
Reply
#2

Show your /me command.
Reply
#3

Do you mean that the word is getting cut off on the end and half of it is going to the next line? Do this

pawn Код:
SendCustomPlayerMessage(playerid, color, text[])
{
    if(strlen(text) > 112)
    {
        new text1[112],
            text2[112],
            pos = strfind(text," "false,102)
            string[224];

        strmid(text1, text, 0, pos);
        strmid(text2, text, pos, strlen(text));
       
        format(string, sizeof(string), "%s...", text1);
        SendClientMessage(playerid, color, string);

        format(string, sizeof(string), "...%s", text2);
        SendClientMessage(playerid, color, string);
    }
    else SendClientMessage(playerid, color, text);
}
This code will cause it to cut off after the word. There is a issue if the person types grjioji9urejogjoirjoieerjoijoirejoigrjiergjoigrejo jeegrrgorojrjijrigo without any spaces though but that should be easy to fix.
Reply
#4

This is the /me command.

Код:
if(!strcmp(cmdtext, "/me", true, 3))
    {
        if(IsPlayerConnected(playerid))
	    {
	        if(pInfo[playerid][pLogged] != 1)
	        {
	            SendClientMessage(playerid,COLOR_GREY,"* You haven't logged in yet");
	            return 1;
	        }
    		if(!cmdtext[3]) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /me [action]");
    		format(string, sizeof(string), "* %s %s", RemoveUnderScore(playerid), cmdtext[4]);
    		ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			format(string, sizeof(string), "[ACTION] %s - %s", RemoveUnderScore(playerid), cmdtext[4]);
			SaveAction(string);
		}
    	return 1;
    }
Reply
#5

... I know. That's what I actually want.
BUT, when I reach the chat (in SAMP) length limit and send the form, it shows without the end, even when the second line is not full. On Los Santos RolePlay (I assume everybody heard about it) it's not like that, you can send a full chat form and it shows (in two lines, but shows full).
And that's what I want.

Splitted in two lines without cutting the end.
Reply
#6

pawn Код:
format(string, sizeof(string), "* %s %s", RemoveUnderScore(playerid), cmdtext[4]);
I think string is 128 cells big. You need to make it bigger.
Reply
#7

Quote:
Originally Posted by Homerman
Посмотреть сообщение
... I know. That's what I actually want.
BUT, when I reach the chat (in SAMP) length limit and send the form, it shows without the end, even when the second line is not full. On Los Santos RolePlay (I assume everybody heard about it) it's not like that, you can send a full chat form and it shows (in two lines, but shows full).
And that's what I want.

Splitted in two lines without cutting the end.
The end part of your text cuts off because the input limit of samp(the 'chat') is 128 characters, just like your string which is 128 cells big. But, that's not it, the input will also be used on the player's name. Let's assume your name is 12 characters long and you enter a full 128 character message, so that will be 12-128=116=the amount of characters you will be displayed on screen. You can resolve this by changing the string cells to: 128+MAX_PLAYER_NAME+3=155 (note: that the '3' is the star and 2 spaces in the string).
Reply
#8

That was it... sorry for my dumbness, fixed.
Reply
#9

Quote:
Originally Posted by ******
Посмотреть сообщение
For my own reasons I did a test to see what the true max length of a "SendClientMessage" string was and came up with 144 (so 145 with "NULL").
Wow, I was wondering why it went over 128... Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)