offline messege
 

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

offline messege

Started by dragos_sto, 22 September, 2006, 01:48:11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dragos_sto

it a old script convert to lua 5.1


P.S. it working , but can be make improvements

zvamp

#1
Really nice script!!

Please translate the sentences into english =)

dragos_sto

sorry i neglected
i whil translate and modify the first post :D

Zeel

Can you post the full script here on the thread?  I download it from you but when i open it, it is all scrambled up and not organized at all.  Thanks!

dodgeviper

hey what language is it???translate this man

Josecar

The messages are in romanian.
The script is good, simple and effective.
The messages are very simple. I can translate that if there is somebody interested yet.

Greetings.
Josecar

dragos_sto

Quote from: Zeel on 11 October, 2006, 21:07:06
Can you post the full script here on the thread?  I download it from you but when i open it, it is all scrambled up and not organized at all.  Thanks!

i use to edit lua files
whit blua or notepad++
when open whit notepad from microsoft you have right i look to be scrambled but it not :)

sorry for answer soo late
modify first post and add english version and i whil post he script hear

Code: lua
-- offlinemsg.lua, created by amutex 11.01.2003
-- thx to nathanos for the fine pm-parsing
-- bits and pieces added and deleted by bolamix over time, kudos to all scripters who helped!
-- attempted conversion to lua5 by bolamix Feb. 27 2005
-- successful conversion to lua5 by Jelf March 9 2005
-- accept command in main and ,or PM by dragos_sto september 2006
-- usage: send a PM to the bot with <command> <username> <message>
-- or main chat <command> <username> <message>
-- for englise uncomment the line whit --en in tale and comment the file whit --ro

path = "messages" -- name of the folder where the message files will be stored
ext = ".msg" -- extension for the message files
command = "+note"
tipe = 2 -- 0 accept command in main ; 1 accept command in PM ; 2 accept command in both
botname = frmHub:GetHubBotName() -- or use whatever botname you want then uncomment the following 3 lines
--function main
-- 	frmHub:RegBot( botname )#Offline_Message
--end

os.execute("mkdir ".."\""..string.gsub(path, "/", "\\").."\"")

function ToArrival(user, data)
	if (tipe == 1) or (tipe == 2) then
		local _,_,whoTo = string.find(data,"$To:%s+(%S+)")
		if (whoTo == botname) then
		local _,_,_,_,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
			if (string.lower(cmd) == string.lower(command)) then
				local _,_,_,_,_,arg,arg2 = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s+(.*)")
				if arg then
					arg = string.lower(arg)
					if arg2 == "" or arg2 == nil then
						arg2 = "Te saluta "..arg..", dar a uitat sa scrie un mesaj" --ro
--						arg2 = "It Say Hy "..arg..", but forget to writw the message" --en
					end
					if GetItemByName(arg) == nil then 
						local f,_ = io.open(path.."/"..arg..ext,"a+")
						if f then
							f:write(""..user.sName.." tia trimis acest mesaj la ora "..GetDate().." in data de "..GetTime().." : "..arg2.." bkspck") --ro
--							f:write(""..user.sName.." It send you this message at "..GetDate().." hour and in this date "..GetTime().." : "..arg2.." bkspck") --en
							user:SendPM(botname,"Mesaj Stocat."..arg2.." Va fi trimis lui "..arg.." cu prima ocazie cand va fi vazut pe aici.") --ro
--							user:SendPM(botname,"Message save."..arg2.." Whil be sent to "..arg.." first time when join the hub.") --en
							f:close()
						end
					else
						user:SendPM(botname," Mesajul Nu a fost Trimis. Userul "..arg.." este online.") --ro
--						user:SendPM(botname," The message whos not sent. User "..arg.." it online.") --en
					end
				else 
					user:SendPM(botname,"Ai uitat sa specifici un Nick si Mesaj") --ro
--					user:SendPM(botname,"You forget to write the nick and the message") --en
				end
				return 1
			end
		end
	end
end

function ChatArrival(user, data)
	if (tipe == 0) or (tipe == 2) then
		if (string.sub(data,1,1) == "<") then 
		local data1=string.sub(data,1,string.len(data)-1) 
		local _,_,cmd = string.find(data1,"%b<>%s+(%S+)")
			if (string.lower(cmd) == string.lower(command)) then
				local _,_,_,arg,arg2 = string.find(data1,"%b<>%s+(%S+)%s+(%S+)%s+(.*)")
				if arg then
					arg = string.lower(arg)
					if arg2 == "" or arg2 == nil then
						arg2 = "Te salut "..arg..", dar am uitat sa scrie un mesaj" --ro
--						arg2 = "It Say Hy "..arg..", but forget to writw the message" --en
					end
					if GetItemByName(arg) == nil then 
						local f,e = io.open(path.."/"..arg..ext,"a+")
						if f then
							f:write(""..user.sName.." tia trimis acest mesaj in data de "..GetDate().." la ora "..GetTime().." : "..arg2.." bkspck") --ro
--							f:write(""..user.sName.." It send you this message at "..GetDate().." hour and in this date "..GetTime().." : "..arg2.." bkspck") --en
							SendToNick(user.sName, "<"..botname.."> Mesaj Stocat. "..arg2.." va fi trimis lui "..arg.." cu prima ocazie cand va fi vazut pe aici.") --ro
--							SendToNick(user.sName, "<"..botname.."> Message save."..arg2.." Whil be sent to "..arg.." first time when join the hub.") --en
							f:close()
						end
					else
						SendToNick(user.sName, "<"..botname.."> Mesajul Nu a fost Trimis. Userul "..arg.." este online.") --ro
--						SendToNick(user.sName, "<"..botname.."> The message whos not sent. User "..arg.." it online.") --en
					end
				else
					SendToNick(user.sName, "<"..botname.."> Ai uitat sa specifici un Nick si Mesaj") --ro
--					SendToNick(user.sName, "<"..botname.."> You forget to write the nick and the message") --en
				end
				return 1
			end
		end
	end
end

function NewUserConnected(curUser)
	local CusNa = string.lower(curUser.sName)
	local handle = io.open(path.."/"..CusNa ..ext,"r")
	if (handle ~= nil) then
		local line = handle:read() 
		line = string.gsub(line, "bkspck", "\r\n")
		SendToNick(curUser.sName, "<"..botname.."> Aveti mesaje offline :\r\n"..line) --ro
--		SendToNick(curUser.sName, "<"..botname.."> You have offline message :\r\n"..line) --en
		curUser:SendPM(botname, "Aveti mesaje offline :\r\n"..line) --ro
--		curUser:SendPM(botname, "You have offline message :\r\n"..line) --en
		handle:close()
	 	os.remove(path.."/"..CusNa..ext)
	else
	end
end

OpConnected = NewUserConnected

function GetTime()
	local Time = os.date("%H")..":"..os.date("%M")
	return Time
end

function GetDate()
	local Date = os.date("%d").." - "..os.date("%B").." - "..os.date("%Y")
	return Date
end

SMF spam blocked by CleanTalk