PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: yoonohoo on 02 June, 2005, 02:22:07

Title: Ban triggers txt file
Post by: yoonohoo on 02 June, 2005, 02:22:07
I would like to have a script which would trigger a text file (ascii) every time some1 gets banned or kicked.
Is this possible?

Thanks
Title:
Post by: Dessamator on 02 June, 2005, 14:05:50
-- By Dessamator
-- AScii kicker v1

asciifile ="ascii.txt"
bot =frmHub:GetHubBotName()

Main = function (user,data)
local file = io.open(asciifile)
if not(file)  then
io.output(asciifile)
io.close()
io.output()
end

end

function ChatArrival(user,data)
data=string.sub(data,1,-2)
local s,e,cmd,victim =string.find(data,"%b<>%s+(%S+)%s+(%S+)")
local s,e,reason =string.find(data,"%b<>%s+%S+%s+%S+%s+(%S+)")
if user.bOperator then
usr =GetItemByName(victim)
if not(reason) then
reason=".."
end
if usr and victim then
if cmd=="!kick" then
user:SendData(bot,victim.." has been kicked! ")
usr:SendData(bot,"You have been kicked because: "..reason)
SendToAll(sendascii())
usr:TempBan()
return 1
elseif cmd == "!ban" then
user:SendData(bot,victim.." has been Banned! ")
usr:SendData(bot,"You Have Been Banned because: "..reason)
SendToAll(sendascii())
usr:Ban()
return 1
end
elseif usr==nil and victim then
user:SendPM(bot,victim.." is not online !! ")

end
end
temp=nil
end

function ToArrival(user,data)
if string.sub(data,6,5+(string.len(bot))) == bot then
ChatArrival(user,data)
return 1
end
end

--Send Ascii
function sendascii()
local temp = ""
for line in io.lines(asciifile) do
temp=temp..line.."\r\n"
end

return temp

end

KickArrival= function(User, Data)
SendToAll(sendascii())
temp=nil
end


Done !
Title:
Post by: yoonohoo on 02 June, 2005, 14:21:18
Thanks Dessamator

Trying it now :)
Title:
Post by: yoonohoo on 02 June, 2005, 14:29:59
Getting this error:
92: attempt to concatenate local `victim' (a nil value)
It does ban the user but no txt show.
Kick cmd doesn't do anything...removed script kick cmd does his job.

Testing on 17.09 with only this script.
Title:
Post by: Dessamator on 02 June, 2005, 14:51:09
QuoteOriginally posted by yoonohoo
Getting this error:
92: attempt to concatenate local `victim' (a nil value)
It does ban the user but no txt show.
Kick cmd doesn't do anything...removed script kick cmd does his job.

Testing on 17.09 with only this script.

fixed, post edited , btw the script creates a file--> ascii.txt, & u have to paste  ur ascii there !
Title:
Post by: yoonohoo on 02 June, 2005, 15:10:01
Getting there...
Both cmd working but:
Main chat log = user is not online
This happens to passive and active users
The txt still hasn't show up.
Quotebtw the script creates a file--> ascii.txt, & u have to paste ur ascii there !
Done that!

Thanks

OK...Written Cmd worked and show txt, is the rightclick "Kick user" that doesn't show the txt
Title:
Post by: Dessamator on 02 June, 2005, 15:47:53
do u mean the built in right click of dc??

if thats what u mean, then its done, post edited, ;)
Title:
Post by: yoonohoo on 02 June, 2005, 19:16:01
Quotedo u mean the built in right click of dc??
Yes it was. Thanks

Before user is not online
Now   kicking is not online or is is not online
This appears in the mainchat of the cmd user when using right click.

Another request, if I may: How can I enter the user name being kicked in the ascii file?
Title:
Post by: Dessamator on 02 June, 2005, 19:56:41
hmm ill check it out
Title:
Post by: yoonohoo on 02 June, 2005, 20:12:31
thanks m8
Title:
Post by: Dessamator on 02 June, 2005, 20:18:16
done, post edited!
Title:
Post by: yoonohoo on 03 June, 2005, 00:28:57
Quotedone, post edited!
This doesn't include user name being kicked in the ascii file or does it?

Rightclick OK
Log OK
Cmd !kick appears in mc --> !kick yoonohoo
Cmd !ban appears in pm --> Error: Can't ban test - user is not online

Apreciate ur help m8
Title:
Post by: Dessamator on 03 June, 2005, 11:45:45
QuoteOriginally posted by yoonohoo
 This doesn't include user name being kicked in the ascii file or does it?
nop

QuoteRightclick OK
Log OK
goody


QuoteCmd !kick appears in mc --> !kick yoonohoo
Cmd !ban appears in pm --> Error: Can't ban test - user is not online
done

QuoteApreciate ur help m8
ur welcome