I want a script that when a unreg user types the word " hub " , to skip the whole message, if it's possible :) Just like in an advertising bot, but I don't want the bot to kick the user that says "hub" in my HUB(MC and PM), I want the bot to skip the message silently ... Thx
-- Say Hub
-- Made by Madman, 06-07-26
-- Requested by BoyKind
function ChatArrival(curUser, data)
local data = string.sub(data, 1, -2)
if not curUser.bRegistered then
if string.find(data, "hub") then
return 1
end
end
end
ToArrival = ChatArrival
It don't get any more silent then this, not even the one that types hub will kno it's blocked...
-- Say "What"?
-- Made by Madman, 06-07-26
--- optimised by Herodes
-- Requested by BoyKind
local wordie = " hub "
function ChatArrival(user, data)
return ((string.find(data, wordie) and (not user.bRegistered))
end
ToArrival = ChatArrival
Hmm .. just some inspirational conceptual optimisation .. It could be not working ..
As there's no need to string.sub 'data', here's part of the code:
ChatArrival = function(user, data)
if string.find(data, "hub") and not user.bRegistered then
return 1
end
end
If you don't string.sub, better beware of the | et al., and it's also wise to convert to lowercase:
ChatArrival = function(user, data)
if string.find(string.lower(data), "hub",1,true) and not user.bRegistered then
return 1
end
end
Quote from: bastya_elvtars on 26 July, 2006, 17:19:21
If you don't string.sub, better beware of the | et al.
The endpipe won't affect the
string.find, as long as we don't try to parse the vars.
Quote, and it's also wise to convert to lowercase:
True, though it was just an example :P
Thanks Madman :D
Quote from: jiten on 26 July, 2006, 17:27:15
The endpipe won't affect the string.find, as long as we don't try to parse the vars.
Yeah, you're right, I simply like failsafe methods. :-)
Quote from: Herodes on 26 July, 2006, 16:59:56
just some inspirational conceptual optimisation .. It could be not working ..
It isn't =)...Correct code above
-- Say "What"?
-- Made by Madman, 06-07-26
--- optimised by Herodes
-- Requested by BoyKind
local wordie = " hub"
function ChatArrival(user, data)
return ((string.find(data, wordie)) and (not user.bRegistered)),1
end
ToArrival = ChatArrival
-- Say Hub
-- Made by Madman, 06-07-26
-- Requested by BoyKind
-- Optimized, useing ideas by some weirdos on the forum ;)
function ChatArrival(curUser, data)
if string.find(string.lower(data), "hub") and not curUser.bRegistered then
return 1
end
end
ToArrival = ChatArrival
Here you are gone for a few hours.. and ppl pops more ideas then what a popcorn bag *pops*.
BoyKind, my first post only blocks hub and not HUB, this blocks both =)
Quote from: Madman on 26 July, 2006, 23:27:19
-- Optimized, useing ideas by some weirdos on the forum ;)
Hehehehehe... :-D
:) thx
hehe nice ending to a nice story :)
indeed...