Skip word " hub "
 

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

Skip word " hub "

Started by BoyKind, 25 July, 2006, 20:28:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BoyKind

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
With all the respect

Madman

-- 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...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Herodes

-- 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 ..

jiten

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

bastya_elvtars

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
Everything could have been anything else and it would have just as much meaning.

jiten

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

BoyKind

With all the respect

bastya_elvtars

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. :-)
Everything could have been anything else and it would have just as much meaning.

Markitos

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


Madman

-- 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 =)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

bastya_elvtars

Quote from: Madman on 26 July, 2006, 23:27:19
-- Optimized, useing ideas by some weirdos on the forum ;)

Hehehehehe... :-D
Everything could have been anything else and it would have just as much meaning.

BoyKind

With all the respect

Herodes

hehe nice ending to a nice story :)

Markitos


SMF spam blocked by CleanTalk