Hey Guys,
I am very very new to scripting and making hubs. I am trying to learn things as i go along but rite now i would like help with a few scripts please!
i apologise if altering these scripts is basic but i am a newbie and get very confused when i look at the scripts so please do bear with me :rolleyes:
The following script i only want Masters to use
-- simple standalone get-password-by-nick-bot by bonki 09/06/03
sBotName = "PasswdBot";
sGetPasswdPhrase = "!getpasswd";
sPasswdFile = "../RegisteredUsers.dat";
function DataArrival(curUser, sData)
local _, _, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");
if(cmd == nil) then
return 0; end
cmd = strlower(cmd);
if (cmd == sGetPasswdPhrase) then
curUser:SendData(sData);
if (curUser.bOperator) then
if (strlen(args) > 0) then
local sPasswd = GetPassword(args);
if (sPasswd) then
curUser:SendData(sBotName, args.."'s password is: '"..sPasswd.."'");
else
curUser:SendData(sBotName, "User "..args.." doesn't exist!");
end
else
curUser:SendData(sBotName, "Syntax: "..sGetPasswdPhrase.." ");
end
else
curUser:SendData(sBotName, "You don't have sufficient rights to run that command!");
end
return 1;
end
return 0;
end
function GetPassword(sFrom)
local flPasswdFile = openfile(sPasswdFile, "r");
local line = "";
sFrom = strlower(sFrom);
if (flPasswdFile) then
line = read(flPasswdFile);
while (line) do
_, _, sNick, sPasswd = strfind(line, "^(%S+)|(%S+)|");
if (strlower(sNick) == sFrom) then
return sPasswd;
end
line = read(flPasswdFile);
end
closefile(flPasswdFile);
end
return nil;
end
Also i am using Robcop and i was looking for a script which Ops could add latest releases i know abt the in built release bot in robocop but i want one wheer you could add 2 a certain type.
4 xample:
+progs - 4 latest programs
+music - 4 latest music
+movies - 4 latest movies
etc which ops can add 2 and it shows which op has added what.
I apologise dearly if this is easy but i am a newbie to making hubs and scripts etc.
Plz Help
Thank You!!!
replace:
if (curUser.bOperator) then
for
if (curUser.iProfile == 0) then
for the releases bot you requested, take a look @ freshstuff 3.x or chilla's files database.
both can do what you want.
plop
i jus like sum help with this script......i want it so u can delete things that have been added... also feel free 2 edit things 2 make it betta i'm a newbie hub maker and would love 2 test new things!...its has a .dat file where all the info saves
botname = "S??Lj?h"
function Main()
frmHub:RegBot(botname)
end
function DataArrival(user, data)
-- PM cmds:
if(strsub(data, 1, 4) == "$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if user.bOperator then
if (cmd=="addhiphop") then
-- arg from PM
arg= GetArgsPM(data)
-- Check if arg from PM is not 'nil' (empty)
if arg ~= nil then
local handle=openfile("hiphop.dat","a")
write(handle,""..date("<%d.%m.%Y> ")..arg.." <"..user.sName..">?")
user:SendPM(botname,"Saved ....")
user:SendData(botname, "New entry in Hip Hop!")
closefile(handle)
else
user:SendData(botname, "Wrong synthax: addhiphop ")
end
end
end
if (cmd=="+hiphop") then
handle2=openfile("hiphop.dat","r")
if (handle2==nil) then
else
line = read(handle2,"*a")
line=strsub(line,1,strlen(line)-1)
linearray=tokenize(line,"?")
for i=1,linearray.n do
user:SendPM(botname,linearray[i])
end
closefile(handle2)
end
end
end
end
-- Main Chat cmds:
if (strsub(data, 1, 1) == "<") then
data = strsub(data,1,strlen(data)-1)
s,e,cmd,dataa = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
if user.bOperator then
if (strfind(strlower(data), strlower("addhiphop"))) then
-- arg from main
arg= GetArgsML(data)
-- Check if arg from main is not 'nil' (empty)
if arg ~= nil then
local handle=openfile("hiphop.dat","a")
write(handle,""..date("<%d.%m.%Y> ")..arg.." <"..user.sName..">?")
user:SendPM(botname,"Saved ....")
user:SendData(botname, "New entry in Hip Hop!")
closefile(handle)
else
user:SendData(botname, "Wrong synthax: addhiphop ")
end
end
end
if (strfind(strlower(data), strlower("+hiphop"))) then
handle2=openfile("hiphop.dat","r")
if (handle2==nil) then
else
line = read(handle2,"*a")
line=strsub(line,1,strlen(line)-1)
linearray=tokenize(line,"?")
for i=1,linearray.n do
user:SendPM(botname,linearray[i])
end
closefile(handle2)
end
end
end
end
function tokenize (inString,token)
_WORDS = {}
local matcher = "([^?"..token.."]+)"
gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
return _WORDS
end
-- Get Args from PM:
function GetArgsPM(data)
s,e,whoTo,from,cmd,arg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg
end
-- Get Args from the Main Chat:
function GetArgsML(data)
s,e,cmd,arg = strfind(data, "%b<>%s+(%S+)%s+(.*)")
return arg
end
if u can help many thanx
thanx a lot m8s u lot r a gr8 help
QuoteOriginally posted by Devastator
Hey Guys,
I am very very new to scripting and making hubs. I am trying to learn things as i go along but rite now i would like help with a few scripts please!
i apologise if altering these scripts is basic but i am a newbie and get very confused when i look at the scripts so please do bear with me :rolleyes:
The following script i only want Masters to use
-- simple standalone get-password-by-nick-bot by bonki 09/06/03
sBotName = "PasswdBot";
sGetPasswdPhrase = "!getpasswd";
sPasswdFile = "../RegisteredUsers.dat";
function DataArrival(curUser, sData)
local _, _, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");
if(cmd == nil) then
return 0; end
cmd = strlower(cmd);
if (cmd == sGetPasswdPhrase) then
curUser:SendData(sData);
if (curUser.bOperator) then
if (strlen(args) > 0) then
local sPasswd = GetPassword(args);
if (sPasswd) then
curUser:SendData(sBotName, args.."'s password is: '"..sPasswd.."'");
else
curUser:SendData(sBotName, "User "..args.." doesn't exist!");
end
else
curUser:SendData(sBotName, "Syntax: "..sGetPasswdPhrase.." ");
end
else
curUser:SendData(sBotName, "You don't have sufficient rights to run that command!");
end
return 1;
end
return 0;
end
function GetPassword(sFrom)
local flPasswdFile = openfile(sPasswdFile, "r");
local line = "";
sFrom = strlower(sFrom);
if (flPasswdFile) then
line = read(flPasswdFile);
while (line) do
_, _, sNick, sPasswd = strfind(line, "^(%S+)|(%S+)|");
if (strlower(sNick) == sFrom) then
return sPasswd;
end
line = read(flPasswdFile);
end
closefile(flPasswdFile);
end
return nil;
end
Hi there, is there a way to not show ""!getpasswd nick" when we type that in main ?
Thanks.
QuoteOriginally posted by Luso
QuoteOriginally posted by Devastator
Hey Guys,
I am very very new to scripting and making hubs. I am trying to learn things as i go along but rite now i would like help with a few scripts please!
i apologise if altering these scripts is basic but i am a newbie and get very confused when i look at the scripts so please do bear with me :rolleyes:
The following script i only want Masters to use
-- simple standalone get-password-by-nick-bot by bonki 09/06/03
sBotName = "PasswdBot";
sGetPasswdPhrase = "!getpasswd";
sPasswdFile = "../RegisteredUsers.dat";
function DataArrival(curUser, sData)
local _, _, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");
if(cmd == nil) then
return 0; end
cmd = strlower(cmd);
if (cmd == sGetPasswdPhrase) then
curUser:SendData(sData);
if (curUser.bOperator) then
if (strlen(args) > 0) then
local sPasswd = GetPassword(args);
if (sPasswd) then
curUser:SendData(sBotName, args.."'s password is: '"..sPasswd.."'");
else
curUser:SendData(sBotName, "User "..args.." doesn't exist!");
end
else
curUser:SendData(sBotName, "Syntax: "..sGetPasswdPhrase.." ");
end
else
curUser:SendData(sBotName, "You don't have sufficient rights to run that command!");
end
return 1;
end
return 0;
end
function GetPassword(sFrom)
local flPasswdFile = openfile(sPasswdFile, "r");
local line = "";
sFrom = strlower(sFrom);
if (flPasswdFile) then
line = read(flPasswdFile);
while (line) do
_, _, sNick, sPasswd = strfind(line, "^(%S+)|(%S+)|");
if (strlower(sNick) == sFrom) then
return sPasswd;
end
line = read(flPasswdFile);
end
closefile(flPasswdFile);
end
return nil;
end
Hi there, is there a way to not show ""!getpasswd nick" when we type that in main ?
Thanks.
place "return 1" on the lines below the data sending lines.
curUser:SendData(sBotName, "You don't have sufficient rights to run that command!");
return 1
like that.
plop
QuoteOriginally posted by plop
QuoteOriginally posted by Luso
QuoteOriginally posted by Devastator
Hey Guys,
I am very very new to scripting and making hubs. I am trying to learn things as i go along but rite now i would like help with a few scripts please!
i apologise if altering these scripts is basic but i am a newbie and get very confused when i look at the scripts so please do bear with me :rolleyes:
The following script i only want Masters to use
-- simple standalone get-password-by-nick-bot by bonki 09/06/03
sBotName = "PasswdBot";
sGetPasswdPhrase = "!getpasswd";
sPasswdFile = "../RegisteredUsers.dat";
function DataArrival(curUser, sData)
local _, _, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");
if(cmd == nil) then
return 0; end
cmd = strlower(cmd);
if (cmd == sGetPasswdPhrase) then
curUser:SendData(sData);
if (curUser.bOperator) then
if (strlen(args) > 0) then
local sPasswd = GetPassword(args);
if (sPasswd) then
curUser:SendData(sBotName, args.."'s password is: '"..sPasswd.."'");
else
curUser:SendData(sBotName, "User "..args.." doesn't exist!");
end
else
curUser:SendData(sBotName, "Syntax: "..sGetPasswdPhrase.." ");
end
else
curUser:SendData(sBotName, "You don't have sufficient rights to run that command!");
end
return 1;
end
return 0;
end
function GetPassword(sFrom)
local flPasswdFile = openfile(sPasswdFile, "r");
local line = "";
sFrom = strlower(sFrom);
if (flPasswdFile) then
line = read(flPasswdFile);
while (line) do
_, _, sNick, sPasswd = strfind(line, "^(%S+)|(%S+)|");
if (strlower(sNick) == sFrom) then
return sPasswd;
end
line = read(flPasswdFile);
end
closefile(flPasswdFile);
end
return nil;
end
Hi there, is there a way to not show ""!getpasswd nick" when we type that in main ?
Thanks.
place "return 1" on the lines below the data sending lines.
curUser:SendData(sBotName, "You don't have sufficient rights to run that command!");
return 1
like that.
plop
Well, i have that script there, i did that return 1 but is no working here :(
Thank U 4 help Plop.