SA-MP Forums Archive
OnPlayerText - 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: OnPlayerText (/showthread.php?tid=376307)



OnPlayerText - jpeg - 09.09.2012

How to do that if the text is larger than player X, continue text in new line? is it possible?

sorry my bad english.



Re: OnPlayerText - Passout - 09.09.2012

Show "OnPlayerText"

I think you are asking about how to make it so players can write longer sentences in the chat...yes?


Re: OnPlayerText - jpeg - 09.09.2012

No, I want to make for example the text of player is greater than 64 characters keep the rest on a new line, not to be all in one line.


Re: OnPlayerText - Seven_of_Nine - 09.09.2012

That's automatical. SA-MP breaks the line when needed.


Re : OnPlayerText - ricardo178 - 09.09.2012

It's not automatic.. I don't actualy know how to do it but i know it's not automaticly, as i saw servers where if you write half line, it'll pass to the second one, while if i make a small string, text wont just show up, and if i make it big, it'll be gone in the screen, and bigger screens can see everything, small ones not.


Re: Re : OnPlayerText - jpeg - 09.09.2012

Quote:
Originally Posted by ricardo178
View Post
It's not automatic.. I don't actualy know how to do it but i know it's not automaticly, as i saw servers where if you write half line, it'll pass to the second one, while if i make a small string, text wont just show up, and if i make it big, it'll be gone in the screen, and bigger screens can see everything, small ones not.
Yes, I know, thanks for confirming, but unfortunately I do not know where to start :P


Re: OnPlayerText - Kirollos - 09.09.2012

use strmid, tried to make small code and tested it and worked.

pawn Code:
public OnPlayerText(playerid, text[])
{
    new pname[MAX_PLAYER_NAME], msg[256], partone[70], parttwo[70];
    GetPlayerName(playerid, pname, sizeof(pname));
   
    if(strlen(text) >= 64)
    {
        strmid(partone, text, 0, 64);
        strmid(parttwo, text, 64, strlen(text));
        format(msg, sizeof(msg), "%s[%i]:{FFFFFF} %s", pname, playerid, partone);
        SendClientMessageToAll(GetPlayerColor(playerid), msg);
        SendClientMessageToAll(-1, parttwo);
    }
    else
    {
        format(msg, sizeof(msg), "%s[%i]:{FFFFFF} %s", pname, playerid, text);
        SendClientMessageToAll(GetPlayerColor(playerid), msg);
    }
    return 0;
}



Re: OnPlayerText - jpeg - 10.09.2012

thank you guy! ^^

-