Search a script
 

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

Search a script

Started by TheRevenge, 02 October, 2004, 12:59:08

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TheRevenge

hello

i search a script with :

3 warn than 1 kick -> 3 kick than 1 ban with 6 hours ... and this save with a file and than the op write a commands than he see the banlist

TheRevenge


 :rolleyes: sorry for my bad english ;)

enema

maybe Robocop could help you with slight adjustments... Although ban is a ban... it lasts 4ever

Herodes

there is user:TimeBan(360)
:)

enema

Hope its what you are looking for
--Made by nErBoS, slight adjustments by enema

Bot = "security"

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:TimeBan(360)
		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 are being 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 have 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


It has one mayor error or missfunction - it doesnt save any logs when you restart your scripts or hub. I will try to fix that

nErBoS

Hi,

Here is the "mulfunction" fixed :D

--Made by nErBoS, slight adjustments by enema
--Add Table Save and Load

Bot = "security"

warn = {}
kicked = {}
fKick = "kick.dat"
fWarn = "warn.dat"

--## Configuration ##--

uLaterPtokax = 0	-- Choose 0 if you are using Ptokax Version 0.3.3.0 or higher
			-- Choose 1 if you are using Ptokax Version lower then 0.3.3.0

--## END ##--

function Main()
	--frmHub:RegBot(Bot)
	LoadFromFile(fKick)
	LoadFromFile(fWarn)
end

function OnExit()
	SaveToFile(fKick , kicked , "kicked")
	SaveToFile(fWarn , warn , "warn")
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
		if (uLaterPtokax == 1) then
			SaveToFile(fWarn , warn , "warn")	
		end	
	end
	if (kicked[user.sName] == 3) then
		user:SendData(Bot, "You going to be banned because you had 3 kicks.")
		user:TimeBan(360)
		kicked[user.sName] = nil
		if (uLaterPtokax == 1) then
			SaveToFile(fKick , kicked , "kicked")
		end
	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 are being kicked because: "..reason)
						if (kicked[userToBeKicked.sName] == nil) then
							kicked[userToBeKicked.sName] = 1
						else
							kicked[userToBeKicked.sName] = kicked[userToBeKicked.sName] + 1
						end
						if (uLaterPtokax == 1) then
							SaveToFile(fKick , kicked , "kicked")
						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 have 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
						if (uLaterPtokax == 1) then
							SaveToFile(fWarn , warn , "warn")	
						end	
						userToBeWarned:Disconnect()
					end
				end
			else
				user:SendData(Bot, "You don?t have permission to use this command.")
			end
			return 1
		end 
	end 
end

function Serialize(tTable, sTableName, sTab)
	assert(tTable, "tTable equals nil");
	assert(sTableName, "sTableName equals nil");

	assert(type(tTable) == "table", "tTable must be a table!");
	assert(type(sTableName) == "string", "sTableName must be a string!");

	sTab = sTab or "";
	sTmp = ""

	sTmp = sTmp..sTab..sTableName.." = {\n"

	for key, value in tTable do
		local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
			sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
		end

		sTmp = sTmp..",\n"
	end

	sTmp = sTmp..sTab.."}"
	return sTmp
end

function SaveToFile(file , table , tablename)
	writeto(file)
	write(Serialize(table, tablename))
	writeto()
end

function LoadFromFile(file)
	if (readfrom(file) ~= nil) then
		readfrom(file)
		dostring(read("*all"))
		readfrom()
	end
end

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

enema

grr... :D nErBoS, in your script there are still some enlgish mistakes. I thought I fix them, but when I look above, I see that bot, which I posted isint fixed or adjusted at all :D I just changed 2 things (I guess), well maybe more... not sure

nErBoS

Hi,

"English Mistakes" yes i write and speak bad english :P. Please correct them.

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

enema

No offence, nErBoS!!! I dont speek or write any better :DDD

nErBoS

Hi,

Not taken, welcome to the club then  :)) .

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

SMF spam blocked by CleanTalk