Hello.. I have a question. I write little script
function ChatArrival(user,data)
Core.GetUserAllData(user)
local data = string.sub(data,1,-2)
local s,e,cmd =string.find(data, "%b<>%s+(%S+)")
if cmd == "!booring" then
name = user.sNick
tv = 0
return true
end
if tv == 0 and name == user.sNick then
Core.SendToAll("*booring "..data.."")
return true
end
But only one user at time can use them. I want, what more then one user can use this script. How to do it?
You need to add the user in to a table...
Just ask and i'll help...
Hello again, i'm write this script with using with table, but before i read Your post. Sorry for old code. All works good, but i don't now how to remove nick from table. This is my code
--Insert user nick in table by command (!booring)
local data = string.sub(data,1,-2)
local s,e,cmd =string.find(data, "%b<>%s+(%S+)")
if cmd == "!booring" then
table.insert (sSettings.uNick, user.sNick)
table.insert (sSettings.uMode, "1")
return true
end
if cmd == "!withoutint" then
table.insert (sSettings.uNick, user.sNick)
table.insert (sSettings.uMode, "0")
return true
end
--Find user nick and mode in table
local s,e,cmd =string.find(data, "%b<>%s+(%S+)")
for i = 1,table.maxn(sSettings.uNick) do
for i = 1,table.maxn(sSettings.uMode) do
disp = sSettings.uNick[i]
disp2 = sSettings.uMode[i]
if user.sNick == disp and disp2 == "0" then
for j = 1,table.maxn(sSettings.uNick) do
table.remove(sSettings.uNick, i)
end
end
if user.sNick == disp and disp2 == "1" then
Core.SendToAll("*booring "..data.."")
return true
end
I think, that problem with this happend because
if cmd == "!withoutint" then
table.insert (sSettings.uNick, user.sNick)
table.insert (sSettings.uMode, "0")
return true
end
After this command user.sNick and uMode writing in table how a new element.
How remove mode(*booring) from user? I don't find any information about search in table.