JEDi Script Project - Page 2
 

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

JEDi Script Project

Started by -PT-B2S, 05 July, 2005, 15:25:48

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

-PT-B2S

#25
sorry ??????Hawk?????? but this doesn't work.

If i say in the hub:

!warn test reason

and the user "test" is not online,  the script gives me an error.

See it :



function ChatArrival(oUser, data)
	if (string.sub(data,1,1) == "<" or string.sub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = string.sub(data,1,string.len(data)-1)
		local s,e, cmd, extra, rest = string.find(data, "%b<>%s+(%S+)%s*(%S*)%s*(.*)")
		if (string.sub(cmd,1,1) == "!") then
			if (cmd == "!warn") then
				local Nick = GetItemByName(extra) 
				if Nick then 
					Nick:TempBan()


This kind of thing doesn't work

i need a command that verifies if the user mentioned in "extra" is really online.

Props

-PT-B2S

Hello. I need one more thing to the script, please.

In some hubs, you have to share xGB to enter the hub if you are regged. For exemple, if you have 1GB you can enter if you are non regged but if you are regged, you have to share 5GB. So, what i want is a line to the script that does this:

If the user is vip (profile 3, for exemple) but have less than the minimum share for vips (causa he have to format the hard disk or something) the script will unreg the user so the user can enter.

Thnks and props.

TTB

Hi, the code you posted... it is not very good.
if (string.sub(data,1,1) == "<" or string.sub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
The way you do this is wrong. In LUA5 ChatArrival is for main chat, and ToArrival is for PM. IN this case, the whole line is not needed (in LUA4 it is...).

I should do it a different way...

function ChatArrival(curUser,data)
	data = string.sub(data,1,string.len(data)-1)
	local s,e,cmd,extra,rest = string.find(data, "%b<>%s+(%S+)%s+(%S+)%s+(.*)")
	if (string.sub(cmd,1,1) == "!") then
			if (cmd == "!warn") then
				if GetItemByName(extra) then
					extra:TempBan()
					-- ## REST OF YOUR CODE ## --
				end
			end
		end
	end
end

It is just a thought... I wrote it very fast, but try something like this...
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

-PT-B2S

Thaks TTB. I will try this.

Props ;)

-PT-B2S

Hello Again

I need a thing to my script. I want to block the "dc++ kick command". Some clients (like strongdc++, dcdm and other OP clients) have a own kick command. I want to block this command, and if a user uses this command, the script will do his own !kick command instead of the command from the client.

Thnks again. Props

Dessamator

Simple, use pattern matching to find the raw command and return 1 .
Ignorance is Bliss.

-PT-B2S

hello.

that's not so simple. I'm using this:

function ChatArrival(oUser, data)
	data = string.sub(data,1,string.len(data)-1)
	local s,e, cmd, extra, rest = string.find(data, "%b<>%s+(%S+)%s*(%S*)%s*(.*)")
		if (cmd == "$kick") then 
		return 1
		end			
	end
end


IT's not working.

Props

Madman

#32
Quote[18:46:37] Syntax error there was someone on the board, who asked if it is possible to block te inbuild kick command... Is this possible?
[18:47:23] ? yeah... a return 1 in the KickArrival block the actual kick...
[18:48:17] ? and then you need to catch the You are being kicked because string in ToArrival and return 1 on that...
[18:49:59] ? and to stop the msg from appering in the status bar... do a string.find on is kicking in the ChatArrival

That should give you an idea... ;)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

TTB

#33
Thanx to madman for the tip, here we go:

-- Kick interception by TTB
-- 01-08-2005
-- Requested by -PT-B2S
-- Thanx to madman for the tip ;-)
------------------------------------------------------------------------

bot = "kickintercept"

function ChatArrival(curUser,data)
data = string.sub(data,1,string.len(data)-1)
s,e,all = string.find(data,"%b<>%s+(.*)")
	if string.find(all,"is kicking") then
		SendToAll(bot,"Kick command not enabled!")
		return 1
	end
end

function KickArrival(curUser, data)
	if string.find(data,"$Kick") then
		return 1
	end
end

function ToArrival(curUser,data)
	local _,_,whoTo,mes = string.find(data,"$To:%s+(%S+)%s+From:%s+%S+%s+$(.*)")
	if (string.find(mes,"%b<>%s+(.*)")) then
		data = string.sub(mes,1,string.len(mes)-1)
		if string.find(data,"You are being kicked because") then
			return 1
		end
	end
end

pure code, no extra shit:
function ToArrival(curUser, data) 
	if string.find(data, "You are being kicked because") then 
		return 1 
	end 
end 
 
function ChatArrival(curUser, data) 
	if string.find(data, "is kicking") then 
		return 1 
	end 
end 
 
function KickArrival(curUser, data) 
	return 1 
end

Also thanx to madman!
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

-PT-B2S

#34
Ok this is working, the script bloks the command.

thnks to both of you

This is what i want now:

I want the script to do the "!kick " command when an OP try to use the client $kick command.

Props

TTB

post above updated!
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

-PT-B2S

my last post edited :) thnks

TTB

Maybe you can try that on your own... You know how to catch values with a string, like
local s,e,cmd,extra,rest = string.find(data, "%b<>%s+(%S+)%s+(%S+)%s+(.*)")
experiment with this kind of things...! So, the tip is: Catch the kick with a string, and make "$Kick victim reason" to "!kick victim reason". Notice that the !kick shouldn't be returned (use return 0). G00d luck
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

TTB

was just thinking, maybe this can't be done. Scripts doesn't catch other commands from scripts... Maybe someone else knows...  ?(
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

-PT-B2S

TTB

Maybe you can help me.

Think with me:

function ToArrival(curUser,data)
	local _,_,whoTo,mes = string.find(data,"$To:%s+(%S+)%s+From:%s+%S+%s+$(.*)")
	if (string.find(mes,"%b<>%s+(.*)")) then
		data = string.sub(mes,1,string.len(mes)-1)
		if string.find(data,"You are being kicked because") then
			return 1
		end
	end
end


If this thing can detect this:
("You are being kicked because")


There must be a way to detect the reason.

When i have the reason identified, i'll have the victim user (the one that will be kicked) and the reason.
Since the !kick command is in the same script (this is an 'all in one' script) there must be a way to send the command (!kick user reason) instead of the client command ($kick user)

can you help me?

Thnks,

props

Madman

To catch the Reason...
_,_,Reason = string.find(data, "You are being kicked because: (.*)|")
As for the Kick... I dont kno...And to tierd to try
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

-PT-B2S

Ok, thnks madman.

now the kick.

Well, this thing does't work, as everybody knows:

SendToAll(user, "!kick user reason")

So, does somebody knows how to do it? thnks

TTB

#42
This was damn irritating to build... but it should work now, tested it, so please try this:

-- Kick interception by TTB   v.2
-- 02-08-2005
-- Requested by -PT-B2S
-- Thanx to madman for the tip ;-)
----------------------------------------------------------------------------------------

bot = "kickintercept"

function ChatArrival(curUser,data)
	if string.find(data,"is kicking") then
		return 1
	end
end

function KickArrival(curUser, data)
	if string.find(data,"$Kick") then
		return 1
	end
end

function ToArrival(curUser,data)
	local _,_,whoTo,mes = string.find(data,"$To:%s+(%S+)%s+From:%s+%S+%s+$(.*)")
	if (string.find(mes,"%b<>%s+(.*)")) then
		victim = whoTo
		data = string.sub(mes,1,string.len(mes)-1)
		if string.find(data,"You are being kicked because") then
			data = string.gsub(data,"(%S+)%s+You are being kicked because: ","")
			SendToAll(bot,"!kick "..victim.." "..data)
			return 1
		end
	end
end
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

-PT-B2S

Hello TTB

This line doesn't work, as i said:

SendToAll(bot,"!kick "..victim.." "..data)


This line sends this text to the hub:

!kick 'user' 'reason'

But the ptokax don't recognize it like a command. the text is seen by everyone, but it is not considered a command.

Thnks again

Props

-PT-B2S

#44
The Problem is now solved!!!

Since you gave me an help with this, i will post the way i solved it here!

By the way, my profile numbers are:

REG = 0
ELITE = 1
VIP = 2
OP = 3
MODERATOR = 4
FOUNDER = 5

--## Kick interception by Hahn?(-PT-B2S)
-- 02-08-2005
-- Thanx to madman, TTB and zero-cool for the help 

sBot = "name of the bot"

iTimeBan = 30,				-- Time fot Timeban in minutes 
kickLimit = 3,				-- kick limit
warnLimit = 3, 				-- warn limit

kwTab = { 
	tKick = {},
	tWarn = {},
}

function ChatArrival(oUser,data)
	if string.find(data,"is kicking") then
		return 1
	end
end

function KickArrival(oUser, data)
	if string.find(data,"$Kick") then
		return 1
	end
end

function ToArrival(oUser,data)
	local _,_,whoTo,mes = string.find(data,"$To:%s+(%S+)%s+From:%s+%S+%s+$(.*)")
	if (string.find(mes,"%b<>%s+(.*)")) then
		victim = whoTo
		data = string.sub(mes,1,string.len(mes)-1)
		if string.find(data,"You are being kicked because") then
			reason = string.gsub(data,"(%S+)%s+You are being kicked because: ","")
			iVictim = GetItemByName(whoTo)
			SendToOps(sBot, " The User " ..oUser.sName.. " used this commad:  -- kick --  on the user  -- "..victim.." --")
			if oUser.bOperator then
				if (victim == nil) then
					oUser:SendData(sBot, "***Error, The user "..victim.." is not online")
				else
					if (oUser.bOperator) and (iVictim.iProfile < oUser.iProfile) then 
						if kwTab.tKick[victim] == nil then
							kwTab.tKick[victim] = {}
							kwTab.tKick[victim]["Kicked"] = {}
							kwTab.tKick[victim]["Kicked"] = 1
						else
							kwTab.tKick[victim]["Kicked"] = kwTab.tKick[victim]["Kicked"] + 1
						end
						if (kwTab.tKick[victim]["Kicked"] == kickLimit) then
							iVictim:SendPM(sBot, "You are beeing banned cause you have reached the kick limit with the reason: "..reason)
							SendToOps(sBot, "The User "..victim.." was banned by "..oUser.sName.." ,after reach the kick limit with the reason: "..reason)
							kwTab.tKick[victim] = nil
							iVictim:TimeBan(iTimeBan)
						else
							iVictim:SendPM(sBot, "You are being kicked by "..oUser.sName.." because: "..reason)
							SendToOps(sBot, "O User "..victim.." was kicked by "..oUser.sName.." because: "..reason)
							iVictim:TempBan()
							iVictim:Disconnect()
						end
					end
					if (oUser.bOperator) and (iVictim.iProfile > oUser.iProfile) then 
						oUser:SendData(sBot, "You can not kick "..victim.." because he has a superior profile than yours!") 
					end
				end
			else
				oUser:SendData(sBot, "*** Error, You can not use this command.")
			end
		return 1
		end
	end
end

The !kick command is like this one i have posted here and uses this too:

tConf = { 
	mSet = {
		iTimeBan = 30, -- in minutes
		kLimit = 3, -- kick limit
		wLimit = 3, -- warn limit
	},
	tKick = {},
	tWarn = {},
}


Tested and working perfectelly

Thanks Again and Props

TTB

Of course... that is the best way, but it isn't catched by another script...

But indeed, what you did, if you put it in the script it should catch, then it works. Well... we just learn from this, and it is nice that you got now what you need.  :D

Greetz.
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

-PT-B2S

Yes TTB, it's true, but as i said, this is an "all in one" script that i am doing, and it has all the commands, including the !kick command. :D

Props

TTB

Ghehe, I could have known. Well, the way to catch it was a little bit frustrating, but these are the things were we can learn from. Ghehe, g00d luck with the all in 1 script. You know where to post when you have probs  :)
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

-PT-B2S

Hello again people.

Well, now i want to do a difficult thing (i think :P )

I want a script that automatically erase the registered users that don't enter the hub for more than 1 month. I'm not very good with "timers" in LUA scripts, so i ask for your help.

Is that possible? i Hope so.

Thnks and props

Dessamator

have a look at plop's reg cleaner, it does that !
Ignorance is Bliss.

SMF spam blocked by CleanTalk