Some like warn funtion
 

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

Some like warn funtion

Started by Pit, 08 November, 2004, 02:58:41

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Pit

Greetings

What i want in this request is that if someone can make me a standalone script for my hub.
with this options:

-Only certain nicks have permission to the comand;
-Comand may be !pick
-If it find an error in the sintase phrase, send PM with a line of explanation like: !pick
-After a certain 'pick' times, the bot send his nickname to a certain op nick with the varios 'picks' writen in PM
-Of course that has to be made a picks.txt or a picks.dat to acomplish

If it's possible be able to make a table with the 5 top 'pickers' with the following items:

-Username
-Pick times
-Date of picks
-Picked by
-Levels

This estructure has a funny gold that i rather not confess it, but if it can be made i'll be gratefull..

Thanks

nErBoS

Hi,

I could make the script, but fisrt i need to understand it. I am not understanding what you mean with "pick" what is the objective of this command ??? Can you give more examples please.

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

Pit

Greetings

You can understand 'pick' as warn!
But instead, after a number predifened 'warnings', the user get kicked, simple the bot send pm to some defined in script nicks a msg!
Then after some msg's receaved the nick in charge of that task simple realize what to do with it!

Hope i get more clear this time..

Thanks

And i'm still using your Brain-Master dude...
100%
no stops and see this:

Tempo de Liga??o, 9 Dias, 22 Horas 17 Minutos e 23 Segundos
O tempo m?ximo de Estado Online no Friends ? de 15 dias, 19 Horas e 32 Minutos...no dia 26/8/2004

Not jokin',,,it's true man!!

And i've made some modifications on it

More cmds and txts

Hope you don?t mind..

Keep up the good work

nErBoS

Hi,

I think i have understood it right. You want to save all warns made to the user, or only the last one ???

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

Pit

Greetings nerbos

Thanks for the quick replies..
And yes
I want the script to save all warns made to the user, with all the points i designed

thanks man

[[[[[[]]]]]]]]]]]]

nErBoS

Hi,

Here you go...

--## DIFFERENT WARN BOT
--## Requested by Pit
--## Made by nErBoS
--## Commands:
--##	!pick   	- Warns a user and saves it with a type of warn level
--##	!toppick				- The "iTop" most warned in the HUB

sBot = "DW-Bot"

arrWarn = {}
fWarn = "warn.dat"
arrAux = {}

--## Configuration ##--

iWarns = 4	-- Time of warns to warn OPs

iTop = 5	-- Number of users you want to show on the TOP

arrOPs = {	-- Table with the nick of OPs to be warned after iWarns
	"nErBoS",
	"Pit",
}

arrLevel = {	-- Table with the levels of Warn
	[0] = "DANGER",
	[1] = "MEDIUM",
	[2] = "LIGHT",
}

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(sBot)
	LoadFromFile(fWarn)
end

function OnExit()
	SaveToFile(fWarn , arrWarn , "arrWarn")
end


function DataArrival(user, data)
	if (user.bOperator and (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot)) then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "!pick") then
			local s,e,sNick,iLevel,sReason = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)%s+(.+)")
			if (sNick == nil or sReason == nil) then
				user:SendPM(sBot, "Syntax Error, !pick   , you must write a nick, a level of pick and a reason.")
			elseif (iLevel == nil or tonumber(iLevel) == nil or arrLevel[tonumber(iLevel)] == nil) then
				local sTmp,iIndex,sPick = "The Level of Pick is invalid, it must be one of this numbers:\r\n\r\n"
				for iIndex, sPick in arrLevel do
					sTmp = sTmp.."LEVEL: "..iIndex.." ["..sPick.."]\r\n"
				end
				user:SendPM(sBot, sTmp)
			elseif (GetItemByName(sNick) == nil) then
				user:SendPM(sBot, "The user "..sNick.." is not online.")
			else
				sNick = GetItemByName(sNick)
				if (arrWarn[sNick.sName] == nil) then
					arrWarn[sNick.sName] = {}
					arrWarn[sNick.sName]["WARNS"] = {}
					arrWarn[sNick.sName]["TIMES"] = 0
				end
				tinsert(arrWarn[sNick.sName]["WARNS"], {["REASON"] = sReason, ["TIME"] = GetTime(), ["BY"] = user.sName, ["LEVEL"] = arrLevel[tonumber(iLevel)]} )
				arrWarn[sNick.sName]["TIMES"] =  arrWarn[sNick.sName]["TIMES"] + 1
				user:SendPM(sBot, "The user "..sNick.sName.." was been pick, because: "..sReason.." wiht the level "..arrLevel[tonumber(iLevel)])
				sNick:SendPM(sBot, "You are been pick by "..user.sName.." because: "..sReason.." with the level "..arrLevel[tonumber(iLevel)])
				if (arrWarn[sNick.sName]["TIMES"] >= iWarns) then
					SendWarn(sNick.sName)
				end
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 1
		elseif (cmd == "!toppick") then
			local sTmp,iSize,iCount,iMax,sMax,sNick,arrTable,iTimes = "The "..iTop.." Users most warned in the HUB: \r\n\r\n",GetSize(),0,0,""
			while iCount < iSize do
				for sNick, arrTable in arrWarn do
					if (arrAux[sNick] == nil and arrTable["TIMES"] >= iMax) then
						sMax = sNick
						iMax = arrTable["TIMES"]
					end
				end
				sTmp = sTmp.."USER: "..sMax.." WARNED: "..iMax.." times\r\n"
				iCount = iCount + 1
			end
			arrAux = {}
			user:SendPM(sBot, sTmp)
			return 1
		end
	end
end

function SendWarn(sNick)
	local sTmp,arrTable = "The user "..sNick.." has recived "..arrWarn[sNick]["TIMES"].." warns :\r\n\r\n"
	for i=1, getn(arrWarn[sNick]["WARNS"]) do
		arrTable = arrWarn[sNick]["WARNS"][i]
		sTmp = sTmp.."\t--## WARN ##--\r\n\r\n"
		sTmp = sTmp.."REASON: "..arrTable["REASON"].."\r\n"
		sTmp = sTmp.."TIME: "..arrTable["TIME"].."\r\n"
		sTmp = sTmp.."LEVEL: "..arrTable["LEVEL"].."\r\n"
		sTmp = sTmp.."BY: "..arrTable["BY"].."\r\n"
	end
	for i=1, getn(arrOPs) do
		if (GetItemByName(arrOPs[i]) ~= nil) then
			GetItemByName(arrOPs[i]):SendPM(sBot, sTmp)
		end
	end
end

function GetSize()
	local iCount,sNick,arrTable = 0
	for sNick, arrTable in arrWarn do
		iCount = iCount + 1
		if (iCount >= iTop) then
			return iTop
		end
	end
	return iCount
end

function GetTime()
	return "Date: ".." "..date("%d").."/"..date("%m").."/20"..date("%y").." Hour: "..date("%H")..":"..date("%M")..":"..date("%S")
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

About the Brain-Master....

No problem you are free to make the modification you want. About the UPTIME, the record of the BOT for now belongs to [PT]CableGuy for more then 40 days (without shutting down the ptokax) with the Brain-Master.

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

Pit

Greetings nerbos

thanks for the script
i'll check it right now..then i'll say something to you

Keep on doing thw good work man

See ya

Pit

Pit

Greetings nerbos

The script works 200%
I think we have a connection man
I have the thoughts, you the gift doing them...
Thanks a lot man
Own you one more...
lol

I have two more ideas..
Check it out the request scripts...
;)
when you have free time of course..

See ya nerbos
;)


monnie[[[[[[]]]]]]]]]]]

SMF spam blocked by CleanTalk