Delay before disconnect users
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Delay before disconnect users

Started by FrancoS, 24 June, 2005, 19:56:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

FrancoS

Hi guys,

I have one issue.

I run PtokaX DC Hub 0.3.3.0 build 15.18 [debug]

I have one script that checks for the dc++ version and that checks for extra slots dc++ function.

If dc++ version is wrong or if any extraslot is found a user disconnect happen.

Well: the disconnection is as much fast that no user is able to read the disconnet explanation message, nor the ptokax built in messages for minimum sharing size and or hub/slot ratio... nothing.

only the disconnected string

If I remove the disconnect code line, the message is correctly sent to the user.

How to overcome this issue?
I have tried to make a loop before the disconnect line, but it doesn't work.

My idea now is to send a warning every 15 seconds to the user that explain what is goign to happen and only after the 3rd warning as last the disconnection should happen.

Well, any idea of how to store and count the warnings amount? I'm not so strong with lua, so thank you for any idea.

Naturally, if you know a way to delay enough the disconnection in such a way that the message may arrive to the user client, instead of the warnings sequence.. thank you aswell.

Regards to all of you

Robert (??Corsari??)

Dessamator

well that shouldnt be a problem , u just have to write in the correct order, curUser:Disconnect() (or something like it), and then curUser:SendData("info")  

or just search the forum for "disconnect delay", u should find some info to help u with that !
Ignorance is Bliss.

FrancoS

#2
order is correct, time it is not enough.

How to setup a delay before the disconnection with the timer + offset?

Thank you

Dessamator

#3
theres a lot of ways of doing so,  
1. use a timer, something like this :
function Main()
SetTimer(1000)
StartTimer()
end

table1 = {}
function NewUserConnected(user)
if --min version then -- do stuff,
table1[curUser.sName] = msg 
end
end

function Ontimer()
for i,v in table1 do 
GetItemByName(i):SendData(v)
GetItemByName(i):Disconnect()
end
table1 =nil
table1 ={}
end


2. other way is using a clock()
search the forum for info on how to use that !

3. OR send a PM to the user, instead of senddata use SendPM, might work

as for storing warns, u can use tables for that, something like :

warns = {}

function NewUserConnected(user)
if -- then --
warns[user.sName] = 1
end
end
Ignorance is Bliss.

SMF spam blocked by CleanTalk