PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Finished Scripts => Topic started by: ?StIfFLEr?? on 23 April, 2009, 11:32:37

Title: MainChat Cleaner 1.0 Lua 5.1x [API 2]
Post by: ?StIfFLEr?? on 23 April, 2009, 11:32:37
--MainChat Cleaner 1.0 Lua 5.1x [API 2]
--Revised Script with some addition by ?StIfFLEr??
--The Original Script is Taken From Mutor And Crazyguy frm lua 5.1
--Converted to new API by HillyBilly 26 sept 07
--Profile Table Added by speedX to the original script.
--Rightclick according to profile permission added by ?StIfFLEr?? [With the help of Mutors CustomCmds 1.0 LUA 5.1x [API 2]]
--This Script Does not Belong to ?StIfFLEr?? [Me] Its Just a taken Script from board and Revised.Please dont take it personally.
-------------------------------------------------------------------------------------------
--Settings [Do not change if you don't know]
-------------------------------------------------------------------------------------------
-- "Botname" [Add as you wish]
bot = "[Cleaner]"
-- "BotDesc" [Describe]
botDesc = "I Can Clean"
-- "Tag" [Version.DO NOT CHANGE]
botTag = "version.01-23/05/09"
-- "prefix" [#,! Anything you would feel convinient]
prefix = "!"
-- Command You wish to use for cleaning MainChat
cmdClean = "cls"
-- Lines to Added to clean The MainChat
cline = "500"
-- Profile permission as per new ptokax
tProfile = {
[-1] = 0, -- Unregistered Users
[0] = 1, -- Masters
[1] = 1, -- Operators
[2] = 0, -- VIP
[3] = 0, -- Registered
}

------------------------------------------------------------------------------------------
--OnStartup Function
------------------------------------------------------------------------------------------
function OnStartup()
        Core.RegBot(bot,botDesc,botTag,true)
end
------------------------------------------------------------------------------------------
--Script Function
------------------------------------------------------------------------------------------
ChatArrival = function(User,Data)
if tProfile[User.iProfile] == 1 then
local _,_,cmd = string.find(Data, "%b<>%s%p(%S+)|")
if cmd and (cmd == cmdClean) then
local str = "\n\n"..string.rep("\t",3).." "..
User.sNick.." is clearing Main Chat..."..
string.rep("\n",cline)..string.rep("\t",3).."Main Chat Has "..
"Been Cleared By: "..User.sNick.."   \n\n"
Core.SendToAll(str)
return true
else
return "Clear Main Chat","",""
end
end
end
---------------------------------------------------------------------------------------------
--Right Click As per Profile permissions Given Above.
---------------------------------------------------------------------------------------------
RcCmds = {
{1,"$UserCommand 1 3 Cleaner\\Clean$<%[mynick]> !cls&#124;|"},
}

UserConnected = function(user)
local lvl,x = tProfile[user.iProfile],""
if lvl then
for i,v in ipairs(RcCmds) do if lvl >= v[1] then x = x..v[2] end end
if #x > 0 then Core.SendToUser(user,x) end
collectgarbage("collect")
end
end
RegConnected,OpConnected = UserConnected,UserConnected


If i have missed any credits please let me know i have no intension of stealing anyones credits.
I am just learning lua with the help of scripts made my many scriptors trying to understand.
Title: Re: MainChat Cleaner 1.0 Lua 5.1x [API 2]
Post by: ?StIfFLEr?? on 23 April, 2009, 11:34:29
Thanks a lot Mutor,Madman
Your scripts have been truely a way to learn the way of scripting wish to learn even more.
If i have made any mistake please let me know.
Title: Re: MainChat Cleaner 1.0 Lua 5.1x [API 2]
Post by: ?StIfFLEr?? on 23 April, 2009, 15:24:33
OOoops... I need help.
The script has a cmdClean option where in desired command can be used.
But the right click has !cls command.
Can i have a code for a rightclick where in changed desired command for cleaning can be used without editing the right click function?

'''
{1,"$UserCommand 1 3 Cleaner\\Clean$<%[mynick]> "!cls"&#124;|"},
''''
I have marked that place.
Title: Re: MainChat Cleaner 1.0 Lua 5.1x [API 2]
Post by: ?StIfFLEr?? on 23 April, 2009, 17:42:07
Right click fixed.

--MainChat Cleaner 1.0 Lua 5.1x [API 2] 23/05/09
--Revised Script with some addition by ?StIfFLEr??
--The Original Script is Taken From Mutor And Crazyguy frm lua 5.1
--Converted to new API by HillyBilly 26 sept 07
--Profile Table Added by speedX to the original script.
--Rightclick according to profile permission added by ?StIfFLEr?? [With the help of Mutors CustomCmds 1.0 LUA 5.1x [API 2]]
--This Script Does not Belong to ?StIfFLEr?? [Me] Its Just a taken Script from board and Revised.Please dont take it personally.

--Changed to MainChat Cleaner 1.0a Lua 5.1x [API 2] 23/05/09
--Right click fixed.Commands and prefix changed in Settings will also be read in Right click.[Learnt The command from one of the old script] by ?StIfFLEr??
-------------------------------------------------------------------------------------------
--Settings [Do not change if you don't know]
-------------------------------------------------------------------------------------------
-- "Botname" [Add as you wish]
bot = "[Cleaner]"
-- "BotDesc" [Describe]
botDesc = "I Can Clean"
-- "Tag" [Version.DO NOT CHANGE]
botTag = "version.01-23/05/09"
-- "prefix" [#,! Anything you would feel convinient]
prefix = "!"
-- Command You wish to use for cleaning MainChat
cmdClean = "cls"
-- Lines to Added to clean The MainChat
cline = "500"
-- Profile permission as per new ptokax
tProfile = {
[-1] = 0, -- Unregistered Users
[0] = 1, -- Masters
[1] = 1, -- Operators
[2] = 0, -- VIP
[3] = 0, -- Registered
}

------------------------------------------------------------------------------------------
--OnStartup Function
------------------------------------------------------------------------------------------
function OnStartup()
        Core.RegBot(bot,botDesc,botTag,true)
end
------------------------------------------------------------------------------------------
--Script Function
------------------------------------------------------------------------------------------
ChatArrival = function(User,Data)
if tProfile[User.iProfile] == 1 then
local _,_,cmd = string.find(Data, "%b<>%s%p(%S+)|")
if cmd and (cmd == cmdClean) then
local str = "\n\n"..string.rep("\t",3).." "..
User.sNick.." is clearing Main Chat..."..
string.rep("\n",cline)..string.rep("\t",3).."Main Chat Has "..
"Been Cleared By: "..User.sNick.."   \n\n"
Core.SendToAll(str)
return true
else
return "Clear Main Chat","",""
end
end
end
---------------------------------------------------------------------------------------------
--Right Click As per Profile permissions Given Above.
---------------------------------------------------------------------------------------------
RcCmds = {
{1,"$UserCommand 1 3 Cleaner\\Clean$<%[mynick]> "..prefix..""..cmdClean.."&#124;|"},
}

UserConnected = function(user)
local lvl,x = tProfile[user.iProfile],""
if lvl then
for i,v in ipairs(RcCmds) do if lvl >= v[1] then x = x..v[2] end end
if #x > 0 then Core.SendToUser(user,x) end
collectgarbage("collect")
end
end
RegConnected,OpConnected = UserConnected,UserConnected


Thanks To mutor and madman's Scripts.
Was for this reason I was given a -ve karma?
Cant the reason be properly posted and then given a -ve mark so that people like me who have started learning lua can understand their mistakes and will not repeat it further.---Whosever it may concern.
Title: Re: MainChat Cleaner 1.0 Lua 5.1x [API 2]
Post by: Azurious on 23 April, 2009, 18:37:49
lol nice to see u involving in this...
Title: Re: MainChat Cleaner 1.0 Lua 5.1x [API 2]
Post by: ?StIfFLEr?? on 23 April, 2009, 18:40:51
Trying to learn but negavtive marks are comming at a faster rate.....
Dont know they r been comming without reasons.... mad ethe script keeping in mind all the credits then also... ???
Title: Re: MainChat Cleaner 1.0 Lua 5.1x [API 2]
Post by: ?StIfFLEr?? on 24 April, 2009, 10:58:33
Why i have been given negative Karma??