Help With A Few Scripts
 

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

Help With A Few Scripts

Started by Devastator, 09 January, 2004, 21:17:44

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

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


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!!!
(? ?.??.->PLOP DEFINATELY 4 MOD!!!<-.??.???)


plop

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
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Devastator

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
(? ?.??.->PLOP DEFINATELY 4 MOD!!!<-.??.???)


nEgativE

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.

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
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

nEgativE

#5
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.

SMF spam blocked by CleanTalk