PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: LiqUiD~TrolL on 22 March, 2005, 23:07:12

Title: no slow connections script
Post by: LiqUiD~TrolL on 22 March, 2005, 23:07:12
heyaaaa again and again  =o)

this is NO SLOW CONNECTIONS ALLOWED IN THE HUB

small script but really usefull for me,i used the converter to chnge it in lua 5 but it still doesn t works

check it out guys :


BotName = "-Inspector-"

function NewUserConnected(curUser)
    data=curUser.sMyInfoString
    s,e,cmd = string.find( data, "[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+([^$]+)" )

if (string.find(cmd,"28.8K")) then
curUser:SendPM(BotName,"___SorrY_BuT_Users_With_Slow_Connection_(28.8)_ArE_NoT_AlloweD_In_HerE___!! ")
curUser:Disconnect()
end
if (string.find(cmd,"33.6K")) then
curUser:SendPM(BotName,"___SorrY_BuT_Users_With_Slow_Connection_(33.6)_ArE_NoT_AlloweD_In_HerE___!! ")
curUser:Disconnect()
end
if (string.find(cmd,"56K")) then
curUser:SendPM(BotName,"___SorrY_BuT_Users_With_Slow_Connection_(56k)_ArE_NoT_AlloweD_In_HerE___!! ")
curUser:Disconnect()
end
end
Title:
Post by: Herodes on 22 March, 2005, 23:55:09
smth like this ?function MyInfoArrival( user, data)
local BotName = "NoDialUps"
local tCons = {
["28.8Kbps"] = { 0, "bye bye no dialups here..." },
["33.6Kbps"] = { 0, "bye bye no dialups here..." },
["56Kbps"] = { 0, "bye bye no dialups here..." },
["ISDN"] = { 1, "no.dial-ups.org", "bye bye no dialups here..." },
}
for i,v in tCons do
if i == user.sConnection then
if v[1] == 0 then
user:SendData( BotName, v[2] )
user:Disconnect()
elseif v[1] == 1 then
user:Redirect(v[2], v[3])
end
break
end
end
end
Title:
Post by: bastya_elvtars on 23 March, 2005, 00:53:54
IMHO it would be a lot better by hashing. :)if tCons[user.sConnection] then punish(user); end
Title:
Post by: Herodes on 23 March, 2005, 01:00:58
QuoteOriginally posted by bastya_elvtars
IMHO it would be a lot better by hashing. :)if tCons[user.sConnection] then punish(user); end
yeah .. too much php can do that to a scripter ..
Title:
Post by: bastya_elvtars on 23 March, 2005, 01:02:55
QuoteOriginally posted by Herodes
QuoteOriginally posted by bastya_elvtars
IMHO it would be a lot better by hashing. :)if tCons[user.sConnection] then punish(user); end
yeah .. too much php can do that to a scripter ..

That's why when i did my first trial page in HTML, I froze LUA for that time. :D
Title:
Post by: LiqUiD~TrolL on 23 March, 2005, 15:54:59
ok my friends i ve tried this script and i added in my settings 28,8 connction
and i tried to connect as a user and the log me in

note : i have DSL connection

but is this can be done?? the script seems it works in ptoka x no errors but why when i m connection with 54 connection in my settings it log me in the hub??
Title:
Post by: Herodes on 23 March, 2005, 21:40:05
QuoteOriginally posted by LiqUiD~TrolL
...but why when i m connection with 54 connection in my settings it log me in the hub??
I read this part 7 times and couldnt understand it. can you please explain ?
Title:
Post by: jiten on 23 March, 2005, 21:47:04
Indeed ;)
Title:
Post by: Dessamator on 23 March, 2005, 22:33:55
i think he meant 56kb connection setting, :D
Title: ehehhehe
Post by: LiqUiD~TrolL on 28 March, 2005, 09:58:25
sorry guys i wasn t so clear in what i wanted to say

well look,i have a script and when someone have in DC++ settings 58,isdn,28,and 34 KBS connection then the script doesn t allow him to log in the hub.

so how is this script works??
it s the same as mine?? if someone have in his DC++ settings these connections it doesn t allow him to log in the hub???
Title:
Post by: jiten on 28 March, 2005, 11:25:12
Well, the code is written in a way that either the user gets disconnected (0) or redirected (1), depending on the settings u chose here:

local tCons = {
["28.8Kbps"] = { 0, "bye bye no dialups here..." },
["33.6Kbps"] = { 0, "bye bye no dialups here..." },
["56Kbps"] = { 0, "bye bye no dialups here..." },
["ISDN"] = { 1, "no.dial-ups.org", "bye bye no dialups here..." },
}


With the settings, I mean the value (0 or 1) behind the reason message.

Best regards,

jiten
Title:
Post by: LiqUiD~TrolL on 28 March, 2005, 11:32:49
;-) i already got that jiten , but look what i m doing
i m adding the script ok,and i m opening the hub .the script is working ok??
and after that i m going on my DC++ settings and change my connection in ["28.8Kbps"] or something else from these not allowed
and the hub log me in,why ??
shouldn t ordinary dissconnect me ?
Title:
Post by: jiten on 28 March, 2005, 11:42:56
Yups, it should  ;)
Title:
Post by: Herodes on 28 March, 2005, 14:51:22
It should work.. any how I believe it was working before ...just made it more smooth to configure... function MyInfoArrival( user, data)
local BotName = "NoDialUps"
local tCons = {
-- ["con_type"] = { 0/1=off/on, "address.toredirect.to", "message to send" },
["28.8Kbps"] = { 0, "no.dial-ups.org", "bye bye no dialups here..." },
["33.6Kbps"] = { 0, "no.dial-ups.org", "bye bye no dialups here..." },
["56Kbps"] = { 0, "no.dial-ups.org", "bye bye no dialups here..." },
["ISDN"] = { 1, "no.dial-ups.org", "bye bye no dialups here..." },
}
for conn, tbl in tCons do
if (string.sub( user.sConnection, 1, -1 ) == i) then
if tbl[1] == 0 then
user:SendData( BotName, tbl[3] )
user:Disconnect()
elseif tbl[1] == 1 then
user:Redirect(tbl[2], tbl[3])
end
break;
end
end
end
[*edit*] small typo...
Title: no shit
Post by: LiqUiD~TrolL on 28 March, 2005, 22:41:19
this script doesn t works too =/

i add it,in ptokaX it works
with no errors,but when someone connected to the hub with slow connection it log in him ordinary, =(

why is this ?? is it better maybe to convert this one in LUA 5 ???

code :
------------------------------------------------------------------------
otName = "-Inspector-"

function NewUserConnected(curUser)
data=curUser.sMyInfoString
s,e,cmd = string.find( data, "[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+([^$]+)" )

if (string.find(cmd,"28.8K")) then
curUser:SendPM(BotName,"___SorrY_BuT_Users_With_Slow_Connection_(28.8)_ArE_NoT_AlloweD_In_HerE___!! ")
curUser:Disconnect()
end
if (string.find(cmd,"33.6K")) then
curUser:SendPM(BotName,"___SorrY_BuT_Users_With_Slow_Connection_(33.6)_ArE_NoT_AlloweD_In_HerE___!! ")
curUser:Disconnect()
end
if (string.find(cmd,"56K")) then
curUser:SendPM(BotName,& quot;___SorrY_BuT_Users_With_Slow_Connection_(56k)_ArE_NoT_AlloweD_In_HerE_ __!! ")
curUser:Disconnect()
end
end
------------------------------------------------------------------------
Title:
Post by: jiten on 28 March, 2005, 22:55:04
It happened the same with me.
Title:
Post by: Herodes on 28 March, 2005, 23:26:23
I am pretty sure users are sending a MyINFO when they connect,... I am not sure if PtokaX passes that first MyINFO through lua ... If PPK is listening (or reading) this I wish he could clarify it ;)

Maybe this ?function GetHim(user, con)
local BotName = "NoDialUps"
local tCons = {
["28.8Kbps"] = { 0, "no.dial-ups.org", "bye bye no dialups here..." },
["33.6Kbps"] = { 0, "no.dial-ups.org", "bye bye no dialups here..." },
["56Kbps"] = { 0, "no.dial-ups.org", "bye bye no dialups here..." },
["ISDN"] = { 1, "no.dial-ups.org", "bye bye no dialups here..." },
}
for conn, tbl in tCons do
if string.find( con, conn ) then
if tbl[1] == 0 then
user:SendData( BotName, tbl[3] )
user:Disconnect()
elseif tbl[1] == 1 then
user:Redirect(tbl[2], tbl[3])
user:Disconnect()
end
break;
end
end
end

function MyInfoArrival( user, data)
if user.sConnection then GetHim(user, user.sConnection) end
end

function UserConnected(user)
if user.sConnection then GetHim(user, user.sConnection) end
end
Title:
Post by: jiten on 29 March, 2005, 10:31:42
I'm curious about that one too, because the code seems OK, and it should work.
Let's hear PPK  :D
Title:
Post by: LiqUiD~TrolL on 29 March, 2005, 15:19:16
nop not working either m8

=/  shit, why i can t understand?

can you test it on a ptoka x to see ???

in my test it did nt disconnect me
Title:
Post by: Pothead on 29 March, 2005, 15:29:25
I'm just expecting all the people this disconnects / redirects to change the DC++ setting to sommit else and try again.  So you will end up with loads of false connections. If you want to deny slow connections, you are best of with an IP blocker. :)
Title:
Post by: LiqUiD~TrolL on 29 March, 2005, 22:48:56
m8 i alreday know this, and i try it , plz read all the dialogue next time  ;-)