past in 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

past in a script

Started by Themaster, 11 January, 2005, 08:09:01

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Themaster

have a little problem 2 past this script i made a standalone...
i can't get in 2 my script...

Bot = "UserLog"

UserInfo = {}

sOffline = "UserLog.lst"

-- New User Connected --
function NewUserConnected(user,data)
	LogInfo(user)
end

function Main()
   frmHub:RegBot(Bot)
   LoadFromFile(sOffline)
end

function OnExit()
   SaveToFile(sOffline, UserInfo , "UserInfo")
end

function DataArrival(user, data)
	if (strsub(data, 1, 1) == "<" ) then
      local data=strsub(data,1,strlen(data)-1)
      local _,_,cmd=strfind(data, "%b<>%s+(%S+)")
      local Commands = (UserCommands(user, data, cmd))
      return Commands
   elseif (strsub(data,1,4) == "$To:") then
      data = strsub(data,1,-2);
      local s,e,whoTo,from,arg = strfind(data,"%$To:%s+(%S+)%s+From:%s+(%S+)%s+%$%b<>%s+(.*)")
      local s,e,cmd = strfind(arg,"(%S+)")
      if (whoTo == Bot) then 
      UserCommands(user,data,cmd)
      end
   end
end

function UserCommands(user,data,cmd)
   if cmd == "+log" then
     UserLog(user,data)
      return 1
   end
end

function UserLog(user,data)
   local s,e,arg = strfind(data,"%b<>%s+%S+%s+(%S+)")
  -- dofile(sOffline)
   if UserInfo[arg] then
   local msg = "\r\n\r\n"
      msg = msg .."\t"..strrep("-=",40).."\r\n"
      msg = msg .."\t\tThe user Name are:\t\t"..arg.."\r\n"
      msg = msg .."\t\tThe user Ip are:\t\t"..UserInfo[arg].IP.."\r\n"
      msg = msg .."\t\tThe user Profile are:\t\t"..UserInfo[arg].PROFILE.."\r\n"
      msg = msg .."\t\tUser are Seen:\t\t"..UserInfo[arg].Seen.."\r\n"
      msg = msg .."\t\tUserInfo :\t\t"..UserInfo[arg].MYINFO.."\r\n"
      msg = msg .."\r\n"
   user:SendPM(Bot, msg)
   end
end

-- Log Users Info --
function LogInfo(user)
--	LoadFromFile(sOffline)
   UserInfo[user.sName] = {["IP"]=user.sIP,["PROFILE"]=user.iProfile,["MYINFO"]=user.sMyInfoString,["Seen"]=date("%m/%d/%y"),}
   SaveToFile(sOffline, UserInfo , "UserInfo")
	return 1
end

-- Serialize --
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"); -- THE BUG WAS IN HERE
		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.."}\r\n"
	return sTmp
end

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

function LoadFromFile(file)	
		readfrom(file)
		dostring(read("*all"))
		readfrom()
end
it work's as a stanalone..so please help me 2 fix it
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

SMF spam blocked by CleanTalk