• 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 0.X Remove anti-idle kick (but adding a storage and not count on otservlist)

binny

Member
Joined
Mar 16, 2017
Messages
65
Reaction score
12
I want to remove kick on idle characters

config.lua:
Code:
idleKickTime = 15 * 60 * 1000
what should i do? put it 0?

But even after this i need to do 2 things
1- don't count the players who are idle for 15 min+ on otservlist
and when they back, back to count

2- set a storage on this players that are idle for 15 min+
and when they back, remove the storage

Is anybody could give me a idea?
I'm using 0.4 -> Fir3element/3777 (https://github.com/Fir3element/3777/)
 
OP
binny

binny

Member
Joined
Mar 16, 2017
Messages
65
Reaction score
12
I hate this kick after 15 min, but if i remove this my server will get ban on otservlist and will die
anybody can help?
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,352
Solutions
350
Reaction score
3,463
I hate this kick after 15 min, but if i remove this my server will get ban on otservlist and will die
anybody can help?
Idle is located here

If updating their storage value will prevent your server from showing these players as online, a simple edit like this, should do the trick.

Lua:
local config = {
    idleWarning = getConfigValue('idleWarningTime'),
    idleKick = getConfigValue('idleKickTime')
}

function onThink(cid, interval)
    if(getTileInfo(getCreaturePosition(cid)).nologout or getCreatureNoMove(cid) or
        getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_ALLOWIDLE)) then
        return true
    end
    
    local idleTime = getPlayerIdleTime(cid) + interval
    doPlayerSetIdleTime(cid, idleTime)
    -- if(config.idleKick > 0 and idleTime > config.idleKick) then
        -- doRemoveCreature(cid)
    -- elseif(config.idleWarning > 0 and idleTime == config.idleWarning) then
    if(config.idleWarning > 0 and idleTime == config.idleWarning) then
        local message = "You have been idle for " .. math.ceil(config.idleWarning / 60000) .. " minutes"
        if(config.idleKick > 0) then
            message = message .. ", you will be disconnected in "
            local diff = math.ceil((config.idleWarning - config.idleKick) / 60000)
            if(diff > 1) then
                message = message .. diff .. " minutes"
            else
                message = message .. "one minute"
            end
    
            message = message .. " if you are still idle"
        end
    
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message .. ".")
    end
    
    if idleTime > config.idleKick and getCreatureStorage(cid, STORAGE_KEY) ~= 1 then
        doCreatureSetStorage(cid, STORAGE_KEY, 1)
    elseif idleTime < config.idleKick and getCreatureStorage(cid, STORAGE_KEY) ~= -1 then
        doCreatureSetStorage(cid, STORAGE_KEY, -1)
    end
    
    return true
end
 
OP
binny

binny

Member
Joined
Mar 16, 2017
Messages
65
Reaction score
12
Idle is located here

If updating their storage value will prevent your server from showing these players as online, a simple edit like this, should do the trick.

Lua:
local config = {
    idleWarning = getConfigValue('idleWarningTime'),
    idleKick = getConfigValue('idleKickTime')
}

function onThink(cid, interval)
    if(getTileInfo(getCreaturePosition(cid)).nologout or getCreatureNoMove(cid) or
        getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_ALLOWIDLE)) then
        return true
    end
   
    local idleTime = getPlayerIdleTime(cid) + interval
    doPlayerSetIdleTime(cid, idleTime)
    -- if(config.idleKick > 0 and idleTime > config.idleKick) then
        -- doRemoveCreature(cid)
    -- elseif(config.idleWarning > 0 and idleTime == config.idleWarning) then
    if(config.idleWarning > 0 and idleTime == config.idleWarning) then
        local message = "You have been idle for " .. math.ceil(config.idleWarning / 60000) .. " minutes"
        if(config.idleKick > 0) then
            message = message .. ", you will be disconnected in "
            local diff = math.ceil((config.idleWarning - config.idleKick) / 60000)
            if(diff > 1) then
                message = message .. diff .. " minutes"
            else
                message = message .. "one minute"
            end
   
            message = message .. " if you are still idle"
        end
   
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message .. ".")
    end
   
    if idleTime > config.idleKick and getCreatureStorage(cid, STORAGE_KEY) ~= 1 then
        doCreatureSetStorage(cid, STORAGE_KEY, 1)
    elseif idleTime < config.idleKick and getCreatureStorage(cid, STORAGE_KEY) ~= -1 then
        doCreatureSetStorage(cid, STORAGE_KEY, -1)
    end
   
    return true
end

Thank you!
You are right, doing this change it don't kick the idle player and set the storage...

But i'm scared to be banned on otservlist, if i be banned my server is over...

What should i do to don't count in otservlist?
Searching it on forum i found this: C++ - [0.4] No count more then 4 players on same IP (NEW otservlist.org rulles) (https://otland.net/threads/0-4-no-count-more-then-4-players-on-same-ip-new-otservlist-org-rulles.250979/)
Do you know how to do this change (not kick) but not be banned on otservlist?
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,352
Solutions
350
Reaction score
3,463
Thank you!
You are right, doing this change it don't kick the idle player and set the storage...

But i'm scared to be banned on otservlist, if i be banned my server is over...

What should i do to don't count in otservlist?
Searching it on forum i found this: C++ - [0.4] No count more then 4 players on same IP (NEW otservlist.org rulles) (https://otland.net/threads/0-4-no-count-more-then-4-players-on-same-ip-new-otservlist-org-rulles.250979/)
Do you know how to do this change (not kick) but not be banned on otservlist?
Unfortunately no, I have no experience with hosting a server, ironically.
 
OP
binny

binny

Member
Joined
Mar 16, 2017
Messages
65
Reaction score
12
Unfortunately no, I have no experience with hosting a server, ironically.
lol so ironically :D
you helped a lot of people here but never open a server? hahaha

---

anybody else here knows how i can use it with no ban on otservlist?
i want this feature a lot...
but if i get banned my server is over, all my players come from there...
i'm just starting and scary to do any shit
 

supergt

Active Member
Joined
May 11, 2017
Messages
78
Reaction score
28
I'm also using this kick on idle players just to don't be banned on otservlist...
If there is any way to dont count exited players pls post here
 
OP
binny

binny

Member
Joined
Mar 16, 2017
Messages
65
Reaction score
12
The @Way20 made a change to don't count more then 3 MCs

But looks like he don't use the forum anymore...

I'm using that code and it is working
Is anybody knows how to make the same stuff he did to MCs to IDLE/EXITED players?
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,352
Solutions
350
Reaction score
3,463
The @Way20 made a change to don't count more then 3 MCs

But looks like he don't use the forum anymore...

I'm using that code and it is working
Is anybody knows how to make the same stuff he did to MCs to IDLE/EXITED players?
honestly, you can probably e-mail xinn and ask what he recommends for you to do.

I'm sure a support e-mail is on the website somewhere.

Worst case scenario he doesn't help.
Best case scenario he gives you some links / code
 
OP
binny

binny

Member
Joined
Mar 16, 2017
Messages
65
Reaction score
12
Looking another topic here on forum i've change the @Way20 change: C++ - [0.4] No count more then 4 players on same IP (NEW otservlist.org rulles) (https://otland.net/threads/0-4-no-count-more-then-4-players-on-same-ip-new-otservlist-org-rulles.250979/#post-2440771)

To:
Code:
    p = xmlNewNode(NULL,(const xmlChar*)"players");
    // No count more then 4 ON per IP
    uint32_t real = 0;
    std::map<uint32_t, uint32_t> listIP;
    for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it) {
       // START -> Do not count idle/exited players
       std::string stridleplayerstorage;
       it->getCreature()->getStorage(17001, stridleplayerstorage);
       int32_t intidlestorageplayer = (int32_t)(atoi(stridleplayerstorage.c_str()));
       // storage setted 1 to exited players in: data/creaturescripts/scripts/idle.lua
       if(intidlestorageplayer < 1)
       { // CHECK -> Do not count idle/exited players
            if (it->second->getIP() != 0) {
                if (listIP.find(it->second->getIP()) != listIP.end()) {
                    listIP[it->second->getIP()]++;
                    if (listIP[it->second->getIP()] < 4) {
                        real++;
                    }
                } else {
                    listIP[it->second->getIP()] = 1;
                    real++;
                }
            }
       } // END -> Do not count idle/exited players
    }
    sprintf(buffer, "%d", real);
    xmlSetProp(p, (const xmlChar*)"online", (const xmlChar*)buffer);
    // end

But i have two problems
1- to compile:
Code:
status.cpp: In member function ‘std::__cxx11::string Status::getStatusString(bool) const’:
status.cpp:144:9: error: ‘struct std::pair<const unsigned int, Player*>’ has no member named ‘getCreature’
     it->getCreature()->getStorage(17001, stridleplayerstorage);
         ^~~~~~~~~~~
Makefile:33: recipe for target 'status.o' failed
make: *** [status.o] Error 1
make: *** Waiting for unfinished jobs....

2- i'm scared...
it will work?
if i get banned on otservlist i'm done :(

is anybody with more experience can help me?
 
OP
binny

binny

Member
Joined
Mar 16, 2017
Messages
65
Reaction score
12
Looking another topic here on forum i've change the @Way20 change: C++ - [0.4] No count more then 4 players on same IP (NEW otservlist.org rulles) (https://otland.net/threads/0-4-no-count-more-then-4-players-on-same-ip-new-otservlist-org-rulles.250979/#post-2440771)

To:
Code:
    p = xmlNewNode(NULL,(const xmlChar*)"players");
    // No count more then 4 ON per IP
    uint32_t real = 0;
    std::map<uint32_t, uint32_t> listIP;
    for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it) {
       // START -> Do not count idle/exited players
       std::string stridleplayerstorage;
       it->getCreature()->getStorage(17001, stridleplayerstorage);
       int32_t intidlestorageplayer = (int32_t)(atoi(stridleplayerstorage.c_str()));
       // storage setted 1 to exited players in: data/creaturescripts/scripts/idle.lua
       if(intidlestorageplayer < 1)
       { // CHECK -> Do not count idle/exited players
            if (it->second->getIP() != 0) {
                if (listIP.find(it->second->getIP()) != listIP.end()) {
                    listIP[it->second->getIP()]++;
                    if (listIP[it->second->getIP()] < 4) {
                        real++;
                    }
                } else {
                    listIP[it->second->getIP()] = 1;
                    real++;
                }
            }
       } // END -> Do not count idle/exited players
    }
    sprintf(buffer, "%d", real);
    xmlSetProp(p, (const xmlChar*)"online", (const xmlChar*)buffer);
    // end

But i have two problems
1- to compile:
Code:
status.cpp: In member function ‘std::__cxx11::string Status::getStatusString(bool) const’:
status.cpp:144:9: error: ‘struct std::pair<const unsigned int, Player*>’ has no member named ‘getCreature’
     it->getCreature()->getStorage(17001, stridleplayerstorage);
         ^~~~~~~~~~~
Makefile:33: recipe for target 'status.o' failed
make: *** [status.o] Error 1
make: *** Waiting for unfinished jobs....

2- i'm scared...
it will work?
if i get banned on otservlist i'm done :(

is anybody with more experience can help me?


it->getCreature()->
is not the player
how to get the player there?
 
OP
binny

binny

Member
Joined
Mar 16, 2017
Messages
65
Reaction score
12
it->getCreature()->
is not the player
how to get the player there?

the way 20 is working, otservlist is not counting more then 3 mcs
if i can manage to get player storage there it will work too
anybody knows how to?
i bet others servers would like to able exit on trainers like me
 

pink_panther

Premium User
Premium User
Joined
Sep 10, 2016
Messages
590
Solutions
8
Reaction score
236
Location
Kazordoon
I hate this kick after 15 min, but if i remove this my server will get ban on otservlist and will die
anybody can help?
Why would you get banned?

Pretty sure otlist gets the player online count by connecting to the server, so you'd only be able to change the count it gets by doing dodgy shit in source to spoof the number it get.

THAT might get you banned.... Idk why removing idle limit would.
 

kennyubuntu

Member
Joined
May 20, 2016
Messages
142
Reaction score
12
Why would you get banned?

Pretty sure otlist gets the player online count by connecting to the server, so you'd only be able to change the count it gets by doing dodgy shit in source to spoof the number it get.

THAT might get you banned.... Idk why removing idle limit would.

i got banned a long time ago by exited players in no-logout zones
 
Top