Verlihub script in PtokaX
 

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

Verlihub script in PtokaX

Started by Zigurds, 03 March, 2005, 10:26:57

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zigurds

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

bastya_elvtars

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... :)
Everything could have been anything else and it would have just as much meaning.

PPK

#2
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
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Zigurds

thanks, works ok  :)))

Zigurds

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

6Marilyn6Manson6

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

Zigurds


6Marilyn6Manson6

Post you're error please

6Marilyn6Manson6

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

Zigurds

no syntax error, 0 emotion

bastya_elvtars

#10
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
Everything could have been anything else and it would have just as much meaning.

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

blackwings

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

And try this slot checker =>
Click Here

And also try this share checker =>
Click Here
(if you also want max share, then I can add it.)


bastya_elvtars

Above script edited.
Everything could have been anything else and it would have just as much meaning.

blackwings

bastya_elvtars, the Vip share script use code that isn't needed for detecting share+slots


Zigurds

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

Zigurds

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

SMF spam blocked by CleanTalk