timer
 

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

timer

Started by gizmo, 12 November, 2003, 11:05:59

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gizmo

hi

ihave a low aand hi share script who redirect users to the right hub i only wonder is it possible to put in a timer
funktion so the users stay in hub 1 min before its redirect because i have a script who checks the users for bad files.


klownietklowniet

Depends on what the script looks like. There might be need to do some changes. I think it redirects them in NewUserConnected. If so then you need to change the script to add the usernames to a list instead of redirect them, and add the timer so it checks that every minute. That is not 100% accurate though, since a user might login and then the timer might get executed just after, so less that 1 minute. Depends on how accurate you wanna be, you can set the timer to hit every 10 secs, and add the nicks to an assosiative array, with nickname as key and the time they logged in in as value, and on timer go through that one. Just be ready for some heavy resources...

So it should be done, just show us the script...
[ > DC - UniteD < ]

gizmo

-- Share Checker with High & Low Redirect
-- By NightLitch 2003
-- Users between 15 & 40 Gb stays in the hub, otherwise under
-- 15Gb redirected to hub1 alt. hub2 with 40Gb

BotName = "-Checker-"

kb = 1024
mb = kb*kb
gb = kb*kb*kb

LOWminShare = 20 * gb --// Users under 15Gb is being redirected to Address 2
BIGmaxShare = 20 * gb --// Users Over 40Gb is being redirected to Address 1
Redirect1 = "xxx.myftp.org" --// Redirect Address for HIGH Share Here
Redirect2 = "xxx.myftp.org" --// Redirect Address for LOW Share Here

function Main()
--   frmHub:RegBot(Bot)
end

function NewUserConnected(curUser)
i,j,temp = strfind(curUser.sMyInfoString, "$(%d+)%$")
   if temp == nil then
   curUser:Disconnect()
   return
   end

   Share = format("%0.2f", tonumber(temp)/gb)
   if tonumber(temp) < LOWminShare then
      curUser:SendPM("ShareCheck", "You Share "..Share..". You are being Redirected to a Low Share Hub....")
      curUser:SendData("$ForceMove "..Redirect2);

   else
   if tonumber(temp) > BIGmaxShare then
         curUser:SendPM("ShareCheck", "You Share "..Share..". You are being Redirectedto a High Share Hub....")
         curUser:SendData("$ForceMove "..Redirect1);


      end
   end
end

gizmo

can i put i timer in that script ??

klownietklowniet

#4
I just wrote this and haven't tested it at all...

-- Share Checker with High & Low Redirect 
-- By NightLitch 2003 
-- Users between 15 & 40 Gb stays in the hub, otherwise under 
-- 15Gb redirected to hub1 alt. hub2 with 40Gb 
-- Added timer ( klownietklowniet ) 16-11-2003

BotName = "-Checker-" 

kb = 1024 
mb = kb*kb 
gb = kb*kb*kb 

LOWminShare = 15 * gb --// Users under 15Gb is being redirected to Address 2 
BIGmaxShare = 40 * gb --// Users Over 40Gb is being redirected to Address 1 
Redirect1 = "xxx.myftp.org" --// Redirect Address for HIGH Share Here 
Redirect2 = "xxx.myftp.org" --// Redirect Address for LOW Share Here 

rusers = {}

function Main() 
-- frmHub:RegBot(Bot) 
   SetTimer(60000)
   StartTimer()
end 

function NewUserConnected(curUser) 
   i,j,temp = strfind(curUser.sMyInfoString, "$(%d+)%$") 
   if temp == nil then 
      curUser:Disconnect() 
      return 
   end 

   Share = format("%0.2f", tonumber(temp)/gb) 
   if tonumber(temp) < LOWminShare then 
      rusers[curUser.sName] = "2"
   elseif tonumber(temp) > BIGmaxShare then 
      rusers[curUser.sName] = "1"
   end
end


function UserDisconnected(curUser)
      rusers[curUser] = nil
end


function OnTimer() 

   for n, i in rusers do
      local tempuser = GetItemByName(n)
      if tmpuser ~= nil then
         if i == 1 then
            tempUser:SendPM("ShareCheck", "You Share "..Share..". You are being Redirectedto a High Share Hub....") 
            tempUser:SendData("$ForceMove "..Redirect1); 
         else
            tempUser:SendPM("ShareCheck", "You Share "..Share..". You are being Redirectedto a High Share Hub....") 
            tempUser:SendData("$ForceMove "..Redirect2); 
         end
      end
   end

   rusers = {}

end
[ > DC - UniteD < ]

SMF spam blocked by CleanTalk