Odd Script : To kick any user that is sharing, unless regged user
 

Odd Script : To kick any user that is sharing, unless regged user

Started by Zebbie, 05 November, 2003, 10:17:59

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zebbie

I know this is an odd script, but I need a script to :

Check users when they connect, and if they are registered users, skip the check, but if they are guests etc, to check if they are sharing, if so, kick them with a message.

If they're not sharing, leave them alone.



If anyone could throw that together, that'd be great.

Regards,

Zeb

NightLitch

Here you go....

Hope I understand you right....

------------------------------------------------
-- Tiny Share Check Bot
-- By NightLitch
-- This Script Checks all NON REGGED USERS...
-- Set Desire MINIMUM Share on Wanted Share
-- what NON REGGED should share...
------------------------------------------------
kb = 1024
mb = kb*kb
gb = kb*kb*kb

Bot = "TinyBot"		

WantedShare = 6 *gb	

KickMessage = "\t\t\twarning\r\n\tYOU ARE NOT A REGISTERED USER OF THIS HUB\r\n\t"..
"you are not sharing "..WantedShare/gb.." GB, You are being disconnected..."

function DataArrival (curUser, data)
	if (strsub(data,1,7) == "$MyINFO") and curUser.bOperator == nil then
		s,e, vShare = strfind(data,"$+(%d+)$+|+")
		if vShare ~= nil then
			if curUser.iProfile == -1 then
				if (tonumber(vShare) < WantedShare) then
					curUser:SendData(Bot, KickMessage)
					curUser:Disconnect()
				end
			end
		end
	end
end


/NightLitch
//NL

Zebbie

#2
Thanks a lot for posting, but if I read the script correctly, you did not quite understand me correctly.


What I was after, was :

Registered users are ignored by the script,

Unregistered users, if they are sharing >0 bytes, are kicked with the message :-)

The script if for a public hub at a large lan event, and we want people to be able to access data from the organisers, but not to be able to share themselves :-)

I know it's an odd way of doing things ;-)

But.. If I change the line :

if (tonumber(vShare) < WantedShare) then


to

if (tonumber(vShare) > WantedShare) then

and set the wanted share as 0, it should do what I want?




Thanks

Zeb

Zebbie

Tested :-)

Works a treat, thanks

Zeb

SMF spam blocked by CleanTalk