PtokaX forum

Archive => Archived 5.1 boards => Help with scripts => Topic started by: jack_port1000 on 19 June, 2007, 10:41:45

Title: Pls help with this script
Post by: jack_port1000 on 19 June, 2007, 10:41:45
befor i was used PtokaX 0.3.5.2. with Rcup  now i useing Ptokax 0.3.4.0.dbg with Terminator i was use thsi script in
0.3.5.2.  its work good this script is best for me now this script not work with 0.3.4.0. every thing going k no error loaed bot but its not stop badword so can u pls change this script for me or any error then pls solve it Thanks in Advance
[14:00] badword.lua loaded.
[14:00] badword.lua loaded.

local sBot = frmHub:GetHubBotName()
local trigs = {"fuck","coaie","suck","sucks","suckz","blow","fucker","chutiya",
"madarchod","chodu","bhadva","bhadve","chut","lund","lavde","lavdu","bhenchod","madarchot","madar",
"rand","randi","chod","chinal","gand","jatu","lundfakir","lavda","bastard",}

function ChatArrival (user, data)
if not user.bOperator then
local s,e,msg = string.find(string.lower(data), "^%b<> (.+)|$")
for word in string.gmatch(msg,"%S+") do
for key,val in ipairs(trigs) do
if word == string.lower(val) then
return SendPmToOps(sBot," "..user.sName.." Try to sent "..
"this message in Main----> "..data),user:SendData(sBot,user.sName..", "..
"please don't use words like "..word.." in this hub order by AnnA  Reconnect to hub."),user:Disconnect(),1
end
end
end
end
end
Title: Re: Pls help with this script
Post by: Leun on 19 June, 2007, 11:43:45
try this:


local trigs = {"fuck","coaie","suck","sucks","suckz","blow","fucker","chutiya",
"madarchod","chodu","bhadva","bhadve","chut","lund","lavde","lavdu","bhenchod","madarchot","madar",
"rand","randi","chod","chinal","gand","jatu","lundfakir","lavda","bastard",}

function ChatArrival (user, data)
if not user.bOperator then
local s,e,msg = string.find(string.lower(data), "^%b<> (.+)|$")
for word in string.gfind(msg,"%S+") do
for key,val in ipairs(trigs) do
if word == string.lower(val) then
return SendPmToOps(sBot," "..user.sName.." Try to sent "..
"this message in Main----> "..data),user:SendData(sBot,user.sName..", "..
"please don't use words like "..word.." in this hub order by AnnA  Reconnect to hub."),user:Disconnect(),1
end
end
end
end
end


I changed string.match with string.gfind. So I think your 0.3.4.0 is using LUA 5.0 en the script you past is for LUA 5.1

greetz
Title: Re: Pls help with this script
Post by: jack_port1000 on 19 June, 2007, 12:20:15
tanx for help but still not work :'(
Title: Re: Pls help with this script
Post by: Naithif on 19 June, 2007, 12:27:55
Quote from: swagat_j on 19 June, 2007, 12:20:15
tanx for help but still not work :'(

Give a try replacing

local s,e,msg = string.find(string.lower(data), "^%b<> (.+)|$")

with

local s,e,msg = string.find(string.lower(data),  "%b<>%s+(.*)|")

Title: Re: Pls help with this script
Post by: jack_port1000 on 19 June, 2007, 12:40:07
same not work
Title: Re: Pls help with this script
Post by: Leun on 19 June, 2007, 13:19:12
OK maby this one:


-- Set BotName
sBot = frmHub:GetHubBotName()

local trigs = {"fuck","coaie","suck","sucks","suckz","blow","fucker","chutiya",
"madarchod","chodu","bhadva","bhadve","chut","lund","lavde","lavdu","bhenchod","madarchot","madar",
"rand","randi","chod","chinal","gand","jatu","lundfakir","lavda","bastard",}

function Main ()
string.gmatch = (string.gmatch or string.gfind);
end

function ChatArrival (user, data)
if not user.bOperator then
local s,e,msg = string.find(string.lower(data), "^%b<> (.+)|$")
for word in string.gmatch(msg,"(%S+)") do
for key,val in ipairs(trigs) do
if word == string.lower(val) then
return SendPmToOps(sBot," "..user.sName.." Try to sent "..
"this message in Main----> "..data),user:SendData(sBot,user.sName..", "..
"please don't use words like "..word.." in this hub order by AnnA  Reconnect to hub."),user:Disconnect(),1
end
end
end
end
end


I can't test it yet, I'm still at the office
But I changed:

for word in string.gmatch(msg,"%S+") do

into

for word in string.gmatch(msg,"(%S+)") do


Hopefully it works now,

Greetz
Title: Re: Pls help with this script
Post by: jack_port1000 on 19 June, 2007, 13:31:47
tanx again all but sorry dude still same problem and thanks a lot Greetz tat u help from ur work place its ok u when u come to ur home then work on it tanx again
Title: Re: Pls help with this script
Post by: Naithif on 19 June, 2007, 13:38:59
As far as the script doesn't give any error, nobody's closer any place  ;D (and I guess it looks ok)

string.gmatch or string.gfind would have to give an error message doesn't it? Or only the new PtokaX gives?

(removing 'local' before trigs?  :-\ Guess I'm desperate or what, but isn't local refers to 'within function/chunk'?)
Title: Re: Pls help with this script
Post by: jack_port1000 on 19 June, 2007, 14:05:06
is tat posible tat i use terminator bot it stop this script? bec no error in script showing to me also but when use any bad word in hub its discoonect to tat user but now its cant disconnect , i was used  PtokaX 0.3.5.2 with robcop in tat its work proper but now i use ptokax 0.3.4.0.dbg with terminator bot  "! ! ! ']['?RM???']['?R V1.Rev 7c ! ! ! By ??????Hawk??????  is Active."  its not work in this only there nothing error but why its not work
Title: Re: Pls help with this script
Post by: bastya_elvtars on 19 June, 2007, 14:06:54
0.3.4.0 is old. Upgrade.
Title: Re: Pls help with this script
Post by: jack_port1000 on 19 June, 2007, 14:08:37
with new is terminotor work?
Title: Re: Pls help with this script
Post by: Psycho_Chihuahua on 19 June, 2007, 14:18:22
Here you go - fixed the script and added CheckProfiles settings - tested as Reg User and even as Master and it works

-- Set BotName
sBot = frmHub:GetHubBotName()
HubOwner = "Psycho_Chihuahua"
CheckProfiles = {
[0] = 1,    -- =[Master]=
[1] = 1,    -- =[OP]=
[2] = 1,    -- =[ViP]=
[3] = 1,    -- =[Reg]=
[4] = 1,    -- =[Custom Profile 1]=
[5] = 1,    -- =[Custom Profile 2]=
[-1] = 1,    -- =[UnReg]=
}


local trigs = {"fuck","coaie","suck","sucks","suckz","blow","fucker","chutiya",
"madarchod","chodu","bhadva","bhadve","chut","lund","lavde","lavdu","bhenchod","madarchot","madar",
"rand","randi","chod","chinal","gand","jatu","lundfakir","lavda","bastard",}

function Main ()
string.gmatch = (string.gmatch or string.gfind);
end

function ChatArrival (user, data)
if CheckProfiles[user.iProfile] == 1 then
local s,e,msg = string.find(string.lower(data), "^%b<> (.+)|$")
for word in string.gmatch(msg,"(%S+)") do
for key,val in ipairs(trigs) do
if word == string.lower(val) then
return SendPmToOps(sBot," "..user.sName.." Try to sent "..
"this message in Main----> "..data),user:SendData(sBot,user.sName..", "..
"please don't use words like "..word.." in this hub order by "..HubOwner.."  Reconnect to hub."),user:Disconnect(),1
end
end
end
end
end
Title: Re: Pls help with this script
Post by: jack_port1000 on 21 June, 2007, 23:41:50
Tanx a lot all bastya_elvtars  u great man problem slove ;)
There is   "reg Chat" in my hub there if any one use badword bot cant disconnect them so what add in this script that also work in regchat

-- Set BotName
sBot = frmHub:GetHubBotName()
HubOwner = "Psycho_Chihuahua"
CheckProfiles = {
[0] = 1,    -- =[Master]=
[1] = 1,    -- =[OP]=
[2] = 1,    -- =[ViP]=
[3] = 1,    -- =[Reg]=
[4] = 1,    -- =[Custom Profile 1]=
[5] = 1,    -- =[Custom Profile 2]=
[-1] = 1,    -- =[UnReg]=
}


local trigs = {"fuck","coaie","suck","sucks","suckz","blow","fucker","chutiya",
"madarchod","chodu","bhadva","bhadve","chut","lund","lavde","lavdu","bhenchod","madarchot","madar",
"rand","randi","chod","chinal","gand","jatu","lundfakir","lavda","bastard","maderchod","lodu","bhosda","landus","bhadwa","harami","motherfucker",}

function Main ()
string.gmatch = (string.gmatch or string.gfind);
end

function ChatArrival (user, data)
if CheckProfiles[user.iProfile] == 1 then
local s,e,msg = string.find(string.lower(data), "^%b<> (.+)|$")
for word in string.gmatch(msg,"(%S+)") do
for key,val in ipairs(trigs) do
if word == string.lower(val) then
return SendPmToOps(sBot," "..user.sName.." Try to sent "..
"this message in Main----> "..data),user:SendData(sBot,user.sName..", "..
"please don't use words like "..word.." in this hub order by AnnA  Reconnect to hub."),user:Disconnect(),1
end
end
end
end
Title: Re: Pls help with this script
Post by: bastya_elvtars on 22 June, 2007, 00:03:41
One should also add badword checking in PM. I don't like that, so I won't code it, but it's food for thuoght anyway.
Title: Re: Pls help with this script
Post by: jack_port1000 on 22 June, 2007, 02:15:23
i dont care about who use badword in pm, but main chat and regchat is problem for us bec there is senior citizen and females and some kids in our hub so we must respect them tats it so pls in this script codeing for regchat only not for pm :)
??Reg-Chat?? this a bot in my hub if any user (admin,ops,master,reguser) pm this bot this bot tat message send to every one i want to stop badword here no in pm so dont get me wrong   8)
Title: Re: Pls help with this script
Post by: bastya_elvtars on 22 June, 2007, 03:41:01
I think you should post the regchat script, because incorporating word filtering right into that would be better.
Title: Re: Pls help with this script
Post by: jack_port1000 on 22 June, 2007, 09:32:56
bastya there is ??Reg-Chat?? option in terminator bot like opschat, vipchat,adminchat, so check box for ??Reg-Chat?? in terminator bot so it seen in hub ??Reg-Chat?? bot but i dont know how to pull out ??Reg-Chat?? script from terminator
if its not possible to pullout ??Reg-Chat?? script from terminator then can u do me a favor  ;) can u make one script same as above script but in tat script add one thing tat if i start that script, that script add one bot in hub as ??Reg-Chat?? there any user master to reguser  pm tat bot that pm got each and every user in hub and reply to tat message but must badword not work there tats the main thing
Title: Re: Pls help with this script
Post by: bastya_elvtars on 22 June, 2007, 10:59:16
If this (http://forum.ptokax.org/index.php?action=tpmod;dl=item30) is OK for you, I will mod it.
Title: Re: Pls help with this script
Post by: jack_port1000 on 22 June, 2007, 13:14:00
tanx man