17.02.2012, 13:28
It will fully resend all chat messages (but not send client messages)
I didn't tested it but I hope it will work
pawn Код:
new Chat[256][999], ChatLines, PlayerColor[999], PlayerName[999];
public OnPlayerText(playerid, text[])
{
format(Chat[ChatLines], 256, "%s", text);
ChatLines++;
PlayerColor[ChatLines]=GetPlayerColor(playerid);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if (strcmp("/editmessage", cmd, true, 10) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /editmessage [line] [text]");
new tmp2[128];
tmp2 = strtok(cmdtext, idx);
if(strlen(tmp2) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /editmessage [line] [text]");
new id=ChatLines-strval(tmp);
format(Chat[id], 256, "%s", tmp2);
for(new i; i<ChatLines; i++)
{
new string[256]; format(string, 256, "%s: %s", PlayerName[i], Chat[i]);
SendClientMessageToAll(PlayerColor[i], string);
}
return 1;
}
return 0;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}