Hi all
I just wrote my first bot totally from scratch. It seemed to work like a charm but it seems that ptokax doesnt clear the table on a hub reboot or script reboot...
The problem lies at the clone detection. I have a list which stores IP's. Here's a stripped example of the problem:
tIPList = {}
function NewUserConnected(curUser)
if(tIPList[curUser.sIP]) and not curUser.bOperator then
local CloneUser = GetItemByName(tIPList[curUser.sIP])
CloneUser:SendData(Bot,"No clones allowed. Only 1 login per IP")
CloneUser:Disconnect()
tIPList[curUser.sIP] = curUser.sName
else
tIPList[curUser.sIP] = curUser.sName
end
end
function UserDisconnected(curUser)
tIPList[curUser.sIP] = nil;
end
It simply stores every the ip of every connecting in tIPList, and when the user disconnects it removes the entry again. Whenever a user connects for the 2nd time the first connection is disconnected and the ip is stored in the list again (becouse on the disconnect it removes the ip from the list so a 3rd connection would be possible).
but now whenever I restart the script or the hub without restarting the pc the list gets saves so lots of ppl cant get in.
Can I clear or reset the table in the main funcion? so to say whenever the script starts?
lots of thx in advance!
? Empie ?
Killua Anime - Akira's Fiction 1 - Killua.student.utwente.nl
Wouldn't that delete all entries?
Im not sure but you could try in main
function Main()
tIPList = nil;
tIPList = {}
end
??
You also check "and if not user.bOperator" which i don't think is needed since you use NewUserConnected() that only proceed data with an index below OP's
should be no need 2 save it anymore with this modifications.
tIPList = {}
function NewUserConnected(curUser)
if(tIPList[curUser.sIP]) then
curUser:SendData(Bot,"No clones allowed. Only 1 login per IP")
curUser:Disconnect()
else
tIPList[curUser.sIP] = curUser.sName
end
end
function UserDisconnected(curUser)
if curUser.sName == tIPList[curUser.sIP] then
tIPList[curUser.sIP] = nil
end
end
function DataArrival(curUser, data)
if curUser.bOperator == nil then
if tIPList[curUser.sIP] == nil then
tIPList[curUser.sIP] = curUser.sName
elseif tIPList[curUser.sIP] ~= curUser.sName then
curUser:SendData(Bot,"No clones allowed. Only 1 login per IP")
curUser:Disconnect()
end
end
end
removed the disconnecting of the clone as you can better disconnect the 2de ip.
some isp's put multiple users on 1 ip, your way would be really irritating for them.
plop
QuoteOriginally posted by plop
removed the disconnecting of the clone as you can better disconnect the 2de ip.
some isp's put multiple users on 1 ip, your way would be really irritating for them.
plop
Yeah, I see what you mean but I'm going to stick to the kicking of the first one..
Sometimes a "ghost clone" stays in the hub for some reason, and it would mean that that user couldnt log in...
about ISP's giving 2 ppl the same IP... I have never heard of that. It is true that a lot of people share their internetconnection, and those people would have 1 IP, thats true, but at the same time they also have only 1 upload, so I dont mind that only one of them can connect.
In the two days that I had the script running (in a 1000+ user hub) only 1 person came to me with that problem. I explained it to him and he totally understood :).
still much thanx for the help Kepp and plop, Im going to dig into the script now ^_^
? Empie ?
NGT from norway is 1 of those isp's, all of them are passive users.
the record i found was 8 users on 1 ip.
it's a lame trick as they need 2 pay extra for a own ip.
nearly all don't know about this untill they complained 2 the isp.
plop