• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ 255.255.255.0 disconnected for exceeding packet per second limit.

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
1.3 tfs.
some players are disconnected from the game, and this message appears in the log.
(edited out the real IP shown below)
Code:
255.255.255.0 disconnected for exceeding packet per second limit.
How can I set a storage in the player before it is disconnected for this reason?

C++:
    if ((++packetsSent / timePassed) > static_cast<uint32_t>(g_config.getNumber(ConfigManager::MAX_PACKETS_PER_SECOND))) {
        std::cout << convertIPToString(getIP()) << " disconnected for exceeding packet per second limit." << std::endl;
        close();
        return;
    }

player:setStorageValue(9010, 1) -- SOMETHING LIKE THIS (BUT I NEED IN C++)
 
Last edited by a moderator:
using
Code:
maxPacketsPerSecond = 300
You shouldn't use anything larger than 100 because it is simply enough, it looks like somebody try to DOS your server cpu by sending too many packets using wireshark or something or maybe if it is bot ask them to change scripts so they don't send that much packets.
 
Save the IP and compare IP against the IPs in your table using onLogin and set storage value there, remove IP from list, simple.
 
You don't have access to the player object in the connection class.
Are you sure? a little example:
C++:
if ((++packetsSent / timePassed) > static_cast<uint32_t>(g_config.getNumber(ConfigManager::MAX_PACKETS_PER_SECOND))) {
    auto protocolGamePtr = std::dynamic_pointer_cast<ProtocolGame>(protocol);
    if(protocolGamePtr)
    {
        Player* player = protocolGamePtr->player;
        if(player)
            player->addStorageValue(9010, 1);
    }
    std::cout << convertIPToString(getIP()) << " disconnected for exceeding packet per second limit." << std::endl;
    close();
    return;
}

it only require to add "friend class Connection;" inside protocolgame.cpp, however I would add new virtual function to protocol.h and handle it inside protocolgame.cpp, then it is even possible to use "sendFYIBox" so the player would know why he got disconnected
 
Are you sure? a little example:
C++:
if ((++packetsSent / timePassed) > static_cast<uint32_t>(g_config.getNumber(ConfigManager::MAX_PACKETS_PER_SECOND))) {
    auto protocolGamePtr = std::dynamic_pointer_cast<ProtocolGame>(protocol);
    if(protocolGamePtr)
    {
        Player* player = protocolGamePtr->player;
        if(player)
            player->addStorageValue(9010, 1);
    }
    std::cout << convertIPToString(getIP()) << " disconnected for exceeding packet per second limit." << std::endl;
    close();
    return;
}

it only require to add "friend class Connection;" inside protocolgame.cpp, however I would add new virtual function to protocol.h and handle it inside protocolgame.cpp, then it is even possible to use "sendFYIBox" so the player would know why he got disconnected
Well yeah, but not as simply as it was made out to be. Was a bit misleading if you ask me.
 
Try to hold ctrl and any arrowrot right or someone bec i got same when i do that, but changing it to 40 instead of 25 removed the problem for me
 
Are you sure? a little example:
C++:
if ((++packetsSent / timePassed) > static_cast<uint32_t>(g_config.getNumber(ConfigManager::MAX_PACKETS_PER_SECOND))) {
    auto protocolGamePtr = std::dynamic_pointer_cast<ProtocolGame>(protocol);
    if(protocolGamePtr)
    {
        Player* player = protocolGamePtr->player;
        if(player)
            player->addStorageValue(9010, 1);
    }
    std::cout << convertIPToString(getIP()) << " disconnected for exceeding packet per second limit." << std::endl;
    close();
    return;
}

it only require to add "friend class Connection;" inside protocolgame.cpp, however I would add new virtual function to protocol.h and handle it inside protocolgame.cpp, then it is even possible to use "sendFYIBox" so the player would know why he got disconnected
thx for help but really it dont work
I want to set a storage, so when he logs in with this storage, he will get a message like:
"you were recently signed out of bot use too much functions"
1570469285229.png
 
thx for help but really it dont work
I want to set a storage, so when he logs in with this storage, he will get a message like:
"you were recently signed out of bot use too much functions"
View attachment 39571
You need to add #include "player.h" in connection.cpp but I thought it was obvious.
The friend class Connection; should be after friend class Player; inside protocolgame.h
 
Back
Top