Hello There, Guest! Login or Register


Help with making a good anti-spam like LVP has.
#1
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.
Reply
#2
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]
Reply
#3
take one of the 100 filterscripts sa-mp.com has
Reply
#4
(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.
Reply
#5
(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
Reply
#6
http://wiki.sa-mp.com/wiki/SetTimerEx
Reply
#7
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...
Reply
#8
Make it so the timer sets "Chat" to 0 after every 10-20 seconds.
Reply
#9
I suggest using 5 seconds.
Reply
#10
Yes, I know what you mean but do I nmeed to use the SetTimerEx under Chat[playerud]++; too?
Scroll up to see my codes.
Reply