SA-MP Forums Archive
Server just crashed AGAIN, what can i script to prevent this? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server just crashed AGAIN, what can i script to prevent this? (/showthread.php?tid=374880)



Server just crashed AGAIN, what can i script to prevent this? - denNorske - 04.09.2012

Код:
[12:07:42] [chat] [mijowa]: 7777777
[12:07:42] [chat] [mijowa]: 88888888
[12:07:42] [chat] [mijowa]: 999999999
[12:07:42] [chat] [mijowa]: 101010101010
[12:07:42] [chat] [mijowa]: 999999999
[12:07:42] [chat] [mijowa]: 88888888
[12:07:42] [chat] [mijowa]: 7777777
[12:07:42] [chat] [mijowa]: 666666
[12:07:42] [chat] [mijowa]: 55555
[12:07:42] [chat] [mijowa]: 4444
[12:07:42] [chat] [mijowa]: 333
[12:07:42] [chat] [mijowa]: 22
[12:07:42] [chat] [mijowa]: 1
[12:07:42] [chat] [mijowa]: 1
[12:07:42] [chat] [mijowa]: 22
[12:07:42] [chat] [mijowa]: 333
[12:07:42] [chat] [mijowa]: 4444
[12:07:42] [chat] [mijowa]: 55555
[12:07:42] [chat] [mijowa]: 666666
[12:07:42] [chat] [mijowa]: 7777777
[12:07:42] [chat] [mijowa]: 88888888
[12:07:42] [chat] [mijowa]: 999999999
[12:07:42] [chat] [mijowa]: 101010101010
[12:07:42] [chat] [mijowa]: 999999999
[12:07:42] [chat] [mijowa]: 88888888
[12:07:42] [chat] [mijowa]: 7777777
[12:07:42] [chat] [mijowa]: 666666
[12:07:42] [chat] [mijowa]: 55555
[12:07:42] [chat] [mijowa]: 4444
[12:07:42] [chat] [mijowa]: 333
[12:07:42] [chat] [mijowa]: 22
[12:07:42] [chat] [mijowa]: 1
[12:07:42] [chat] [mijowa]: 1
[12:07:42] [chat] [mijowa]: 22
[12:07:42] [chat] [mijowa]: 333
[12:07:42] [chat] [mijowa]: 4444
[12:07:42] [chat] [mijowa]: 55555
[12:07:42] [chat] [mijowa]: 666666
[12:07:42] [chat] [mijowa]: 7777777
[12:07:42] [chat] [mijowa]: 88888888
[12:07:42] [chat] [mijowa]: 999999999
[12:07:42] [chat] [mijowa]: 101010101010
[12:07:42] [chat] [mijowa]: 999999999
[12:07:42] [chat] [mijowa]: 88888888
[12:07:42] [chat] [mijowa]: 7777777
[12:07:42] [chat] [mijowa]: 666666
[12:07:42] [chat] [mijowa]: 55555
[12:07:42] [chat] [mijowa]: 4444
[12:07:42] [chat] [mijowa]: 333
[12:07:42] [chat] [mijowa]: 22
[12:07:42] [chat] [mijowa]: 1
[12:07:42] [chat] [mijowa]: 1
[12:07:42] [chat] [mijowa]: 22
[12:07:42] [chat] [mijowa]: 333
AND 300 000 more lines of exact same lines......

How can i automaticly BAN!!!! something like this ?


Re: Server just crashed AGAIN, what can i script to prevent this? - per~fectionist - 04.09.2012

Just write an anti-spam script


Re: Server just crashed AGAIN, what can i script to prevent this? - leonardo1434 - 04.09.2012

made this quirckly, it should work.
pawn Код:
new timeforuse[MAX_PLAYERS];
public OnPlayerText(playerid, text[])
{
    if(timeforuse[playerid] > gettime()) return SendClientMessage(playerid,-1,"You must wait 4 secongs to chat again");
    timeforuse[playerid] = gettime() + 4;
    return 1;
}



Re: Server just crashed AGAIN, what can i script to prevent this? - denNorske - 04.09.2012

can I make my server ban people spamming like this multiple times after that warning?


Re: Server just crashed AGAIN, what can i script to prevent this? - Deal-or-die - 04.09.2012

Think this should work, probably not the best way of doing it but should still work.
pawn Код:
new timeforban[MAX_PLAYERS];
new timeforuse[MAX_PLAYERS];
public OnPlayerText(playerid, text[])
{
    if(timeforuse[playerid] > gettime()) return SendClientMessage(playerid,-1,"You must wait 4 secongs to chat again");
    timeforuse[playerid] = gettime() + 4;
    timeforban[playerid] += 1;
    if(timeforban[playerid] > = 3)
    {
        Ban(playerid);
        return 1;
    }
    return 1;
}



Re: Server just crashed AGAIN, what can i script to prevent this? - leonardo1434 - 04.09.2012

if the player has spammed more than 5 times in less than 1 second it will ban him.
pawn Код:
new timeforuse[MAX_PLAYERS],timesused[MAX_PLAYERS];
public OnPlayerText(playerid, text[])
{
    if(timesused[playerid] > 5) return Ban(playerid);
    if(timeforuse[playerid] > GetTickCount()) return ++timesused[playerid],SendClientMessage(playerid,-1,"You must wait 4 secongs to chat again");
    else
    {
      timesused[playerid] = 0;
    }
    timeforuse[playerid] = GetTickCount() + 1000;
    return 1;
}



Re: Server just crashed AGAIN, what can i script to prevent this? - denNorske - 04.09.2012

Aha! Thanks Leonardo1434 ^^ I will give you the 100th Rep xD