Send Long Message - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Send Long Message (
/showthread.php?tid=277281)
Send Long Message -
jameskmonger - 17.08.2011
I saw a function a while ago to send a long message to a player, the format would be like this:
pawn Код:
SendLongMessage(playerid, COLOR_RED, "This is a very very long message and it's going to overflow hopefully yada yada yada");
And the output would be something like:
This is a very very long message and it's going to ...
...overflow hopefully yada yada yada
Basically if the message was longer than 128 bytes, it would split it.
Can someone give me it?
Re: Send Long Message -
Davz*|*Criss - 17.08.2011
Hi there,
You can get an idea from this
https://sampforum.blast.hk/showthread.php?tid=220209
Re: Send Long Message -
jameskmonger - 17.08.2011
Davz* I need a way to do it automatically, because I'm sending a message that the player has sent
Re: Send Long Message -
Darnell - 17.08.2011
pawn Код:
SendLongMessage(playerid, COLOR_RED, "This is a very very long message and..\n..it's going to overflow hopefully yada yada yada");
Try this.
Re: Send Long Message -
=WoR=Varth - 17.08.2011
You can't use \n in Client Message.
Re: Send Long Message -
marrcko - 17.08.2011
https://sampwiki.blast.hk/wiki/Strlen use this to get string length
if sting is like 200 u can create 2 other string variables and give them ur message then use this:
https://sampwiki.blast.hk/wiki/Strdel and delete 1st string for example from 128 other to 129. If u need '...' use
https://sampwiki.blast.hk/wiki/Strins
Re: Send Long Message -
jameskmonger - 17.08.2011
Darnell read before you reply.
Thanks marrcko, I was hoping someone could just give me it, but thanks anyway.
Re: Send Long Message -
marrcko - 17.08.2011
no problem.. probably i could script it but i'm too lazy now
Re: Send Long Message -
iPLEOMAX - 17.08.2011
I guess you're searching for this: (had it for long..

)
pawn Код:
//On top of your script:
#define MAX_CHARS_PER_LINE 80
#define FINAL_DOTS
//somewhere outside functions:
stock sendLongMessage( playerid , color , message[] )
{
new len = strlen(message),
_iL = len / MAX_CHARS_PER_LINE;
if( ( len % MAX_CHARS_PER_LINE ) ) _iL++;
new _Line[MAX_CHARS_PER_LINE + 5];
new _:_i@Index;
while( _i@Index < _iL )
{
if( _i@Index == 0 )
strmid( _Line, message, ( _i@Index * MAX_CHARS_PER_LINE ), ( _i@Index * MAX_CHARS_PER_LINE ) + MAX_CHARS_PER_LINE );
else
strmid( _Line, message, ( _i@Index * MAX_CHARS_PER_LINE ), ( _i@Index * MAX_CHARS_PER_LINE ) + MAX_CHARS_PER_LINE );
#if defined FINAL_DOTS
if( _iL > 1 )
{
if( _i@Index == 0 )
{
format( _Line, sizeof _Line, "%s ...", _Line );
}
else if( _i@Index > 0 && ( _i@Index + 1 ) < _iL )
{
format( _Line, sizeof _Line, "... %s ...", _Line );
}
else
{
format( _Line, sizeof _Line, "... %s", _Line );
}
}
#endif
////////////
SendClientMessage( playerid, color, _Line );
///////////
_i@Index++;
}
return 1;
}
//Credits to Miki
Re: Send Long Message -
steki. - 17.08.2011
Thanks for the credits D: