Splitting chat lines
#3

It is not difficult, it is simple, you should learn how to use strings, strmid, strdel and strlen. Here is an example.

pawn Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>


public OnPlayerText(playerid, text[])
{
    new chat_text[144];
    format(chat_text, sizeof(chat_text), "%s(%d): %s", Name(playerid), playerid, text);
   
    if(strlen(chat_text) < 72) // 1/2
    {
        SendClientMessageToAll(-1, chat_text);
    }
    else if(strlen(chat_text) > 72) // +1/2
    {
        new chat_line[2][73];
        strmid(chat_line[0], chat_text, 0, 72, 72);
        SendClientMessageToAll(-1, chat_line[0]);
        strmid(chat_line[1], chat_text, 73, 144, 72);
        SendClientMessageToAll(-1, chat_line[1]);
        strdel(chat_text, 0, 144);
        return false;
    }
    return true;
}

stock Name(playerid)
{
    new name[24];
    GetPlayerName(playerid, name, 24);
    return name;
}
Reply


Messages In This Thread
Splitting chat lines - by CalvinC - 22.12.2014, 09:48
Re: Splitting chat lines - by CalvinC - 24.12.2014, 00:14
Re: Splitting chat lines - by JuanStone - 24.12.2014, 00:44

Forum Jump:


Users browsing this thread: 2 Guest(s)