Script for diffrent accounts
 

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

Script for diffrent accounts

Started by bastsweden, 06 December, 2003, 16:33:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bastsweden

Hey guys.

I just need a script for diffrent accounts that i have made in ptokaX

So i want it to determen min share and so on in those accounts ex: -[RaR] So i can change easelly on that account.

Min share
Min slot
Max hub
Max Slot

And i want so i can add a message if they get disonnected for anny of the above


Cheers m8?s
:D  im back  :D

Troubadour

I will give it a shot tomorrow.

-Troubadour-
Regards,

Troubadour

** Guardian Forum **

hubaddy:   nederfun.no-ip.com

bastsweden

Sounds Great -Troubadour- :-)
:D  im back  :D

Troubadour

#3
I did try it like this, but get some errors and haven't got a clue at this moment.  
Will try again tonight.  

Bot = "Your_botname_here"

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

mminShare = 2 * gb        -- Sets Minimum Share
ominShare = 4 * gb        -- Sets Minimum Share
vminShare = 8 * gb        -- Sets Minimum Share
rminShare = 10 * gb       -- Sets Minimum Share
maxShare = 1000 * gb      -- Sets Maximum Share
mmaxslots = 20            -- Sets Maximum Number of Slots
omaxslots = 18            -- Sets Maximum Number of Slots
vmaxslots = 16            -- Sets Maximum Number of Slots
rmaxslots = 12            -- Sets Maximum Number of Slots
mminslots = 1             -- Sets Minimum Number of Slots
ominslots = 2             -- Sets Minimum Number of Slots
vminslots = 4             -- Sets Minimum Number of Slots
rminslots = 6             -- Sets Minimum Number of Slots
mmaxhubs = 20             -- Sets Maximim Number of Hubs
omaxhubs = 18             -- Sets Maximim Number of Hubs
vmaxhubs = 15             -- Sets Maximim Number of Hubs
rmaxhubs = 10             -- Sets Maximim Number of Hubs


-- Script Settings 0=off  1=on

checkcommands = {
   masterminshare = 1, mastermaxshare = 1, masterminslots = 1, mastermaxslots = 1, mastermaxhubs = 1,
   opsminshare = 1, opsmaxshare = 1, opsminslots = 1, opsmaxslots = 1, opsmaxhubs = 1,
   vipminshare = 1, vipmaxshare = 1, vipminslots = 1, vipmaxslots = 1, vipmaxhubs = 1,
   regminshare = 1, regmaxshare = 1, regminslots = 1, regmaxslots = 1, regmaxhubs = 1 }

-- master settings --
masterMinShare = "1"  -- Sets Minimum Share on/off
masterMaxShare = "1"  -- Sets Maximum Share on/off
masterMinSlots = "1"  -- Sets Minimum Slots on/off
masterMaxSlots = "0"  -- Sets Maximum Slots on/off
masterMaxHubs = "0"   -- Sets Maximum Hubs on/off

-- operator settings --
opsMinShare = "1"  -- Sets Minimum Share on/off
opsMaxShare = "1"  -- Sets Maximum Share on/off
opsMinSlots = "1"  -- Sets Minimum Slots on/off
opsMaxSlots = "0"  -- Sets Maximum Slots on/off
opsMaxHubs = "0"   -- Sets Maximum Hubs on/off

-- vip settings --
vipMinShare = "1"  -- Sets Minimum Share on/off
vipMaxShare = "1"  -- Sets Maximum Share on/off
vipMinSlots = "1"  -- Sets Minimum Slots on/off
vipMaxSlots = "0"  -- Sets Maximum Slots on/off
vipMaxHubs = "0"   -- Sets Maximum Hubs on/off

-- reg settings --
regMinShare = "1"  -- Sets Minimum Share on/off
regMaxShare = "1"  -- Sets Maximum Share on/off
regMinSlots = "1"  -- Sets Minimum Slots on/off
regMaxSlots = "0"  -- Sets Maximum Slots on/off
regMaxHubs = "0"   -- Sets Maximum Hubs on/off

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

function DataArrival(user, data)

   if strsub(data, 1, 1) == "<" then
      data=strsub(data,1,strlen(data)-1)
      s,e,cmd = strfind(data,"%b<>%s+(%S+)")
      end
      if (cmd=="!checker") and user.iProfile == 0 then
         user:SendPM(Bot, "!masterminshare    -- sets minimum share on/off")
         user:SendPM(Bot, "!mastermaxshare    -- sets maximum share on/off")
         user:SendPM(Bot, "!masterminslots    -- sets minimum slots on/off")
         user:SendPM(Bot, "!mastermaxslots    -- sets minimum slots on/off")
         user:SendPM(Bot, "!mastermaxhubs     -- sets maximum hubs on/off")
         user:SendPM(Bot, "!opsminshare       -- sets minimum share on/off")
         user:SendPM(Bot, "!opsmaxshare       -- sets maximum share on/off")
         user:SendPM(Bot, "!opsminslots       -- sets minimum slots on/off")
         user:SendPM(Bot, "!opsmaxslots       -- sets minimum slots on/off")
         user:SendPM(Bot, "!opsmaxhubs        -- sets maximum hubs on/off")
         user:SendPM(Bot, "!vipminshare       -- sets minimum share on/off")
         user:SendPM(Bot, "!vipmaxshare       -- sets maximum share on/off")
         user:SendPM(Bot, "!vipminslots       -- sets minimum slots on/off")
         user:SendPM(Bot, "!vipmaxslots       -- sets minimum slots on/off")
         user:SendPM(Bot, "!vipmaxhubs        -- sets maximum hubs on/off")
         user:SendPM(Bot, "!regminshare       -- sets minimum share on/off")
         user:SendPM(Bot, "!regmaxshare       -- sets maximum share on/off")
         user:SendPM(Bot, "!regminslots       -- sets minimum slots on/off")
         user:SendPM(Bot, "!regmaxslots       -- sets minimum slots on/off")
         user:SendPM(Bot, "!regmaxhubs        -- sets maximum hubs on/off")
      end

         local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")
         if s and checkcommands[cmd] then
         if user.iProfile == 0
         return 0
         elseif user.iProfile == nil then
         user:SendPM(BOTName, "you are not allowed to use this command")
         end


function NewUserConnected(user)
      

      s,e,slots = strfind(user.sMyInfoString, "S:(%d+)")
      s,e,hubs = strfind(user.sMyInfoString, "H:(%d+)")
      end

-- reg users part --
      if user.iProfile == 3 then
      if (regMaxSlots == "1") and (tonumber(slots) > rmaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..rmaxslots.." slots!")
         user:Disconnect()
         end

      if (regMinSlots == "1") and (tonumber(slots) < rminslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..rminslots.." slots!")
         user:Disconnect()
         end
      
      elseif (regMaxHubs == "1") and (tonumber(hubs) > rmaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is: "..rmaxhubs..)   
         user:Disconnect()
         end

      if (regMinShare == "1") and tonumber(temp) < rminShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..rminShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if (regMaxShare == "1") and tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

-- vip users part --

      if user.iProfile == 2 then
      if (vipMaxSlots == "1") and (tonumber(slots) > vmaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..vmaxslots.." slots!")
         user:Disconnect()
         end

      if (vipMinSlots == "1") and (tonumber(slots) < vminslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..vminslots.." slots!")
         user:Disconnect()
         end
      
      elseif (vipMaxHubs == "1") and (tonumber(hubs) > vmaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is: "..vmaxhubs..)   
         user:Disconnect()
         end

      if (vipMinShare == "1") and tonumber(temp) < vminShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..vminShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if (vipMaxShare == "1") and tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

-- ops users part --

      if user.iProfile == 1 then
      if (opsMaxSlots == "1") and (tonumber(slots) > omaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..omaxslots.." slots!")
         user:Disconnect()
         end

      if (opsMinSlots == "1") and (tonumber(slots) < ominslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..ominslots.." slots!")
         user:Disconnect()
         end
      
      elseif (opsMaxHubs == "1") and (tonumber(hubs) > omaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is: "..omaxhubs..)   
         user:Disconnect()
         end

      if (opsMinShare == "1") and tonumber(temp) < ominShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..ominShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if (opsMaxShare == "1") and tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

-- master users part --

      if user.iProfile == 0 then
      if (masterMaxSlots == "1") and (tonumber(slots) > mmaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..mmaxslots.." slots!")
         user:Disconnect()
         end

      if (masterMinSlots == "1") and (tonumber(slots) < mminslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..mminslots.." slots!")
         user:Disconnect()
         end
      
      elseif (masterMaxHubs == "1") and (tonumber(hubs) > mmaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is: "..mmaxhubs..)   
         user:Disconnect()
         end

      if (masterMinShare == "1") and tonumber(temp) < mminShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..mminShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if (masterMaxShare == "1") and tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end
   end
Regards,

Troubadour

** Guardian Forum **

hubaddy:   nederfun.no-ip.com

XPMAN

I am in desperate need of something like this my self to run on my hub. Maybe the errors is something that will be easy for you to figure out. I am eager to see a working version of this script.  

Thanks again for helping.

bastsweden

lokks good. But im having my account like this.. did forgett to mention that the last time... :-S

0/master   1/opar   2/vips    3/regs    4/ [?VC?]    5/-[RaR]      6/-[DvD-R]
:D  im back  :D

kepp

Just a question.... ;)
(I may be wrong)
vipMinSlots = "1"

That one for instance,
Dosen't that mean that vipMinSlots will be the same as 1
while
vipMinSlots = 1 will have the value 1?

if BlaBlaBla == 1 then
--//ToDo
end

if BlaBlaBla2 == 1 then
--//ToDo
end

Why not use elseif to get rid of all "end"?
Guarding    

Troubadour

#7
--------------------------------------------------------------------------------
Bot = "Your_botname_here"
Creator = Troubadour

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

mminShare = 2 * gb        -- Sets Minimum Share
ominShare = 4 * gb        -- Sets Minimum Share
vminShare = 8 * gb        -- Sets Minimum Share
rminShare = 10 * gb       -- Sets Minimum Share
maxShare = 1000 * gb      -- Sets Maximum Share
mmaxslots = 20            -- Sets Maximum Number of Slots
omaxslots = 18            -- Sets Maximum Number of Slots
vmaxslots = 16            -- Sets Maximum Number of Slots
rmaxslots = 12            -- Sets Maximum Number of Slots
mminslots = 1             -- Sets Minimum Number of Slots
ominslots = 2             -- Sets Minimum Number of Slots
vminslots = 4             -- Sets Minimum Number of Slots
rminslots = 6             -- Sets Minimum Number of Slots
mmaxhubs = 20             -- Sets Maximim Number of Hubs
omaxhubs = 18             -- Sets Maximim Number of Hubs
vmaxhubs = 15             -- Sets Maximim Number of Hubs
rmaxhubs = 10             -- Sets Maximim Number of Hubs


function GetArg(data)
   s,e,whoTo,from,cmd,arg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s*")
   return arg
end

function Get2Args(data)
   s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s*")
   return arg,arg2
end

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

-------------------------------------------------------------------------------------------------------------------------------------------------

function DataArrival(user, data)

      if( strsub(data, 1, 1) == "<" ) then
      data=strsub(data,1,strlen(data)-1)
      s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
      end
end

function NewUserConnected(user)
      
-- hubs and slot checking --
      if strfind(curUser.sMyInfoString,"<++") then
      _,b, slots = strfind(curUser.sMyInfoString,"S:(%d+)",b)
      _,b, hubs = strfind(curUser.sMyInfoString,"H:(%d+)")


-- reg users part --
      if user.iProfile == 3 then
      if (tonumber(slots) > rmaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..rmaxslots.." slots!")
         user:Disconnect()
         end

      if (tonumber(slots) < rminslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..rminslots.." slots!")
         user:Disconnect()
         end
      
      elseif (tonumber(hubs) > rmaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is "..rmaxhubs.." hubs")
         user:Disconnect()
         end

      if tonumber(temp) < rminShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..rminShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

-- vip users part --

      if user.iProfile == 2 then
      if (tonumber(slots) > vmaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..vmaxslots.." slots!")
         user:Disconnect()
         end

      if (tonumber(slots) < vminslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..vminslots.." slots!")
         user:Disconnect()
         end
      
      elseif (tonumber(hubs) > vmaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is "..vmaxhubs.." hubs")
         user:Disconnect()
         end

      if tonumber(temp) < vminShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..vminShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

-- ops users part --

      if user.iProfile == 1 then
      if (tonumber(slots) > omaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..omaxslots.." slots!")
         user:Disconnect()
         end

      if (tonumber(slots) < ominslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..ominslots.." slots!")
         user:Disconnect()
         end
      
      elseif (tonumber(hubs) > omaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is "..omaxhubs.." hubs")
         user:Disconnect()
         end

      if tonumber(temp) < ominShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..ominShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

-- master users part --

      if user.iProfile == 0 then
      if (tonumber(slots) > mmaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..mmaxslots.." slots!")
         user:Disconnect()
         end

      if (tonumber(slots) < mminslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..mminslots.." slots!")
         user:Disconnect()
         end
      
      elseif (tonumber(hubs) > mmaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is "..mmaxhubs.." hubs")
         user:Disconnect()
         end

      if tonumber(temp) < mminShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..mminShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end
   end
end

--------------------------------------------------------------------------------

Hope this will do the trick.

-Troubadour-
Regards,

Troubadour

** Guardian Forum **

hubaddy:   nederfun.no-ip.com

kepp

What is "temp" in your script?

           function DoCheckMasterMinShare(curUser)
             local s,e,share = strfind(curUser.sMyInfoString, "[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+([^$]+)")
                temp = share
                      if tonumber(temp) < MasterMinShare then
                            SendToNick(curUser.sName, BotName.." You have not met the minimum share of "..MasterMinShare.." GB\r\nDisconnecting...")
                            curUser:Disconnect()
                   end
    end

This is just a piece of code that i've made for my bot..
It check the user.s InfoString and returns the share in bytes...

Which means, when you send data to the user about what the minimum share is, He will see it in bytes..

You can do format("%2.0f", MasterMinShare)
and divide untill you get it in GB
Guarding    

Troubadour

Bot = "Your_botname_here"
Creator = Troubadour

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

mminShare = 2 * gb        -- Sets Minimum Share
ominShare = 4 * gb        -- Sets Minimum Share
vminShare = 8 * gb        -- Sets Minimum Share
rminShare = 10 * gb       -- Sets Minimum Share
maxShare = 1000 * gb      -- Sets Maximum Share
mmaxslots = 20            -- Sets Maximum Number of Slots
omaxslots = 18            -- Sets Maximum Number of Slots
vmaxslots = 16            -- Sets Maximum Number of Slots
rmaxslots = 12            -- Sets Maximum Number of Slots
mminslots = 1             -- Sets Minimum Number of Slots
ominslots = 2             -- Sets Minimum Number of Slots
vminslots = 4             -- Sets Minimum Number of Slots
rminslots = 6             -- Sets Minimum Number of Slots
mmaxhubs = 20             -- Sets Maximim Number of Hubs
omaxhubs = 18             -- Sets Maximim Number of Hubs
vmaxhubs = 15             -- Sets Maximim Number of Hubs
rmaxhubs = 10             -- Sets Maximim Number of Hubs


function GetArg(data)
   s,e,whoTo,from,cmd,arg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s*")
   return arg
end

function Get2Args(data)
   s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s*")
   return arg,arg2
end

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

-------------------------------------------------------------------------------------------------------------------------------------------------

function DataArrival(user, data)

      if( strsub(data, 1, 1) == "<" ) then
      data=strsub(data,1,strlen(data)-1)
      s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
      end
   i,j,temp = strfind(curUser.sMyInfoString, "$(%d+)%$")
   if temp == nil then
   curUser:Disconnect()
   return
   end
   Share = format("%0.2f", tonumber(temp)/gb)
end

function NewUserConnected(user)
      
-- hubs and slot checking --
      if strfind(curUser.sMyInfoString,"<++") then
      _,b, slots = strfind(curUser.sMyInfoString,"S:(%d+)",b)
      _,b, hubs = strfind(curUser.sMyInfoString,"H:(%d+)")
    
   
-- reg users part --
      if user.iProfile == 3 then
      if (tonumber(slots) > rmaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..rmaxslots.." slots!")
         user:Disconnect()
         end

      if (tonumber(slots) < rminslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..rminslots.." slots!")
         user:Disconnect()
         end
      
      elseif (tonumber(hubs) > rmaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is "..rmaxhubs.." hubs")
         user:Disconnect()
         end

      if tonumber(temp) < rminShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..rminShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

-- vip users part --

      if user.iProfile == 2 then
      if (tonumber(slots) > vmaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..vmaxslots.." slots!")
         user:Disconnect()
         end

      if (tonumber(slots) < vminslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..vminslots.." slots!")
         user:Disconnect()
         end
      
      elseif (tonumber(hubs) > vmaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is "..vmaxhubs.." hubs")
         user:Disconnect()
         end

      if tonumber(temp) < vminShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..vminShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

-- ops users part --

      if user.iProfile == 1 then
      if (tonumber(slots) > omaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..omaxslots.." slots!")
         user:Disconnect()
         end

      if (tonumber(slots) < ominslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..ominslots.." slots!")
         user:Disconnect()
         end
      
      elseif (tonumber(hubs) > omaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is "..omaxhubs.." hubs")
         user:Disconnect()
         end

      if tonumber(temp) < ominShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..ominShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

-- master users part --

      if user.iProfile == 0 then
      if (tonumber(slots) > mmaxslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open max "..mmaxslots.." slots!")
         user:Disconnect()
         end

      if (tonumber(slots) < mminslots) then
         SendToNick(user.sName, "<" ..Bot.."> You have "..slots.." slots open")
         SendToNick(user.sName, "<" ..Bot.."> Please open min "..mminslots.." slots!")
         user:Disconnect()
         end
      
      elseif (tonumber(hubs) > mmaxhubs) then
         SendToNick(user.sName, "<" ..Bot.."> You are in to many hubs max is "..mmaxhubs.." hubs")
         user:Disconnect()
         end

      if tonumber(temp) < mminShare then
      SendToNick(user.sName, "<" ..Bot.."> You have not got the min share of: ..mminShare.. Gb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end

      if tonumber(temp) > maxShare then
      SendToNick(user.sName, "<" ..Bot.."> You have exeeded the maximum share of: 1 Tb")
      SendToNick(user.sName, "<" ..Bot.."> Disconnecting...")
      user:Disconnect()
      end
   end
end
 

Better this way!
Regards,

Troubadour

** Guardian Forum **

hubaddy:   nederfun.no-ip.com

kepp

#10
--# Originally made by Troubador
--# Modified a little by Kepp
--#

kb = 1024
mb = kb*kb
gb = kb*kb*kb
---------------[ - Bot - ]------------------
Bot = "Your_BotName_Here"
Creator = "Troubador"

---------------[ - Settings - ]----------------
MasterMinShare = 2*gb
OpMinShare = 4*gb
VipMinShare = 6*gb
WholeHubShare = 10*gb


-------------[ - New user connected - ]---------------

function NewUserConnected(user)
                    data=curUser.sMyInfoString
                    local s,e,share = strfind(data, "$(%d+)%$")

temp = format("%0.2f", MasterMinShare)/gb
temp1 = format("%0.2f", OpMinShare)/gb
temp2 = format("%0.2f", VipMinShare)/gb
temp3 = format("%0.2f", WholeHubShare)/gb

                                  if (user.iProfile == 0) then
                                        if share == nil then
                                           user:Disconnect()
                                        elseif tonumber(share) < MasterMinShare then
                                           SendPmToNick(user.sName, "<"..Bot.."> You have not met the minimum sharesize of "..temp.." GB")
                                           user:Disconnect()
                      end
end


                                  if (user.iProfile == 1) then
                                        if share == nil then
                                           user:Disconnect()
                                        elseif tonumber(share) < OpMinShare then
                                           SendPmToNick(user.sName, "<"..Bot.."> You have not met the minimum sharesize of "..temp1.." GB")
                                           user:Disconnect()
                      end
end


                                  if (user.iProfile == 2) then
                                        if share == nil then
                                           user:Disconnect()
                                        elseif tonumber(share) < VipMinShare then
                                           SendPmToNick(user.sName, "<"..Bot.."> You have not met the minimum sharesize of "..temp2.." GB")
                                           user:Disconnect()
                      end
end


                                  if (user.iProfile == -1) or (user.iProfile == 3) then
                                        if share == nil then
                                           user:Disconnect()
                                        elseif tonumber(share) < WholeHubShare then
                                           SendPmToNick(user.sName, "<"..Bot.."> You have not met the minimum sharesize of "..temp3.." GB")
                                           user:Disconnect()
                            end
              end
end

The last code of yours couln't index ?user'
and bla bla bla :)
And why mix it it up with dataArrival?
Guarding    

XPMAN

Can u edit the slot for each too ,along with the min share? This would be cool if its possible. Wish i could be of some assistance with the script, i am a newbie and still in the learning stage........I am learning alot from u guys though,keep up the good work.

kepp

if i don't see it finished when i get back home from work i'll keep on working with it :)
Guarding    

IceCoder


SaintSinner

   


kepp

Working on it, just some common Copy'n'paste misstakes im working on :D
Guarding    

kepp

---------------------------------------------[ - C0p - ]----------------------------------
--# Originally made by Troubador
--# Modified a little by Kepp
--# Fixed: It now actually sends Why the user has been disconnected..
--# Fixed: Op/Master min share now works
--# Added: Min slots.. :D
--# Added: Max slots
------------------------------------------------------------------------------------------
--*** Take Note:
--
-- If you want to use this script, Make sure you have Minimum Share and Minimum slots DISABLED in PtokaX
-- As it may cause problems..
-- I use a nil statement in MaxSlots which im not so sure of that i need.. just in case ;)
-- Next Release: Max Hubs :O
-- Next Release: SlotRatio............ That is, IF possible.. :D

kb = 1024
mb = kb*kb
gb = kb*kb*kb
---------------[ - Bot - ]-------------
Bot = "c0p"

---------------[ - Settings - ]--------
MasterMinShare = 2*gb
OpMinShare = 4*gb                   --// Min Share
VipMinShare = 6*gb
WholeHubShare = 10*gb
---------------------------------------
MasterMinSlots = 0
OpMinSlots = 0                          --// Min Slots
VipMinSlots = 2
WholeHubMinSlots = 3
---------------------------------------
MasterMaxSlots = 15
OpMaxSlots = 12                       --// Max Slots
VipMaxSlots = 10
WholeHubMaxSlots = 6
---------------------------------------

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

-------------[ - New user connected - ]---------------

function NewUserConnected(user)

temp2 = format("%0.2f", VipMinShare)/gb
temp3 = format("%0.2f", WholeHubShare)/gb

                    data=user.sMyInfoString
                    local s,e,share = strfind(data, "$(%d+)%$")
                    local s,e,slots = strfind(data,"S:(%d+)")

                                  if (user.iProfile == 2) then
                                        if share == nil then
                                           user:Disconnect()
                                        elseif tonumber(share) < VipMinShare then
                                           user:SendData(Bot, "You have not met the minimum sharesize of "..temp2.." GB")
                                           user:Disconnect()
                      end
end


                                  if (user.iProfile == -1) or (user.iProfile == 3) then
                                        if share == nil then
                                           user:Disconnect()
                                        elseif tonumber(share) < WholeHubShare then
                                           user:SendData(Bot, "You have not met the minimum sharesize of "..temp3.." GB")
                                           user:Disconnect()
                            end
              end


             if (user.iProfile == 2) then
                            if slots == nil then
                               user:Disconnect()
                            elseif tonumber(slots) < VipMinSlots then
                               user:SendData(Bot, "You have not met the minimum slots required, Minimum slots: "..VipMinSlots)
                               user:Disconnect()
                   end
    end

             if (user.iProfile == -1) or (user.iProfile == 3) then
                         if slots == nil then
                            user:Disconnect()
                         elseif tonumber(slots) < WholeHubMinSlots then
                            user:SendData(Bot, "You have not met the minimum slots required, Minimum slots: "..WholeHubMinSlots)
                            user:Disconnect()
                   end
    end

             if (user.iProfile == 2) then
                         if slots == nil then
                            user:Disconnect()
                         elseif tonumber(slots) > VipMaxSlots then
                            user:SendData(Bot, "You have too many slots open.. Max Slots: "..VipMaxSlots)
                            user:Disconnect()
                   end
    end


            if (user.iProfile == -1) or (user.iProfile == 3) then
                         if slots == nil then
                            user:Disconnect()
                         elseif tonumber(slots) > WholeHubMaxSlots then
                            user:SendData(Bot, "You have too many slots open.. Max Slots: "..WholeHubMaxSlots)
                            user:Disconnect()
                   end
    end

end
-------------------------------------------------[ - END OF NEW USER - ]--------------------------------------

function OpConnected(user)

temp = format("%0.2f", MasterMinShare)/gb
temp1 = format("%0.2f", OpMinShare)/gb

                   data=user.sMyInfoString
                   local s,e,share = strfind(data,"$(%d+)%$")
                   local s,e,slots = strfind(data,"S:(%d+)")

                                  if (user.iProfile == 0) then
                                        if share == nil then
                                           user:Disconnect()
                                        elseif tonumber(share) < MasterMinShare then
                                           user:SendData(Bot, "You have not met the minimum sharesize of "..temp.." GB")
                                           user:Disconnect()
                      end
end


                                  if (user.iProfile == 1) then
                                        if share == nil then
                                           user:Disconnect()
                                        elseif tonumber(share) < OpMinShare then
                                           user:SendData(Bot, "You have not met the minimum sharesize of "..temp1.." GB")
                                           user:Disconnect()
                      end
end


                   if (user.iProfile == 0) then
                         if slots == nil then
                            user:Disconnect()
                         elseif tonumber(slots) < MasterMinSlots then
                            user:SendData(Bot, "You have not met the minimum slots required, Minimum slots: "..MasterMinSlots)
                            user:Disconnect()
                end
end

                   if (user.iProfile == 1) then
                         if slots == nil then
                            user:Disconnect()
                         elseif tonumber(slots) < OpMinSlots then
                            user:SendData(Bot, "You have not met the minimum slots required, Minimum slots: "..OpMinSlots)
                            user:Disconnect()
                end
end

                   if (user.iProfile == 0) then
                         if slots == nil then
                            user:Disconnect()
                         elseif tonumber(slots) > MasterMaxSlots then
                            user:SendData(Bot, "You have too many slots open.. Max Slots: "..MasterMaxSlots)
                            user:Disconnect()
                end
end


                   if (user.iProfile == 1) then
                         if slots == nil then
                            user:Disconnect()
                         elseif tonumber(slots) > OpMaxSlots then
                            user:SendData(Bot, "You have too many slots open.. Max Slots: "..OpMaxSlots)
                            user:Disconnect()
                      end
             end
    end
Guarding    

bastsweden

Hey guys. Nice work on this script.

But i havent got what i wanted in  the first place..lol....
as i said be4 i have my Accounts like this.

0/master 1/opar 2/vips 3/regs 4/ [?VC?] 5/-[RaR] 6/-[DvD-R]

so are missing these in the script 4/ [?VC?] 5/-[RaR] 6/-[DvD-R]

maybe its easy to add it i dont knowe.. i cant anny Lua :-(


cheers m8
:D  im back  :D

tezlo

GB = 1024^3

minshare = {
	["[?VC?]"] = 250*GB,
	["-[DvD-R]"] = 100*GB,
}

minslots = {
	["-[RaR]"] = 2, 
}

maxslots = {
	["-[RaR]"] = 6,
}

maxhubs = {
	["-[DvD-R]"] = 4,
}

hubschecktype = 3
allowpassiveusers = 1

forbiddenflags = { "B", "U" } 
requiredflags = { "V", "S", "H" }

function check(user)
	local s, e, desc, cnnx, mode, mail, share = strfind(user.sMyInfoString, "^%$MyINFO %$ALL %S+ (.*)%$ %$(.*)(.)%$(.-)$(%d+)%$%|$")
	if not s then return nil, "bad myinfo" end

	local s, e, tag = strfind(desc, "%<%+%+ (.+)%>")
	if not s then return nil, "no tag" end

	local flags = {}
	gsub(tag, "(%u)%:([^,]+)", function(key, value) %flags[key] = value end)

	for i, key in forbiddenflags do if flags[key] then return nil, "forbidden flag: "..key end end
	for i, key in requiredflags do if not flags[key] then return nil, "required flag: "..key end end
	
	local tmp = {0}
	gsub(flags["H"], "(%d+)", function(n) %tmp[1] = %tmp[1] + tonumber(n) end, hubschecktype)
	flags["H"] = tmp[1]

	if allowpassiveusers == 0 and flags["M"] == "P" then return nil, "passive" end

	flags["M"] = nil
	for k, v in flags do flags[k] = tonumber(v) end
	local profile = GetProfileName(user.iProfile) or "Unreg"

	local tmp = minshare[profile]
	if tmp and (tmp > tonumber(share)) then return nil, "min share: "..format("%0.2f", tmp/GB).." GB" end

	local tmp = minslots[profile]
	if tmp and (tmp > flags["S"]) then return nil, "min slots: "..tmp end

	local tmp = maxslots[profile]
	if tmp and (tmp < flags["S"]) then return nil, "max slots: "..tmp end

	local tmp = maxhubs[profile]
	if tmp and (tmp < flags["H"]) then return nil, "max hubs: "..tmp end

	return 1, nil
end

function NewUserConnected(user)
	local pass, msg = check(user)
	if not pass then
		user:SendData("Hub-Security", msg)
		user:Disconnect()
	end
end

function OpConnected(user)
	local pass, msg = check(user)
	if not pass then
		user:SendData("Hub-Security", msg)
		user:Disconnect()
	end
end

bastsweden

#19
Nice Tezlo... thx m8....... u are the man hehe ;-)
:D  im back  :D

bastsweden

Aint working :-(

it is returning bad info on a oDC klient, and it dont allowe the user to have 1 slot for an ex

i do use Dark Mind as main script. but i have set it to 0 on that and running the min and max in PtokaX.
Could that do the probb?

Cheers m8s
:D  im back  :D

tezlo

hmm.. latest oDC works for me

try replace the bad info line with..
if not s then return nil, "bad myinfo: "..user.sMyInfoString end

and please post the message you get if it happens again

i dont get the other part..
the min/max slotcheck doesnt work ?

SMF spam blocked by CleanTalk