!kick and !warn for ptokax 330
 

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

!kick and !warn for ptokax 330

Started by Hades, 05 March, 2004, 05:19:22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hades

Here is my admin ptokax 330b15.25 commands:
!ban () - permanently ban IP address of the , followed by kick. Reason is optional.
   !banip - permanently ban IP address
   !nickban - ban user's nick (if user is connected then he is kicked)
   !unban - unban IP address or Nick
   !getbanlist - display list of banned IP addresses
   !clrtempban - clear tempban list
   !clrpermban - clear permban list
   !drop - silent kick with tempban
   !getinfo - displays basic info on user with given nick
   !op - give a temporal Op status to the for one session
   !gag - the user cant post to mainchat anymore
   !ungag - the user can post to mainchat again
   !restart - restart hub
   !restartscripts - restart scripting part from the hub
   !reloadtxt - reload all textfiles
   !addreguser - add registered user with specified profile
   !delreguser - remove registered user with
   !stat - Show some hub statistics
   !topic - Set new topic. Or !topic off - clear topic.
   !ipinfo - Show all on/offline users with that ip
   !iprangeinfo - Show all on/offline users within that iprange
   !userinfo - Show all visits of that user
...
As u can see there is no kick or warn can someone write me a simple !kick or !warn scrips?
i wish it could have settable number of warns b4 kick and settable nb of kicks b4 ban...

PLS PLS PLS help!
...
PS.: Possibly kick and warn command with reason
!kick

[T-G-T]M@sto

QuoteOriginally posted by Hades
Here is my admin ptokax 330b15.25 commands:
!ban () - permanently ban IP address of the , followed by kick. Reason is optional.
   !banip - permanently ban IP address
   !nickban - ban user's nick (if user is connected then he is kicked)
   !unban - unban IP address or Nick
   !getbanlist - display list of banned IP addresses
   !clrtempban - clear tempban list
   !clrpermban - clear permban list
   !drop - silent kick with tempban
   !getinfo - displays basic info on user with given nick
   !op - give a temporal Op status to the for one session
   !gag - the user cant post to mainchat anymore
   !ungag - the user can post to mainchat again
   !restart - restart hub
   !restartscripts - restart scripting part from the hub
   !reloadtxt - reload all textfiles
   !addreguser - add registered user with specified profile
   !delreguser - remove registered user with
   !stat - Show some hub statistics
   !topic - Set new topic. Or !topic off - clear topic.
   !ipinfo - Show all on/offline users with that ip
   !iprangeinfo - Show all on/offline users within that iprange
   !userinfo - Show all visits of that user
...
As u can see there is no kick or warn can someone write me a simple !kick or !warn scrips?
i wish it could have settable number of warns b4 kick and settable nb of kicks b4 ban...

PLS PLS PLS help!
...
PS.: Possibly kick and warn command with reason
!kick

See this "!drop - silent kick with tempban"
Temban means the users is kicked
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

nErBoS

#2
Hi,

Hope it helps...

--Requested by Hades
--Made by nErBoS

Bot = "Func-Bot"

warn = {}
kicked = {}

function Main()
	frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
	if (warn[user.sName] == 3) then
		user:SendData(Bot, "You going to be kicked because you had 3 warns.")
		user:TempBan()
		warn[user.sName] = nil
	else
	end
	if (kicked[user.sName] == 3) then
		user:SendData(Bot, "You going to be baned because you had 3 kicks.")
		user:TempBan()
		kicked[user.sName] = nil
	else
	end
end

function DataArrival(user, data) 
	if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")
		if (cmd=="!kick") then
			if (user.bOperator) then
				local s,e,usr,reason = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.*)")
				if (usr == nil or reason == nil) then
					user:SendData(Bot, "Syntax error, !kick  , must have a nick and reason.")
				else
					if (GetItemByName(usr) == nil) then
						user:SendData(Bot, "The user "..usr.." is not online.")
					else
						local userToBeKicked = GetItemByName(usr)
						SendToAll(Bot, "The user "..userToBeKicked.sName" has been kicked by "..user.sName.." because: "..reason)
						userToBeKicked:SendPM(Bot, "You have been kicked because: "..reason)
						if (kicked[userToBeKicked.sName] == nil) then
							kicked[userToBeKicked.sName] = 0
						else
							kicked[userToBeKicked.sName] = kicked[userToBeKicked.sName] + 1
						end
						userToBeKicked.sName:TempBan()
					end
				end
			else
				user:SendData(Bot, "You don?t have permission to use this command.")
			end
			return 1
		elseif (cmd=="!warn") then
			if (user.bOperator) then
				local s,e,usr,reason = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.*)")
				if (usr == nil or reason == nil) then
					user:SendData(Bot, "Syntax error, !warn  , must have a nick and reason.")
				else
					if (GetItemByName(usr) == nil) then
						user:SendData(Bot, "The user "..usr.." is not online.")
					else			
						local userToBeWarned = GetItemByName(usr)
						userToBeWarned:SendPM(Bot, "You are been warned because: "..reason)
						user:SendData(Bot, "Your warn has been sent.")
						if (warn[userToBeWarned.sName] == nil) then
							warn[userToBeWarned.sName] = 0
						else
							warn[userToBeWarned.sName] = warn[userToBeWarned.sName] + 1
						end
						userToBeWarned.sName:Disconnect()
					end
				end
			else
				user:SendData(Bot, "You don?t have permission to use this command.")
			end
			return 1
		end 
	end 
end

Be warn, when ever you restart the script or the Hub the count of kicks and warns will be lost.

Best regards, nErBoS
--## nErBoS Spot ##--

Hades

#3
That's it!!!
Thanx so much!!!
Now i need a script for !kick
And !warn
Example:
Ops types in m chat !warn Dicori Hacked dc++
hub reaction:
User Dicori was warned by because of:hdc
:))
HELP!!!!!

nErBoS

Hi,

Done..

--Requested by Hades
--Made by nErBoS

Bot = "Func-Bot"

warn = {}
kicked = {}

function Main()
	frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
	if (warn[user.sName] == 3) then
		user:SendData(Bot, "You going to be kicked because you had 3 warns.")
		user:TempBan()
		warn[user.sName] = nil
	else
	end
	if (kicked[user.sName] == 3) then
		user:SendData(Bot, "You going to be baned because you had 3 kicks.")
		user:TempBan()
		kicked[user.sName] = nil
	else
	end
end

function DataArrival(user, data) 
	if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")
		if (cmd=="!kick") then
			if (user.bOperator) then
				local s,e,usr,reason = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.*)")
				if (usr == nil or reason == nil) then
					user:SendData(Bot, "Syntax error, !kick  , must have a nick and reason.")
				else
					if (GetItemByName(usr) == nil) then
						user:SendData(Bot, "The user "..usr.." is not online.")
					else
						local userToBeKicked = GetItemByName(usr)
						SendToAll(Bot, "The user "..userToBeKicked.sName" has been kicked by "..user.sName.." because: "..reason)
						userToBeKicked:SendPM(Bot, "You have been kicked because: "..reason)
						if (kicked[userToBeKicked.sName] == nil) then
							kicked[userToBeKicked.sName] = 0
						else
							kicked[userToBeKicked.sName] = kicked[userToBeKicked.sName] + 1
						end
						userToBeKicked.sName:TempBan()
					end
				end
			else
				user:SendData(Bot, "You don?t have permission to use this command.")
			end
			return 1
		elseif (cmd=="!warn") then
			if (user.bOperator) then
				local s,e,usr,reason = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.*)")
				if (usr == nil or reason == nil) then
					user:SendData(Bot, "Syntax error, !warn  , must have a nick and reason.")
				else
					if (GetItemByName(usr) == nil) then
						user:SendData(Bot, "The user "..usr.." is not online.")
					else			
						local userToBeWarned = GetItemByName(usr)
						userToBeWarned:SendPM(Bot, "You are been warned because: "..reason)
						user:SendData(Bot, "Your warn has been sent.")
						SendToAll(Bot, "User "..userToBeWarned.sName" was warned by "..Bot.." because of "..reason)
						if (warn[userToBeWarned.sName] == nil) then
							warn[userToBeWarned.sName] = 0
						else
							warn[userToBeWarned.sName] = warn[userToBeWarned.sName] + 1
						end
						userToBeWarned.sName:Disconnect()
					end
				end
			else
				user:SendData(Bot, "You don?t have permission to use this command.")
			end
			return 1
		end 
	end 
end

Best regards, nErBoS
--## nErBoS Spot ##--

Hades

#5
Thanx so much once more
!!
I going to test it now:))
.........
Warn works kick doesn't!!
Bot doesn't count warns or its still bcuz kick doesnt' work???

nErBoS

#6
Hi,

Sorry the script had little bugs, was made in a horry.
Have test and is working ok...

--Requested by Hades
--Made by nErBoS

Bot = "Func-Bot"

warn = {}
kicked = {}

function Main()
	frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
	if (warn[user.sName] == 3) then
		user:SendData(Bot, "You going to be kicked because you had 3 warns.")
		user:TempBan()
		warn[user.sName] = nil
	else
	end
	if (kicked[user.sName] == 3) then
		user:SendData(Bot, "You going to be banned because you had 3 kicks.")
		user:Ban()
		kicked[user.sName] = nil
	else
	end
end

function DataArrival(user, data) 
	if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")
		if (cmd=="!kick") then
			if (user.bOperator) then
				local s,e,usr,reason = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.*)")
				if (usr == nil or reason == nil) then
					user:SendData(Bot, "Syntax error, !kick  , must have a nick and reason.")
				else
					if (GetItemByName(usr) == nil) then
						user:SendData(Bot, "The user "..usr.." is not online.")
					else
						local userToBeKicked = GetItemByName(usr)
						SendToAll(Bot, "User "..userToBeKicked.sName.." was kicked by "..Bot.." because of "..reason)
						userToBeKicked:SendPM(Bot, "You have been kicked because: "..reason)
						if (kicked[userToBeKicked.sName] == nil) then
							kicked[userToBeKicked.sName] = 1
						else
							kicked[userToBeKicked.sName] = kicked[userToBeKicked.sName] + 1
						end
						userToBeKicked:TempBan()
					end
				end
			else
				user:SendData(Bot, "You don?t have permission to use this command.")
			end
			return 1
		elseif (cmd=="!warn") then
			if (user.bOperator) then
				local s,e,usr,reason = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.*)")
				if (usr == nil or reason == nil) then
					user:SendData(Bot, "Syntax error, !warn  , must have a nick and reason.")
				else
					if (GetItemByName(usr) == nil) then
						user:SendData(Bot, "The user "..usr.." is not online.")
					else			
						local userToBeWarned = GetItemByName(usr)
						userToBeWarned:SendPM(Bot, "You are been warned because: "..reason)
						user:SendData(Bot, "Your warn has been sent.")
						SendToAll(Bot, "User "..userToBeWarned.sName.." was warned by "..Bot.." because of "..reason)
						if (warn[userToBeWarned.sName] == nil) then
							warn[userToBeWarned.sName] = 1
						else
							warn[userToBeWarned.sName] = warn[userToBeWarned.sName] + 1
						end
						userToBeWarned:Disconnect()
					end
				end
			else
				user:SendData(Bot, "You don?t have permission to use this command.")
			end
			return 1
		end 
	end 
end

Best regards, nErBoS
--## nErBoS Spot ##--

Hades

as i tested it tis time it warns and  disconnect everytime warning is given but wont kick after 3 warns.
kick works but doesn't give a ban after 3 kicks.
I think counter doesn't work this time
:((

nErBoS

#8
Hi,

Have you restarted the script or the Hub when you kicked or warned ?? Because when you do that the information will be lost.

Best regards, nErBoS
--## nErBoS Spot ##--

Hades

i didn't restart script
I was testing warn command on op though does it matter?
He was getting warn message an was getting sisconnected but i have warned him like 15 times and no kick accured and same with kick.

WooshMan

If you give me a few days, I will give you part of my bot which does just what you want.

Kicks on 4th warning
bans on 3rd kick

Keeps tables in files so you can stop and start hub whenever and still keep kicks and warns.

Let me know if you want it and I will sortit for you.

WooshMan :-)
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

nErBoS

#11
QuoteOriginally posted by Hades
i didn't restart script
I was testing warn command on op though does it matter?
He was getting warn message an was getting sisconnected but i have warned him like 15 times and no kick accured and same with kick.

Hi,

You were working the command with ops that was my mistake i tought the commands was only to users but here is it..

--Requested by Hades
--Made by nErBoS

Bot = "Func-Bot"

warn = {}
kicked = {}

function Main()
	frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
	if (warn[user.sName] == 3) then
		user:SendData(Bot, "You going to be kicked because you had 3 warns.")
		user:TempBan()
		warn[user.sName] = nil
	else
	end
	if (kicked[user.sName] == 3) then
		user:SendData(Bot, "You going to be banned because you had 3 kicks.")
		user:Ban()
		kicked[user.sName] = nil
	else
	end
end

OpConnected = NewUserConnected

function DataArrival(user, data) 
	if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")
		if (cmd=="!kick") then
			if (user.bOperator) then
				local s,e,usr,reason = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.*)")
				if (usr == nil or reason == nil) then
					user:SendData(Bot, "Syntax error, !kick  , must have a nick and reason.")
				else
					if (GetItemByName(usr) == nil) then
						user:SendData(Bot, "The user "..usr.." is not online.")
					else
						local userToBeKicked = GetItemByName(usr)
						SendToAll(Bot, "User "..userToBeKicked.sName.." was kicked by "..Bot.." because of "..reason)
						userToBeKicked:SendPM(Bot, "You have been kicked because: "..reason)
						if (kicked[userToBeKicked.sName] == nil) then
							kicked[userToBeKicked.sName] = 1
						else
							kicked[userToBeKicked.sName] = kicked[userToBeKicked.sName] + 1
						end
						userToBeKicked:TempBan()
					end
				end
			else
				user:SendData(Bot, "You don?t have permission to use this command.")
			end
			return 1
		elseif (cmd=="!warn") then
			if (user.bOperator) then
				local s,e,usr,reason = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.*)")
				if (usr == nil or reason == nil) then
					user:SendData(Bot, "Syntax error, !warn  , must have a nick and reason.")
				else
					if (GetItemByName(usr) == nil) then
						user:SendData(Bot, "The user "..usr.." is not online.")
					else			
						local userToBeWarned = GetItemByName(usr)
						userToBeWarned:SendPM(Bot, "You are been warned because: "..reason)
						user:SendData(Bot, "Your warn has been sent.")
						SendToAll(Bot, "User "..userToBeWarned.sName.." was warned by "..Bot.." because of "..reason)
						if (warn[userToBeWarned.sName] == nil) then
							warn[userToBeWarned.sName] = 1
						else
							warn[userToBeWarned.sName] = warn[userToBeWarned.sName] + 1
						end
						userToBeWarned:Disconnect()
					end
				end
			else
				user:SendData(Bot, "You don?t have permission to use this command.")
			end
			return 1
		end 
	end 
end

Best regards, nErBoS
--## nErBoS Spot ##--

Hades

QuoteOriginally posted by WooshMan
If you give me a few days, I will give you part of my bot which does just what you want.

Kicks on 4th warning
bans on 3rd kick

Keeps tables in files so you can stop and start hub whenever and still keep kicks and warns.

Let me know if you want it and I will sortit for you.

WooshMan :-)
Of course i want it!!!
Take your time i'm here almost everyday:))

SMF spam blocked by CleanTalk