30.06.2012, 02:40
Whenever someone types a radio message over /r with more than 87 characters, the second line appears but improperly formatted. This is what I get:
And I should be getting it like this:
This is a part of my /radio command, that's formatting and sending the text to the other players:
Код:
Captain Marcus Keaton says [Radio]: test 3433333333333333333333333333 555555555555555555555555555555555555 233333333 test 3433333333333333333333333333 555555555555555555555555555555555555 233333333111111
Код:
Captain Marcus Keaton says [Radio]: test 3433333333333333333333333333 555555555555555555555555555555555555 233333333 Captain Marcus Keaton says [Radio]: ...test 3433333333333333333333333333 555555555555555555555555555555555555 233333333111111
pawn Код:
if(IsPlayerConnected(playerid))
{
new wstring[192];
new faction = PlayerInfo[playerid][pFaction];
new rank = PlayerInfo[playerid][pRank];
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_USAGE, "[USAGE:] /®adio [message]");
return 1;
}
if(Muted[playerid])
{
SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] You can't use the radio, you're muted.");
return 1;
}
if(PlayerInfo[playerid][pFaction] != 255 && (DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1 || DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 2 || DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 3))
{
if(PlayerInfo[playerid][pFaction] != 255 && (DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1 || DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 2 || DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 3))
{
if(CopOnDuty[playerid] || EMSOnDuty[playerid] || DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 2)
{
if(rank == 1)
{
if(strlen(result)<87)
{
if(PlayerInfo[playerid][pMaskUse] == 0)
{
format(wstring, sizeof(wstring), "%s %s says [Radio]: %s",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
SendFactionTypeMessage(DynamicFactions[PlayerInfo[playerid][pFaction]][fType], COLOR_YELLOW, wstring);
}
else
{
format(wstring, sizeof(wstring), "%s %s says [Radio]: %s",DynamicFactions[faction][fRank1],PlayerInfo[playerid][pMaskID],result);
SendFactionTypeMessage(DynamicFactions[PlayerInfo[playerid][pFaction]][fType], COLOR_YELLOW, wstring);
}
ProxDetector(20.0, playerid, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
else
{
new part1[87];
new part2[44];
strmid(part1,result,0,86,87);
if(PlayerInfo[playerid][pMaskUse] == 0)
{
format(wstring, sizeof(wstring), "%s %s says [Radio]: %s...",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),part1);
SendFactionTypeMessage(DynamicFactions[PlayerInfo[playerid][pFaction]][fType], COLOR_YELLOW, part1);
}
else
{
format(wstring, sizeof(wstring), "%s %s says [Radio]: %s...",DynamicFactions[faction][fRank1],PlayerInfo[playerid][pMaskID],part1);
SendFactionTypeMessage(DynamicFactions[PlayerInfo[playerid][pFaction]][fType], COLOR_YELLOW, part1);
}
ProxDetector(20.0, playerid, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
strmid(part2,result,86,128,44);
if(PlayerInfo[playerid][pMaskUse] == 0)
{
format(wstring, sizeof(wstring), "%s %s says [Radio]: ...%s",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),part2);
SendFactionTypeMessage(DynamicFactions[PlayerInfo[playerid][pFaction]][fType], COLOR_YELLOW, part2);
}
else
{
format(wstring, sizeof(wstring), "%s %s says [Radio]: ...%s",DynamicFactions[faction][fRank1],PlayerInfo[playerid][pMaskID],part2);
SendFactionTypeMessage(DynamicFactions[PlayerInfo[playerid][pFaction]][fType], COLOR_YELLOW, part2);
}
ProxDetector(20.0, playerid, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
}
else if(rank == 2)
{ ... // and so on...