PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: D-J Valhala on 14 May, 2004, 09:25:00

Title: +gag (Stand-alone)
Post by: D-J Valhala on 14 May, 2004, 09:25:00
+gag (Stand-alone) anyone? :D
Title:
Post by: Corayzon on 14 May, 2004, 11:21:37
um...here a hotted up version of cslave gagging system...

remember to edit the files in the cslave settings folder to make the gagging system act how you want ;)

ftp://cslave.no-ip.org/ptokax_administrations_scripts/other/gagging_system_(standalone).rar
Title:
Post by: D-J Valhala on 14 May, 2004, 12:10:37
thank you coryzon... but sorry mate i dont realy like your cSlave... coz it was writen like 1 sceipt in 50 part's...
so i need one script one part...
But Thanks anyway my friend :D
Title:
Post by: Corayzon on 14 May, 2004, 12:17:39
lolz...ur a tripa ;)

have u though that maybe updating certain sections can be easierly done with multiple scripts...and how does this make u not like it?

neways...

u can just compile into one script if u really want ;)

and if u cant do i guess i can do for ya...and put the settings up that u want =]
Title:
Post by: D-J Valhala on 14 May, 2004, 12:31:12
hehehe cool bro :D
Title:
Post by: D-J Valhala on 15 May, 2004, 17:20:30
no body? :\
Title:
Post by: nErBoS on 15 May, 2004, 17:34:14
Hi,

Hope it helps...

--Requested by D-J Valhala
--Made by nErBoS

sBot = "Gagger"

gagged = {}
gaggedsv = "gagged.dat"

function Main()
frmHub:RegBot(sBot)
LoadFromFile(gaggedsv)
end

function OnExit()
SaveToFile(gaggedsv , gagged , "gagged")
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5) == "$To: ") then
if (gagged[strlower(user.sName)] ~= nil) then
user:SendPM(sBot, "You are gagged.")
return 1
end
end
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!gag" and user.bOperator) then
local s,e,gag = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (gag == nil) then
user:SendPM(sBot, "Syntax Error, !gag , you must write a nick.")
else
if (gagged[strlower(gag)] == nil) then
gagged[strlower(gag)] = 1
user:SendPM(sBot, "The user "..gag.." has been gagged.")
else
user:SendPM(sBot, "The user "..gag.." is already gagged.")
end
end
return 1
elseif (cmd == "!ungag" and user.bOperator) then
local s,e,gag = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (gag == nil) then
user:SendPM(sBot, "Syntax Error, !ungag , you must write a nick.")
else
if (gagged[strlower(gag)] == nil) then
user:SendPM(sBot, "The user "..gag.." isn't gagged.")
else
user:SendPM(sBot, "The user "..gag.." has been ungaged.")
gagged[strlower(gag)] = nil
end
end
return 1
end
end
end

function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";
sTmp = ""

sTmp = sTmp..sTab..sTableName.." = {\n"

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end

sTmp = sTmp..",\n"
end

sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end

function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end

Best regards, nErBoS
Title:
Post by: QuikThinker on 15 May, 2004, 18:25:01
Nerbos the prob I have is even tho I gag a user they then act clever by usin the !me command and talk in 3rd person. Does ur gagger prevent this also or isn't that possible?
Title:
Post by: D-J Valhala on 15 May, 2004, 18:28:25
GREAT man :D
it work great! can you add +gaglist?
Title:
Post by: nErBoS on 15 May, 2004, 18:55:28
Hi,

QuoteOriginally posted by QuikThinker
Nerbos the prob I have is even tho I gag a user they then act clever by usin the !me command and talk in 3rd person. Does ur gagger prevent this also or isn't that possible?

Yes is possible, does your !me talk phrase star with *** ???

Best regards, nErBoS
Title:
Post by: nErBoS on 15 May, 2004, 19:02:40
Hi,

Gaglist and !me block if it starts with "*"...

--Requested by D-J Valhala
--Made by nErBoS

sBot = "Gagger"

gagged = {}
gaggedsv = "gagged.dat"

function Main()
frmHub:RegBot(sBot)
LoadFromFile(gaggedsv)
end

function OnExit()
SaveToFile(gaggedsv , gagged , "gagged")
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5) == "$To: " or strsub(data,1,1) == "%*") then
if (gagged[strlower(user.sName)] ~= nil) then
user:SendPM(sBot, "You are gagged.")
return 1
end
end
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!gag" and user.bOperator) then
local s,e,gag = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (gag == nil) then
user:SendPM(sBot, "Syntax Error, !gag , you must write a nick.")
else
if (gagged[strlower(gag)] == nil) then
gagged[strlower(gag)] = 1
user:SendPM(sBot, "The user "..gag.." has been gagged.")
else
user:SendPM(sBot, "The user "..gag.." is already gagged.")
end
end
return 1
elseif (cmd == "!ungag" and user.bOperator) then
local s,e,gag = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (gag == nil) then
user:SendPM(sBot, "Syntax Error, !ungag , you must write a nick.")
else
if (gagged[strlower(gag)] == nil) then
user:SendPM(sBot, "The user "..gag.." isn't gagged.")
else
user:SendPM(sBot, "The user "..gag.." has been ungaged.")
gagged[strlower(gag)] = nil
end
end
return 1
elseif (cmd == "!gaglist" and user.bOperator) then
ShowGagList(user)
return 1
end
end
end

function ShowGagList(user)
local sTmp = "Users that are gagged in this Hub:\r\n\r\n"
local usr,aux
for usr, aux in gagged do
sTmp = sTmp..usr.."\r\n"
end
user:SendPM(sBot, sTmp)
end

function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";
sTmp = ""

sTmp = sTmp..sTab..sTableName.." = {\n"

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end

sTmp = sTmp..",\n"
end

sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end

function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end

Best regards, nErBoS
Title:
Post by: QuikThinker on 15 May, 2004, 19:40:26
Perfect Nerbos! But just one more thing, when u gag sum1, can it make a note of it in main chat like b4 coz now it just comes up in PM that the person has been gagged?
Title:
Post by: D-J Valhala on 15 May, 2004, 21:27:23
hehehe Great! it work perfect!!! :D
thank you mate
Title:
Post by: nErBoS on 15 May, 2004, 22:01:25
Hi,

Done...

--Requested by D-J Valhala
--Made by nErBoS

sBot = "Gagger"

gagged = {}
gaggedsv = "gagged.dat"

function Main()
frmHub:RegBot(sBot)
LoadFromFile(gaggedsv)
end

function OnExit()
SaveToFile(gaggedsv , gagged , "gagged")
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5) == "$To: " or strsub(data,1,1) == "%*") then
if (gagged[strlower(user.sName)] ~= nil) then
user:SendPM(sBot, "You are gagged.")
return 1
end
end
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!gag" and user.bOperator) then
local s,e,gag = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (gag == nil) then
user:SendPM(sBot, "Syntax Error, !gag , you must write a nick.")
else
if (gagged[strlower(gag)] == nil) then
gagged[strlower(gag)] = 1
user:SendPM(sBot, "The user "..gag.." has been gagged.")
SendToAll(sBot, "The user "..gag.." has been gagged by "..user.sName..".")
else
user:SendPM(sBot, "The user "..gag.." is already gagged.")
end
end
return 1
elseif (cmd == "!ungag" and user.bOperator) then
local s,e,gag = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (gag == nil) then
user:SendPM(sBot, "Syntax Error, !ungag , you must write a nick.")
else
if (gagged[strlower(gag)] == nil) then
user:SendPM(sBot, "The user "..gag.." isn't gagged.")
else
user:SendPM(sBot, "The user "..gag.." has been ungaged.")
SendToAll(sBot, "The user "..gag.." has been ungagged by "..user.sName..".")
gagged[strlower(gag)] = nil
end
end
return 1
elseif (cmd == "!gaglist" and user.bOperator) then
ShowGagList(user)
return 1
end
end
end

function ShowGagList(user)
local sTmp = "Users that are gagged in this Hub:\r\n\r\n"
local usr,aux
for usr, aux in gagged do
sTmp = sTmp..usr.."\r\n"
end
user:SendPM(sBot, sTmp)
end

function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";
sTmp = ""

sTmp = sTmp..sTab..sTableName.." = {\n"

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end

sTmp = sTmp..",\n"
end

sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end

function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end

Best regards, nErBoS
Title:
Post by: QuikThinker on 16 May, 2004, 00:44:43
nErBoS = gEnIuS  :]
Title:
Post by: D-J Valhala on 16 May, 2004, 10:09:29
hehehehe GREAT my friend the script is perferct! thank you again for the 1000000 time :D