Auto-Mute + ChatLog
#1

Hey,

Basically I attempted this script, I am trying to mute a player if the player spams 5 things:

pawn Код:
public OnPlayerText(playerid,text[])
{
    if(PlayerInfo[playerid][pMuted] == 1)
    {
        SendClientMessage(playerid,COLOR_RED,"You are currently muted.");
        SendClientMessage(playerid,COLOR_RED,"If you feel you shouldn't be muted then please /request unmute");
        SendClientMessage(playerid,COLOR_RED,"Do not abuse this system, you will be kicked and possibly banned.");
        return 0;
    }
    if(ChatSpamMuted[playerid] == 1)
    {
        SendClientMessage(playerid,COLOR_RED,"You are currently muted.");
        SendClientMessage(playerid,COLOR_RED,"If you feel you shouldn't be muted then please /request unmute");
        SendClientMessage(playerid,COLOR_RED,"Do not abuse this system, you will be kicked and possibly banned.");
        return 0;
    }
    ChatSpam[playerid] ++;
    SetTimer("ChatSpamClear",500,true);
    if(ChatSpam[playerid] == 5)
    {
        SendClientMessage(playerid,COLOR_RED,"Please Do Not Spam, You Have Been Muted");
        ChatSpamMuted[playerid] = 1;
        return 0;
    }
    ChatLog(text);
    return 1;
}
pawn Код:
public ChatSpamClear()
{
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
        if(ChatSpam[i] >= 1)
        {
            ChatSpam[i] = 0;
        }
    }
    return 1;
}
Unfortunately that doesn't work the player spams then just stops talking and cannot enter any commands I spammed 30things, after around 15 it stopped working and stopped transmitting also while kind of on topic my ChatLog doesn't work as it should:

pawn Код:
public ChatLog(text[])
{
    new File:File = fopen("/Logs/ChatLog.txt",io_write);
    new Y,M,D,iH,iM,iS;
    getdate(Y,M,D);
    gettime(iH,iM,iS);
    new string[128];
    format(string,sizeof(string),"[%d/%d/%d - %d:%d]: %s\r\n",D,M,Y,iH,iM,text);
    fwrite(File,string);
    fclose(File);
    return 1;
}
That just prints the last chat line in the file so I only have: [1/1/2012 - 21:36]: ****: attt when it should be 50+ things, could anyone help?

Thanks In Advance.

DarkKiller.
Reply


Messages In This Thread
Auto-Mute + ChatLog - by DarkKillerWithPride<3 - 01.01.2012, 20:42
Re: Auto-Mute + ChatLog - by Jefff - 01.01.2012, 21:29
Re: Auto-Mute + ChatLog - by DarkKillerWithPride<3 - 01.01.2012, 21:30
Re: Auto-Mute + ChatLog - by Basssiiie - 01.01.2012, 21:32
Re: Auto-Mute + ChatLog - by DarkKillerWithPride<3 - 01.01.2012, 21:43
Re: Auto-Mute + ChatLog - by Basssiiie - 01.01.2012, 21:56

Forum Jump:


Users browsing this thread: 1 Guest(s)