/me & /do (format) in two lines
#1

Hey.
I assume that most of you have got a clue about LS:RP. Well, at LS:RP, when you use /me or /do, /b, /ooc, ... I mean any command returning a string, the text will be shown in two lines.
And that's what I need.

If somebody writes something in /me, it cuts because of too many characters, so I want to divide it and show like:

* Some_Body blablabal emfwe,fw bla bla bla ... // end, too many words
... blabla bla. // here it continues.

I hope you understand, and thanks for your help.
Reply
#2

pawn Код:
CMD:me(playerid,params[])
{
new text[128],string[128],pName[MAX_PLAYER_NAME];
if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,color,"USAGE:/me [action]");
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string),"» %s: %s",pName,text);
SendClientMessageToAll(color,string);
return 1;
}
Reply
#3

pawn Код:
if(!strcmp(cmdtext, "/me", true, 3))
    {
    if(!cmdtext[3])return SendClientMessage(playerid, COLOR_PINK, "USAGE: /me [action/activity]");
    new str[256];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
    SendClientMessageToAll(0x81CFAB00, str);
    return 1;
    }

Try this I am not sure about it hehe
Reply
#4

well too late now

well you show count the string that the player send/wrights and if it goes over like lets say 80 character
send the rest of the text into another Message
EXAMPLE
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text>=80)//this would not work btw only an example
{
//and then the function to send the rest.
}
    return 1;
}
Sorry cant realy show u but thats becouse im my phone
Reply
#5

None of you caught my point :/
Reply
#6

pawn Код:
new string[2][160];
if(strlen([PARAMETER VARIABLE] > 127)
{
    strins(string[1], ,[PARAMETER VARIABLE], 128);
    strdel([PARAMETER VARIABLE], 128, sizeof(PARAMETER VARIABLE));
    new Pname[24];
    GetPlayerName(playerid, Pname, 24);
    format(string[0], sizeof(string[0]), "%s(%d):%s", Pname, playerid, [PARAMETER VARIABLE]);
    format(string[1], sizeof(string[1]), "%s(%d):%s", Pname, playerid, string[1]);
    SendClientMessage(playerid, 0xFFFFFF, string[0]);
    SendClientMessage(playerid, 0xFFFFFF, string[1]);
}
I think that's what you meant.
Reply
#7

He meant if the string is too long it'll be split into two lines.

I found you a topic about this.
http://forum.sa-mp.com/showthread.ph...ight=wrap+text

EDIT: Too late!
Reply
#8

Exactly!
Thank you
Reply
#9

Oh, right.


Код:
C:\Users\Viktor\SERVER\gamemodes\CERT.pwn(1318) : error 029: invalid expression, assumed zero
C:\Users\Viktor\SERVER\gamemodes\CERT.pwn(1318) : error 017: undefined symbol "PARAMETER"
C:\Users\Viktor\SERVER\gamemodes\CERT.pwn(1318) : error 017: undefined symbol "VARIABLE"
C:\Users\Viktor\SERVER\gamemodes\CERT.pwn(1318) : fatal error 107: too many error messages on one line
Код:
1318: if(strlen([PARAMETER VARIABLE] > 127)
EDIT: I assume I have to change the "[PARAMATER VARIABLE]" to my variable, which I did, but I still have errors like

Код:
C:\Users\Viktor\SERVER\gamemodes\CERT.pwn(1318) : error 035: argument type mismatch (argument 1)
C:\Users\Viktor\SERVER\gamemodes\CERT.pwn(1320) : error 029: invalid expression, assumed zero
C:\Users\Viktor\SERVER\gamemodes\CERT.pwn(1320) : warning 215: expression has no effect
C:\Users\Viktor\SERVER\gamemodes\CERT.pwn(1320) : warning 215: expression has no effect
C:\Users\Viktor\SERVER\gamemodes\CERT.pwn(1320) : error 001: expected token: ";", but found ")"
C:\Users\Viktor\SERVER\gamemodes\CERT.pwn(1320) : error 029: invalid expression, assumed zero
Reply
#10

Is the function inside OnPlayerCommandText?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)