OpChat++
 

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

OpChat++

Started by jiten, 01 April, 2005, 13:53:24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jiten

--[[

	OpChat++  v.1.1d by jiten (1/7/2006)

	Based on: OpChat++ By nErBoS 

	## Commands: 
	## +invite <nick> -- Invites an user to OpChat
	## +delinvite <nick> -- Removes the user from OpChat
	## +invitelist -- List all OpChat invited users
	## +talklog -- Show all the talking while you were offline

	Changelog:

	Changed: Profile Permissions;
	Added: Optional message to every user invited on Hub Start/Script Restart
	Added: Automatic Folder creating
	Added: add, read and del commands (requested by Krisalys)
	Fixed: Commands handling
	Optimized and removed arrOpLevel table
	Changed the add comand parsing
	Fixed: Hopefully fixed bug with OpConnected/Disconnected function
	Changed: OpChat++'s Bot Name can be set to anything
	Added: Profile permission for each command (12/20/2005)
	Fixed: Bug with command table return (thx to TM)
	Removed: ChatArrival (12/27/2005)
	Added: Option to choose which profiles can read/write in OpChat (1/7/2006)

]]--

Krysalis

Hello,

can u try change it, so only Masters can invite Users.
invitet Users should also be invitet after Hub/Scriptrestart.

And finally, the users should can use

+add [line1] [line2]
+read

+add [line1] [line2] is for adding some like homeFTP Adresses.
(+adds [Whats on it?] [http or ftp Adress]

+read is for invitet Users to take this List.

I hope u can do this.

jiten

QuoteOriginally posted by Krysalis
can u try change it, so only Masters can invite Users.
invitet Users should also be invitet after Hub/Scriptrestart.
I'll check this.
And finally, the users should can use

+add [line1] [line2]
+read

+add [line1] [line2] is for adding some like homeFTP Adresses.
(+adds [Whats on it?] [http or ftp Adress]

+read is for invitet Users to take this List.

Well, this isn't a OpChat++ task.
Seems like a release bot, add and read function. Search the forum for "release bot" and you'll find matches that will suit your needs for this request.

Cheers

jiten

Here you go:
--## OpChat++
--## By nErBoS 
--## Converted to Lua 5 by jiten (english version)
--## Changed: Invite and delinvite to Masters
--## Changed: Message on restart scripts to every invited user
--## Operator Commands: 
--## +invite  -- Invites an user to OpChat
--## +delinvite  -- Removes the user from OpChat
--## +invitelist -- List all OpChat invited users
--## +talklog -- Show all the talking while u were offline-

sOpChat = "sOpChat"

arrInvite = {} arrLog = {} 
fInvite = "logs/invite.dat" 
fLog = "logs/log.dat" 

--## Settings ##-- 

arrOpLevel = { --Put here the profile with operator privileges and its respective level
["Master"] = 0, 
["Operator"] = 1, 
["Moderator"] = 4, 
["NetFounder"] = 5, 
} 

--## FIM ##-- 

function Main() 
	frmHub:RegBot(sOpChat)
	if loadfile(fInvite) then dofile(fInvite) end
	if loadfile(fLog) then dofile(fLog) end Refresh() 
	for usr, aux in arrInvite do 
		if (GetItemByName(usr) ~= nil) then 
			SendToNick(GetItemByName(usr).sName, "$To: "..GetItemByName(usr).sName.." From: "..sOpChat.." $<"..sOpChat.."> You are currently invited to OpChat.") 
		end 
	end
end 

function OnExit() 
	SaveToFile(fInvite , arrInvite , "arrInvite") 
	SaveToFile(fLog , arrLog , "arrLog") 
end 

function OpConnected(user) 
	if (arrLog[user.sName] == nil) then 
		Refresh() 
	elseif (arrLog[user.sName]["Talk"] ~= "") then 
		user:SendPM(sOpChat, "There was chat while you were offline. Type +talklog to read it.") 
	end 
	arrLog[user.sName]["Mode"] = "online" 
end 

function OpDisconnected(user) 
	arrLog[user.sName]["Mode"] = "offline" 
end 

function ChatArrival(user, data) 
	local data = string.sub(data, 1, -2) 
	local s,e,cmd = string.find(data, "%b<>%s+(%S+)") 
	if user.bOperator then
		if (cmd == "+invitelist") then 
			InviteList(user) 
			return 1 
		elseif (cmd == "+talklog") then 
			ShowTalkLog(user) 
			return 1 
		end
	elseif user.iProfile == 0 then
		if (cmd == "+invite") then 
			InviteUser(user, data) 
			return 1 
		elseif (cmd == "+delinvite") then 
			RemoveInvite(user, data) 
			return 1
		end
	end
	local _,_,whoTo = string.find(data,"$To:%s+(%S+)")
	if (whoTo == sOpChat) then
		if (user.bOperator or arrInvite[string.lower(user.sName)] ~= nil) then 
			SendTalkToOps(data) 
			SendTalkToInvited(data)
			return 1
		else 
			user:SendPM(sOpChat, "You can't talk in OpChat.") 
			return 1 
		end 
	end 
end 

ToArrival = ChatArrival

InviteUser = function(user, data) 
	local s,e,nick = string.find(data, "%b<>%s+%S+%s+(%S+)") 
	if (nick == nil) then 
		user:SendPM(sOpChat, "Syntax Error, +invite  . You have to type a nick.") 
	elseif (arrInvite[string.lower(nick)] ~= nil) then 
		user:SendPM(sOpChat, "User "..nick.." has already been invited to OpChat.") 
	else 
		arrInvite[string.lower(nick)] = user.sName 
		user:SendPM(sOpChat, "User "..nick.." was invited to OpChat.") 
		if (GetItemByName(nick) ~= nil) then 
			GetItemByName(nick):SendPM(sOpChat, "You were invited to OpChat by Operator "..user.sName) 
		end 
		SendPmToOps(sOpChat, "User "..nick.." was invited to OpChat by Operator "..user.sName) 
		SaveToFile(fInvite , arrInvite , "arrInvite") 
	end 
end 

RemoveInvite = function(user, data) 
	local s,e,nick = string.find(data, "%b<>%s+%S+%s+(%S+)") 
	if (nick == nil) then 
		user:SendPM(sOpChat, "Syntax Error, +delinvite  . You have to type a nick.") 
	elseif (arrInvite[string.lower(nick)] == nil) then 
		user:SendPM(sOpChat, "User "..nick.." wasn't invited to OpChat.") 
	else 
		arrInvite[string.lower(nick)] = nil 
		user:SendPM(sOpChat, "User "..nick.." is no longer invited to OpChat.") 
		if (GetItemByName(nick) ~= nil) then 
			GetItemByName(nick):SendPM(sOpChat, "The invitation to OpChat was removed by Operator "..user.sName) 
		end 
		SendPmToOps(sOpChat, ""..nick.." 's invitation to OpChat was removed by Operator "..user.sName) 
		SaveToFile(fInvite , arrInvite , "arrInvite") 
	end 
end 

InviteList = function(user) 
	local sTmp,op,usr = "List of Users invited to OpChat:\r\n\r\n" 
	for usr, op in arrInvite do 
		sTmp = sTmp.."User: "..usr.."\tInvited by: "..op.."\r\n" 
	end 
	user:SendPM(sOpChat, sTmp) 
end 

SendTalkToOps = function(data) 
	local s,e,from,talk = string.find(data, "$To:%s+%S+%s+From:%s+(%S+)%s+$%b<>%s+(.+)") 
	local aux,profile,usr 
	if (from ~= nil and talk ~= nil) then 
		SaveToLog(from, talk) 
		for aux, profile in GetProfiles() do 
			for aux, usr in GetUsersByProfile(profile) do 
				if (GetItemByName(usr) ~= nil and GetItemByName(usr).bOperator and GetItemByName(usr).sName ~= from) then 
					SendToNick(GetItemByName(usr).sName, "$To: "..GetItemByName(usr).sName.." From: "..sOpChat.." $<"..from.."> "..talk) 
				end 
			end 
		end 
	end 
end 

SendTalkToInvited = function(data) 
	local s,e,from,talk = string.find(data, "$To:%s+%S+%s+From:%s+(%S+)%s+$%b<>%s+(.+)") 
	local aux,usr 
	if (from ~= nil and talk ~= nil) then 
		for usr, aux in arrInvite do 
			if (GetItemByName(usr) ~= nil and GetItemByName(usr).sName ~= from) then 
				SendToNick(GetItemByName(usr).sName, "$To: "..GetItemByName(usr).sName.." From: "..sOpChat.." $<"..from.."> "..talk) 
			end 
		end 
	end 
end 

Refresh = function() 
	local aux,aux2,usr,profile 
	for profile, aux in arrOpLevel do 
		for aux2, usr in GetUsersByProfile(profile) do 
			if (arrLog[usr] == nil) then 
				arrLog[usr] = {} 
				if (GetItemByName(usr) == nil) then 
					arrLog[usr]["Mode"] = "offline" 
				else 
					arrLog[usr]["Mode"] = "online" 
				end 
					arrLog[usr]["Talk"] = "" 
			elseif (GetItemByName(usr) == nil) then		
				arrLog[usr]["Mode"] = "offline" 
			else 
				arrLog[usr]["Mode"] = "online" 
			end 
		end 
	end 
	SaveToFile(fLog , arrLog , "arrLog") 
end 

SaveToLog = function(from, talk) 
	local usr,aux 
	for usr, aux in arrLog do 
		if (arrLog[usr]["Mode"] == "offline") then 
			arrLog[usr]["Talk"] = arrLog[usr]["Talk"].."<"..from.."> "..talk.."\r\n" 
		end 
	end 
	SaveToFile(fLog , arrLog , "arrLog") 
end 

ShowTalkLog = function(user) 
	if (arrLog[user.sName]["Talk"] == "") then 
		user:SendPM(sOpChat, "There aren't any chat logs for you to see. You were always online.") 
	else 
		user:SendPM(sOpChat, "Chat while you were offline:\r\n\r\n"..arrLog[user.sName]["Talk"]) 
		user:SendPM(sOpChat, "The chat logs were cleaned.") 
		arrLog[user.sName]["Talk"] = "" 
		SaveToFile(fLog , arrLog , "arrLog") 
	end 
end 

Serialize = function(tTable,sTableName,hFile,sTab)
	sTab = sTab or "";
	hFile:write(sTab..sTableName.." = {\n");
	for key,value in tTable do
		if (type(value) ~= "function") then
			local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
			if(type(value) == "table") then
				Serialize(value,sKey,hFile,sTab.."\t");
			else
				local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
				hFile:write(sTab.."\t"..sKey.." = "..sValue);
			end
			hFile:write(",\n");
		end
	end
	hFile:write(sTab.."}");
end

SaveToFile = function(file,table,tablename)
	local hFile = io.open(file,"w+") Serialize(table,tablename,hFile); hFile:close() 
end

Krysalis

And finally, the users should can use

+add [line1] [line2]
+read

+add [line1] [line2] is for adding some like homeFTP Adresses.
(+adds [Whats on it?] [http or ftp Adress]

+read is for invitet Users to take this List.


This only i miss now;-)
And i don?t need a release bot. What i need is a extra chat where i can insert FTP Adresses and HTTP Adresses into a .txt List. And finally, invitet Users should can read this txt-file with +read everytime.
Not invitete User should see absolutely nothing, even they are OPs.
I hope u understand my thinking.

Thanks for your time and work, jiiten, i hope you can do this ;-)

Gruss

jiten

QuoteOriginally posted by Krysalis
And finally, the users should can use

+add [line1] [line2]
+read

+add [line1] [line2] is for adding some like homeFTP Adresses.
(+adds [Whats on it?] [http or ftp Adress]

+read is for invitet Users to take this List.


This only i miss now;-)
And i don?t need a release bot. What i need is a extra chat where i can insert FTP Adresses and HTTP Adresses into a .txt List. And finally, invitet Users should can read this txt-file with +read everytime.
Not invitete User should see absolutely nothing, even they are OPs.
I hope u understand my thinking.

Thanks for your time and work, jiiten, i hope you can do this ;-)

Gruss
Seems like Chatrooms by tezlo with some extra functions.
I'll see what I can do about it.

Best regards

Krysalis

I have used Tezlos Chatscript long time now, this where perfect with my needet Modifications:

Exactly i Need following CMDs

For Master:

+invite user
+deinvite User
+add NAME ADRESS (Entry will save in txt]
+delete NAME (delete entry from txt)
+read (read txt)
+Users (show invitet Users with Online/offline Status)

For all other Users:

+add NAME ADRESS
+read
+users

Invitet Users should be stay invitet  even the Hub or Script restarts
And no funktion by typing anything in PM to non invitet Users. ( But a editable Message to them would be great )

The List should appear like This
Nr 1
-[NAME1]
-[ADRESS1]
-Eingetragen von: [Username] am [Date] um [time]

Nr 2
-[NAME2]
-[ADRESS2]
-Eingetragen von: [Username] am [Date] um [time]

Maybe you can do the +delete command using the Number of the saved entry. +delete 1 and so on.

So, thats all i think and i hope, u know now what i mean ;-)
Its difficult, i think, but i look for this for a very long time.
It would be great if you can help me out ;-)

Best Regards

Krysalis

--## +talklog -- Show all the talking while u were offline-


maybe this funktion too...its nice ;-)

GrinSlaW

hello jiten  :))

why can't i change the bot name ? when i do it will not apear i user list  ?(  is it a bug or i just can't change the name ?

cheers  8)
.:: AcExtreme ::. | .:: AcPro ::.

jiten

QuoteOriginally posted by GrinSlaW
hello jiten  :))

why can't i change the bot name ? when i do it will not apear i user list  ?(  is it a bug or i just can't change the name ?

cheers  8)
Well, if you renamed the bot to "OpChat", the script will be working fine, but, the botname won't be visible to the non-operators as, that's its default setting, (although the invited users are able to talk). But, with the new PtokaX build there'll be a "small checkbox for profile, to allow opchat".

Best regards

Krysalis

#10
Jit?n, are you trying with tezlos Script?

Greets

jiten

QuoteOriginally posted by Krysalis
Jit?n, are you trying with tezlos Script?

Greets
Not yet, need to get some free time (that lacks lately), but, it's on my todo list ;)

Cheers

jiten

#12
Here you go:
--/ Lua 5 version 1.1 by jiten
-- Changed: Profile Permissions;
-- Added: Optional message to every user invited on Hub Start/Script Restart
-- Added: Automatic Folder creating

--## OpChat++ By nErBoS 
--## Commands: 
--## +invite  -- Invites an user to OpChat
--## +delinvite  -- Removes the user from OpChat
--## +invitelist -- List all OpChat invited users
--## +talklog -- Show all the talking while you were offline

--## Settings ##-- 
sOpChat = "sOpChat"					-- OpChat Bot Name (Set it to everything but "OpChat")
sFolder = "Logs"					-- Folder where the .tbl files are stord
fInvite = "Invite.tbl"					-- File where the invited users are stored
fLog = "Log.tbl"					-- File where the chat logs are stored
sendCustom = 0						-- 1 = Custom Message to invited user on Hub/Script Restart; 0 = Not
customMsg = "You are currently invited to OpChat"	-- Message sent to them
arrOpLevel = {						-- Put here the profile with operator privileges and its respective level
	["Master"] = 0,
	["Operator"] = 1,
} 
--## END ##--

arrInvite = {} arrLog = {} 

Main = function() 
	frmHub:RegBot(sOpChat)
	if loadfile(fInvite) then dofile(fInvite) else os.execute("mkdir "..sFolder) end
	if loadfile(fLog) then dofile(fLog) end Refresh() 
	if sendCustom == 1 then
		for usr, aux in arrInvite do 
			if (GetItemByName(usr) ~= nil) then 
				SendToNick(GetItemByName(usr).sName, "$To: "..GetItemByName(usr).sName.." From: "..sOpChat.." $<"..sOpChat.."> "..customMsg..".") 
			end 
		end
	end
end 

OnExit = function() 
	SaveToFile(sFolder.."/"..fInvite , arrInvite , "arrInvite") 
	SaveToFile(sFolder.."/"..fLog , arrLog , "arrLog") 
end 

OpConnected = function(user) 
	if (arrLog[user.sName] == nil) then 
		Refresh() 
	elseif (arrLog[user.sName]["Talk"] ~= "") then 
		user:SendPM(sOpChat, "There was chat while you were offline. Type +talklog to read it.") 
	end 
	arrLog[user.sName]["Mode"] = "online" 
end 

OpDisconnected = function(user) 
	arrLog[user.sName]["Mode"] = "offline" 
end 

ChatArrival = function(user, data) 
	local data = string.sub(data, 1, -2) 
	local s,e,cmd = string.find(data,"%b<>%s+[%!%?%+%#](%S+)")
	if (string.sub(data,1,1) == "<") or (string.sub(data,1,5+string.len(sOpChat)) == "$To: "..sOpChat) then
		if cmd then
			local tCmds = {
			["invitelist"] =	function(user)
							local sTmp,op,usr = "List of Users invited to OpChat:\r\n\r\n" 
							for usr, op in arrInvite do 
								sTmp = sTmp.."User: "..usr.."\tInvited by: "..op.."\r\n" 
							end 
							user:SendPM(sOpChat, sTmp) 
						end,
			["talklog"] =		function(user)
							if user.bOperator then
								if (arrLog[user.sName]["Talk"] == "") then 
									user:SendPM(sOpChat, "There aren't any chat logs for you to see. You were always online.") 
								else 
									user:SendPM(sOpChat, "Chat while you were offline:\r\n\r\n"..arrLog[user.sName]["Talk"]) 
									user:SendPM(sOpChat, "The chat logs were cleaned.") 
									arrLog[user.sName]["Talk"] = "" 
									SaveToFile(sFolder.."/"..fLog , arrLog , "arrLog") 
								end 
							end
						end,
			["invite"] =		function(user,data)
							if user.iProfile == 0 then
								local s,e,nick = string.find(data, "%b<>%s+%S+%s+(%S+)") 
								if (nick == nil) then 
									user:SendPM(sOpChat, "Syntax Error, +invite  . You have to type a nick.") 
								elseif (arrInvite[string.lower(nick)] ~= nil) then 
									user:SendPM(sOpChat, "User "..nick.." has already been invited to OpChat.") 
								else 
									arrInvite[string.lower(nick)] = user.sName 
									user:SendPM(sOpChat, "User "..nick.." was invited to OpChat.") 
									if (GetItemByName(nick) ~= nil) then 
										GetItemByName(nick):SendPM(sOpChat, "You were invited to OpChat by Operator "..user.sName) 
									end 
									SendPmToOps(sOpChat, "User "..nick.." was invited to OpChat by Operator "..user.sName) 
									SaveToFile(sFolder.."/"..fInvite , arrInvite , "arrInvite") 
								end 
							else
								user:SendData(frmHub:GetHubBotName(),"*** Error: You are not allowed to use this command.")
							end
						end,
			["delinvite"] =		function(user,data)
							if user.iProfile == 0 then
								local s,e,nick = string.find(data, "%b<>%s+%S+%s+(%S+)") 
								if (nick == nil) then 
									user:SendPM(sOpChat, "Syntax Error, +delinvite  . You have to type a nick.") 
								elseif (arrInvite[string.lower(nick)] == nil) then 
									user:SendPM(sOpChat, "User "..nick.." wasn't invited to OpChat.") 
								else 
									arrInvite[string.lower(nick)] = nil 
									user:SendPM(sOpChat, "User "..nick.." is no longer invited to OpChat.") 
									if (GetItemByName(nick) ~= nil) then 
										GetItemByName(nick):SendPM(sOpChat, "The invitation to OpChat was removed by Operator "..user.sName) 
									end 
									SendPmToOps(sOpChat, ""..nick.." 's invitation to OpChat was removed by Operator "..user.sName) 
									SaveToFile(sFolder.."/"..fInvite , arrInvite , "arrInvite") 
								end 
							else
								user:SendData(frmHub:GetHubBotName(),"*** Error: You are not allowed to use this command.")
							end
						end,
			}
			if tCmds[cmd] then return tCmds[cmd](user,data),1 end
		end
	end
	local _,_,whoTo = string.find(data,"$To:%s+(%S+)")
	if (whoTo == sOpChat) then
		if (user.bOperator or arrInvite[string.lower(user.sName)] ~= nil) then 
			SendTalkToOps(data) 
			SendTalkToInvited(data)
			return 1
		else 
			user:SendPM(sOpChat, "You can't talk in OpChat.") 
			return 1 
		end 
	end 
end

ToArrival = ChatArrival

SendTalkToOps = function(data) 
	local s,e,from,talk = string.find(data, "$To:%s+%S+%s+From:%s+(%S+)%s+$%b<>%s+(.+)") 
	local aux,profile,usr 
	if (from ~= nil and talk ~= nil) then 
		SaveToLog(from, talk) 
		for aux, profile in GetProfiles() do 
			for aux, usr in GetUsersByProfile(profile) do 
				if (GetItemByName(usr) ~= nil and GetItemByName(usr).bOperator and GetItemByName(usr).sName ~= from) then 
					SendToNick(GetItemByName(usr).sName, "$To: "..GetItemByName(usr).sName.." From: "..sOpChat.." $<"..from.."> "..talk) 
				end 
			end 
		end 
	end 
end 

SendTalkToInvited = function(data) 
	local s,e,from,talk = string.find(data, "$To:%s+%S+%s+From:%s+(%S+)%s+$%b<>%s+(.+)") 
	local aux,usr 
	if (from ~= nil and talk ~= nil) then 
		for usr, aux in arrInvite do 
			if (GetItemByName(usr) ~= nil and GetItemByName(usr).sName ~= from) then 
				SendToNick(GetItemByName(usr).sName, "$To: "..GetItemByName(usr).sName.." From: "..sOpChat.." $<"..from.."> "..talk) 
			end 
		end 
	end 
end 

Refresh = function() 
	local aux,aux2,usr,profile 
	for profile, aux in arrOpLevel do 
		for aux2, usr in GetUsersByProfile(profile) do 
			if (arrLog[usr] == nil) then 
				arrLog[usr] = {} 
				if (GetItemByName(usr) == nil) then 
					arrLog[usr]["Mode"] = "offline" 
				else 
					arrLog[usr]["Mode"] = "online" 
				end 
				arrLog[usr]["Talk"] = "" 
			elseif (GetItemByName(usr) == nil) then		
				arrLog[usr]["Mode"] = "offline" 
			else 
				arrLog[usr]["Mode"] = "online" 
			end 
		end 
	end 
	SaveToFile(sFolder.."/"..fLog , arrLog , "arrLog") 
end 

SaveToLog = function(from, talk) 
	local usr,aux 
	for usr, aux in arrLog do 
		if (arrLog[usr]["Mode"] == "offline") then 
			arrLog[usr]["Talk"] = arrLog[usr]["Talk"].."<"..from.."> "..talk.."\r\n" 
		end 
	end 
	SaveToFile(sFolder.."/"..fLog , arrLog , "arrLog") 
end 

Serialize = function(tTable,sTableName,hFile,sTab)
	sTab = sTab or "";
	hFile:write(sTab..sTableName.." = {\n");
	for key,value in tTable do
		if (type(value) ~= "function") then
			local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
			if(type(value) == "table") then
				Serialize(value,sKey,hFile,sTab.."\t");
			else
				local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
				hFile:write(sTab.."\t"..sKey.." = "..sValue);
			end
			hFile:write(",\n");
		end
	end
	hFile:write(sTab.."}");
end

SaveToFile = function(file,table,tablename)
	local hFile = io.open(file,"w+") Serialize(table,tablename,hFile); hFile:close() 
end

Best regards

Krysalis

Well, looks great. I will test it today afternoon ;-)

gemini

i have this error
Syntax ...m\Desktop\0.3.3.0.b17.08.nt.dbg\scripts\OpChat++.lua:61: attempt to index field `?' (a nil value)
what is error?
I await a your reply. cordial greetings
thanks

jiten

QuoteOriginally posted by gemini
i have this error
Syntax ...m\Desktop\0.3.3.0.b17.08.nt.dbg\scripts\OpChat++.lua:61: attempt to index field `?' (a nil value)
what is error?
I await a your reply. cordial greetings
thanks
Can you tell me when does this happen?
I can't reproduce the error here.

Best regards

gemini

I start the script works immediately and after about 3 seconds the mistake happens
thanks bye

jiten

QuoteOriginally posted by gemini
I start the script works immediately and after about 3 seconds the mistake happens
thanks bye
I tested everything here and didn't get any error. It's working fine.
Did you change something in the script? The Levels table?

Cheers

Krysalis

I love it.
Everythings seem to work correctly.

I received a Syntax Error, but Script ean as usual.

Syntax C:\Programme\Ptokax\scripts\MysteryHeaven.lua:240: attempt to index local `hFile' (a nil value)


Its normal?

jiten

QuoteOriginally posted by Krysalis
I received a Syntax Error, but Script ean as usual.

Syntax C:\Programme\Ptokax\scripts\MysteryHeaven.lua:240: attempt to index local `hFile' (a nil value)


Its normal?
No, that's not normal. What did you change in the script?

Cheers

Krysalis

I received this Error from beginning, before i made any changes.

After this, i made some Language Translations. But the Error was there before.
The Script runs good, i will use in this Form.
I thought u know what its mean ;-)

Many Many Thanx for this good work ;-)

Dessamator

hmm, i see an error here :

Serialize = function(tTable,sTableName,hFile,sTab)


SaveToFile(fLog , arrLog , "arrLog")
 

there seems to be an extra value in the serialize function, although it shouldnt really cause those errors , anyways serialize should be something like this :

Serialize = function(tTable,sTableName,hFile)
Ignorance is Bliss.

jiten

First post updated with a fix.

Cheers

Krysalis

-- If you're using Robocop profiles don't change this. If not, remove Profile 4 and 5 and follow this syntax:
-- [Profile number] = value (higher value means more rights)
Levels = { [-1] = 1, [3] = 2, [2] = 3, [1] = 4, [4] = 5, [0] = 6, [5] = 7, }



Jiten, can you maybe explain me this part? I dont have Robocop Profiles....what exactly i have to change.....and for what? ^^    

Thanks in Advance

jiten

QuoteOriginally posted by Krysalis
-- If you're using Robocop profiles don't change this. If not, remove Profile 4 and 5 and follow this syntax:
-- [Profile number] = value (higher value means more rights)
Levels = { [-1] = 1, [3] = 2, [2] = 3, [1] = 4, [4] = 5, [0] = 6, [5] = 7, }



Jiten, can you maybe explain me this part? I dont have Robocop Profiles....what exactly i have to change.....and for what? ^^    

Thanks in Advance
Change your Levels table to this then:
-- If you're using Robocop profiles don't change this. If not, remove Profile 4 and 5 and follow this syntax: 
-- [Profile number] = value (higher value means more rights) 
Levels = { 
[-1] = 1,	-- Unreg
[3] = 2,	-- Reg
[2] = 3,	-- VIP
[1] = 4,	-- Operator
[0] = 5,	-- Master
}
As you can see in the table, it gives more rights to higher profiles by assigning a higher value (the one in the right). So, a lower Profile means lower rights.
After changing this you'll have to change the values in the Commands table. Something like this:
["talklog"] =	{ 
				function(user,data)
					if (arrLog[user.sName]["Talk"] == "") then 
						user:SendPM(sOpChat, "There aren't any chat logs for you to see. You were always online.") 
					else 
						user:SendPM(sOpChat, "Chat while you were offline:\r\n\r\n"..arrLog[user.sName]["Talk"]) 
						user:SendPM(sOpChat, "The chat logs were cleaned.") 
						arrLog[user.sName]["Talk"] = "" 
						SaveToFile(fLog , arrLog , "arrLog") 
					end 
				end, [COLOR=red]4[/COLOR], },
The number in red is based on the Levels table. So, with this function, only profiles equal or higher than Operators can use it.
Hope this helps.

Cheers

SMF spam blocked by CleanTalk