--[[
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)
]]--
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.
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
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
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
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
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
--## +talklog -- Show all the talking while u were offline-
maybe this funktion too...its nice ;-)
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)
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
Jit?n, are you trying with tezlos Script?
Greets
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
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
Well, looks great. I will test it today afternoon ;-)
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
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
I start the script works immediately and after about 3 seconds the mistake happens
thanks bye
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
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?
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
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 ;-)
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)
First post updated with a fix.
Cheers
-- 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,
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
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,
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
I understand ;-) Thanx
If i invite a reguser, and he is typing in pm to bot, i cant read what he?s wrote...how can i fix this?
I think this would be last ;-)
QuoteOriginally posted by Krysalis
I understand ;-) Thanx
If i invite a reguser, and he is typing in pm to bot, i cant read what he?s wrote...how can i fix this?
I think this would be last ;-)
Well, just don't set "sOpchat = "OpChat"" and it should work.
If not, copy the script all over again, delete all old .tbl files and run it.
Best regards,
jiten
Changed only this:
sOpChat = "Mystery"
sBot = frmHub:GetHubBotName()
isnt correct?
Syntax ...tor\Desktop\0.3.3.0.b17.05.nt.rls\scripts\heaven.lua:169: attempt to compare number with nil
Syntax ...tor\Desktop\0.3.3.0.b17.05.nt.rls\scripts\heaven.lua:270: attempt to index local `handle' (a nil value)
I have those 2 Syntax errors.
Edit: Commands are acceptet in Main, in PM an in every other PM. Can u fix it, so only cmds in pm to bot are acceptet?
Going to test it tomorrow thoroughly to find the bug with the handle.
Btw, the first error is related to Levels table. You had to change the red values in the other commands. Anyway, I'll post the debugged version tomorrow (compatible with the normal profiles).
Best regards,
jiten
-
-
Master
11111111111111111111111111111111
-
Operator
11111100011001111111111111111000
-
S-Operator
11111111111111111111111111111111
-
Moderator
10000000000000000000000000000000
-
S-VIP
10000000000000000000000000000000
-
VIP
10000000000000000000000000000000
-
SUser
10000000000000000000000000000000
-
DUser
10000000000000000000000000000000
-
Stammie
10000000000000000000000000000000
-
User
10000000000000000000000000000000
-
Anw?rter
10000000000000000000000000000000
this is my profile xml.
where i find the Profile Numbers ?
i think:
-- [Profile number] = value (higher value means more rights)
Levels = {
[-1] = 1,
[10] = 1,
[9] = 1,
[8] = 1,
[7] = 1,
[6] = 1,
[5] = 1,
[4] = 1,
[3] = 1,
[2] = 1,
[1] = 1,
}
even with this settings i see nothing anything invitet users typing
btw, red nr is always set to 1
First post updated with a debugged version (hopefully).
Cheers
Thx for ur fast fix. i?ll try today evening ;-)
QuoteOriginally posted by Krysalis
Thx for ur fast fix. i?ll try today evening ;-)
Hoping to hear from you if it's working well, so that I can post the Release part.
Best regards
still testing at the moment, master :)
First little thing.
I cant change Botname anymore. If i do, the bot doesnt appear in the userlist.
Can u tell me what i have to do to change?
Greets
QuoteOriginally posted by Krysalis
First little thing.
I cant change Botname anymore. If i do, the bot doesnt appear in the userlist.
Can u tell me what i have to do to change?
Greets
Well, if you change the Botname to "OpChat" (default one) it will disappear for non-operators as it's its default setting. That's why you can use every nick except "OpChat".
But, with the new PtokaX build there'll be a "small checkbox for profile, to allow opchat" (so it will be visible to whom you choose).
Best regards
QuoteOriginally posted by jiten
there'll be a "small checkbox for profile, to allow opchat"
dont find it....
QuoteOriginally posted by Krysalis
QuoteOriginally posted by jiten
there'll be a "small checkbox for profile, to allow opchat"
dont find it....
It hasn't been released yet, so, till then, better use a botname different than "OpChat".
Something like "Mistery", "sOpChat", etc...
Apart from that, is the script working OK? I mean, no errors...
say to in ten minutes, but semms trouble again
:(
invitet users cant see what anyone wrote in pm to bot...
same as yesterday
QuoteOriginally posted by Krysalis
invitet users cant see what anyone wrote in pm to bot...
same as yesterday
I've tested the script a lot of times here and everything is working fine.
Can you tell me what PtokaX version are you using, your default Bot Name for OpChat in PtokaX's GUI and what did you change in the script? It'd help me help you.
Cheers
build 1705
!???SchattenReich?
no changes yet on script ( would not do the work for nothing again ;)
Would u connect and see while running?
hellgate.no-ip.info:8679
Its a temp test hub
QuoteOriginally posted by Krysalis
build 1705
!???SchattenReich?
no changes yet on script ( would not do the work for nothing again ;)
Would u connect and see while running?
hellgate.no-ip.info:8679
Its a temp test hub
First post updated with the debugged version.
The problem was that you didn't create the "logs" folder. That's why all this happened.
Now, just copy the script again and test it. It should work fine.
Best regards
wait
+read amd +add are not in the script by your last edit?
QuoteOriginally posted by 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
i tried to change the bot name to this [CHAT]OP and when i do it will not work it only work if i have OpChat as bot name it will work. well it work but it will not apear in user list when i enter as a op
hehe do you understand what i mean ? :rolleyes:
Your last Edit seems to work fine. If u input +read +add and +del again, i think its finished;)
Did that purposely because I wanted to check if the OpChat script was ok.
Best regards,
jiten
Now i miss the other CMDs (Invite, deinvite, invitelist, talklog)
Why removed this? And can u put in again? I need this function really. ( only master should can invite/deinvite, other cmds for all invitet)
Best Regards
QuoteOriginally posted by Krysalis
Now i miss the other CMDs (Invite, deinvite, invitelist, talklog)
Why removed this? And can u put in again? I need this function really
Best Regards
I didn't remove those functions.
My last post has the stand-alone bot with the add, del and read function you requested.
The OpChat bot is still there. Check the first page of this thread. I just splitted them.
Cheers
hmmm....I didnt request a Releasebot. I requestet as it was before u split. With all funktions, because i need this all in this one.
The Releasebot now is not interesting for me, and same with the op script from Page 1. I need a script that can both.
I dont want anyone release, i want a extra chat for some special users and some of my vips/Ops/sus.
Whre i (Master) can invite and deinvite people and del entrys per +del.
invitet users should can use the cmds (read add invitelist and talklog)....
Maybe its my english... :rolleyes:
Greetings
understand what i mean, jiten?
That script I posted before is a Release bot based one and the only thing that differs are the messages. Anyway, here goes one:
--/ Lua 5 version 1.1a by jiten
-- 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
--## 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")
sBot = frmHub:GetHubBotName() -- Bot Name
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
fRelease = "Releases.tbl" -- File where the Address File is 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
--## END ##--
arrInvite = {} arrLog = {} Releases = {}
Main = function()
frmHub:RegBot(sOpChat)
if loadfile(sFolder.."/"..fInvite) then dofile(sFolder.."/"..fInvite) else os.execute("mkdir "..sFolder) end
if loadfile(sFolder.."/"..fLog) then dofile(sFolder.."/"..fLog) end Refresh() if loadfile(sFolder.."/"..fRelease) then dofile(sFolder.."/"..fRelease) end
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 (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,
["add"] = function(user,data)
local s,e,rel,desc = string.find(data, "%b<>%s+%S+%s+(.*)%s+(ftp+.*)")
if rel == nil or desc == nil then
user:SendData(sBot,"*** Error: Type +add ")
else
table.insert( Releases, { user.sName, rel, desc, os.date(), } )
SaveToFile(sFolder.."/"..fRelease,Releases,"Releases")
SendToAll(sBot, user.sName.." added a new Address: "..rel..". For more details type: +read")
end
end,
["read"] = function(user,data)
local msg, Exists = "", nil
for i = 1, table.getn(Releases) do
if Releases[i] then
msg = msg.."\r\n\tNumber "..i..".\r\n\t["..Releases[i][2].."]\r\n\t["..Releases[i][3].."]\r\n\tPosted by: "..Releases[i][1].." on "..Releases[i][4].."\r\n" Exists = 1
end
end
if Exists == nil then
user:SendData(sBot,"*** Error: The Address list is empty.")
else
user:SendPM(sBot,msg)
end
end,
}
local mCmds = {
["invite"] = 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(sFolder.."/"..fInvite , arrInvite , "arrInvite")
end
end,
["delinvite"] = 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(sFolder.."/"..fInvite , arrInvite , "arrInvite")
end
end,
["del"] = function(user,data)
local s,e,i = string.find(data,"%b<>%s+%S+%s+(%S+)")
if i then
if Releases[tonumber(i)] then
table.remove(Releases,i)
SaveToFile(sFolder.."/"..fRelease,Releases,"Releases")
user:SendData(sBot,"Address "..i..". was deleted succesfully!")
else
user:SendData(sBot,"*** Error: There is no Address "..i..".")
end
else
user:SendData(sBot,"*** Error: Type +del ")
end
end,
}
if tCmds[cmd] then
if user.bOperator or arrInvite[string.lower(user.sName)] then
return tCmds[cmd](user,data),1
else
return user:SendData(sBot,"*** Error: You are not allowed to use this command."),1
end
elseif mCmds[cmd] then
if user.iProfile == 0 then
return mCmds[cmd](user,data),1
else
return user:SendData(sBot,"*** Error: You are not allowed to use this command."),1
end
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 i,usr
for i,usr in frmHub:GetOperators() do
usr = usr.sNick
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
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
Cheers
Hello jiten :))
the script works just as i wanted very nice work :D
tnx alot for your work :))
cheers
That's what I most like to hear, ups, read :D
Lets see if it's OK with Krysalis too.
Best regards
Same opinion. Seems to work absolutely fine ;-)
Where i have to change that the Result from the +read cmd came in bot pm and not in Hubbot pm?
Thats the last one ;-)
Very good work.
Best regards
PS: Another Change please ;-)
-- Added: add, read and del commands (requested by Krisalys)
into
-- Added: add, read and del commands (requested by Krysalis)
Thats really all *g*
QuoteOriginally posted by Krysalis
Where i have to change that the Result from the +read cmd came in bot pm and not in Hubbot pm?
In this code I'm copying, replace every "sBot" with "sOpChat" and that should do it:
["read"] = function(user,data)
local msg, Exists = "", nil
for i = 1, table.getn(Releases) do
if Releases[i] then
msg = msg.."\r\n\tNumber "..i..".\r\n\t["..Releases[i][2].."]\r\n\t["..Releases[i][3].."]\r\n\tPosted by: "..Releases[i][1].." on "..Releases[i][4].."\r\n" Exists = 1
end
end
if Exists == nil then
user:SendData(sBot,"*** Error: The Address list is empty.")
else
user:SendPM(sBot,msg)
end
end,
Best regards,
jiten
Thx,
if i have changed botname, i have renamed to this, and not in sOPChat, right? If i renamed to "Mystery" i musst replace sbot to Mystery.
Maybe i Find a little Bug. (But can?t testet enough yesterday to say is really one)
I invitet a user and he is typing +read in pm. The CMD works right, but same time "Youre not allowed to use this command" in Mainchat. But all functions work correct.
How i Say, it can be that this was only one time.
and another help need;-)
Where i must change to become this messages also in PM to this bot?;-)
I love your work;-)
Greets
QuoteOriginally posted by Krysalis
if i have changed botname, i have renamed to this, and not in sOPChat, right? If i renamed to "Mystery" i musst replace sbot to Mystery.
and another help need;-)
Where i must change to become this messages also in PM to this bot?;-)
Can you explain in better? I didn't understand it.
QuoteI invitet a user and he is typing +read in pm. The CMD works right, but same time "Youre not allowed to use this command" in Mainchat. But all functions work correct.
Last script updated. Copy it again and guess that's the final one.
Best regards
I tell shit, thats how u don?t understand what i want. Ive thinking 5 more seconds ago and is was clear *g*
Sorry for this;-)
I?ll try your last fix today evening and test it more. Don?t think there where bugs again;-)
Let you know when finished ;-)
i have this error
[13:20] Syntax ...sktop\0.3.3.0.b17.08.nt.dbg \scripts\OpChat++.lua:55: attempt to index field `?' (a nil value)
why?
thanks jiten
thanks
cordial greetings jiten
I'll be waiting for your reports.
gemini, it had to do with the "arrOpLevel" table that probably wasn't well set up with the extra profiles you could have (e.g. Moderator, NetFounder), but, it's nice to know that you sorted it out.
Best regards,
jiten
my profile
netfounder
master
moderator
operator
vip
reg user
user
in zright clicker
SendTo = { --> 1=on/0=off
- = 1, -- Masters
[1] = 1, -- Operators
[2] = 1, -- Vips
[3] = 1, -- Regs
[4] = 1, -- Moderator
[5] = 1, -- NetFounder
arrOpLevel = { --Put here the profile with operator privileges and its respective level
["Master"] = ?,
["Operator"] = ?,
["Moderator"] = ?,
["NetFounder"] = ?,
}
that you number I put on
thanks cordial greetings
gemini, this would be your correct table then:
arrOpLevel = { --Put here the profile with operator privileges and its respective level
["Master"] = 0,
["Operator"] = 1,
["Moderator"] = 4,
["NetFounder"] = 5,
}
Cheers
now return this error
[16:50] Syntax ...m\Desktop\0.3.3.0.b17.08.nt.dbg\scripts\OpChat++.lua:51: attempt to index field `?' (a nil value)
repeat why lol
bye thanks
QuoteOriginally posted by gemini
now return this error
[16:50] Syntax ...m\Desktop\0.3.3.0.b17.08.nt.dbg\scripts\OpChat++.lua:51: attempt to index field `?' (a nil value)
repeat why lol
bye thanks
After replacing your old table with the one I posted a while ago, save the .lua file, restart your scripts and then reconnect. That error will be gone.
Just to be sure, delete all old .tbl files before doing this.
Best regards
QuoteOriginally posted by jiten
QuoteOriginally posted by Krysalis
Where i have to change that the Result from the +read cmd came in bot pm and not in Hubbot pm?
In this code I'm copying, replace every "sBot" with "sOpChat" and that should do it:
["read"] = function(user,data)
local msg, Exists = "", nil
for i = 1, table.getn(Releases) do
if Releases[i] then
msg = msg.."\r\n\tNumber "..i..".\r\n\t["..Releases[i][2].."]\r\n\t["..Releases[i][3].."]\r\n\tPosted by: "..Releases[i][1].." on "..Releases[i][4].."\r\n" Exists = 1
end
end
if Exists == nil then
user:SendData(sBot,"*** Error: The Address list is empty.")
else
user:SendPM(sBot,msg)
end
end,
Best regards,
jiten
changed into, but messages came again in main. i rstartet script. What can it be?
changed also this:
sOpChat = "???Heaven?" -- OpChat Bot Name (Set it to everything but "OpChat")
sBot = "???Heaven?" -- Bot Name
Anyway, script in this form works fine and can be made Final called^^
Many Thanx for your Time jiiten. Will use this 4 long time now ;-)
Greets
QuoteOriginally posted by Krysalis
changed into, but messages came again in main. i rstartet script. What can it be?
changed also this:
sOpChat = "???Heaven?" -- OpChat Bot Name (Set it to everything but "OpChat")
sBot = "???Heaven?" -- Bot Name
How do those messages appear on main?
Something like "Private message from... "?
[23:35] ??Heaven?> aerith hat : xxx eingetragen.
[23:35] ??Heaven?> aerith hat : und eingetragen.
[00:00] ??Heaven?> Address 1. wurde erfolgreich gel?scht!
[00:00] ??Heaven?> *** Error: Dieser Befehl ist dir nicht gestattet.
[00:00] ??Heaven?> Address 2. wurde erfolgreich gel?scht!
[00:00] ??Heaven?> *** Error: Dieser Befehl ist dir nicht gestattet.
[00:01] ??Heaven?> *** Error: Dieser Befehl ist dir nicht gestattet.
[00:01] ??Heaven?> Address 1. wurde erfolgreich gel?scht!
[00:02] ??Heaven?> *** Error: Dieser Befehl ist dir nicht gestattet.
[00:02] ??Heaven?> Address 1. wurde erfolgreich gel?scht!
[00:02] ??Heaven?> *** Error: Nix da.
came into main, not in pm to bot window. But its not a bug, only silly *g*
But find a big Bug for me.
Invitet Users are not automatically invitet after scriptrestart or hubrestart. How can i fix this? This should be integratet in "Final Version" :)
However, this is a "stable" Version right now
Best Regards
Quotecame into main, not in pm to bot window. But its not a bug, only silly *g*
Krysalis, everywhere you find the red selection:
user:[COLOR=red]SendData[/COLOR](sBot,"*** Error: The Address list is empty.")
replace it with the green one:
user:[COLOR=green]SendPM[/COLOR](sBot,"*** Error: The Address list is empty.")
QuoteInvitet Users are not automatically invitet after scriptrestart or hubrestart. How can i fix this? This should be integratet in "Final Version" :)
Just set SendCustom to 1 and it will work then.
Cheers
Great Work, Jiten. Now its Perfekt ;-)
Is it much work to integrate a +help cmd with available cmds in pm? (Maybe read help from text?)
But this i must?nt have, only if ya want;-)
Greets
QuoteOriginally posted by Krysalis
Great Work, Jiten. Now its Perfekt ;-)
Is it much work to integrate a +help cmd with available cmds in pm? (Maybe read help from text?)
But this i must?nt have, only if ya want;-)
Greets
If I had more time, probably I would, but, at the moment, I rather leave it this way ;)
Cheers
EDIT: Found a bug ;-) Invitet users arent invitet after Scriptrestart.
They stay invitet after they disconnect but not if scripts where restartet. Can u fix this?
QuoteOriginally posted by Krysalis
EDIT: Found a bug ;-) Invitet users arent invitet after Scriptrestart.
They stay invitet after they disconnect but not if scripts where restartet. Can u fix this?
Tested it here and nothing like that happened.
Everytime i restart scripts in hubsoft, i have to invitet all again.
Greets
QuoteOriginally posted by Krysalis
Everytime i restart scripts in hubsoft, i have to invitet all again.
Greets
It must be a result of some change you made. Do you have the folder "Logs"?
If it still doesn't work, post your script here so that I can have a look.
Cheers
--/ Lua 5 version 1.1a by jiten
-- Translatet to German by Krysalis
-- 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 Krysalis)
--## 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 = "???Heaven?" -- OpChat Bot Name (Set it to everything but "OpChat")
sBot = "???Heaven?" -- Bot Name
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
fRelease = "logs/Releases.tbl" -- File where the Address File is stored
sendCustom = 1 -- 1 = Custom Message to invited user on Hub/Script Restart; 0 = Not
customMsg = "Du bist Member im Heaven. Enjoy your Stay" -- Message sent to them
arrOpLevel = { -- Put here the profile with operator privileges and its respective level
["Master"] = 0,
}
--## END ##--
arrInvite = {} arrLog = {} Releases = {}
Main = function()
frmHub:RegBot(sOpChat)
if loadfile(fInvite) then dofile(fInvite) end
if loadfile(fLog) then dofile(fLog) end Refresh() if loadfile(fRelease) then dofile(fRelease) end
if sendCustom == 1 then
for usr, aux in arrInvite do
if (GetItemByName(usr) ~= nil) then
SendToNick(GetItemByName(usr).sName, "$To: "..GetItemByName(usr).sName.." eingeladen von: "..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, "W?hrend du weg warst, hast du was verpasst. Schreib +talklog ums zu lesen.")
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 = "Heaven Members:\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 (arrLog[user.sName]["Talk"] == "") then
user:SendPM(sOpChat, "Du warst immer online, es gibt keine History f?r dich :).")
else
user:SendPM(sOpChat, "OFFLINE:\r\n\r\n"..arrLog[user.sName]["Talk"])
user:SendPM(sOpChat, "ChatHistory wurde gel?scht.")
arrLog[user.sName]["Talk"] = ""
SaveToFile(sFolder.."/"..fLog , arrLog , "arrLog")
end
end,
["add"] = function(user,data)
local s,e,rel,desc = string.find(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)")
if rel == nil or desc == nil then
user:SendPM(sOpChat,"*** Error: Type +add ")
else
table.insert( Releases, { user.sName, rel, desc, os.date(), } )
SaveToFile(fRelease,Releases,"Releases")
SendPmToOps(sOpChat, user.sName.." hat : "..rel.." eingetragen.")
end
end,
["read"] = function(user,data)
local msg, Exists = "", nil
for i = 1, table.getn(Releases) do
if Releases[i] then
msg = msg.."\r\n\t-=(HeavenFTP Nr. "..i..")=-.\r\n\t["..Releases[i][2].."]\r\n\t"..Releases[i][3].."\r\n\tEingetragen von: "..Releases[i][1].." on "..Releases[i][4].."\r\n" Exists = 1
end
end
if Exists == nil then
user:SendPM(sOpChat,"*** Error: Nix da.")
else
user:SendPM(sOpChat,msg)
end
end,
}
local mCmds = {
["invite"] = 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 . nick angeben.")
elseif (arrInvite[string.lower(nick)] ~= nil) then
user:SendPM(sOpChat, "User "..nick.." ist bereits hier.")
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.." wurde eingeladen von Master "..user.sName)
SaveToFile(sFolder.."/"..fInvite , arrInvite , "arrInvite")
end
end,
["delinvite"] = 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 . Nick angeben.")
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.." ist nicht l?nger unter uns.")
if (GetItemByName(nick) ~= nil) then
GetItemByName(nick):SendPM(sOpChat, "Account aufgehoben von Master "..user.sName)
end
SendPmToOps(sOpChat, ""..nick.." wurde ausgeladen von Master "..user.sName)
SaveToFile(sFolder.."/"..fInvite , arrInvite , "arrInvite")
end
end,
["del"] = function(user,data)
local s,e,i = string.find(data,"%b<>%s+%S+%s+(%S+)")
if i then
if Releases[tonumber(i)] then
table.remove(Releases,i)
SaveToFile(fRelease,Releases,"Releases")
user:SendPM(sOpChat,"Address "..i..". wurde erfolgreich gel?scht!")
else
user:SendPM(sOpChat,"*** Error: Dieser Eintrag ist nicht vorhanden: "..i..".")
end
else
user:SendPM(sBot,"*** Error: Type +del ")
end
end,
}
if tCmds[cmd] and user.bOperator or arrInvite[string.lower(user.sName)] then
return tCmds[cmd](user,data),1
elseif mCmds[cmd] and user.iProfile == 0 then
return mCmds[cmd](user,data),1
else
return user:SendPM(sBot,"*** Error: Dieser Befehl ist dir nicht gestattet."),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, "Du hast in diesem Bereich keinen Zutritt.")
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()
Take a look. It seems, if the invite.tbl deletet if hub restarts or scripts restarts.
I removed this mkdir function, because i thought it clear .tbl at Start.
Guess I copied the wrong script on the other day as it had some bugs I had already fixed. But, now I've updated it with the correct one. Where was my head at? :D
Sorry for the trouble.
Cheers
Can i easy fix my version or have i do translatet all again?:(
QuoteCan i easy fix my version or have i do translatet all again?:(
Yes, you can eheh
Just replace your Main function with this one:
Main = function()
frmHub:RegBot(sOpChat)
if loadfile(sFolder.."/"..fInvite) then dofile(sFolder.."/"..fInvite) else os.execute("mkdir "..sFolder) end
if loadfile(sFolder.."/"..fLog) then dofile(sFolder.."/"..fLog) end Refresh() if loadfile(sFolder.."/"..fRelease) then dofile(sFolder.."/"..fRelease) end
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
That should do it.
Cheers
Absolutily Happy....nothing more to say:)
Runs very stable
Greets
-
-
Master
11111111111111111111111111111111
-
Operator
11111100011001111111111111111000
-
S-Operator
11111111111111111111111111111111
-
Moderator
10000000000000000000000000000000
-
S-VIP
10000000000000000000000000000000
-
VIP
10000000000000000000000000000000
-
SUser
10000000000000000000000000000000
-
DUser
10000000000000000000000000000000
-
Stammie
10000000000000000000000000000000
-
User
10000000000000000000000000000000
-
Anw?rter
10000000000000000000000000000000
Another little thing. Can u tell me my Profile "Numbers"? In TD 4 i found here...Need exactly Numbers, my thoughts are wrong till now.
Thanks in Advance jiten
Greets
Hi jiten i found a litle problem if i want to use the inbuild txt viewer in ptokax i have to dissable the opchat bot why ? if i try to use a txt command i only get this error in main chat: *** Error: You are not allowed to use this command
cheers
Found this Problem at the moment, too. Can u do that the scripts ONLY accept cmds in PM. At the moment I cannot use many other mainchat cmds with + and ! as prefix.
PS: And how can be this came in Main?
[01:50] Private message from :
is a client setting or to do in script?
I want this to come in pm window.
Its on chathistory script....but its my second problem @ the Moment ,-)
Greets
QuoteOriginally posted by GrinSlaW
Hi jiten i found a litle problem if i want to use the inbuild txt viewer in ptokax i have to dissable the opchat bot why ? if i try to use a txt command i only get this error in main chat: *** Error: You are not allowed to use this command
cheers
QuoteFound this Problem at the moment, too.
Fixed and first post updated :]
QuoteAnd how can be this came in Main?
[01:50] Private message from :
is a client setting or to do in script?
Have you ticked "Popup messages from users that are not online" and unticked "Ignore messages from users that are not online" in File - Settings - Advanced ? Or, is that bot registered?
Best regards
second is unticket, first i doesnt found in 0.674
Bot arent regged. after regged, it works mostly, but sometimes is cames in main too....
Thx ,-)
And also, can u give me the last fix passage hgere to fix manually? u know...the translation *g*
Best Regards
QuoteOriginally posted by Krysalis
second is unticket, first i doesnt found in 0.674
Bot arent regged. after regged, it works mostly, but sometimes is cames in main too....
Thx ,-)
And also, can u give me the last fix passage hgere to fix manually? u know...the translation *g*
Best Regards
Change to this:
fRelease = "Releases.tbl" -- File where the Address File is stored
if tCmds[cmd] then
if user.bOperator or arrInvite[string.lower(user.sName)] then
return tCmds[cmd](user,data),1
else
return user:SendData(sBot,"*** Error: You are not allowed to use this command."),1
end
elseif mCmds[cmd] then
if user.iProfile == 0 then
return mCmds[cmd](user,data),1
else
return user:SendData(sBot,"*** Error: You are not allowed to use this command."),1
end
end
Best regards
fRelease = "Releases.tbl"
sendCustom = 1 -- 1 = Custom Message to invited user on Hub/Script Restart; 0 = Not
customMsg = "Du bist Member im Heaven. Enjoy your Stay" -- Message sent to them
arrOpLevel = { -- Put here the profile with operator privileges and its respective level
["Master"] = 0,
}
--## END ##--
arrInvite = {} arrLog = {} Releases = {}
Main = function()
frmHub:RegBot(sOpChat)
if loadfile(sFolder.."/"..fInvite) then dofile(sFolder.."/"..fInvite) else os.execute("mkdir "..sFolder) end
if loadfile(sFolder.."/"..fLog) then dofile(sFolder.."/"..fLog) end Refresh() if loadfile(sFolder.."/"..fRelease) then dofile(sFolder.."/"..fRelease) end
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, "W?hrend du weg warst, hast du was verpasst. Schreib +talklog ums zu lesen.")
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 = "Heaven Members:\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 (arrLog[user.sName]["Talk"] == "") then
user:SendPM(sOpChat, "Du warst immer online, es gibt keine History f?r dich :).")
else
user:SendPM(sOpChat, "OFFLINE:\r\n\r\n"..arrLog[user.sName]["Talk"])
user:SendPM(sOpChat, "ChatHistory wurde gel?scht.")
arrLog[user.sName]["Talk"] = ""
SaveToFile(sFolder.."/"..fLog , arrLog , "arrLog")
end
end,
["add"] = function(user,data)
local s,e,rel,desc = string.find(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)")
if rel == nil or desc == nil then
user:SendPM(sOpChat,"*** Error: Type +add ")
else
table.insert( Releases, { user.sName, rel, desc, os.date(), } )
SaveToFile(fRelease,Releases,"Releases")
SendPmToOps(sOpChat, user.sName.." hat : "..rel.." eingetragen.")
end
end,
["read"] = function(user,data)
local msg, Exists = "", nil
for i = 1, table.getn(Releases) do
if Releases[i] then
msg = msg.."\r\n\t-=(HeavenFTP Nr. "..i..")=-.\r\n\t["..Releases[i][2].."]\r\n\t"..Releases[i][3].."\r\n\tEingetragen von: "..Releases[i][1].." on "..Releases[i][4].."\r\n" Exists = 1
end
end
if Exists == nil then
user:SendPM(sOpChat,"*** Error: Nix da.")
else
user:SendPM(sOpChat,msg)
end
end,
}
local mCmds = {
["invite"] = 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 . nick angeben.")
elseif (arrInvite[string.lower(nick)] ~= nil) then
user:SendPM(sOpChat, "User "..nick.." ist bereits hier.")
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.." wurde eingeladen von Master "..user.sName)
SaveToFile(sFolder.."/"..fInvite , arrInvite , "arrInvite")
end
end,
["delinvite"] = 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 . Nick angeben.")
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.." ist nicht l?nger unter uns.")
if (GetItemByName(nick) ~= nil) then
GetItemByName(nick):SendPM(sOpChat, "Account aufgehoben von Master "..user.sName)
end
SendPmToOps(sOpChat, ""..nick.." wurde ausgeladen von Master "..user.sName)
SaveToFile(sFolder.."/"..fInvite , arrInvite , "arrInvite")
end
end,
["del"] = function(user,data)
local s,e,i = string.find(data,"%b<>%s+%S+%s+(%S+)")
if i then
if Releases[tonumber(i)] then
table.remove(Releases,i)
SaveToFile(fRelease,Releases,"Releases")
user:SendPM(sOpChat,"Address "..i..". wurde erfolgreich gel?scht!")
else
user:SendPM(sOpChat,"*** Error: Dieser Eintrag ist nicht vorhanden: "..i..".")
end
else
user:SendPM(sBot,"*** Error: Type +del ")
end
end,
}
[COLOR=red]if tCmds[cmd] then
if user.bOperator or arrInvite[string.lower(user.sName)] then
return tCmds[cmd](user,data),1
else
return user:SendData(sBot,"*** Error: You are not allowed to use this command."),1
end
elseif mCmds[cmd] then
if user.iProfile == 0 then
return mCmds[cmd](user,data),1
else
return user:SendData(sBot,"*** Error: You are not allowed to use this command."),1
end
end[/COLOR]
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, "Du hast in diesem Bereich keinen Zutritt.")
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
Changed teh red passage, but there is now syntag error:
heaven.lua:165:
expected near `end'
it should be like this it works for me 8)
if tCmds[cmd] then
if user.bOperator or arrInvite[string.lower(user.sName)] then
return tCmds[cmd](user,data),1
else
return user:SendData(sBot,"*** Error: You are not allowed to use this command."),1
end
elseif mCmds[cmd] then
if user.iProfile == 0 then
return mCmds[cmd](user,data),1
else
return user:SendData(sBot,"*** Error: You are not allowed to use this command."),1
end
end
end
end
local _,_,whoTo = string.find(data,"$To:%s+(%S+)")
if (whoTo == sOpChat) then
QuoteChanged teh red passage, but there is now syntag error:
heaven.lua:165: expected near `end'
There are two "end" missing after the red part, just like Grinslaw posted ;)
Best regards
argh.....sure *g*
Thanks ;-)
Syntax ...tor\Desktop\0.3.3.0.b17.05.nt.rls\scripts\heaven.lua:45: attempt to index field `?' (a nil value)
received this today. What can it be?
Line 41:
arrLog[user.sName]["Mode"] = "online"
Line 45:
arrLog[user.sName]["Mode"] = "offline"
greets
QuoteOriginally posted by Krysalis
Syntax ...tor\Desktop\0.3.3.0.b17.05.nt.rls\scripts\heaven.lua:45: attempt to index field `?' (a nil value)
received this today. What can it be?
Line 41:
arrLog[user.sName]["Mode"] = "online"
Line 45:
arrLog[user.sName]["Mode"] = "offline"
greets
It has to do with this table:
arrOpLevel = { -- Put here the profile with operator privileges and its respective level
["Master"] = 0,
["Operator"] = 1,
}
You should fill it with every profile with Operator privileges and then run the script. If it is incorrectly set up, you will get that kind of syntax error.
Cheers
QuoteOriginally posted by jiten
It has to do with this table:
arrOpLevel = { -- Put here the profile with operator privileges and its respective level
["Master"] = 0,
["Operator"] = 1,
}
You should fill it with every profile with Operator privileges and then run the script. If it is incorrectly set up, you will get that kind of syntax error.
Cheers
With Profiles with Operator Privileges u mean all Profiles with Key? Or all who have the ability to kick?
QuoteOriginally posted by Krysalis
With Profiles with Operator Privileges u mean all Profiles with Key? Or all who have the ability to kick?
The first one, everyone with the Key ;)
Cheers
Well, I decided to remove and optimize the arrOpLevel table. Now, there's no need for it.
Last script updated with it.
Cheers
ah...then i know...and now i know also my ProfileNrs....but dont know the right way to find aut which profile is which profile nr.
Can u exlain me this? I would not only bring this to work, i try to understand...but i dont find anything where i can read which Profile has which nr.
Find out with Upgrade script from madman, but this can?t be the right way *g*
Greets
Thats cool. Can i update with change only some parts?
Or are there more changes?
QuoteOriginally posted by Krysalis
ah...then i know...and now i know also my ProfileNrs....but dont know the right way to find aut which profile is which profile nr.
Can u exlain me this? I would not only bring this to work, i try to understand...but i dont find anything where i can read which Profile has which nr.
Find out with Upgrade script from madman, but this can?t be the right way *g*
Greets
try this :
function Main()
for i,v in GetProfiles() do
SendToAll("Profile Name: "..v.."\t\Profile Number : "..GetProfileIdx(v))
end
end
it should show you all ur profile names and the corresponding profile numbers
QuoteOriginally posted by Krysalis
ah...then i know...and now i know also my ProfileNrs....but dont know the right way to find aut which profile is which profile nr.
Can u exlain me this? I would not only bring this to work, i try to understand...but i dont find anything where i can read which Profile has which nr.
Find out with Upgrade script from madman, but this can?t be the right way *g*
Greets
Check Dessamator's post ;)
QuoteThats cool. Can i update with change only some parts?
Or are there more changes?
Well, delete the arrOpLevel table and replace your Refresh() function with this one:
Refresh = function()
local i,usr
for i,usr in frmHub:GetOperators() do
usr = usr.sNick
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
SaveToFile(sFolder.."/"..fLog , arrLog , "arrLog")
end
Best regards
Have a urgend wish ;-)
It is to realize to enter adreeses with spacedirs with +add. Maybe with a Special signed start and end.
As this
+add [Rolling Stones] ftp://00.00.00.00/ / / / t@/ /
If i typed in this add the moment entry will only be
[Rolling
Stones]
Addy by Krysalis at Date
Would be have like this
[Rolling Stones]
ftp://00.00.00.00/ / / / t@/ /
Is this possible in any way, jiten?
QuoteOriginally posted by Krysalis
Have a urgend wish ;-)
It is to realize to enter adreeses with spacedirs with +add. Maybe with a Special signed start and end.
As this
+add [Rolling Stones] ftp://00.00.00.00/ / / / t@/ /
If i typed in this add the moment entry will only be
[Rolling
Stones]
Addy by Krysalis at Date
Would be have like this
[Rolling Stones]
ftp://00.00.00.00/ / / / t@/ /
Is this possible in any way, jiten?
Yes, it is. Last script updated.
Btw, change your add function to this:
["add"] = function(user,data)
local s,e,rel,desc = string.find(data, "%b<>%s+%S+%s+(.*)%s+(ftp+.*)")
if rel == nil or desc == nil then
user:SendData(sBot,"*** Error: Type +add ")
else
table.insert( Releases, { user.sName, rel, desc, os.date(), } )
SaveToFile(sFolder.."/"..fRelease,Releases,"Releases")
SendToAll(sBot, user.sName.." added a new Address: "..rel..". For more details type: +read")
end
end,
Best regards
you are the best ;-)
Greets
Sorry for taking your time again....why i can change this that only Invitet users can see. no ops and uninvitet.
SendPmToOps(sOpChat, ""..nick.." 's wurde ausgeladen von Master "..user.sName)
and
SendToAll(sBot, user.sName.." hat : "..rel.." eingetragen")
Please help;-)
Try using this:
for usr, aux in arrInvite do
if (GetItemByName(usr) ~= nil) then
SendToNick(GetItemByName(usr).sName, "$To: "..GetItemByName(usr).sName.." From: "..x.." $<"..x.."> "msg".")
end
end
Where "x" is the sender's nick (sOpChat or sBot) and "msg" is the message sent to them.
Best regards
Many thanx, m8. Now i got it ;-)
["add"] = function(user,data)
local s,e,rel,desc = string.find(data, "%b<>%s+%S+%s+(.*)%s+(ftp+.*)")
if rel == nil or desc == nil then
user:SendData(sBot,"*** Error: Schreibe +add ")
else
table.insert( Releases, { user.sName, rel, desc, os.date(), } )
SaveToFile(sFolder.."/"..fRelease,Releases,"Releases")
for usr, aux in arrInvite do
if (GetItemByName(usr) ~= nil) then
SendToNick(GetItemByName(usr).sName, "$To: "..GetItemByName(usr).sName.." From: "..sBot.." $<"..sBot.."> "Es wurde was neues eingetragen".")
end
end,
i don?t get it:( can you help me pleas??
Greets
Try this one:
["add"] = function(user,data)
local s,e,rel,desc = string.find(data, "%b<>%s+%S+%s+(.*)%s+(ftp+.*)")
if rel == nil or desc == nil then
user:SendData(sBot,"*** Error: Schreibe +add ")
else
table.insert( Releases, { user.sName, rel, desc, os.date(), } )
SaveToFile(sFolder.."/"..fRelease,Releases,"Releases")
for usr, aux in arrInvite do
if (GetItemByName(usr) ~= nil) then
SendToNick(GetItemByName(usr).sName, "$To: "..GetItemByName(usr).sName.." From: "..sBot.." $<"..sBot.."> Es wurde was neues eingetragen.")
end
end
end
end,
Cheers
Now its the Final Versio for me really. I thank you for your time you spend to help me :)
Greets
QuoteOriginally posted by Krysalis
Now its the Final Versio for me really. I thank you for your time you spend to help me :)
Greets
I'm really glad to know that it's the way you expected it to be :))
Cheers
[17:03] Syntax E:\pto\scripts\op++.lua:51: attempt to index field `?' (a nil value)
[17:03] Syntax E:\pto\scripts\op++.lua:47: attempt to index field `?' (a nil value)
i get this error
pls help
QuoteOriginally posted by kunal
[17:03] Syntax E:\pto\scripts\op++.lua:51: attempt to index field `?' (a nil value)
[17:03] Syntax E:\pto\scripts\op++.lua:47: attempt to index field `?' (a nil value)
i get this error
pls help
That error has been fixed ;)
Update to the last script I posted (look for it in the third page).
Cheers
Syntax E:\pto\scripts\op++.lua:47: attempt to index field `?' (a nil value)
is still popping up in my soft.... what version of ptokax is it intended with? maybe thats whats wrong
and yes i have used the cript on page 3...but the error still appares
same error here
there is a tricky way to name the bot OpChat or any name you want :)
-first you have to unregister the OpChat name in the Ptokax GUI and name it something else for ex. Op-Chat
then make this changes in the script
--## Settings ##--
sOpChat = "OpChat" -- OpChat Bot Name (Set it to everything but "OpChat")
sBot = "OpChat" -- Bot Name
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
fRelease = "Releases.tbl" -- File where the Address File is stored
sendCustom = 1 -- 1 = Custom Message to invited user on Hub/Script Restart; 0 = Not
customMsg = "Esti invitat pe OpChat,Enjoy!" -- Message sent to them
--## END ##--
arrInvite = {} arrLog = {} Releases = {}
Main = function()
frmHub:RegBot("OpChat")
-start the script
-change the name for the Opchat in the Ptokax GUI in OpChat and register it
it worked for me
Cheers
Quote from: Alexinno on 22 June, 2006, 15:13:13
there is a tricky way to name the bot OpChat or any name you want :)
This issue was solved in the latest version of this script.
However, I forgot to update it when the board "re-appeared".
:P, do that now
Quote from: Alexinno on 22 June, 2006, 21:02:51
:P, do that now
As requested, I've updated the first post of this thread with the 'latest' LUA 5.0 OpChat++ version.
I saw the code after a while and have to admit that it requires a rewrite.
I'm planning to do it soon and will also update it to LUA 5.1.
Best regards
Erm I have probably a really stupid problem but none of the commands work. I'm trying to use the commands at the top of the script and I get nothing. What am I doing wrong? :(
MP
You have to send a pm to the bot you set in the settings, and type the commands there.
Thanks still does not seem to be working but I may see if I can test it out a bit more with the other OPS and stuff first. I'll post back if I still ahve a problem :D
MP
If it still doesnt work, try disabling the other scripts and running only that one.
Will it work without the other ops being around to answer pm's?
MP
Indeed it should.
Quote from: MetalPrincess on 02 July, 2006, 22:28:54
Erm I have probably a really stupid problem but none of the commands work. I'm trying to use the commands at the top of the script and I get nothing. What am I doing wrong? :(
As previously stated by Dessamator, the commands must be used in PM to OpChat++'s bot.
And yes, it will work even without the other operators around.
So, any success?
Nope :( I upgraded my hub software though so this could be part of the problem for now.
MP