Anti Join message spam.
#1

Hey, i have a question...

In 0.3x server sometimes some people use those stupid s*beit shits to connect alot of bots and spam the server with joins / time outs and that makes the server aswell... i managed to make a anti bot join spam that bans em but still they manage to join (and get banned next instant).

So my question was how could i make something like if the last join in server was before 1 second then send the message "x joined the server..." else if it was before 1 second... dont send the message in chat that the player joined.

i tried:
PHP код:
new lastJoin;
OnPlayerConnect(playerid)
{
lastJoin gettime();
if((
gettime() - lastJoin)>=2)
{
// send message
}
return 
1;

But it doesnt work... any solutions?


EDIT: Could doing lastJoin = gettime(); under join message solve the problem? (not at pc to test)
Reply
#2

Try this;

PHP код:
new lastJoin[MAX_PLAYERS]; 

public 
OnPlayerConnect(playerid)  { 

    if(
gettime() - lastJoin[playerid] >= 2) {
    
        
// send message
    
}
    
lastJoin[playerid] = gettime(); 
    return 
1

Reply
#3

Welp, just fixing the code above, if you are storing that for each player id, then it will make no sense that because player will get different ids on their connect.

Код:
new lastJoin;
public OnPlayerConnect(playerid)  { 
    new jointime = gettime();
    if(jointime-lastJoin > 1) {
        // send message
    }
    lastJoin = jointime; 
    return 1;
}
However like you say it's just for sending message, then it's fine doing like this. if you wanted to block join floods, check out the maxips.pwn filterscript instead of this.
Reply
#4

Yes, you're correct about the structural side of it. If you were to assign the value to the variable 'after' the 'if' check, this would work as intended.

PHP код:
new lastJoin
OnPlayerConnect(playerid

    new 
time gettime();
    if((
time lastJoin) >= 2
    { 
        
// send message 
    
}
    
lastJoin time;
    return 
1

Also, try seeing if you can use a combination of OnIncomingConnection and BlockIpAddress to make an efficient method of stopping them from joining. I'm not sure if BlockIpAddress works instantaneously, but if it does, it would be your best method for preventing these kind of messages as they would never fully connect to the server.
Reply
#5

EDIT: nvm, didnt read the 2 replies after oma.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)