something wrong plz help -
samuel_hamza - 13.07.2010
Well, I wanted to make 2 lines whenever I write a long text, I tried to do that, but it shows a text messed up..., but when I write short text, it looks fine. dunno why, take atleast one look on it, plz and thx
Код:
if(strcmp(cmd, "/d", true) == 0)
{
new string[256];
if(IsPlayerConnected(playerid))
{
if(IsLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You are not logged in yet.");
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_WHITE, " USAGE: /r [radio transmission]");
return 1;
}
if(strlen(cmdtext) > 50)
{
new string2[120];
format(string,120,"[GOV]%s:%s...", sendername,cmdtext[50]);
strdel(cmdtext,50,strlen(cmdtext));
format(string2,120,"... %s",cmdtext[4]);
SendClientMessageToAll(COLOR_DEPART_RADIO,string);
SendClientMessageToAll(COLOR_DEPART_RADIO,string2);
}
else
{
format(string,120,"[GOV]%s: %s", sendername,cmdtext[4]);
SendClientMessageToAll(COLOR_DEPART_RADIO,string);
}
}
return 1;
}
Re: something wrong plz help -
coole210 - 14.07.2010
On the second line should'nt you make cmdtext[4] into cmdtext[strlen(cmdtext)-50] ?
Just guessing
Re: something wrong plz help -
samuel_hamza - 14.07.2010
Excuse me, but I didn't understand anything..
Re: something wrong plz help -
Zezombia - 14.07.2010
As I posted in your other topic, this would do fine:
pawn Код:
if(strcmp(cmdtext, "/d", true, 2) == 0)
{
new string[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(IsLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You are not logged in yet.");
if(strlen(cmdtext[3]) == 0) return SendClientMessage(playerid, COLOR_GREY, " USAGE: /b [text]");
format(string, sizeof(string), "((%s: %s))", pname, cmdtext[3]);
SendClientMessageToAll(COLOR_GREY, string);
return 1;
}
Re: something wrong plz help -
samuel_hamza - 14.07.2010
Well, this will make only for one line, I want that /d works in 2 lines when it got 2 long text, understood now ?
Re: something wrong plz help -
Zezombia - 14.07.2010
I understand, but I don't think you really need that :P. But if you insist, try this:
pawn Код:
if(strcmp(cmdtext, "/d", true, 2) == 0)
{
new string[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(IsLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You are not logged in yet.");
if(strlen(cmdtext[3]) == 0) return SendClientMessage(playerid, COLOR_GREY, " USAGE: /b [text]");
if(strlen(cmdtext) > 50)
{
strmid(string, cmdtext, 3, 50);
format(string, sizeof(string), "[GOV]%s: %s...", pname, string);
SendClientMessageToAll(COLOR_GREY, string);
format(string, sizeof(string), "...%s", cmdtext[50]);
SendClientMessageToAll(COLOR_GREY, string);
}
else
{
format(string, sizeof(string), "[GOV]%s: %s", pname, cmdtext[3]);
SendClientMessageToAll(COLOR_GREY, string);
}
return 1;
}
Re: something wrong plz help -
samuel_hamza - 14.07.2010
Thanks man, appreciate it...