Need some help with fixing this...
 

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

Need some help with fixing this...

Started by JoshJ, 30 April, 2004, 00:30:38

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JoshJ

Ok guys I started do this script last nite and I basically want to be able to have like previous have done with bots having descriptions but being able to change it within the hub running...problem is that I did it late last nite and I screwed it up somewhere. Any help would be appreciated..

Botname = "InfoBot" -- Name of the bot
BotMail = "none" -- Email Address shown in user list beside the botname.
BotSpeed = "56kbps" -- 56kbps/Cable/DSL/LAN(T1)/LAN(T3)
BotDesc = "Howdy" -- Description of bot
kb = 1024
mb = 1024 * 1024
gb = 1024 * 1024 * 1024
BotShare = 5 * mb -- use numbers below to choose kb, mb, or gb
BotTag = "<++ V:0.401,M:A,H:0/0/1,S:1>" -- A dc++ style tag can be put here (if you want users to believe its a real user)
BotShareFrmt = BotShare / 1048576
BotInfo = 1
MIS = "$MyINFO $ALL "..Botname.." "..BotDesc..BotTag.."$ $"..BotSpeed..strchar( 1 ).."$"..BotMail.."$"..BotShare.."$"

function Main()
frmHub:RegBot(Botname)
if (BotInfo == 1) then
MIS = "$MyINFO $ALL "..Botname.." "..BotDesc..BotTag.."$ $"..BotSpeed..strchar( 1 ).."$"..BotMail.."$"..BotShare.."$"
else
end
end

function NewUserConnected(user)
user:SendData(Botname, "Welcome to "..frmHub:GetHubName().."!")
if (BotInfo == 1) then
user:SendData(MIS)
else
end
end

function OpConnected(user)
if (BotInfo == 0) then
user:SendData(Botname, "We have a problem! Bot descriptions info have been disabled!")
else
user:SendData(MIS)
end
end

function DataArrival(user,data) 
if strsub(data, 1, 1) == "<" then 
data=strsub(data,1,strlen(data)-1) 
s,e,cmd = strfind(data,"%b<>%s+(%S+)") -- this converts it into cmd (the incoming data) 

if cmd == "showinfo" then
user:SendData(Botname, "The following are statistics of InfoBot:\r\n")
user:SendData(Botname, "The current Botname is set to: "..Botname)
user:SendData(Botname, "The current description of "..Botname.." is set to: "..BotDesc)
user:SendData(Botname, "The current tag that "..Botname.." uses is set to: "..BotTag)
user:SendData(Botname, "The current e-mail address that "..Botname.." has is set to: "..BotMail)
user:SendData(Botname, "The current share amount that "..Botname.." has is set to: "..BotShareFrmt.." MB")
user:SendData(Botname, "The bot info script is now set to: "..BotInfo.." -- (0 = off, 1 = on)")
return 1
elseif cmd == "setmail" then
SetMail(user,data)
elseif cmd == "setdesc" then
SetDesc(user,data)
end
end
end

function SetMail(user,data)
if user.bOperator then
BotMail = mail
local s,e,cmd,mail = strfind(data,"%s+(%S+)%s+(.*)")
user:SendData(Botname, "The InfoBot E-mail address has been changed to: "..mail)
if mail == nil then
user:SendData(Botname, "No email address for the bot was chosen, action cancelled!")
else
user:SendData(Botname, "You do not have permission to do that!")
end
end
end

function SetDesc(user,data)
local s,e,cmd,desc = strfind(data,"%s+(%S+)%s+(.*)")
if user.bOperator then
BotDesc = desc
user:SendData(Botname, "The InfoBot description has been changed to: "..BotDesc)
if desc == nil then
user:SendData(Botname, "No description was chosen, action cancelled!")
else
user:SendData(Botname, "You do not have permission to do that!")
end
end
end

Thanks Guys.

P.S. : Forgot to state that the error message I get when typing the commands is as follows:
Syntax Errorattempt to concat global `BotDesc' (a nil value)
Syntax Error: attempt to concat global 
`mail' (a nil value)


nEgativE

Maybe this lines.. i don't know.

MIS = "$MyINFO $ALL "..Botname.." "..BotDesc..BotTag.." $ $"..BotSpeed..strchar( 1 ).."$"..BotMail.."$"..BotShare.."$"

user:SendData(Botname, "The InfoBot E-mail address has been changed to: "..mail )

1 --> "..BotDesc.." "..BotTag.."

2 --> "..BotMail.."

[UK]Madman

#2
Im not an expert, so plz tell me if im wrong  :P

But it look like your saying Botmail = mail before you have grabbed "mail"


function SetMail(user,data)
if user.bOperator then
BotMail = mail   <<<<< declaring Botmail = mail
local s,e,cmd,mail = strfind(data,"%s+(%S+)%s+(.*)") <<<<< finding what mail actually is

so maybe this would work better

function SetMail(user,data)
if user.bOperator == Nil then
user:SendData(Botname, "You do not have permission to do that!")
else
local s,e,cmd,mail = strfind(data, "%s+(%S+)%s+(.*)")
if mail == nil then 
user:SendData (Botname, "No email address for the bot was chosen, action cancelled!")
else 
user:SendData(Botname, "The InfoBot E-mail address has been changed to: "..mail)
BotMail = mail
end
end
end

Id also make the second function SetDesc same kind of format.

SMF spam blocked by CleanTalk