PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: Zigurds on 03 March, 2005, 10:26:57

Title: Verlihub script in PtokaX
Post by: Zigurds on 03 March, 2005, 10:26:57
Please this 3 scripts tranlate in work with PtokaX

---------------DCversion
function VH_OnUserLogin(nick)
  res, sMyInfoString = VH:GetMyINFO(nick)
  if string.find(sMyInfoString,"<++") then
    s,e,dcver = string.find(sMyInfoString,"V:(%x.%x+)")
    if ((dcver>="0.403") and (dcver<="0.665")) and not IsUserOperator(nick) then
      VH:SendDataToUser("<-HUBBOTS-> Aizliegti viltojumi un jebkura DC 0.403 versija un uz taas baazeetiee citi klienti!!!)",nick)
      VH:CloseConnection(nick);
    end
  end
end

function IsUserOperator(nick)
  res, class = VH:GetUserClass(nick)
  if res and class > 4 then
    return true
  else
    return false
  end
end


-----------Minversion

function VH_OnUserLogin(nick)
  res, sMyInfoString = VH:GetMyINFO(nick)
  if string.find(sMyInfoString,"<++") then
    s,e,dcver = string.find(sMyInfoString,"V:(%x.%x+)")
    if ((dcver>="0.100") and (dcver<="0.399")) and not IsUserOperator(nick) then
      VH:SendDataToUser("<-HUBBOTS-> Aizliegta jebkura DC++ versija  mazaaka par 0.400!)",nick)
      VH:CloseConnection(nick);
    end
  end
end

function IsUserOperator(nick)
  res, class = VH:GetUserClass(nick)
  if res and class > 4 then
    return true
  else
    return false
  end
end

--------oDCversion

function VH_OnUserLogin(nick)
  res, sMyInfoString = VH:GetMyINFO(nick)
  if string.find(sMyInfoString,"    s,e,dcver = string.find(sMyInfoString,"V:(%x.%x+)")
    if ((dcver>="4.5") and (dcver<="5.313")) and not IsUserOperator(nick) then
      VH:SendDataToUser("<-HUBBOTS-> Novecojusi oDC versija - nav hashings!)",nick)
      VH:CloseConnection(nick);
    end
  end
end

function IsUserOperator(nick)
  res, class = VH:GetUserClass(nick)
  if res and class > 4 then
    return true
  else
    return false
  end
end


Sorry my bad language
-------------------------------------------
owner for Latvian hub Alfa
Title:
Post by: bastya_elvtars on 03 March, 2005, 13:43:35
There is already a LUA5 minversion script aroung for ptokax I guess so no need to convert.

Also I see that verli API is bit more complicated than Px... :)
Title:
Post by: PPK on 03 March, 2005, 14:15:57
Yup verli api is very complicated  :D

---------------DCversion

function NewUserConnected(curUser)
if curUser.bOperator == nil and curUser.bHasTag and curUser.sClient == "DC++" and tonumber(curUser.sClientVersion) ~= nil then
if((tonumber(curUser.sClientVersion) >= 0.403) and (tonumber(curUser.sClientVersion) <= 0.665)) then
curUser:SendData("<-HUBBOTS-> Aizliegti viltojumi un jebkura DC 0.403 versija un uz taas baazeetiee citi klienti!!!)")
curUser:Disconnect()
end
end
end
-----------Minversion

function NewUserConnected(curUser)
if curUser.bOperator == nil and curUser.bHasTag and curUser.sClient == "DC++" and tonumber(curUser.sClientVersion) ~= nil then
if((tonumber(curUser.sClientVersion) >= 0.100) and (tonumber(curUser.sClientVersion)<= 0.399)) then
curUser:SendData("<-HUBBOTS-> Aizliegta jebkura DC++ versija mazaaka par 0.400!)")
curUser:Disconnect()
end
end
end
--------oDCversion

function NewUserConnected(curUser)
if curUser.bOperator == nil and curUser.bHasTag and curUser.sClient == "oDC" and tonumber(curUser.sClientVersion) ~= nil then
if((tonumber(curUser.sClientVersion) >= 4.5) and (tonumber(curUser.sClientVersion) <= 5.313)) then
curUser:SendData("<-HUBBOTS-> Novecojusi oDC versija - nav hashings!)")
curUser:Disconnect()
end
end
end
Title:
Post by: Zigurds on 03 March, 2005, 18:15:52
thanks, works ok  :)))
Title: Vipsharebot
Post by: Zigurds on 03 March, 2005, 19:22:07
Please converter so this

-----------------------------------------------------------
-- VIPbots
-----------------------------------------------------------
kb = 1024
mb = kb*kb
gb = kb*kb*kb
tb = kb*kb*kb*kb
-----------------------------------------------------------
-- All Share values are in GB
-- VIP User = 2 (original set from ptokax)
-----------------------------------------------------------
BotName = "-VIPBOTS-"

VIP = {
Level = 2,
MinShare = 3,
MaxShare = 5000,
}
-------------------------------------------------------------------------------------------------------------
function Main()
--   frmHub:RegBot(BotName)
end
-------------------------------------------------------------------------------------------------------------
function DataArrival(curUser,data)
   if (strsub(data,1,7) == "$MyINFO") then
      CheckShare(curUser,data)
   end
end
-------------------------------------------------------------------------------------------------------------
function CheckShare(curUser,data)
   s,e, vShare = strfind(data,"$+(%d+)$+|+")
   if vShare ~= nil then
-- Vip User Check Share -------------------------------------------------------------------------------------
      if curUser.iProfile == VIP.Level then
         if (tonumber(vShare) < VIP.MinShare * gb) then
            curUser:SendPM(BotName," VIP shaares minimums - "..VIP.MinShare.." Gb")
            curUser:SendPM(BotName," Atvienoju...")
            curUser:Disconnect()
         end
      end
   end
end

Sorry my bad language
-------------------------------------------
owner for Latvian hub Alfa
Title:
Post by: 6Marilyn6Manson6 on 03 March, 2005, 19:44:37
This is ok:

-- Converted the script into LUA 5 by 6Marilyn6Manson6
-----------------------------------------------------------
-- VIPbots
-----------------------------------------------------------
kb = 1024
mb = kb*kb
gb = kb*kb*kb
tb = kb*kb*kb*kb
-----------------------------------------------------------
-- All Share values are in GB
-- VIP User = 2 (original set from ptokax)
-----------------------------------------------------------
BotName = "-VIPBOTS-"

VIP = {
Level = 2,
MinShare = 3,
MaxShare = 5000,
}
-------------------------------------------------------------------------------------------------------------
function Main()
-- frmHub:RegBot(BotName)
end
-------------------------------------------------------------------------------------------------------------
function DataArrival(curUser,data)
if (string.sub(data,1,7) == "$MyINFO") then
CheckShare(curUser,data)
end
end
-------------------------------------------------------------------------------------------------------------
function CheckShare(curUser,data)
s,e, vShare = string.find(data,"$+(%d+)$+|+")
if vShare ~= nil then
if curUser.iProfile == VIP.Level then
if (tonumber(vShare) < VIP.MinShare * gb) then
curUser:SendPM(BotName," VIP shaares math.minimums - "..VIP.MinShare.." Gb")
curUser:SendPM(BotName," Atvienoju...")
curUser:Disconnect()
end
end
end
end

bye bye
Title:
Post by: Zigurds on 03 March, 2005, 20:08:23
sorry, not work
Title:
Post by: 6Marilyn6Manson6 on 03 March, 2005, 20:12:13
Post you're error please
Title:
Post by: 6Marilyn6Manson6 on 03 March, 2005, 20:22:28
I have made it but not tested:

-----------------------------------------------------------
-- Vip Share Bot v.1.0
-- By: 6Marilyn6Manson6 At 8:05 PM 03/02/2005
-----------------------------------------------------------
kb = 1024
mb = kb*kb
gb = kb*kb*kb
tb = kb*kb*kb*kb
-----------------------------------------------------------
-- All Share values are in GB
-- Need to Set correct Level/Profile
-- on those levels that are nil.
-----------------------------------------------------------
-- Start of Editable Data --

BotName = "VIPShare"

-- VIP User --
VIPLvl = 2
VIP = {
MinShare = 0,
MaxShare = 1000000,
MinSlots = 0,
MaxSlots = 1000,
}
-------------------------------------------------------------
function Main()
frmHub:RegBot(BotName)
end
-------------------------------------------------------------
function DataArrival(curUser,data)
if (string.sub(data,1,7) == "$MyINFO") then
local _,_, Slots = string.find(data,".*S:(%d+)")
elseif curUser.iProfile == VIPLvl then
CheckSlots(curUser,VIP.MinSlots,VIP.MaxSlots,Slots)
end
end

function CheckSlots(curUser,mnSlots,mxSlots,Slots)
if Slots==nil then
curUser:SendData(BotName,"Don't hide your tag...")
curUser:Disconnect()
elseif (tonumber(Slots) < mnSlots) then
curUser:SendData(BotName,"You have only "..Slots.." slot(s) open... You should have at least "..mnSlots.." slot(s) open. ")
curUser:Disconnect()
elseif (tonumber(Slots) > mxSlots) then
curUser:SendData(BotName,"You should have at most "..Slots.." slots open... Maximum of slots is "..mxSlots..". ")
curUser:Disconnect()
end
end

function CheckShare(curUser,data)
s,e, vShare = string.find(data,"$+(%d+)$+|+")
if vShare ~= nil then
elseif curUser.iProfile == VIPLvl then
if (tonumber(vShare) < VIP.MinShare * gb) then
curUser:SendData(BotName,"As a VIP you should have at least "..VIP.MinShare.." GB in your share.")
curUser:Disconnect()
end
end
end

bye bye
Title:
Post by: Zigurds on 03 March, 2005, 20:25:05
no syntax error, 0 emotion
Title:
Post by: bastya_elvtars on 03 March, 2005, 20:42:49
Try now.

-----------------------------------------------------------
-- Vip Share Bot v.1.0
-- By: 6Marilyn6Manson6 At 8:05 PM 03/02/2005
-- fixed by bastya_elvtars
-----------------------------------------------------------
kb = 1024
mb = kb*kb
gb = kb*kb*kb
tb = kb*kb*kb*kb
-----------------------------------------------------------
-- All Share values are in GB
-- Need to Set correct Level/Profile
-- on those levels that are nil.
-----------------------------------------------------------
-- Start of Editable Data --


BotName = "VIPShare"

-- VIP User --
VIPLvl = 2
VIP = {
MinShare = 0,
MaxShare = 1000000,
MinSlots = 0,
MaxSlots = 1000,
}
-------------------------------------------------------------
function Main()
frmHub:RegBot(BotName)
end
-------------------------------------------------------------
function MyINFOArrival(curUser,data)
local _,_, Slots = string.find(data,".*S:(%d+)")
if curUser.iProfile == VIPLvl then
CheckSlots(curUser,VIP.MinSlots,VIP.MaxSlots,Slots)
end
end


function CheckSlots(curUser,mnSlots,mxSlots,Slots)
if Slots==nil then
curUser:SendData(BotName,"Don't hide your tag...")
curUser:Disconnect()
elseif (tonumber(Slots) < mnSlots) then
curUser:SendData(BotName,"You have only "..Slots.." slot(s) open... You should have at least "..mnSlots.." slot(s) open. ")
curUser:Disconnect()
elseif (tonumber(Slots) > mxSlots) then
curUser:SendData(BotName,"You should have at most "..Slots.." slots open... Maximum of slots is "..mxSlots..". ")
curUser:Disconnect()
end
end


function CheckShare(curUser,data)
s,e, vShare = string.find(data,"$+(%d+)$+|+")
if vShare then
if curUser.iProfile == VIPLvl and (tonumber(vShare) < VIP.MinShare * gb)  then
curUser:SendData(BotName,"As a VIP you should have at least "..VIP.MinShare.." GB in your share.")
curUser:Disconnect()
end
else
curUser:SendData(BotName,"Your client is stupid.")
end
end
Title:
Post by: Zigurds on 03 March, 2005, 21:09:54
not work. My test VIP share is 94 Gb.
These
 -- VIP User --
VIPLvl = 2
VIP = {
MinShare = 150,
MaxShare = 50,
MinSlots = 0,
MaxSlots = 1000,

no errors , 0 emotions

Profile manager off
Title:
Post by: blackwings on 03 March, 2005, 21:18:22
QuoteOriginally posted by Zigurds
not work. My test VIP share is 94 Gb.
These
 -- VIP User --
VIPLvl = 2
VIP = {
MinShare = 150,
MaxShare = 50,
MinSlots = 0,
MaxSlots = 1000,

no errors , 0 emotions

Profile manager off
test this min version script =>
Clicker Here (http://board.univ-angers.fr/thread.php?threadid=3725&boardid=29&styleid=1&sid=8503f98720aa93db15c56b996af119b7#5)

And try this slot checker =>
Click Here (http://board.univ-angers.fr/thread.php?threadid=3764&boardid=26&styleid=1&sid=8503f98720aa93db15c56b996af119b7)

And also try this share checker =>
Click Here (http://board.univ-angers.fr/thread.php?threadid=3770&boardid=26&styleid=1&sid=8503f98720aa93db15c56b996af119b7)
(if you also want max share, then I can add it.)
Title:
Post by: bastya_elvtars on 03 March, 2005, 21:26:11
Above script edited.
Title:
Post by: blackwings on 03 March, 2005, 21:30:49
bastya_elvtars, the Vip share script use code that isn't needed for detecting share+slots
Title:
Post by: Zigurds on 03 March, 2005, 21:36:33
no, no, my interest only VIP share check min and max

and little script slots in connections:


-- Slots vs Connection Speed by   [aXs] Wellx   11/06-03
-- Thx goes to Sedulus & aMutex for idea's and help
-- This script checks for slots vs speed and Disconnect if not Master/Operator/VIP
-- Optimized a bit made some no-used code at first...p

Connection={}
Connection["28.8Kbps"] = 0   
Connection["33.6Kbps"] = 0
Connection["56Kbps"] = 0
Connection["ISDN"] = 0
Connection["Satellite"] = 0
Connection["Cable"] = 20
Connection["DSL"] = 24
Connection["LAN(T1)"] = 27
Connection["LAN(T3)"] = 30

function DataArrival(curUser, data)
   if strsub( data, 1, 8 ) == "$MyINFO " and (curUser.iProfile < 0 or curUser.iProfile > 2) then
   SlotsCheck(curUser, strsub(data, 1, strlen(data) -1))
   end
end

function SlotsCheck(curUser, myinfo)   
local s,e,Slots,speed = strfind(myinfo, "S:([^,>]+).*>$ $([^$]*)")  
local Slots = tonumber(Slots)  
   if speed then
   local speed = strsub(speed,1,strlen(speed)-1)
      if Connection[speed] and Slots > Connection[speed] then
      curUser:SendPM("<-SLOTBOTS->", "Par daudz atveertu slotu shim piesleegumam! Maksimums ir ("..Connection[speed]..") Tev atveerti ("..Slots..") sloti")
--      SendToOps("<-SLOTBOTS->","*** Juuzeris <"..curUser.sName.."> IP <" ..curUser.sIP.."> Nepareizs slotu skaits! Atvienots:)")
      curUser:Disconnect()
      end
   end
end
Title:
Post by: Zigurds on 03 March, 2005, 22:10:56
Here then one my verlihub script

---------------------------------------------------------------------------------------------------------------------
--   CENSORBOTS
---------------------------------------------------------------------------------------------------------------------

trigs = {["?"]=1,["?"]=2,["?"]=3,["?"]=4,["?"]=5,["?"]=6,["?"]=7,["?"]=8,["?"]=9,["?"]=10,["?"]=11,["?"]=12,["?"]=13,["?"]=14,["?"]=15,["?"]=16,["?"]=17,["?"]=18,["?"]=19,["?"]=20,["?"]=21,["?"]=22,["?"]=23,["?"]=24,["?"]=25,["?"]=26,["?"]=27,["?"]=28,["?"]=29,["?"]=30}
max_class = 3
botname = "-CENSORBOTS-"
iemesls = "6. rule - Huba pamatvaloda ir latvieshu, bet lietojama tikai translitaa. Krieviski rakstiit atlauts tikai ar latiinju alfabeta burtiem!"

--------
-- Aiz shiis liinijas neko nelabojam :)
--------

function IsUserAdmin(nick)
  res, class = VH:GetUserClass(nick)
  if res and class >= max_class then
    return true
  else
    return false
  end
end

function cenzura(nick,data)
   if not IsUserAdmin(nick) then
      for key,a in trigs do
         if(string.find(data, key)) then
            VH:SendDataToUser("<"..botname.."> "..iemesls,nick)
            VH:CloseConnection(nick);
            return 0
         end
      end
   end
   return 1
end

function VH_OnParsedMsgChat(nick, data)
   return cenzura(nick,data)
end

function VH_OnParsedMsgMyINFO(nick, data)
   return cenzura(nick,data)
end