08.06.2013, 12:34
So here's the thing i made a few commands that format a message written by the player and sends that message around him or to every player on the server but there's a bug where it doesn't send the whole message or cuts it off. It just return unknown command and prints the message at about idk 20 chars but i set the string at 128 chars so i don't know how to fix this if you can help me i would appreciate it
Here's an example command:
And here's what happens:
http://www.zaslike.com/files/0ezfan40y4um0t0i6ih.png
Here's an example command:
pawn Код:
if(strcmp(cmd, "/b", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
new string[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_WHITE, "KORISTI: (/b) [ooc chat]");
return 1;
}
format(string, sizeof(string), "[OOC]%s: (( %s ))", sendername, result);
ProxDetector(7.0, playerid, string, COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN);
}
return 1;
}
http://www.zaslike.com/files/0ezfan40y4um0t0i6ih.png