PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Madman on 09 February, 2005, 00:44:48

Title: PX OpOnly Script to DCH Script
Post by: Madman on 09 February, 2005, 00:44:48
--//TagChecker Made By Madman
--//Stripped From -Dark-Mind- Made By ?
--//And Ofcourse Modded By Madman =)
--//Modded To OpOnly
--//Small changes by Optimus
--//Some Stuff Added By Madman
--//+1 If User Is Op In This Hub
--//Redir Options Requested By Daywalker
--//MOTD Will Be Shown When Redirecting
--//Nothing We Can Do About It
--//Thanks For The Help LUA Hub Tho...
--//To See If Anything Could Be Done

Bot = "OpOnly"
NrOpHub = 2 --//Minimum Number Of OpHubs
SendInfo = 1 --//Send Info On Connect
DisRedir = 1 --//Disconnect = 1, Redirect = 0
Addy = "Put Redir Addy Here"

function DataArrival(curUser,data)
if (strsub(data,1,7)=="$MyINFO") then
s,e,OpHubs = strfind(data,"$MyINFO $ALL.*,H:%d+/%d+/(%d+)")
if s then
if (tonumber(OpHubs) < NrOpHub) then
if DisRedir==0 then
curUser:SendData(Bot, "You are not op in " ..NrOpHub.. " hubs. You are being redirected.")
curUser:SendData(Bot, "Redirecting to: "..Addy.."|$ForceMove "..Addy.."|")
elseif DisRedir==1 then
curUser:SendData(Bot, "You are not op in " ..NrOpHub.. " hubs. You are being disconnected.")
curUser:Disconnect()
end
end
else
curUser:SendData(Bot, "I cant check your hubs. You are being disconnected.")
curUser:Disconnect()
end
end
end

--//The Info On Connect ;p
function NewUserConnected(curUser)
if SendInfo==1 then
if curUser.bOperator then
--//Added +1 To This Line Beacuse It Dosent Count Your Hub
curUser:SendData(Bot, "Hi, Op " ..curUser.sName.. " you are Op in " ..(OpHubs+1).." hubs. The minimum number of ophubs allowed is " ..NrOpHub)
elseif not curUser.bOperator then
curUser:SendData(Bot, "Hi, " ..curUser.sName.. " you are Op in " ..OpHubs.. " hubs. The minimum number of ophubs allowed is " ..NrOpHub)
end
end
end

OpConnected = NewUserConnected

Hi, I made this for Daywalker when he was using PX
Now he has switched to DCH and asked me to convert it, so it works in DCH...
But i cant get it to work...
So if anyone could help us out would be nice =)
Title:
Post by: ??????Hawk?????? on 09 February, 2005, 01:58:16
hi m8   Give this a try  ..

--//TagChecker Made By Madman
--//Stripped From -Dark-Mind- Made By ?
--//And Ofcourse Modded By Madman =)
--//Modded To OpOnly
--//Small changes by Optimus
--//Some Stuff Added By Madman
--//+1 If User Is Op In This Hub
--//Redir Options Requested By Daywalker
--//MOTD Will Be Shown When Redirecting
--//Nothing We Can Do About It
--//Thanks For The Help LUA Hub Tho...
--//To See If Anything Could Be Done
--
-- Attempted Conversion to DCH++ by ??????Hawk?????? ( untested )
--
local Bot = "OpOnly"
local NrOpHub = 2 --//Minimum Number Of OpHubs
local SendInfo = 1 --//Send Info On Connect
local DisRedir = 1 --//Disconnect = 1, Redirect = 0
local Addy = "Put Redir Addy Here"

function dchpp.clientUnknownCommand( client, data )
if (string.sub(data,1,7)=="$MyINFO") then
s,e,OpHubs = string.find(data,"$MyINFO $ALL.*,H:%d+/%d+/(%d+)")
if s then
if (tonumber(OpHubs) < NrOpHub) then
if DisRedir==0 then
client:send(Bot, "You are not op in " ..NrOpHub.. " hubs. You are being redirected.")
client:send(Bot, "Redirecting to: "..Addy.."|$ForceMove "..Addy.."|")
elseif DisRedir==1 then
client:send(Bot, "You are not op in " ..NrOpHub.. " hubs. You are being disconnected.")
client:Disconnect()
end
end
else
client:send(Bot, "I cant check your hubs. You are being disconnected.")
client:Disconnect()
end
end
end

--//The Info On Connect ;p
function dchpp.userConnected( client )
local nick = client:getNick()
local level = client:getLevel()
if SendInfo==1 then
if level >= 2 then
client:send(Bot, "Hi, Op " ..nick.. " you are Op in " ..(OpHubs+1).." hubs. The minimum number of ophubs allowed is " ..NrOpHub)
else
client:send(Bot, "Hi, " ..nick.. " you are Op in " ..OpHubs.. " hubs. The minimum number of ophubs allowed is " ..NrOpHub)
end
end
end


Title:
Post by: 6Marilyn6Manson6 on 09 February, 2005, 13:45:49
Hello I have change it:

--//TagChecker Made By Madman
--//Stripped From -Dark-Mind- Made By ?
--//And Ofcourse Modded By Madman =)
--//Modded To OpOnly
--//Small changes by Optimus
--//Some Stuff Added By Madman
--//+1 If User Is Op In This Hub
--//Redir Options Requested By Daywalker
--//MOTD Will Be Shown When Redirecting
--//Nothing We Can Do About It
--//Thanks For The Help LUA Hub Tho...
--//To See If Anything Could Be Done
--//Change redirect by 6Marilyn6Manson6
--//Add TimeBan and ban by 6Marilyn6Manson6

Bot = "OpOnly"
NrOpHub = 2 --//Minimum Number Of OpHubs
SendInfo = 1 --//Send Info On Connect
DisRedir = 0 --//Ban = 3, TimeBan = 2, Disconnect = 1, Redirect = 0

function Main()
frmHub:EnableFullData(1)
time = "60"
end

function DataArrival(curUser,data)
if (strsub(data,1,7)=="$MyINFO") then
s,e,OpHubs = strfind(data,"$MyINFO $ALL.*,H:%d+/%d+/(%d+)")
if s then
if (tonumber(OpHubs) < NrOpHub) then
if DisRedir==0 then
curUser:SendData(Bot, "You are not op in " ..NrOpHub.. " hubs. You are being redirected.")
curUser:SendData(Bot, "Redirecting... |$ForceMove "..frmHub:GetRedirectAddress().."|")
elseif DisRedir==1 then
curUser:SendData(Bot, "You are not op in " ..NrOpHub.. " hubs. You are being disconnected.")
curUser:Disconnect()
elseif DisRedir==2 then
curUser:SendData(Bot, "You are not op in " ..NrOpHub.. " hubs. You are being timeban.")
curUser:TimeBan(time)
elseif DisRedir==3 then
curUser:SendData(Bot, "You are not op in " ..NrOpHub.. " hubs. You are being banned.")
curUser:Ban()
end
end
else
curUser:SendData(Bot, "I cant check your hubs. You are being disconnected.")
curUser:Disconnect()
end
end
end

--//The Info On Connect ;p
function NewUserConnected(curUser)
if SendInfo==1 then
if curUser.bOperator then
--//Added +1 To This Line Beacuse It Dosent Count Your Hub
curUser:SendData(Bot, "Hi, Op " ..curUser.sName.. " you are Op in " ..(OpHubs+1).." hubs. The minimum number of ophubs allowed is " ..NrOpHub)
elseif not curUser.bOperator then
curUser:SendData(Bot, "Hi, " ..curUser.sName.. " you are Op in " ..OpHubs.. " hubs. The minimum number of ophubs allowed is " ..NrOpHub)
end
end
end

OpConnected = NewUserConnected


bye of6Marilyn6Manson6
MyHUB: planetarium.ichnusanet.net
Title:
Post by: Madman on 19 February, 2005, 00:46:24
Here is my script for dch++
It took some time to figuer out but we got it working...
It dont contain everything as the PX one.. but this is enough... =)

--//OpOnly Script Made By Madman
--//Tested By Daywalker™

--//Disconnect The User If He Dont Are Op In 2 Hubs
--//But If User Is Op In The Hub, It Dosent Matter If He Is Op In Less Then 2 Hubs

-- We Havent Tested With A Client Without Tag

function dchpp.userConnected(client) --//User Connect
local msg = client:getMyInfo()
local ret,c,desc = string.find( msg, "$MyINFO $ALL.*,H:%d+/%d+/(%d+)" ) --//Get The MyInfo
if ret then --//If We Got It
if client:isOp() then --//If User Is Op
client:hubMessage(
"Welcome, To This Nice Hub|" --//Send This
)
else --//If Not Op Then
if (tonumber(desc) < 2 ) then --//If Op Hubs Below 2
client:hubMessage( --//Send This
"You are in "..desc.." hubs, minimum is 2\r\n"..
"You will be Disconnected..\r\n|"
)
client:disconnect() --//And Disconnet
return dchpp.ACTION_DISCONNECTED
end
end
else --//If No MyInfo
client:hubMessage( --//Send This
"Cant read your tag!\r\n"..
"You will be Disconneted..\r\n|"
)
client:disconnect() --//And Disconnect
return dchpp.ACTION_DISCONNECTED
end
end