Las Venturas Playground
Help with making a good anti-spam like LVP has. - Printable Version

+- Las Venturas Playground (https://forum.sa-mp.nl)
+-- Forum: Miscellaneous (https://forum.sa-mp.nl/forum-4.html)
+--- Forum: Gaming (https://forum.sa-mp.nl/forum-27.html)
+--- Thread: Help with making a good anti-spam like LVP has. (/thread-20134.html)

Pages: 1 2


Help with making a good anti-spam like LVP has. - speedruntrainer - 08-21-2009

Hello, I searched everywhere on sa-mp forums to find an anti-spam Like LVP has. But I didn't find.

Can anyone help me? Thanks.


Re: Help with making a good anti-spam like LVP has. - Matthias - 08-21-2009

I'm too lazy to write down the entire code, but I'd do something like this

1) Add: new Chat[MAX_PLAYERS]; on top of your script
2) In OnPlayerText add: Chat[playerid]++;
3) In OnPlayerText add a check if(Chat[playerid] == 5) { Kick(playerid); }
4) create a repeating timer in onplayerconnect that resets Chat[playerid]



Re: Help with making a good anti-spam like LVP has. - Hitman - 08-21-2009

take one of the 100 filterscripts sa-mp.com has


Re: Help with making a good anti-spam like LVP has. - speedruntrainer - 08-21-2009

(08-21-2009, 05:24 PM)Hitman link Wrote: take one of the 100 filterscripts sa-mp.com has

Lol I can't, as I have 1 script to script for Crazy Ass Stunters.
That script I made myself and the founders were happy with it. So it's added.
I have to do it with that script. (Not open source)
I don't have the server's source and rcon.


Re: Help with making a good anti-spam like LVP has. - speedruntrainer - 08-21-2009

(08-21-2009, 05:09 PM)Matthias link Wrote: 4) create a repeating timer in onplayerconnect that resets Chat[playerid]

How to create a timer that resets the chat? I have no idea how to do that. :/
poor me :S


Re: Help with making a good anti-spam like LVP has. - Matthias - 08-22-2009

http://wiki.sa-mp.com/wiki/SetTimerEx


Re: Help with making a good anti-spam like LVP has. - speedruntrainer - 08-22-2009

Hello, I have looked at it and it seems that I'm doing it wrong.
I tried to add it but it failed. I really don't know what to do.

This are my codes where I set the timer:
Code:
public OnPlayerConnect(playerid) {
SetTimerEx("Chat", 5000, false, "is", 1, "string to pass");
SendClientMessage(playerid, yellow, "Welcome. To see the new commands that are added in CAS, use /mycolor help");
return 1;
}

I'm sure I did it wrong. See This under OnPlayerText:

Code:
Chat[playerid]++;
    if(Chat[playerid] == 5) {
    new playername[MAX_PLAYER_NAME],
    string[128];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s has been kicked from the game. (Reason: Spam)", playername);
    SendClientMessageToAll(yellow, string);
    SendClientMessage(playerid, COLOR_GREEN1, "------------------------");
    SendClientMessage(playerid, red, "You have been kicked");
    SendClientMessage(playerid, red, "Reason: Spam");
    SendClientMessage(playerid, red, "Kicked by: Anti-spam");
    SendClientMessage(playerid, COLOR_GREEN1, "------------------------");
    Kick(playerid);
    }
    return 1;
    }

If I type 5 lines I will be kicked. I'm currently testing it in my own server which I can't get it online.

NO ERRORS/WARNINGS found...


Re: Help with making a good anti-spam like LVP has. - FarePak - 08-23-2009

Make it so the timer sets "Chat" to 0 after every 10-20 seconds.


Re: Help with making a good anti-spam like LVP has. - Matthias - 08-23-2009

I suggest using 5 seconds.


Re: Help with making a good anti-spam like LVP has. - speedruntrainer - 08-23-2009

Yes, I know what you mean but do I nmeed to use the SetTimerEx under Chat[playerud]++; too?
Scroll up to see my codes.