error in script
 

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

error in script

Started by ]-[?LL?L?L??nG?L, 01 April, 2008, 15:43:13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

]-[?LL?L?L??nG?L

Hiya hunnies was wondering if anyone can help me fix this error.. im using new API  plops word replacer script. when i kick using any client that has built in kick in its right click this script errors. Its like if messages go to the status bar then it errors if the messages dont go through the status bar its ok. It works using new API ptokax right clicks but i know a lot of Ops use the built in client kick for handyness. Is there any way i can stop these kicks going throught the status bar in main chat...Any suggestions would be much appreciated thanks :P :P

speedX

Please post the script here.....
Thanking You,

speedX

]-[?LL?L?L??nG?L

ok ive attached it for ya sweety  ;D ;D

Tw?sT?d-d?v

#3
Try this for a quick fix

-- word replacer script.
-- includes !me in pm.
-- all commands work in any pm window.
-- for PtokaX 0.3.3.0 16.06 and later.
-- version 1.2 public.
-- by plop
-- RC added by TiMeTrAVelleR
-- Convert to lua 5.11 by TiMeTrAVelleR
--// Converted to NEW API by Tw?sT?d-d?v?l (21/10/07)
--//Removed robocop profiles by Tw?sT?d-d?v?l (21/10/07)

FilterPm = 1				-- filter what? use 1 to enable, nil to disable the filter.
FilterMain = 1				-- filter what? use 1 to enable, nil to disable the filter.


iHistory = 10				-- maximum lines stored in the chat history.


sBot = "?W?rd-R?plac?r?"		-- name of the bot.
UserCommands = 1			-- Send usercommands on connect 1=on/0=off
tMenu = "?W?rd-R?plac?r?"		-- Usercommands menu name

tLevels = {
[-1] = 0,       --Unregistered User
[0] = 0,	-- Master
[1] = 0,	-- Operator
[2] = 0,	-- VIPs
[3] = 0,	-- Regs
}


--regbot in the user list.
iRegBot = 0

UserConnected = function(user)
	Core.GetUserAllData(user)
	if UserCommands == 1 and tLevels[user.iProfile] == 1 then
			Core.SendToNick(user.sNick,"$UserCommand 0 3")
			Core.SendToNick(user.sNick,"$UserCommand 1 3 "..tMenu.."\\WordReplacer Help$<%[mynick]> !wordreplacer&#124;")
			Core.SendToNick(user.sNick,"$UserCommand 1 3 "..tMenu.."\\Shows All Words Which Are Replaced And For What.$<%[mynick]> !showwords&#124;")
			Core.SendToNick(user.sNick,"$UserCommand 1 3 "..tMenu.."\\Add Word To Replace$<%[mynick]> !addword %[line:OldWord] %[line:NewWord]&#124;")
			Core.SendToNick(user.sNick,"$UserCommand 1 3 "..tMenu.."\\Delete Word$<%[mynick]> !delword %[line:Word]&#124;")
			Core.SendToNick(user.sNick,"$UserCommand 1 3 "..tMenu.."\\Chat History$<%[mynick]> !history&#124;")
		end
	end

OpConnected = UserConnected

-- prefixes table, allowed for me.
-- also used 2 bypase commands from other scripts.
tPre = { 
   ["+"] = 1,
   ["!"] = 1,
   ["/"] = 1,
   ["-"] = 1
}

tHistory = {}

tCommands = {

   ["showwords"] = {
	fCom = function(user, data)
	   local line = "\r\n\r\n\tOld\t\t\tNew\r\n"
		 line = line.."\t------------------------------------------------------------------------\r\n"
	   for a,b in pairs(tBadWords) do
		line = line.."\t"..a.."\t\t\t"..b.."\r\n"
	   end
	   line = line.."\r\n\tFunctions\r\n"
	   for a,b in pairs(tBadFuncs) do
		line = line.."\t"..a.."\r\n"
	   end
	   return line
	end,
	sHelp = "\t\t- shows all words which are replaced and for what.",
	tLevels = {
	   [-1] = 0,       --Unregistered User
           [0] = 1,	-- Master
           [1] = 0,	-- Operator
           [2] = 0,	-- VIPs
           [3] = 0,	-- Regs
	},
   },

   ["history"] = {
	fCom = function(user, data)
	   local sText = "\r\n\r\n"
	   for i=1,#tHistory do
		sText = sText..tHistory[i].."\r\n"
	   end
	   return sText
	end,
	sHelp = "\t\t\t- shows the chat history.",
	tLevels = {
	   [-1] = 0,       --Unregistered User
           [0] = 1,	-- Master
           [1] = 1,	-- Operator
           [2] = 0,	-- VIPs
           [3] = 0,	-- Regs
	},
   },

   ["addword"] = {
	fCom = function(user,data)
	   local s,e, word, replaced = string.find(data, "%b<>%s*%S+%s*(%S*)%s*(.*)")
	   if word == "" then
		return "No word??"
	   elseif replaced == "" then
		return "replace "..word.." for what??"
	   elseif string.find(word, "plop") then
		Core.Disconnect(user)
	   else
		word = Format(word)
		replaced = Format(replaced)
		tBadWords[word] = replaced
		Save(tBadWords, "tBadWords")
		return word.." Will Be Replaced For "..replaced
	   end
	end,
	sHelp = "<word> <replaced>\t- adds the word and replaces it for replaced.",
	tLevels = {
	   [-1] = 0,       --Unregistered User
           [0] = 1,	-- Master
           [1] = 1,	-- Operator
           [2] = 0,	-- VIPs
           [3] = 0,	-- Regs
	},
   },

   ["delword"] = {
	fCom = function(user,data)
	   local s,e, word = string.find(data, "%b<>%s*%S+%s*(%S*)")
	   if word == "" then
		return "No word??"
	   elseif not tBadWords[word] then
		return word.." didn't excist in the word replacer"
	   else
		tBadWords[word] = nil
		Save(tBadWords, "tBadWords")
		return word.." Removed From The Word Replacer"
	   end
	   return 1
	end,
	sHelp = "<word>\t\t- removes the word from the replacer.",
	tLevels = {
	   [-1] = 0,       --Unregistered User
           [0] = 1,	-- Master
           [1] = 1,	-- Operator
           [2] = 0,	-- VIPs
           [3] = 0,	-- Regs
	},
   },

   ["wordreplacer"] = {
	fCom = function(user,data)
	   local sText = "\r\n\r\n"
	   local iProf = user.iProfile
	   for a,b in pairs(tCommands) do
		if b.tLevels[iProf] then
		   sText = sText.."\t!"..a.."\t"..b.sHelp.."\r\n"
		end
	   end
	   return sText
	end,
	sHelp = "\t\t- this help menu.",
	tLevels = {
	   [-1] = 0,       --Unregistered User
           [0] = 1,	-- Master
           [1] = 1,	-- Operator
           [2] = 0,	-- VIPs
           [3] = 0,	-- Regs
	},
   },
}

function OnStartup()
   local num = string.gsub(os.date(), "%D", "")
   math.randomseed(tonumber(num))

   dofile("wordreplace/tBadWords.lua")
   dofile("wordreplace/tBadFunctions.lua")
   local fFile = io.open("wordreplace/tHistory.lua")
   if fFile then
	dofile("wordreplace/tHistory.lua")
	fFile:close()
   end
   if iRegBot then
	Core.RegBot(sBot,"friendly wordreplacer<[URL]www.plop.nl[/URL]>","lua.plop.nl",true)
   end
end

function CheckWord(word)
   local wordl = string.lower(word)
   if tBadWords[wordl] then
      return tBadWords[wordl]
   elseif tBadFuncs[wordl] then
      return tBadFuncs[wordl]()
   elseif tonumber(word) or string.find(word, "%W") then
      return word
   else
      return word
   end
end

function addHistory(text)
   if #tHistory > iHistory then
      table.remove(tHistory, 1)
   end
   table.insert(tHistory, text)
end

function ChatArrival(user,data)
	Core.GetUserAllData(user) 
   local data = string.sub(data, 1, (string.len(data)-1))
   local s,e,cmd = string.find(data, "%b<>%s+%p(%S+)")
   if cmd and tCommands[cmd] then 
	if tCommands[cmd].tLevels[user.iProfile] then
	   Core.SendToNick(user.sNick,"<"..sBot.."> ".. tCommands[cmd].fCom(unpack({user, data})) )
	   return true
	else
	   Core.SendToNick(user.sNick,"<"..sBot.."> no acces!!")
	   return true
	end
   end
   if FilterMain then
	local s,e,data =string.find(data, "%b<>%s+(.*)")
	local data,c = string.gsub(data , "(%w+)", function(word) return CheckWord(word) end)
	local s,e,pre, cmd = string.find(data, "^%s*(%W)(%w+)")
	if pre and cmd and tPre[pre] then
	   if cmd == "me" then
		local sText = "* "..user.sNick.." "..string.sub(data, 5, string.len(data))
		Core.SendToAll(sText)
		addHistory("["..os.date("%X").."] "..sText)
		return true
	   else
		return false
	   end
	else
	   local sText = "<"..user.sNick.."> "..data
	   Core.SendToAll(sText)
	   addHistory("["..os.date("%X").."] "..sText)
	   return true
	end
   end
end


function ToArrival(user,data)
	Core.GetUserAllData(user)
   local data = string.sub(data, 1, (string.len(data)-1))
   local s,e,cmd = string.find(data, "%$%b<>%s+%p(%S+)")
   local s,e,whoto = string.find(data, "%S+%s*(%S+)")
   local user = Core.GetUser(whoto,true)
   if cmd and tCommands[cmd] then
	if tCommands[cmd].tLevels[user.iProfile] then
	   if user then
		Core.SendToNick(user.sNick,"$To: "..user.sNick.." From: "..user.sNick.." $"..sBot.." "..tCommands[cmd].fCom(unpack({user, data})).."|")
	   else
		Core.SendPmToNick(user.sNick,sBot, tCommands[cmd].fCom(unpack({user, data})) )
	   end
	   return true
	else
	   Core.SendPmToNick(user.sNick,sBot, "no acces!!")
	   return true
	end
   end
   if FilterPm then
	if user then
	   local sName = user.sNick
	   local s,e,data = string.find(data, "$%b<>%s*(.*)$")
	   local data,c = string.gsub(data , "(%S+)", function(word) return CheckWord(word) end)
	   local s,e,pre, cmd = string.find(data, "^%s*(%W)(%S+)")
	   if pre and tPre[pre] then
		if cmd == "me" then
		   data = string.sub(data, 4, string.len(data))
		   Core.SendToNick(user.sNick,"$To: "..user.sNick.." From: "..sNick.." $* "..sNick.." "..data.."|")
		   return true
		else
		   return false
                end
	    end
        end
    end
end

function OnError(ErrorMsg)
   Core.SendToOps("<"..sBot.."> ".. ErrorMsg)
   local fFile = io.open("error/wordreplacer.lst", "a+")
   fFile:write(ErrorMsg.."\n")
   fFile:close()
end

function Save(tTable, name)
   local fFile = io.open("wordreplace/"..name..".lua", "w+")
   fFile:write(name.."={")
   for a,b in pairs(tTable) do
	fFile:write("\t["..string.format("%q", a).."] = "..string.format("%q", b)..",\n")
   end
   fFile:write("\n}\n\n--plopyrights reserved")
   fFile:close()
   return "Done"
end

function OnExit()
   local fFile = io.open("wordreplace/tHistory.lua", "w+")
   fFile:write("tHistory={\n")
   for i=1,#tHistory do
	fFile:write("\t"..string.format("%q", tHistory[i])..",\n")
   end
   fFile:write("\n}\n\n--plopyrights reserved")
   fFile:close()
end

function Format(sText)
   local sText = string.format("%q", sText)
   sText , iSlash = string.gsub(sText, "\\", "\r\n")
   sText = string.sub(sText, 2, (string.len(sText)-1))
   return sText
end

]-[?LL?L?L??nG?L

You scripters are so clever and that was a quick fix. No errors now sweety Thank you.
and thanks for your quick reply too :P :P :P

Tw?sT?d-d?v

#5
Nps    This script realy needs a rewrite , but im not that good a scripter yet to attempt it.

LOL has i was typing the Master has done it  :)

]-[?LL?L?L??nG?L

Thank you Mutor its running great as usual ;D ;D ;D I love it when scripts are error free  :P :P But then saying that there would be no excitement when your waiting on an error being fixed.. thats what its all about Thanks again xxxxxx

]-[?LL?L?L??nG?L

Hmmmm come to thing of it "if it was my script" sounds like an offer YES you should make a new one if you have some time  :P :P :P :P :P Im sure it would be very useful as this script has always blocked some other scripts and vice versa... ;D ;D ;D

SMF spam blocked by CleanTalk