Hey Guy's I need some help... :-)
I have tried doing my own notification in my bot but
can get it to work so I hopped you guys could help me...
This is the way I have tried:
TABLE = {} to store op's names and when logging in "no"
opname = "no" notification is off by default...
then I have the command !noti on/off with change above opname = "no" to "yes"...
Think that is a good start... but...
How do I do it so the ops that have yes only get OR get
the message... have tried many way but no luck or success...
have tried:
function ShowOnLineOps(data)
for OP,NOT in OPLOG do
local _,_,ToOP = strfind(OP, "(%S+)")
if NOT == "on" then
SendNotiTo = function(this,from,text)
SendPmToNick(this,from,text)
end
SendToAll(BOTNAME,"Online: "..OP.."\t Notification: "..NOT)
else
SendToAll(BOTNAME,"Notification is OFF")
end
return data
end
end
in a function and returning OPS but don't work...
so help me out...
/NL
why don't you only store the op names in the table from the ops who have it enabled.
2 enable OPLOG[user.sName]=1
2 disable OPLOG[user.sName]=nil
for a,b in OPLOG do
SendPmToNick(a, BOTNAME, what)
end
or am i missing what your trying 2 do???
plop
why use all the crap, do what i do its simple, quick.
if notification is on for a op then it writes there name to a text file and then for notification reads the text file and gets each name by item and sends the notification for if the user is nil then it skips the line.....
l8rr,,
-phatty
because all the table crap is way faster than reading from a textfile over and over crap
and SendToNick is also a lot faster than if getitembyname then crap
later
not depending on what you are using, tables and crap = memory/ reading = cpu, now if you consider it to be slow, ur comp must be a 486
we have processors approaching the speed of light and u say slow wow, must be a 486 :P
l8rr ;)
QuoteOriginally posted by (uk-kingdom)pH?tt?
not depending on what you are using, tables and crap = memory/ reading = cpu, now if you consider it to be slow, ur comp must be a 486
we have processors approaching the speed of light and u say slow wow, must be a 486 :P
l8rr ;)
reading from hdd is measured in MB/s, while reading from memory is measured in GB/s.
now who's faster???
check my changelog when a.i. is released 2 see how much difference it makes 2 change a if/elseif/elseif/etc for a table.
plop
yes i know you are right, but a few k of data r3ading in mb is not much differ, its not important, if hdd;s read in kb or bytes then it wud be a differ sotry :P
for example,
1 meg a sec
1 gig a sec
which will be done first, neither both same for about 3k
btw.. i never said slow
but you said quick.. which it isnt
its HD torture
lol, he he he, ok i agree memory is better to use, but, still for if you newbie then it is easier to learn from doing that, Gekko does read from a file but only on script start, and then puts names into table, so yep reading is better from memory, but still a few k is nothink.....
Okey guy get the point and man.. can you guys talk about everything... :-p like helping my life... hehe...
So how do I do this function then...
this is how a check is now:
elseif (tonumber(tFlags["S"]) > MAXSLOTS) then
curUser:sendmessage(BOTNAME, "You have too many slots open, max number is: "..MAXSLOTS)
SendPmToOps(LOGNAME,curUser.sName.." had to many slots, "..tFlags["S"].."/"..MAXSLOTS.." Slots")
curUser:Disconnect()
I now I change the SendPmToOps to SendPmToNick but
how do I trigger the function ??
best way would be starting the function right in Data Arrival or...
and then type "a" or what ever for Ops name...
ex:
function DataArrival (curUser, data)
for OPS,NUM in OPLOG do
if(strsub(data, 1, 7) == "$MyINFO" and curUser.bOperator == nil) then
if DCCHECK == "enable" then
DoClientCheck(curUser,data,OPS) --// Can I do it like this then..??
end
end
end
and then in DoClientCheck
function DoClientCheck(curUser,data,OPS)
SendPmToNick(OPS, BOTNAME, Message)
if (tonumber(tFlags["S"]) > MAXSLOTS) then
curUser:sendmessage(BOTNAME, "You have too many slots open, max number is: "..MAXSLOTS)
SendPmToNick(OPS,BOTNAME,curUser.sName.." had to many slots, "..tFlags["S"].."/"..MAXSLOTS.." Slots")
curUser:Disconnect()
end
end
will this work ???
/NL
hmm i dont understand what you man tirgger it, why?
either way it will need to be triggered to send the ops that have it enabled, else all wont get it,
so for example it cud be if Setting == 1 then send pm to ops sort of thing but thAt is if setting is on, but you want to send to the users in the table so a hint use for
your explaining is a bit fuzzy here, but this is what i understand from it.
function DoClientCheck(curUser,data,OPS)
NotifOPs(Message) --- gues this line is debug or something, because Message looks nil 2 me.
if (tonumber(tFlags["S"]) > MAXSLOTS) then
curUser:sendmessage(BOTNAME, "You have too many slots open, max number is: "..MAXSLOTS)
NotifOPs((curUser.sName.." had to many slots, "..tFlags["S"].."/"..MAXSLOTS.." Slots"))
curUser:Disconnect()
end
end
function NotifOPs(msg)
for a,b in OPLOG do
SendPmToNick(a, BOTNAME, msg)
end
end
plop
ThX alot plop... Works great...
Thank you all... :-)
/NL
QuoteOriginally posted by NightLitch
ThX alot plop... Works great...
Thank you all... :-)
/NL
yw enjoy
plop
hmmm
Quotefunction NotifOPs(msg)
for a,b in OPLOG do
SendPmToNick(a, BOTNAME, msg)
end
end
function NotifOPs(msg)
for a,b in OPLOG do
SendPmToNick(b, BOTNAME, msg)
end
end
?
?
a is the key, b is the value.
in this case a holds the operator nick, while b is just a dummy vallue (anything beside nil can be used).
if you look up i'm using a vallue of 1.
for example OPLOG = {"plop"=1, "phatty"=1}
in your case it would try 2 send the pm 2 user named 1.
the reason 2 use this kind of array's is that it's way easyer 2 add/remove things from them.
OPLOG[NightLitch]=1 adds NightLitch 2 the table and OPLOG[phatty]=nil removes you from it.
as you can see there is no need 2 go thru all the key's 2 see if a name is in the array.
if OPLOG[user.sName] then
SendToAll(Bot, user.sName.." is in the array")
else
SendToAll(Bot, user.sName.." is not in the array")
end
it uses a tiny bit more memory but as a result it works faster.
only 1 bad side effect, sorting those tables is a pain in the ass.
for a example about a way 2 sort them and how 2 handle those tables, take a look @ my usercleaner.
plop
hmmm, well not how i do it, but suppose if it works then great :))