Basic Anti Spam System

Started by Yankee, Jun 09, 2017, 07:37 AM

Previous topic - Next topic

Yankee

Hi guys,
I searched a lot for a spam system for my server.I found some scripts but i can't use it properly.It gives script errors.I tried to make my own spam system but it don't work ,i did something wrong.Can someone help me ?

SAzEe21

Post your codes and errors here instead.

Yankee

Quote from: Zeeshan.Bhatti on Jun 09, 2017, 09:48 AMPost your codes and errors here instead.

[b]Spammers <- array(100);
function onPlayerJoin(player)
{
    //...
    Spammers[player.ID] = ["", "", ""];
    //...
}
function onPlayerLeave(player, reason)
{
    //...
    Spammers[player.ID] = ["", "", ""];
    //...
}
function onPlayerMessage(player, message)
{
    Spammers[player.ID][0] = Spammers[player.ID][1];
    Spammers[player.ID][1] = Spammers[player.ID][2];
    Spammers[player.ID][2] = message;
    if (Spammers[player.ID][0] == Spammers[player.ID][1] && Spammers[player.ID][1] == Spammers[player.ID][2])
    {
        MessageAll(player.Name + " has been kicked for spamming.");
        player.Kick();
    }
}[/b]
Here it is,I added all of this to my main.nut.I added array 100 in scriptload.Why it it not working ?I did something wrong .

NicusorN5

remove [ b ] and  [/ b] from your code

SAzEe21

onPlayerLeave & onPlayerMessage which functions is this?

Yankee

Quote from: Zeeshan.Bhatti on Jun 09, 2017, 05:19 PMonPlayerLeave & onPlayerMessage which functions is this?

My scripter friend send me this mate.He said if i add these into main.nut,ıt can work.Where should I add the onPlayerLeave and onPlayerMessage function's ?

EK.IceFlake

Rename onPlayerLeave to onPlayerPart and onPlayerMessage to onPlayerChat.

Yankee

Quote from: EK.IceFlake on Jun 10, 2017, 04:59 AMRename onPlayerLeave to onPlayerPart and onPlayerMessage to onPlayerChat.
Look at this,I added my scripts.Where did I wrong ?Can you find it,please.
This is array 100

function onScriptLoad()
{
{
print(">>> System SubBan loaded <<<");
db <- ConnectSQL( "DataBase.db" );
QuerySQL( db, "CREATE TABLE IF NOT EXISTS SubBans ( Name VARCHAR(32), IP VARCHAR(25), Admin TEXT, Reason TEXT )" );
}
    AddClass( 1, RGB( 0, 191, 255 ) ,201, Vector( 372, -478, 13.8172 ), 130.0325, 21, 999 ,17, 200, 4, 255 );
    AddClass( 1, RGB( 30,144,255 ) ,202 Vector( -660, 760, 11.0862 ), 130.0325, 101, 999 ,17, 200, 104, 1000 );
    AddClass( 1, RGB( 0, 139, 0 ) ,203, Vector( -1715.79, -160, 15 ), 140.020, 105, 999 ,100, 200, 12, 255 );
    AddClass( 2, RGB( 255, 48, 48 ) ,204, Vector( -25, 0, 24 ), 140.020, 103, 999 ,102, 25, 15, 50 );
    AddClass( 2, RGB( 255, 48, 48 ) ,205, Vector( -695, -1583, 12 ), 140.020, 19, 999 ,28, 100, 23, 1000 );
    AddClass( 1, RGB( 255, 215, 0 ) ,28, Vector( -1009, 196, 11.3937 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 3, RGB( 255, 255, 255 ) ,7, Vector( -841, 551, 10.930 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 4, RGB( 255, 255, 255 ) ,11, Vector( 464, -456, 10.532 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 5, RGB( 255, 255, 255 ) ,27, Vector( 387, -693, 10.97 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 6, RGB( 255, 255, 255 ) ,55, Vector( 464, -456, 10.532 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 7, RGB( 255, 255, 255 ) ,95, Vector( -213, -1440, 8.1129 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 8, RGB( 255, 255, 255 ) ,104, Vector( -776, 977, 10.8241 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 9, RGB( 255, 255, 255 ) ,114, Vector( -394, 894, 10.6133 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 10, RGB( 255, 255, 255 ) ,167, Vector( 464, -456, 10.532 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 11, RGB( 255, 255, 255 ) ,169, Vector( -855, 666, 10.9932 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 12, RGB( 255, 255, 255 ) ,131, Vector( -607, 652, 10.5843 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 13, RGB( 255, 255, 255 ) ,19, Vector( -842, -679, 10.9420 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 14, RGB( 255, 255, 255 ) ,58, Vector( 336, 1201, 17.1962 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 15, RGB( 255, 255, 255 ) ,13, Vector( -753, 927, 11.2812 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 16, RGB( 255, 255, 255 ) ,14, Vector( -782, 672, 10.8485 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 17, RGB( 255, 255, 255 ) ,17, Vector( 387, -693, 10.97 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 18, RGB( 255, 255, 255 ) ,21, Vector( -757, 1333, 11.39 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 19, RGB( 255, 255, 255 ) ,22, Vector( -975, -831, 6.4925 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 20, RGB( 255, 255, 255 ) ,54, Vector( -848, -909, 10.9547 ), 140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 21, RGB( 255, 255, 255 ) ,157, Vector( 387, -693, 10.97 ),  140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 22, RGB( 255, 255, 255 ) ,174, Vector( 387, -693, 10.97 ),  140.020, 0, 0 ,0, 0, 0, 0 );
    AddClass( 23, RGB( 255, 255, 255 ) ,100, Vector( 387, -693, 10.97 ), 140.020, 0, 0 ,0, 0, 0, 0 );
Spammers <- array(100);
}
This is PlayerJoin function

function onPlayerJoin( player )
{
                ClientMessage("-> [#daff00]Sunucumuza hosgeldiniz,/hesap yazarak girmeyi UNUTMAYIN.",player,255,0,102);
                ClientMessage("-> [#83bab3]Admin Facebook adresi:www.facebook.com/saidbali443",player,255,0,102);
                ClientMessage("-> [#83bab3]/komutlar yazarak komutlara bakabilirsiniz.",player,255,0,102);
                ClientMessage("-> [#83bab3]AY YILDIZ TURKEY.",player,255,0,102);
                NewTimer( "CheckBan", 1000, 1, player.ID );
    //...
    Spammers[player.ID] = ["", "", ""];
    //...   
}

This is PlayerPart function

function onPlayerPart( player, reason )
{
//...
Spammers[player.ID] = ["", "", ""];
//...
WriteIniBool("Stats.ini","Logged",player.UniqueID, false)
if (ReadIniBool("Stats.ini","Logged",player.UniqueID))
{
SaveAccount(player)
}
}

This is PlayerChat function

function onPlayerChat( player, text )
{
print( player.Name + ": " + text );
return 1;
    Spammers[player.ID][0] = Spammers[player.ID][1];
    Spammers[player.ID][1] = Spammers[player.ID][2];
    Spammers[player.ID][2] = message;
    if (Spammers[player.ID][0] == Spammers[player.ID][1] && Spammers[player.ID][1] == Spammers[player.ID][2])
    {
        MessageAll(player.Name + " spam yapmaktan ATILDI!");
        player.Kick();
    }
}












SAzEe21

You are ready to use this now, if any other error occurs you can post here.

Yankee

Quote from: Zeeshan.Bhatti on Jun 10, 2017, 02:57 PMYou are ready to use this now, if any other error occurs you can post here.

I'm using now but it doesn't work,I did something wrong,command,line or column error etc.Can you check again for me ?

SAzEe21

Can you post the errors without that we can't help you.

Yankee

Quote from: Zeeshan.Bhatti on Jun 10, 2017, 05:37 PMCan you post the errors without that we can't help you.

There's no error and it's not working ;D probably i did something wrong,maybe i forgot something important.Can you see something in the my commands.I pasted them.

kennedyarz

Spammers <- array(100);change for
Spammers  <- array( GetMaxPlayers(), null );or
Spammers  <- array(100, null );

Yankee

#13
Quote from: kennedyarz on Jun 10, 2017, 10:59 PMSpammers <- array(100);change for
Spammers  <- array( GetMaxPlayers(), null );or
Spammers  <- array(100, null );
Thanks for you advice i added it but nothing changed :P

EK.IceFlake

Quote from: kennedyarz on Jun 10, 2017, 10:59 PMSpammers <- array(100);change for
Spammers  <- array( GetMaxPlayers(), null );or
Spammers  <- array(100, null );
array defaults to null if no default value is specified.