Longer chat
#1

Hey.

My OOC chat is limited to one line of text, only so many characters. How can I change this so players can type longer messages and it will go onto two lines?

Help is appreciated. Thanks.

pawn Код:
//----------------------------------[ooc]-----------------------------------------------
    if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(gPlayerLogged[playerid] == 0)
        {
          SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet !");
          return 1;
        }
            if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "  The OOC channel has been disabled by an Admin !");
                return 1;
            }
            if(PlayerInfo[playerid][pMuted] == 1)
            {
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "**ERROR: You can't speak, you have been silenced by an Administrator!");
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "**HINT: You may (/pm) an Admin to ask to be unsilenced.");
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "**HINT: It is up to the Admin's discretion whether or not to unsilence you.");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/o)oc [ooc chat]");
                return 1;
            }
            format(string, sizeof(string), "%s: %s " , sendername, result);
            OOCOff(COLOR_OOC,string);
            printf("%s", string);
        }
        return 1;
    }
Reply
#2

I'm not sure how to make it so its on two lines, but I know you can make them longer by changing
pawn Код:
new result[64];
to
pawn Код:
new result[128];
Reply
#3

Thanks for your help

EDIT: How can it displayer their ID before the message as well?
Reply
#4

pawn Код:
//----------------------------------[ooc]-----------------------------------------------
if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
    if(gPlayerLogged[playerid] == 0)
    {
      SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet !");
      return 1;
    }
if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "  The OOC channel has been disabled by an Admin !");
return 1;
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "**ERROR: You can't speak, you have been silenced by an Administrator!");
SendClientMessage(playerid, TEAM_CYAN_COLOR, "**HINT: You may (/pm) an Admin to ask to be unsilenced.");
SendClientMessage(playerid, TEAM_CYAN_COLOR, "**HINT: It is up to the Admin's discretion whether or not to unsilence you.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/o)oc [ooc chat]");
return 1;
}
format(string, sizeof(string), "[%i] %s: %s " , playerid, sendername, result);
OOCOff(COLOR_OOC,string);
printf("%s", string);
}
return 1;
}
Reply
#5

Thanks for the help
Reply
#6

No problem.
Reply
#7

Another thing, sorry should have thought of everything in the OP.

How do I get /ooc to display the players name as their color? or different parts of the text different colour, like the ID to display as grey etc. ?
Reply
#8

Quote:
Originally Posted by shaun9
Another thing, sorry should have thought of everything in the OP.

How do I get /ooc to display the players name as their color? or different parts of the text different colour, like the ID to display as grey etc. ?
Eh, explain more, I dont understand.
Reply
#9

You can only have the text as one color unless you use GameText
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)