[Quest] small object & edit message
#6

It will fully resend all chat messages (but not send client messages)
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;
}
I didn't tested it but I hope it will work
Reply


Messages In This Thread
[Quest] small object & edit message - by tomsalmon - 17.02.2012, 10:41
Re: [Quest] small object & edit message - by [HK]Ryder[AN] - 17.02.2012, 11:02
Re: [Quest] small object & edit message - by tomsalmon - 17.02.2012, 11:12
Re: [Quest] small object & edit message - by X-Box - 17.02.2012, 11:13
Re: [Quest] small object & edit message - by tomsalmon - 17.02.2012, 11:29
Re: [Quest] small object & edit message - by TheGamer! - 17.02.2012, 13:28
Re: [Quest] small object & edit message - by tomsalmon - 17.02.2012, 13:48
Re: [Quest] small object & edit message - by KingHual - 17.02.2012, 14:26
Re: [Quest] small object & edit message - by tomsalmon - 17.02.2012, 14:33

Forum Jump:


Users browsing this thread: 2 Guest(s)