[HELP] How to do this? [Unsolved]
#1

How can i do this?


I mean when someome types more than 30 chracters (It is an example,i don't know how many chracters),
it gets what he wrote and types it again in another message,i tried something and it didn't work.
I know it's something in OnPlayerText if(legnth) or something like that.

Thanks
Reply
#2

I made it with space detection, so it would be:
Код:
(( [8] Uniqueee: hello all the people ... ))
(( [8] Uniqueee: ... in the world! ))
instead of:
Код:
(( [8] Uniqueee: hello all the peo ... ))
(( [8] Uniqueee: ... ple in the world! ))
Код:
#define MAXLEN 30
pawn Код:
OnPlayerText

new str[128];
if(strlen(text) > MAXLEN)
{
  new pos = MAXLEN+10;
  while(text[--pos] > ' ') {}
  if(pos < MAXLEN-10) pos = MAXLEN;
  format(str, sizeof(str), "(( [%d] %s: %.*s ... ))", playerid, PlayerName(playerid), pos, text);
  SendClientrMessageToAll(WHITE, str);
  format(str, sizeof(str), "(( [%d] %s: ... %s ))", playerid, PlayerName(playerid), text[pos+1]);
  SendClientMessageToAll(WHITE, str);
  return 0;
}
Reply
#3

Quote:
Originally Posted by Μαστερμινδ
I made it with space detection, so it would be:
Код:
(( [8] Uniqueee: hello all the people ... ))
(( [8] Uniqueee: ... in the world! ))
instead of:
Код:
(( [8] Uniqueee: hello all the peo ... ))
(( [8] Uniqueee: ... ple in the world! ))
Код:
#define MAXLEN 30
pawn Код:
OnPlayerText

new str[128];
if(strlen(text) > MAXLEN)
{
  new pos = MAXLEN+10;
  while(text[--pos] > ' ') {}
  if(pos < MAXLEN-10) pos = MAXLEN;
  format(str, sizeof(str), "(( [%d] %s: %.*s ... ))", playerid, PlayerName(playerid), pos, text);
  SendClientrMessageToAll(WHITE, str);
  format(str, sizeof(str), "(( [%d] %s: ... %s ))", playerid, PlayerName(playerid), text[pos+1]);
  SendClientMessageToAll(WHITE, str);
  return 0;
}
It works but i meant if a player writes something that is bigger than the chat limit,
there is a limit like 50 chracters,i want it to write the text after the limit.
Reply
#4

Quote:
Originally Posted by Uniqueee
It works but i meant if a player writes something that is bigger than the chat limit,
there is a limit like 50 chracters,i want it to write the text after the limit.
hmm.. not sure what you mean :\
Reply
#5

I know what he means,
What he means is on sa-mp,
If you say something in chat like ( This is just a short example imagine it a long sentence )
Hello, My name is Joe, I own GTASA and script pawno,
Imagine that being way longer, If it was..
SA-MP Would show it probably like this

Hello, My name is Joe, I own GTASA and script pa

And cut it off, He wants to make it, So it continues the text and dosent cut it off on another line

Reply
#6

He means SendPlayerMessageToAll...
Reply
#7

LOL what he means is....
if you write something on sa-mp, normally the text would come out like this
ex "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."

he want's it to be like
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore....
....et dolore magna aliqua."
Reply
#8

Quote:
Originally Posted by kmzr
LOL what he means is....
if you write something on sa-mp, normally the text would come out like this
ex "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."

he want's it to be like
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore....
....et dolore magna aliqua."
Exactly. (( I didn't mean SendClientMessageToAll Lol ;p ))
The code he gave me didn't work,i changed it a lil bit but still..
Here is the code:

pawn Код:
if(strlen(result) > MAXLEN)
            {
              new pos = MAXLEN+10;
              while(result[--pos] > ' ') {}
              if(pos < MAXLEN-10) pos = MAXLEN;
              format(string, sizeof(string), "(([ID:%d]%s: %.*s ... ))", playerid, sendername, pos, result);
              ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
              format(string, sizeof(string), "(([ID:%d]%s: ... %s ))", playerid, sendername, result[pos+1]);
              ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
              return 1;
            }

Reply
#9

The max lenght of a line in sa-mp is 128 characters. But you have to take into account the final three dots, the player's name and the parenthesis.
The simple way:
Set #define MAXLEN 97

Why?
128 - MAX_PLAYER_NAME (24) - 3 (for the starting double parenthesis and the space) - 4 (for the ending space and three dots) = 97

The harder way:
Do the same as above, but make MAXLEN dinamic depending on the real lenght of the player name.
Reply
#10

Quote:
Originally Posted by Zamaroht
The max lenght of a line in sa-mp is 128 characters. But you have to take into account the final three dots, the player's name and the parenthesis.
The simple way:
Set #define MAXLEN 97

Why?
128 - MAX_PLAYER_NAME (24) - 3 (for the starting double parenthesis and the space) - 4 (for the ending space and three dots) = 97

The harder way:
Do the same as above, but make MAXLEN dinamic depending on the real lenght of the player name.
I tried to #define MAXLEN 97,it didn't do anything - i can't even see the dots when i write something longer than the samp def.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)