SA-MP Forums Archive
/me & /do (format) in two lines - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /me & /do (format) in two lines (/showthread.php?tid=269653)



/me & /do (format) in two lines - Homerman - 17.07.2011

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.


Re: /me & /do (format) in two lines - FireCat - 17.07.2011

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;
}



Re: /me & /do (format) in two lines - Ehab1911 - 17.07.2011

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


Re: /me & /do (format) in two lines - park4bmx - 17.07.2011

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


Re: /me & /do (format) in two lines - Homerman - 17.07.2011

None of you caught my point :/


Re: /me & /do (format) in two lines - [HiC]TheKiller - 17.07.2011

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.


Re: /me & /do (format) in two lines - Flyfishes - 17.07.2011

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!


Re: /me & /do (format) in two lines - Homerman - 17.07.2011

Exactly!
Thank you


Re: /me & /do (format) in two lines - Homerman - 17.07.2011

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



Re: /me & /do (format) in two lines - Flyfishes - 17.07.2011

Is the function inside OnPlayerCommandText?