Standalone Script Needed
 

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

Standalone Script Needed

Started by D-J Valhala, 31 July, 2004, 17:09:40

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

D-J Valhala

+logop - will save a log file of all commande that OP's/SuperOp's/Master's are used in the lest 12 hours will not show my commands every 12 hourd the log file will be cleard and with +logop i will see the logfile :)
(Only Masters Can See +logop)

10x  :D
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

kepp

Ok, I put one togheter, But there's no way i can tell wether it works or not as im unable to test it at the moment

strBot = "OP-Logger";

--// The prefix that is being used for the commands
strPrefix = "!";

sec = 1000;
min = 60*sec

function Main()
	if dofile("Commands.lst") == nil then
		local handle = openfile("Commands.lst","w")
		write(handle,"tblCOM = {\r\n}")
		closefile(handle)
	else
		dofile("Commands.lst")
	end
	frmHub:RegBot(strBot)
	SetTimer(10 * min)
	StartTimer()
end

function OnTimer()
	WriteFile(tblCOM,"tblCOM","Commands.lst")
end

function DataArrival(curUser,strData)
	if (strsub(strData,1,1) == "<") then
		local s,e,strCMD = strfind(strData,"%b<>%s+(%S+)")
		if (( strCMD == "+logop" )) then
			if curUser.iProfile == 0 then
				local strLST = "";
				for i = 1,getn(tblCOM) do
					strLST = strLST.."NAME\t"..tblCOM[i][1].."\tCOMMAND\t"..tblCOM[i][2].."\tDATE\t"..tblCOM[i][3].."\r\n"
				end
				curUser:SendPM(strBot,"\r\n"..strLST);
				return 1;
			else
				curUser:SendData(strBot,"*** Error, You are not allowed to use this command.")
				return 1;
			end
		elseif (( strCMD == "+clearoplog" )) then
			if curUser.iProfile == 0 then
				tblCOM = nil;
				tblCOM = {}
				collectgarbage()
				flush()
				WriteFile(tblCOM,"tblCOM","Commands.lst")
				curUser:SendPM(strBot,"OP-Logger was successfully cleared.")
				return 1;
			else
				curUser:SendData(strBot,"*** Error, You are not allowed to use this command.")
				return 1;
			end
		end
		if strsub(strCMD,1,1) == strPrefix then
			tinsert(tblCOM,1,{curUser.sName,strCMD,date()})
		end
	elseif (strsub(strData,1,5) == "$Kick") then
		tinsert(tblCOM,1,{curUser.sName,"$KICK",date()})
	end
end

function WriteFile(table, tablename, file)
	local handle = openfile(file, "w")
	Serialize(table, tablename, handle)
  	closefile(handle)
end

function Serialize(tTable, sTableName, hFile, sTab)
	sTab = sTab or "";
	write(hFile, 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
			Serialize(value, sKey, hFile, sTab.."\t");
		else
			local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
			write(hFile, sTab.."\t"..sKey.." = "..sValue);
		end
		write(hFile, ",\n");
	end
	write(hFile, sTab.."}");
end
Guarding    

D-J Valhala

My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

SMF spam blocked by CleanTalk